pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sylte <Sylte_@hotmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: Auto incrementing an integer
Date: Mon, 14 May 2001 23:55:51 +0200
Message-ID: <9dpk8p$f5e$1@sunsite.dk> (raw)
References: <989853345.3afff6a1a3a45@bugs.unl.edu.ar>

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







view thread (6+ messages)  latest in thread

Message-ID: <9dpk8p$f5e$1@sunsite.dk>
Permalink:  ../9dpk8p$f5e$1@sunsite.dk/
Also on:    postgresql.org/message-id/9dpk8p$f5e$1@sunsite.dk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: Sylte_@hotmail.com
  Subject: Re: Auto incrementing an integer
  In-Reply-To: <9dpk8p$f5e$1@sunsite.dk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox