Query to fetch all lo and oid tables/columns in a database

From: Denis Gasparin <denis(at)edistar(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Query to fetch all lo and oid tables/columns in a database
Date: 2001-12-06 09:48:54
Message-ID: 200112060948.fB69mvm53199@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a database with lo (the type for large objects used by the odbc driver
) and oid (the default type for large objects in postgres).

I need to find all the tables (and respective columns) in the database
containing large objects ( lo and oid ).

Is the following query correct?

select c.relname,a.attname from pg_class c, pg_attribute a

where
( format_type(a.atttypid, a.atttypmod)='lo'
or format_type(a.atttypid, a.atttypmod)='oid' )

and a.attrelid=c.oid and a.attnum > 0
and c.relkind = 'r' and c.relname !~ '^pg_'

I have tested my query with two tables in the database containing both oid
and lo types and it worked.

I would know if there is any case in which this query could fetch any column
that doesn't contain large objects (those in pg_largeobject).
(surely this period contains some grammar mistakes... sorry ;-) )

--
Ing. Denis Gasparin: denis(at)edistar(dot)com
---------------------------
Programmer & System Administrator - Edistar srl
www.edistar.com

Browse pgsql-general by date

  From Date Subject
Next Message Erwin Ambrosch 2001-12-06 10:18:46 Number of Connections
Previous Message Karel Zak 2001-12-06 09:22:23 Re: Casting Varchar to Numeric