On Fri, 2002-11-22 at 09:55, David Pradier wrote:
> Hi
>
> I'd like to know who's the owner of a table, and if i can change simply the
> owner of a table.
>
> I tried \z in psql, it gives me :
> {=,user1=arwdRxt,user2=arwdRxt}
>
> Does this mean that user1 is the owner ?
No, those are the granted permissions.
For the owner:
SELECT u.usename
FROM pg_class AS c,
pg_user AS u
WHERE u.usesysid = c.relowner AND
c.relname = 'tablename';
For 7.3, the last part of the condition would be:
c.oid = 'tablename'::regclass;
to distinguish between similarly named tables in different schemas.
--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight, UK
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"Can two walk together, except they be agreed?"
Amos 3:3