I want to grant select privilege on few selected tables.
Can I use sub-query in GRANT statement????
I have tried the following query:
GRANT SELECT ON TABLE
(SELECT array_to_string( array_agg(table_schema||'.'||table_name),', ' ) as flttab
FROM information_schema.tables
where table_schema = 'try3' AND table_name like 'ph1_part_03%') a TO xyz;
But I have got the below error:
ERROR: syntax error at or near "("
LINE 5: GRANT SELECT ON TABLE (SELECT array_to_string( array_agg(ta...
^********** Error **********
ERROR: syntax error at or near "("
SQL state: 42601
Character: 282