zoukankan      html  css  js  c++  java
  • GreenPlum批量授权(PG未测试)

    创建一个自定义function

    create or replace function grant_all_exec(schema_name varchar,select_or_insert varchar,grantee_user varchar) returns varchar as $$
    DECLARE
    funcrow varchar;
    BEGIN
    FOR funcrow IN select 'grant '||$2||' on '||$1||'.'||tablename||' to '||$3 from  pg_tables where schemaname=$1 
    LOOP
    EXECUTE funcrow;
    END LOOP;
    return 'grant '||$2||' to '||$3||' success!';
    END;
    $$ language plpgsql strict ;

     select grant_all_exec('hfods','select','hfods_read')

    "grant select to hfods_read success!"

    使用dp hfods.t1 来查看是否授权成功

  • 相关阅读:
    gnuplot
    charles证书安装
    jenkins 配置ssh
    jenkins 配置slave
    centos 安装jenkins
    mac的一些命令
    docker 常用命令
    GO vim环境
    go vendor目录
    protobuf
  • 原文地址:https://www.cnblogs.com/castlevania/p/9106532.html
Copyright © 2011-2022 走看看