Re: OIDs missing in pg_attribute?

From: Brent Verner <brent(at)rcfile(dot)org>
To: "Marc G(dot) Fournier" <scrappy(at)hub(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: OIDs missing in pg_attribute?
Date: 2001-12-07 06:40:28
Message-ID: 20011207064027.GA21130@rcfile.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

[2001-12-06 21:47] Marc G. Fournier said:
|
| Morning all ...
|
| Well, just spend the past few days banging my head against a brick
| wall trying to figure out why OpenACS 4.x won't work with PgSQL v7.2b3,
| and just figured it out, or, at least, figured out part of it ...
|
| v7.2b3 no longer has an OID on pg_attribute?

nope. It appears to have been removed around 10 Aug 2001.

| The following works great in v7.1.3, but fails in v7.b3:
|
| select upper(c.relname) as table_name,
| upper(a.attname) as column_name,
| d.description as comments
| from pg_class c,
| pg_attribute a
| left outer join pg_description d on (a.oid = d.objoid)
| where c.oid = a.attrelid
| and a.attnum > 0;

see if this does what you need. Notice the col_description() function
that obviates the need for pg_attribute.oid...

SELECT upper(c.relname) as table_name,
upper(a.attname) as column_name,
col_description(a.attrelid, a.attnum) as comments
FROM pg_class c
LEFT JOIN pg_attribute a
ON a.attrelid = c.oid
WHERE a.attnum > 0;

cheers.
brent

--
"Develop your talent, man, and leave the world something. Records are
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing." -- Duane Allman

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Holger Krug 2001-12-07 07:30:47 Re: Using Cursor in PostgreSQL 7.2
Previous Message Stephan Szabo 2001-12-07 06:19:20 Re: OIDs missing in pg_attribute?