Re: Equivalent for AUTOINCREMENT?

From: Michael Hall <mick(at)mjhall(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Equivalent for AUTOINCREMENT?
Date: 2008-10-31 01:45:54
Message-ID: 20081031014554.GB22962@server1.jarvisstreet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> I have a table where I have a serialnumber which shuld be increased be
> each INSERT. I know I can use max() to get the highest number, but how
> can I use it in a INSERT statement?

Have a look in the manual for the SERIAL data type.
For fields with a SERIAL data type, you can use DEFAULT in an INSERT statement.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michelle Konzack 2008-10-31 02:30:44 Equivalent for AUTOINCREMENT?
Previous Message Alvaro Herrera 2008-10-31 01:37:30 Re: Are there plans to add data compression feature to postgresql?