pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Antonio W. Lagnada <alagnada@lsil.com>
To: Trurl McByte <trurl@realtor3d.odessa.ua>
Cc: Andrzej Mazurkiewicz <andrzej.mazurkiewicz@polkomtel.com.pl>
Cc: Pgsql-sql <pgsql-sql@postgreSQL.org>
Subject: Re: [SQL] Autogenerated Unique Index
Date: Tue, 07 Mar 2000 10:46:09 -0600
Message-ID: <38C53251.DF6715B8@lsil.com> (raw)
References: <Pine.LNX.4.20.0003071730140.25971-100000@tserv.realtor3d.odessa.ua>

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

Attachments:

alagnada.vcf (text/x-vcard, 412B) download 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

view thread (9+ messages)

Message-ID: <38C53251.DF6715B8@lsil.com>
Permalink:  ../38C53251.DF6715B8@lsil.com/
Also on:    postgresql.org/message-id/38C53251.DF6715B8@lsil.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: alagnada@lsil.com, trurl@realtor3d.odessa.ua, andrzej.mazurkiewicz@polkomtel.com.pl
  Subject: Re: [SQL] Autogenerated Unique Index
  In-Reply-To: <38C53251.DF6715B8@lsil.com>
  References: <Pine.LNX.4.20.0003071730140.25971-100000@tserv.realtor3d.odessa.ua> <38C53251.DF6715B8@lsil.com>

* 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