pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Uwe Maiwald <u.maiwald@kiss-net.de>
To: pgsql-sql@postgresql.org
Subject: get sequence name from table name
Date: Fri, 04 Dec 2009 17:53:34 +0100
Message-ID: <4B193E8E.6010603@kiss-net.de> (raw)

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



view thread (3+ messages)  latest in thread

Message-ID: <4B193E8E.6010603@kiss-net.de>
Permalink:  ../4B193E8E.6010603@kiss-net.de/
Also on:    postgresql.org/message-id/4B193E8E.6010603@kiss-net.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: u.maiwald@kiss-net.de
  Subject: Re: get sequence name from table name
  In-Reply-To: <4B193E8E.6010603@kiss-net.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox