3
GRANT UPDATE 
ON (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'parcel%') 
TO police;
GMB
  • 216,147
  • 25
  • 84
  • 135
gulls92
  • 33
  • 3

1 Answers1

3

GRANT takes only literal table names. What you want requires dynamic SQL, ie dynamically building a statement and executing it in an anonymous block.

Consider:

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
$$;
GMB
  • 216,147
  • 25
  • 84
  • 135