Query to fetch all lo and oid tables/columns in a database - Mailing list pgsql-general

From Denis Gasparin
Subject Query to fetch all lo and oid tables/columns in a database
Date
Msg-id 200112060948.fB69mvm53199@postgresql.org
Whole thread Raw
List 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@edistar.com
---------------------------
Programmer & System Administrator - Edistar srl
www.edistar.com


pgsql-general by date:

Previous
From: Karel Zak
Date:
Subject: Re: Casting Varchar to Numeric
Next
From: Erwin Ambrosch
Date:
Subject: Number of Connections