get sequence name from table name

From: Uwe Maiwald <u(dot)maiwald(at)kiss-net(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: get sequence name from table name
Date: 2009-12-04 16:53:34
Message-ID: 4B193E8E.6010603@kiss-net.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

how to get the name of the sequence that is responsible for setting the
autoincrement value of a tables primary key column?

i only have the name of the table and need to have an appropiate sql
statement.

i need this to write a program that loops through all tables of a
database and then ajusts the start values of the sequencees in case the
table has an automatic id value (serial/bigserial)

thanks,
Uwe

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Another Trad 2009-12-04 17:24:49 Getting more than one row in UNIQUE fields
Previous Message Dmitriy Igrishin 2009-12-03 19:38:55 Re: create user xxx with md5 string?