Re: General question regarding sequences (Serial columns)

From: "Benjamin Krajmalnik" <kraj(at)illumen(dot)com>
To: "Juan Miguel Paredes" <juan(dot)paredes(at)gmail(dot)com>, <pgsql-admin(at)postgresql(dot)org>
Subject: Re: General question regarding sequences (Serial columns)
Date: 2006-06-15 17:31:37
Message-ID: BF337097BDD9D849A2F4B818DDB27987029352@stash.stackdump.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Thanks. I just looked at the definition and see it is a default value,
so I should be safe just pumping the data over.
On completion of the import I plan to reseed he sequence generator.

-----Original Message-----
From: Juan Miguel Paredes [mailto:juan(dot)paredes(at)gmail(dot)com]
Sent: Thursday, June 15, 2006 11:28 AM
To: Benjamin Krajmalnik
Subject: Re: [ADMIN] General question regarding sequences (Serial
columns)

> If I were to use the former (use Serial/BigSerial), is there a command
> which I can issue to keep PostgreSQL from using the sequence, and
> therefore copying over the original identity field value? Something
> equivalent to SQL Server's "SET IDENTITY_INSERT" command?

"Serial" declares your column being an integer type and provides a
default value (the next value from the sequence). If you DO provide a
value for your id column, PostgreSQL won't use the sequence. However,
be careful to keep in sync your sequence with the values in your
table, to avoid collissions (ALTER SEQUENCE can help)

Regards.

Browse pgsql-admin by date

  From Date Subject
Next Message Patricia Megumi Matsumoto 2006-06-16 02:31:57 unsubscribe pgsql-admin
Previous Message Benjamin Krajmalnik 2006-06-15 17:20:03 General question regarding sequences (Serial columns)