Getting sequence name for a non-serial column - Mailing list pgsql-general

From Együd Csaba
Subject Getting sequence name for a non-serial column
Date
Msg-id fbnvhp$le0$1@news.hub.org
Whole thread Raw
List 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.


pgsql-general by date:

Previous
From: Ow Mun Heng
Date:
Subject: Column as arrays.. more efficient than columns?
Next
From: Ow Mun Heng
Date:
Subject: Need suggestion on how best to update 3 million rows