GRANT UPDATE ON (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'parcel%') TO police;
baubqpgj1#
GRANT只接受文本表名。您需要动态SQL,即动态构建语句并在匿名块中执行它。考虑:
GRANT
do $$ begin execute ( select 'grant all on table ' || string_agg (format('%I.%I', table_schema, table_name), ', ') || ' to police' from information_schema.tables where table_name like 'parcel%' ); end $$;
1条答案
按热度按时间baubqpgj1#
GRANT
只接受文本表名。您需要动态SQL,即动态构建语句并在匿名块中执行它。考虑: