0

I'm currently using the following postgres query and then copying the data output and running to change all of the tables in a specified schema. What's the best way so that I don't have to always run, such as a stored procedure?

select 'ALTER TABLE ' || table_name || ' OWNER TO new_owner;' 
from information_schema.tables 
where table_schema = 'specified_schema';  
user3329160
  • 165
  • 2
  • 13
  • Do you actually need to change the owner, or is it enough to GRANT certain privileges to `new_owner`? In the latter case, continue reading [here](http://stackoverflow.com/questions/10352695/grant-all-on-a-specific-schema-in-the-db-to-a-group-role-in-postgresql/10353730#10353730) and [here](http://dba.stackexchange.com/questions/53914/pg-permission-denied-for-relation-table/53936#53936). – Erwin Brandstetter Apr 09 '14 at 22:02
  • I actually need to change the owner. – user3329160 Apr 10 '14 at 14:44

1 Answers1

0

A stored procedure must be run as well, you gain nothing.

I would create a cron job and put it in cron/{hourly,daily} - provided that it is the best alternative to solve the problem.

You do not give any information to judge that.

Str.
  • 1,389
  • 9
  • 14