您好,欢迎访问一九零五行业门户网

GreenPlum中日常SQL脚本

--1.指定月份总共多少天
select extract(day from cast('2017-08-01' as date) + interval '1 month' - interval '1 day') select extract(day from cast(to_char(now(),'yyyy-mm')||'-01' as date) + interval '1 month' - interval '1 day')
--2.修改默认搜索(search_path)路径
show search_path; set search_path to your_schema_name;
--3.更改schema所有者
alter schema your_schema_name owner to other_user;
--4.修改表的所有者
alter table your_table_name owner to other_user;
--5.授予指定用户查询或所有权限
grant select on table your_table_name to other_user; grant all on table your_table_name to other_user;
--6.授予指定用户schema使用权限
grant usage on schema your_schema_name to other_user;
--7.回收指定用户schema使用权限
revoke all on schema your_schema_name from other_user;
--不同对象授权关键字
tables,views,sequences: select insert update delete rule all external tables: select rule all databases: connect create temporary|temp all functions: execute procedural languages: usage schemas: create usage all
--8.批量授予函数执行权限
select 'grant execute on function '||routines.routine_name||'('||string_agg(parameters.data_type,',' order by parameters.ordinal_position)||') to other_user;' batchgrant from information_schema.routines join information_schema.parameters on routines.specific_name=parameters.specific_name where routines.specific_schema='product' group by routines.routine_name
以上就是greenplum中日常sql脚本的详细内容。
其它类似信息

推荐信息