Re: Inserting preset values into a serial column

From: Tim Landscheidt <tim(at)tim-landscheidt(dot)de>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Inserting preset values into a serial column
Date: 2010-07-21 16:50:54
Message-ID: m37hkovkwh.fsf@passepartout.tim-landscheidt.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Michael Rowan <mike(dot)rowan(at)internode(dot)on(dot)net> wrote:

> PostgreSQL 8.4.4.1

> Can someone pls confirm that, provided I am doing it right, I can insert a row into a table where the primary key is serial NOT NULL and a (unique) value is provided in the offered data? I cannot see an answer to this specific point in the docs.

Sure, just try it. You only need to make sure that after
your insertion the corresponding sequence will not collide
with your data, e. g., you will have to setval() the se-
quence to MAX(value) (+ 1?).

Tim

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Berkus 2010-07-21 20:47:01 Re: C Postgresql CGI
Previous Message Chris Browne 2010-07-21 16:44:36 Re: Inserting preset values into a serial column