Re: Serial Type - Mailing list pgsql-general

From Justin Clift
Subject Re: Serial Type
Date
Msg-id 3AEF94ED.F3B7AB4B@postgresql.org
Whole thread Raw
In response to Serial Type  ("Christian Marschalek" <cm@chello.at>)
List pgsql-general
Hi Chris,

If you do an INSERT straight into the table, AND also make sure you give
it the value you want in the serial column, it will accept it and not
increment the serial column's counter.

There are also a few function which are useful with the serial type :

currval()
setval()
nextval()

See http://odbc.postgresql.org/docs/index.php?sql-createsequence.html
for more info.

Regards and best wishes,

Justin Clift

Christian Marschalek wrote:
>
> The serial data type automaticaly takes the next higher value, but what
> if there's a drop and I want to assing 3 even if there are 20 records
> and the next higher number would be 21 not 3?
>
> Tia Chris
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://www.postgresql.org/search.mpl

--
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
     - Indira Gandhi

pgsql-general by date:

Previous
From: "Christian Marschalek"
Date:
Subject: RE: Ideal hardware configuration for pgsql
Next
From: "Eric G. Miller"
Date:
Subject: Re: Improve a query...