Object ownership in a new database

From: Russell Smith <mr-russ(at)pws(dot)com(dot)au>
To: pgsql-general(at)postgresql(dot)org
Subject: Object ownership in a new database
Date: 2006-02-14 02:55:54
Message-ID: 43F146BA.8010206@pws.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2006-02-14 05:38:49 Re: Limiting with a left outer join
Previous Message Tham Shiming 2006-02-14 01:32:34 Re: Dropping a database that does not exist