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 !~ '^
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=
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?
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
: PostgreSQL
Subject: [GENERAL] Getting table
metadata
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
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 doesn't seem to be any built in method for retrieving a table definition.