Thursday 15 March 2012

PostgreSQL copy permissions from another table -


Is it possible to copy user permissions from one table to another in a table in a postgresql database? What is the point of updating the pg_class.relacl column value for the table of value for the source table, such as:

  UPDATE pg_class SET relacl = (SELECT relacl fg pg_class WHERE relname = 'Source_table ') Where relname =' target_table ';  

It seems to work, but can I do anything else that needs to be done with this method or am I missing other 'gatakas'?

Thanks for any answers.

pg_dump will be used if you can use command line instead of SQL :

  pg_dump dbname -t oldnamename -s \ | For example '^ (GRANT | REVOKE)' \ | Sed 's / oldtablename / newtablename /' \ | Psql dbname  

I find a UNIX server in Windows I use pg_dump -s in a file, manually edit it and then it I can import into a database.

Perhaps you will need to copy the permissions of owned sequences from this table - pg_dump will work.


No comments:

Post a Comment