Re: [GENERAL] Getting table metadata

2005-01-19 Thread Dann Corbit
I am not the original poster. Here is what PSQL does to get the table name list: connxdatasync=# \d * QUERY * SELECT c.relname as "Name", 'table'::text as "Type", u.usename as "Owner" FROM pg_class c, pg_user u WHERE c.relowner = u.usesysid AND c.relkind = 'r' AND c.relname !~ '^

Re: [GENERAL] Getting table metadata

2005-01-19 Thread ntinos
SELECT * FROM pg_attribute WHERE attrelid=; The problem I'm running into however, is that given a table name, there doesn't seem to be any way to get the table oid. Is there some function or query that does this? I think a way to get the table oid is: select oid from pg_class where relname=

Re: [GENERAL] Getting table metadata

2005-01-18 Thread Ken Tozier
Michael, See "Object Identifier Types" in the "Data Types" chapter. SELECT * FROM pg_attribute WHERE attrelid = 'tablename'::regclass; Thanks. That worked like a champ! Ken ---(end of broadcast)--- TIP 6: Have you searched our list archives?

Re: [GENERAL] Getting table metadata

2005-01-18 Thread Michael Fuhr
On Wed, Jan 19, 2005 at 12:14:57AM -0500, Ken Tozier wrote: > I recently stumbled upon the system catalog functions here > "http://www.postgresql.org/docs/7.4/static/catalogs.html"; and see that > it's easy to get a list of all databases and relatively easy to get a > list of tables, but there

Re: [GENERAL] Getting table metadata

2005-01-18 Thread Dann Corbit
Look at the SQL in the PG Admin III project source code base. http://www.pgadmin.org/   It’s non-trivial SQL to collect all the information about a table.   From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ken Tozier Sent: Tuesday, January 18, 2005 9:15 PM To: Pos