Skip site navigation (1) Skip section navigation (2)

Re: Inserting preset values into a serial column

From: Chris Browne <cbbrowne(at)acm(dot)org>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Inserting preset values into a serial column
Date: 2010-07-21 16:44:36
Message-ID: 878w544wej.fsf@cbbrowne.afilias-int.info (view raw or flat)
Thread:
Lists: pgsql-novice
mike(dot)rowan(at)internode(dot)on(dot)net (Michael Rowan) writes:
> 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, it shouldn't present a problem.  You'd presumably also want to
change the value of the sequence that underlies this in order to point
it to a value beyond the range of the "offered data."  (Use the function
"setval()" to do this.)
-- 
Rules of the Evil Overlord #208.  "Members of my Legion of Terror will
attend seminars  on Sensitivity  Training. It's good  public relations
for them to  be kind and courteous to the  general population when not
actively engaged in sowing chaos and destruction."

In response to

pgsql-novice by date

Next:From: Tim LandscheidtDate: 2010-07-21 16:50:54
Subject: Re: Inserting preset values into a serial column
Previous:From: Michael RowanDate: 2010-07-21 14:53:38
Subject: Inserting preset values into a serial column

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group