Return-Path: postarch
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA21756; Wed, 1 Apr 92 18:09:30 -0800
Message-Id: <9204020209.AA21756@postgres.Berkeley.EDU>
From: postarch (Postgres Mailing Archive)
Subject: Re: "dir"-like query
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu
Reply-To: mer@postgres.berkeley.edu
In-Reply-To: Your message of "Wed, 01 Apr 92 07:01:09 PST."
             <9204011346.AA05844@dpi.inpe.br> 
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
mer@postgres.berkeley.edu
