Changing table owner to db owner. - Mailing list pgsql-general

From Paul McGarry
Subject Changing table owner to db owner.
Date
Msg-id AANLkTinhJ6=k23jz=5MApk2T2OOaOGJohxvf_PTqmxc8@mail.gmail.com
Whole thread Raw
Responses Re: Changing table owner to db owner.  (Adrian Klaver <adrian.klaver@gmail.com>)
List pgsql-general
I have a number of DBs that are all the same structure but are owned
by different users and I want to add a table to each of those DBs.

At the moment I have to either connect to each DB as it's user (which
means digging up it's password) or do it as the DB super user and run
an ALTER table ... OWNER specifying the specific user for each of the
DBs.

My task would be easier if I could do something like:

=====

CREATE TABLE test

(
  test_id integer NOT NULL,
  test_string text
};

ALTER TABLE test OWNER DBOWNER;

======

Where DBOWNER magically resolved to the owner of the DB, so I wouldn't
have to futz with different users, I could just use the same SQL
script on every DB without caring about the specific users.

Anyone have any ideas on how something like this could be done?

Paul

pgsql-general by date:

Previous
From: Bill Moran
Date:
Subject: Re: Understanding Schema's
Next
From: Adrian Klaver
Date:
Subject: Re: Changing table owner to db owner.