The "grant all privileges on all tables to postgres;", is never applicable for postgresql version 8.3 and the above syntax works for only versions after 9.0.
For versions below this, we need to do it separately for each tables. To achieve this, what i did is to have a select query that can prepare the grant or revoke statement for all tables at a once and then output it to some text file and then execute this file.
work out this..
select 'REVOKE ALL ON public.' || table_name || ' FROM username ' from information_schema.tables WHERE table_type='BASE TABLE' AND table_schema='public';
For versions below this, we need to do it separately for each tables. To achieve this, what i did is to have a select query that can prepare the grant or revoke statement for all tables at a once and then output it to some text file and then execute this file.
work out this..
select 'REVOKE ALL ON public.' || table_name || ' FROM username ' from information_schema.tables WHERE table_type='BASE TABLE' AND table_schema='public';
No comments:
Post a Comment