Subject: "dir"-like query

From: [email-masked] (Ricardo Cartaxo)
Date: Wed, 1 Apr 92 07:01:09 -0800

Hi,
Is there a way to query all databases, tables, attributes and their types, belon
   ging to certain user?
I can see no relationship between pg_database and pg_class. I mean, the pg_class
    attribute "relowner"  should not indicate the pg_database attribute "datdba"
    which is the same as the pg_user attribute "oid" ?
All classes seems to be owned by postgres and template1.
Thanks in advance.

JoaoPedro
[email-masked]

---

From: postarch (Postgres Mailing Archive)
Date: Wed, 01 Apr 92 18:08:08 PST

you write:

>Is there a way to query all databases, tables, attributes and their types,
>belonging to certain user?

>I can see no relationship between pg_database and pg_class. I mean, the
>pg_class attribute "relowner" should not indicate the pg_database attribute
>"datdba" which is the same as the pg_user attribute "oid" ?

> All classes seems to be owned by postgres and template1.

This type of query is currently impossible as 3.1 postgres doesn't set
the userid correctly.  It uses getuid(), but unfortunately when you are
running under the postmaster the logged in owner of the backend process
is whoever started the postmaster (postgres).  Subsequently when new classes
are created the relowner field is always set to the userid of postgres.  I
have changed this so that the userid is set by scanning the pg_user class. 
This way the relowner field of pg_class will be set to the userid of whoever
owns the front-end process when the class is created.

Jeff Meredith
[email-masked]