Subject: datdba col in pg_database

From: [email-masked] (Banco de Dados Ambiental)
Date: Mon, 2 Dec 91 03:49:52 -0800

Hi,
When I create a new database named, for example, "spring", logged to unix as use
   r
"ambdata", who is a valid postgres user, I can see that the column datdba in the
class pg_database is set to a value that do not correspond to the column usesysi
   d
in class pg_user.

--------------------------------------------------------------------------------
   -
| usename     | usesysid    | usecreatedb | usetrace    | usesuper    | usecatup
   d ---------------------------------------------------------------------------
   ------
| ambdata     | 2127        | t           | t           | t           | t

--------------------------------------------------------------------------------
   -

-------------------------------------------
| datname     | datdba      | datpath     |
-------------------------------------------
| spring      | 17187       | spring      |
-------------------------------------------

The same does not happen when the user "postgres" creates a new database. All
databases created by postgres have the value "6" in the datdba column of the
corresponding row in pg_database.

--------------------------------------------------------------------------------
   --
| usename     | usesysid    | usecreatedb | usetrace    | usesuper    | usecatup
   d
--------------------------------------------------------------------------------
   --
| postgres    | 6           | t           | t           | t           | t

--------------------------------------------------------------------------------
   --

-------------------------------------------
| datname     | datdba      | datpath     |
-------------------------------------------
| postgres    | 6           | postgres    |
-------------------------------------------
| ambdata     | 6           | ambdata     |
-------------------------------------------
| demo        | 6           | demo        |
-------------------------------------------

I would like to know a litle bit more about ownership of databases in postgres.
What kind of problems should be expected?

Thanks for any information about it.
                                        JoaoPedro.

---

From: postarch (Postgres Mailing Archive)
Date: Mon, 02 Dec 91 08:14:58 PST

In message <[email-masked]> you write:

> When I create a new database named, for example, "spring", logged to unix as
> user "ambdata", who is a valid postgres user, I can see that the column
> datdba in the class pg_database is set to a value that do not correspond
> to the column usesysid
> in class pg_user.
> 

datdba is the oid of the pg_user tuple; try

	retrieve (pg_user.oid, pg_user.all) where pg_user.usename = "ambdata"

user postgres has usesysid == pg_user tuple oid == 6 by convention.

					mike olson
					postgres research group
					uc berkeley
					[email-masked]