Re: OIDs missing in pg_attribute? - Mailing list pgsql-hackers

From Brent Verner
Subject Re: OIDs missing in pg_attribute?
Date
Msg-id 20011207064027.GA21130@rcfile.org
Whole thread Raw
In response to OIDs missing in pg_attribute?  ("Marc G. Fournier" <scrappy@hub.org>)
List 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


pgsql-hackers by date:

Previous
From: Brent Verner
Date:
Subject: Re: text -> time cast problem
Next
From: Oleg Bartunov
Date:
Subject: Re: Remote connections?