Thread: Autonumbering column

Autonumbering column

From
"Ryan Mchale"
Date:
Hi,

  Is there anyway to have an autonumbering field?

Ryan


Re: [GENERAL] Autonumbering column

From
James Olin Oden
Date:
> 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


Re: [GENERAL] Autonumbering column

From
"Antonio Garcia Mari"
Date:
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)