Re: derive the sequence name of a column

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Mel Jamero <mel(at)gmanmi(dot)tv>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: derive the sequence name of a column
Date: 2003-10-31 15:51:16
Message-ID: 20031031074859.G87061@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Fri, 31 Oct 2003, Mel Jamero wrote:

> Works fine with 7.2.2. Thanks! I still can't figure it out in 7.1.3
>
> There's no pg_namespace there. Any ideas?

I think you can just remove the join with pg_namespace and the associated
where clauses (the nspname one and the join condition one). I'm not
sure if there'll be any other problems since I don't currently have a
7.1.x system to try against.

And, for good measure, if you're running 7.1.x, you should really upgrade
soon. ;)

> select pg_attrdef.* from pg_attrdef, pg_namespace, pg_class,
> pg_attribute
> where pg_namespace.nspname='public' and
> pg_class.relnamespace=pg_namespace.oid and pg_class.relname='test' and
> pg_attribute.attrelid=pg_class.oid and pg_attribute.attname='test_id'
> and
> pg_attrdef.adrelid=pg_class.oid and
> pg_attrdef.adnum=pg_attribute.attnum;
>
> (filling in the schema, table name and column name for the constants).

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Larry Rosenman 2003-10-31 19:52:18 Re: installation problem
Previous Message Mel Jamero 2003-10-31 07:40:52 Re: derive the sequence name of a column