From: | Trurl McByte <trurl(at)realtor3d(dot)odessa(dot)ua> |
---|---|
To: | "Antonio W(dot) Lagnada" <alagnada(at)lsil(dot)com> |
Cc: | Andrzej Mazurkiewicz <andrzej(dot)mazurkiewicz(at)polkomtel(dot)com(dot)pl>, Pgsql-sql <pgsql-sql(at)postgreSQL(dot)org> |
Subject: | Re: [SQL] Autogenerated Unique Index |
Date: | 2000-03-07 15:37:53 |
Message-ID: | Pine.LNX.4.20.0003071730140.25971-100000@tserv.realtor3d.odessa.ua |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Tue, 7 Mar 2000 (Today), Antonio W. Lagnada wrote:
Try "serial" macro-type off "id" field.
#CREATE TABLE A (
# B serial,
# C char(5)
#);
NOTICE: CREATE TABLE will create implicit sequence 'a_b_seq' for SERIAL column'a.b'
NOTICE: CREATE TABLE/UNIQUE will create implicit index 'a_b_key' for table 'a'
CREATE
Or make it by hand:
#CREATE SEQUENCE A_B_seq;
#CREATE TABLE A (
# B int DEFAULT nextval('A_B_seq') NOT NULL,
# C char(5),
# PRIMARY KEY(B)
#);
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'a_pkey' for table'a'
CREATE
AWL> Hi Andrzej,
AWL>
AWL> Does this mean that everytime I create a new record on the table, the field
AWL> "B" will be automatically incremented?
AWL>
AWL> - Antonio
AWL>
AWL> Andrzej Mazurkiewicz wrote:
AWL>
AWL> > cfmg_adm=> CREATE TABLE A (
AWL> > cfmg_adm(> B int NOT NULL,
AWL> > cfmg_adm(> C char(5),
AWL> > cfmg_adm(> PRIMARY KEY (B)
AWL> > cfmg_adm(> );
AWL> > NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'a_pkey' for
AWL> > table
AWL> > 'a'
AWL> > CREATE
AWL> > cfmg_adm=>
AWL> > Regards,
AWL> > Andrzej Mazurkiewicz
AWL> >
AWL> > > -----Original Message-----
AWL> > > From: Antonio W. Lagnada [SMTP:alagnada(at)lsil(dot)com]
AWL> > > Sent: 7 marca 2000 14:41
AWL> > > To: Pgsql-sql
AWL> > > Subject: [SQL] Autogenerated Unique Index
AWL> > >
AWL> > > Can someone give me a step-by-step instructions on how to generate a
AWL> > > unique autogenerated index in PostgreSQL?
AWL> > >
AWL> > > --
AWL> > > Antonio W. Lagnada
AWL> > >
AWL> > >
AWL> > > 952.921.8533
AWL> > > alagnada(at)lsil(dot)com_NOSPAM
AWL> > > Remove the _NOSPAM for
AWL> > > the actual email address
AWL> > > << File: Card for Antonio W. Lagnada >>
AWL>
AWL> --
AWL> Antonio W. Lagnada
AWL>
AWL> 952.921.8533
AWL> alagnada(at)lsil(dot)com_NOSPAM
AWL> Remove the _NOSPAM for
AWL> the actual email address
AWL>
AWL>
--
Trurl McByte, Capt. of StasisCruiser "Prince"
|InterNIC: AR3200 RIPE: AR1627-RIPE|
|--98 C3 78 8E 90 E3 01 35 87 1F 3F EF FD 6D 84 B3--|
From | Date | Subject | |
---|---|---|---|
Next Message | Trurl McByte | 2000-03-07 15:44:52 | Re: [SQL] VarChar(n) |
Previous Message | Andrzej Mazurkiewicz | 2000-03-07 15:37:30 | RE: [SQL] Autogenerated Unique Index |