Re: Auto incrementing an integer

From: "Sylte" <Sylte_(at)hotmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Auto incrementing an integer
Date: 2001-05-14 21:55:51
Message-ID: 9dpk8p$f5e$1@sunsite.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Thanks Martn....I found this http://dis.lib.muohio.edu/code/entry.html?ID=3

Creating an Autoincrement field in Postgresql

postgres does this a little differently; the "serial" type creates an
integer column, and a sequence used to increment this column.

try this:

create table table_name(
control serial,
another_column text,
primary key(control)
);

results in this:
Table = table_name
+----------------------------------+----------------------------------+-----
--+
| Field | Type |
Length|
+----------------------------------+----------------------------------+-----
--+
| control | int4 not null default nextval('" |
4 |
| another_column | text |
var |
+----------------------------------+----------------------------------+-----
--+
Index: table_name_pkey

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Davis 2001-05-15 01:33:06 RE: Auto incrementing an integer
Previous Message Philip Hallstrom 2001-05-14 21:53:38 Re: Auto incrementing an integer