Re: [GENERAL] Autonumbering column - Mailing list pgsql-general

From Antonio Garcia Mari
Subject Re: [GENERAL] Autonumbering column
Date
Msg-id 199807171005.GAA29541@hub.org
Whole thread Raw
In response to Re: [GENERAL] Autonumbering column  (James Olin Oden <joden@Lee.k12.nc.us>)
List pgsql-general
this is a hack, but it works...

CREATE SEQUENCE key_s INCREMENT 1 START 1;
CREATE TABLE cliente (
    key     int4 NOT NULL DEFAULT nextval('key_s') PRIMARY KEY,
    name     varchar(100) UNIQUE NOT NULL,
    username    varchar(8) NOT NULL
    );
>
> > Hi,
> >
> >   Is there anyway to have an autonumbering field?
> >
>
> I don't think so, but there is a way to generate the values for a key
> column safely.  Look at the manpage on create_sequence...james
>


Antonio Garcia Mari
Mallorca (Spain)


pgsql-general by date:

Previous
From: Roland Roberts
Date:
Subject: PHP and keystone (formerly PTS)
Next
From: Maarten Boekhold
Date:
Subject: Re: [GENERAL] PostgreSQL connect options?