Re: REQUEST: option to auto-generate new sequences with CREATE TABLE (LIKE)

From: David Fetter <david(at)fetter(dot)org>
To: Nico Sabbi <nsabbi(at)officinedigitali(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: REQUEST: option to auto-generate new sequences with CREATE TABLE (LIKE)
Date: 2007-07-18 15:33:25
Message-ID: 20070718153325.GA722@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jul 18, 2007 at 03:10:30PM +0200, Nico Sabbi wrote:
> Hi,
> as the subjects reads I searched in the docs a way to instruct postgres
> to create new sequences when copying tables containing serial columns,
> but the resulting serial fields in the new tables reference the
> original sequence.

That's the right behavior. You should be using

pg_get_serial_sequence('your_table','your_column')

to get the sequence name anyhow. :)

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
phone: +1 415 235 3778 AIM: dfetter666
Skype: davidfetter

Remember to vote!
Consider donating to PostgreSQL: http://www.postgresql.org/about/donate

In response to

Browse pgsql-general by date

  From Date Subject
Next Message 李彦 Ian Li 2007-07-18 16:07:39 Again about varchar()
Previous Message Nico Sabbi 2007-07-18 14:06:38 Can't SELECT from (INSERT ... RETURNING)