Received: from lsi.lsil.com (lsi.lsil.com [147.145.40.2]) by hub.org (8.9.3/8.9.3) with ESMTP id LAA96264 for ; Tue, 7 Mar 2000 11:45:33 -0500 (EST) (envelope-from alagnada@lsil.com) Received: from mhbs.lsil.com ([147.145.31.100]) by lsi.lsil.com (8.9.3+Sun/8.9.1) with ESMTP id IAA00999 for ; Tue, 7 Mar 2000 08:45:02 -0800 (PST) Received: from [147.145.143.10] by mhbs.lsil.com; Tue, 7 Mar 2000 08:44:44 -0800 Received: from lsil.com by mms10 (SMI-8.6/SMI-SVR4) id KAA27288; Tue, 7 Mar 2000 10:44:38 -0600 Message-Id: <38C53251.DF6715B8@lsil.com> Date: Tue, 07 Mar 2000 10:46:09 -0600 From: "Antonio W. Lagnada" Organization: LSI Logic Corporation X-Mailer: Mozilla 4.7 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: Trurl McByte CC: Andrzej Mazurkiewicz , Pgsql-sql Subject: Re: [SQL] Autogenerated Unique Index References: Content-Type: multipart/mixed; boundary="------------3177936DF9C715F05127B4B7" This is a multi-part message in MIME format. --------------3177936DF9C715F05127B4B7 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi Trurl, #CREATE SEQUENCE A_B_seq; #CREATE TABLE A ( # B int DEFAULT nextval('A_B_seq') NOT NULL, # C char(5), # PRIMARY KEY(B) #); I think the above is what I'm looking for....Thanks to All :-) Trurl McByte wrote: > 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@lsil.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@lsil.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@lsil.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--| -- Antonio W. Lagnada Silicon Optimization 952.921.8533 alagnada@lsil.com_NOSPAM Remove the _NOSPAM for the actual email address --------------3177936DF9C715F05127B4B7 Content-Type: text/x-vcard; charset=us-ascii; name="alagnada.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Antonio W. Lagnada Content-Disposition: attachment; filename="alagnada.vcf" begin:vcard n:Lagnada;Antonio W. tel;pager:612-414-9149 tel;cell:612-414-9149 tel;fax:612-921-8843 tel;home:651-501-2587 tel;work:612-921-8533 x-mozilla-html:TRUE url:http://www.lsil.com org:LSI Logic Corporation;Silicon Optimization version:2.1 email;internet:alagnada@lsil.com title:Design Engineer adr;quoted-printable:;;8300 Norman Center=0D=0ASuite 730;Bloomington;MN;55437; fn:Antonio W. Lagnada end:vcard --------------3177936DF9C715F05127B4B7--