pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Benjamin Krajmalnik <kraj@illumen.com>
To: Juan Miguel Paredes <juan.paredes@gmail.com>
To: pgsql-admin@postgresql.org
Subject: Re: General question regarding sequences (Serial columns)
Date: Thu, 15 Jun 2006 11:31:37 -0600
Message-ID: <BF337097BDD9D849A2F4B818DDB27987029352@stash.stackdump.local> (raw)

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.paredes@gmail.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.



view thread (2+ messages)

Message-ID: <BF337097BDD9D849A2F4B818DDB27987029352@stash.stackdump.local>
Permalink:  ../BF337097BDD9D849A2F4B818DDB27987029352@stash.stackdump.local/
Also on:    postgresql.org/message-id/BF337097BDD9D849A2F4B818DDB27987029352@stash.stackdump.local

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: kraj@illumen.com, juan.paredes@gmail.com
  Subject: Re: General question regarding sequences (Serial columns)
  In-Reply-To: <BF337097BDD9D849A2F4B818DDB27987029352@stash.stackdump.local>
  References: <BF337097BDD9D849A2F4B818DDB27987029352@stash.stackdump.local>

* 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