proper way to create table and change ownership and grants

There isn’t a better way currently to manage ownership and grants. The extension system would allow anyone to write a reusable custom tag like for grant, but it varies enough per database that we haven’t gotten it into the core library yet.


You’ll have to stick to the block for now


Nathan


I’m using PostgreSQL (v9.1) and would like to create a new table (using my postgres user) then alter the ownership of the table and grant some permissions to a couple of groups.

The works fine, but I couldn’t find any way to alter the owner or perform the grants without using custom sql in the same changeSet.  This works correctly BUT, LiquiBase apparently cannot rollback this change.  When I try a rollback, I get a RollbackImpossibleException related to the   (I believe).

1) is there a better/preferred way to create the table with the ownership change and grants I need?  For security reasons my owner cannot actually create the table, I have to use postgres to create it then switch ownership.

or

2) Is there a way to specify how to rollback the change?  In this case the RawSql is not relevant, “rollback” just means I  want the table dropped.

For reference, here’s the xml for the changeSet:

   
       
           
               
           
           
               
           
           
               
           
       

       
            ALTER TABLE abcproxy OWNER TO tableowner;
            GRANT ALL ON TABLE abcproxy TO tableowner;
            GRANT ALL ON TABLE abcproxy TO tableusersgroup;
       

   

Found the tag, that works great for #2.  Still need help/advice on #1.
Thanks