postgresql批量修改表的owner

postgresql批量修改表的owner

如果表少的话可以采用pgAdmin来修改,表多使用下面这种方法

1.创建角色

CREATE ROLE "rf_iss" LOGIN PASSWORD 'eoZW0TtR8GYsHFIX';

2.查看需要修改的表

select * from information_schema.tables where table_schema='public';

3.拼接sql 方便后面执行(把结果复制出来执行)

select 'ALTER TABLE ' || table_name || ' OWNER TO yourowner;' from information_schema.tables where table_schema='public';
posted @ 2021-12-07 17:41  RNGException  阅读(1589)  评论(0编辑  收藏  举报