Re: Auto incrementing an integer - Mailing list pgsql-sql

From Sylte
Subject Re: Auto incrementing an integer
Date
Msg-id 9dpk8p$f5e$1@sunsite.dk
Whole thread Raw
In response to Re: Auto incrementing an integer  (Martín Marqués <martin@bugs.unl.edu.ar>)
List pgsql-sql
Thanks Mart�n....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






pgsql-sql by date:

Previous
From: George Moga
Date:
Subject: Re: Select most recent record?
Next
From: "ameet"
Date:
Subject: Exp/Imp Problems...