Re: Serial Type

From: Justin Clift <justin(at)postgresql(dot)org>
To: Christian Marschalek <cm(at)chello(dot)at>
Cc: "[GENERAL] PostgreSQL" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Serial Type
Date: 2001-05-02 05:02:37
Message-ID: 3AEF94ED.F3B7AB4B@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

  • Serial Type at 2001-05-01 17:44:42 from Christian Marschalek

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-05-02 05:17:44 Re: Improve a query...
Previous Message sathya 2001-05-02 04:36:00 Technical Suggestion Pl. Clarrify.