Thread: sequence question

sequence question

From
"Marie G. Tuite"
Date:
Hey there,

Does anybody have a nice way to identify what table.column is using a
particular sequence on a database-wide basis?

--Thanks.




Re: sequence question

From
"Rod Kreisler"
Date:
select relname as table, attname as column from pg_class c join pg_attribute
a on c.oid=a.attrelid join pg_attrdef d on a.attnum=d.adnum where
adsrc='nextval(\'"SEQUENCE_NAME_SEQ"\'::text)'\ AND d.adrelid=c.oid;

There may be a more efficient query, but I wasn't too worried about figuring
it out...

HTH

Rod

> -----Original Message-----
> From: pgsql-sql-owner@postgresql.org
> [mailto:pgsql-sql-owner@postgresql.org]On Behalf Of Marie G. Tuite
> Sent: Monday, January 27, 2003 3:06 PM
> To: Pgsql-Sql@Postgresql. Org
> Subject: [SQL] sequence question
>
>
> Hey there,
>
> Does anybody have a nice way to identify what table.column is using a
> particular sequence on a database-wide basis?
>
> --Thanks.
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
>