Getting sequence name for a non-serial column

From: Együd Csaba <csegyud(at)vnet(dot)hu>
To: pgsql-general(at)postgresql(dot)org
Subject: Getting sequence name for a non-serial column
Date: 2007-09-06 04:26:31
Message-ID: fbnvhp$le0$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I've read several solutions to get the sequence name for a field defined as serial by create/alter table, but when I
define a default expression (e.g. like next_val('foo_seq') ) for an integer column pg_depend will not contain
information to describe this relation.

Is there a backward compatible method (back to 7.3 or 7.4) to get the sequence name for these fields? I know
pg_get_serial_sequence which works correctly only for serial fields and on versions 8.0+. It's a convenient and easy
way, but I also need this information on v7.3 servers and for non-serial columns.

I also can retrieve column_default from information_schema.columns view, but it contains an expression not a sequence name.

Any suggestions are appreciated.

Many thanks,

-- E.Cs.

Browse pgsql-general by date

  From Date Subject
Next Message Ow Mun Heng 2007-09-06 06:13:33 Need suggestion on how best to update 3 million rows
Previous Message Ow Mun Heng 2007-09-06 04:22:51 Column as arrays.. more efficient than columns?