Re: PRIMARY KEY and UNIQUE

From: Andrew Gould <andrewgould(at)yahoo(dot)com>
To: Liam DeMasi <ldemasi(at)acsinc-nj(dot)com>, ambre(at)ebutec(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: PRIMARY KEY and UNIQUE
Date: 2002-02-14 17:00:20
Message-ID: 20020214170020.83514.qmail@web13409.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I just tried it; and you are correct. I must be
confusing my database applications.

Andrew

--- Liam DeMasi <ldemasi(at)acsinc-nj(dot)com> wrote:
> Andrew,
>
> I thought that just by declaring the field the
> Primary Key makes it
> automatically NOT NULL and UNIQUE?
> Am I wrong?
>
> Liam
>
> >-----Original Message-----
> >From: pgsql-general-owner(at)postgresql(dot)org
> >[mailto:pgsql-general-owner(at)postgresql(dot)org]On
> Behalf Of Andrew Gould
> >Sent: Thursday, February 14, 2002 10:31 AM
> >To: ambre(at)ebutec(dot)com; pgsql-general(at)postgresql(dot)org
> >Subject: Re: [GENERAL] PRIMARY KEY and UNIQUE
> >
> >
> >--- Erwin Ambrosch <ambre(at)ebutec(dot)com> wrote:
> >> Hi,
> >>
> >> I have a such a table.
> >>
> >> CREATE TABLE int_article (
> >> name VARCHAR(12) UNIQUE
> >> headline TEXT,
> >> summary TEXT,
> >> main TEXT,
> >> footer TEXT,
> >> PRIMARY KEY (name)
> >> );
> >>
> >> Is the UNIQUE constraint neccessary, because if
> have
> >> specified the column
> >> name to be the primary key.
> >>
> >> Thanks in advance
> >> Erwin
> >
> >No; but if you eliminate 'UNIQUE', you'll need to
> >replace it with 'NOT NULL'.
> >
> >Andrew Gould
> >
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Send FREE Valentine eCards with Yahoo! Greetings!
> >http://greetings.yahoo.com
> >
> >---------------------------(end of
> >broadcast)---------------------------
> >TIP 2: you can get off all lists at once with the
> unregister command
> > (send "unregister YourEmailAddressHere" to
> >majordomo(at)postgresql(dot)org)
> >
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Hans-Juergen Schoenig 2002-02-14 17:01:31 Re: Problem with null dates in 7.2
Previous Message Heather Grace 2002-02-14 16:58:51 at time zone question in pl/pgSQL