Object ownership in a new database - Mailing list pgsql-general

From Russell Smith
Subject Object ownership in a new database
Date
Msg-id 43F146BA.8010206@pws.com.au
Whole thread Raw
List pgsql-general
Hello all,

When you create a new database, not all objects in that database are
owned by the database owner.  Now some of those may need to be owned by
a superuser, eg C functions.  However should other things such as the
public schema or other general objects be owned by the database owner,
or the user who created them in the template database?

To create a db with the public schema owned by postgres, just:

$ createdb -h 172.17.72.1 -U postgres -O non_superuser owner_test;

$ psql -h 172.17.72.1 -U postgres owner_test;
owner_test=# \dn
         List of schemas
         Name        |  Owner
--------------------+----------
  information_schema | postgres
  pg_catalog         | postgres
  pg_toast           | postgres
  public             | postgres
(4 rows)

owner_test=# \q


Now everything is owned by postgres.

Is this the correct and desired behaviour, or is the behaviour expected
to be different.  I expected it to be owned by "non_superuser".

Any comments welcome.

Russell Smith

pgsql-general by date:

Previous
From: alexandre - aldeia digital
Date:
Subject: differences between pg_dump and pg_restore with -t
Next
From: Michael Fuhr
Date:
Subject: Re: Limiting with a left outer join