RE: sequences and tables - Mailing list pgsql-general

From Michael Davis
Subject RE: sequences and tables
Date
Msg-id 01C0756A.21B61C60.mdavis@sevainc.com
Whole thread Raw
In response to sequences and tables  (Nelio Alves Pereira Filho <nelio@ifx.com.br>)
List pgsql-general
Try:

--This shows all default values for columns
SELECT DISTINCT c.relname, a.attname, t.typname, pa.adsrc, a.atttypid
   FROM pg_attribute a, pg_class c, pg_type t, pg_attrdef pa
   WHERE a.attrelid = c.oid
         AND a.atttypid = t.oid
         AND c.oid = pa.adrelid
         AND a.attnum = pa.adnum
         AND upper(c.relname) = 'TABLE_NAME';

--This shows all columns that reference a sequence
SELECT DISTINCT c.relname, a.attname, t.typname, pa.adsrc, a.atttypid
   FROM pg_attribute a, pg_class c, pg_type t, pg_attrdef pa
   WHERE a.attrelid = c.oid
         AND a.atttypid = t.oid
         AND c.oid = pa.adrelid
         AND a.attnum = pa.adnum
         AND upper(pa.adsrc) like '%SEQUENCE_NAME%';


-----Original Message-----
From:    Nelio Alves Pereira Filho [SMTP:nelio@ifx.com.br]
Sent:    Wednesday, January 03, 2001 7:13 AM
To:    pgsql-general@postgresql.org
Subject:    sequences and tables

Where do I find information about a sequence? I'd like to know what are
the table and column referenced by a sequence. As its name may be
truncated, it's not a consistent place to look for.

The system tables didn't seem to help.

Thanks

--
Nelio Alves Pereira Filho
IFX Networks - www.ifx.com.br
+55 11 3365-5863
nelio@ifx.com.br


pgsql-general by date:

Previous
From: Tim Uckun
Date:
Subject: Re: Re: RE: Re: MySQL and PostgreSQL speed compare
Next
From: Tom Lane
Date:
Subject: Re: Pb importing data in v. 7.0.3