Re: Is PRIMARY KEY the same as UNIQUE NOT NULL?

From: Ben Leslie <benno(at)benno(dot)id(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Is PRIMARY KEY the same as UNIQUE NOT NULL?
Date: 2016-02-07 22:45:22
Message-ID: CABZ0LtBPbD6uWDvMOQNYyF=29NJefewHAwGfsh1iark2wHhZHw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 8 February 2016 at 08:04, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Geoff Winkless <pgsqladmin(at)geoff(dot)dj> writes:
>> On 31 January 2016 at 19:53, David G. Johnston
>> <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>>> A PRIMARY KEY enforces a UNIQUE, NOT NULL constraint and additionally allows
>> [snip]
>
>> I would just remove the whole paragraph. A primary key does what it
>> does, a unique constraint does what it does. I'm not really sure why
>> you need to link them.
>
> I think it is useful to compare them; the only problem is claiming that
> they're equivalent.
>
> I've applied some doc updates based on this discussion.
>
> http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=c477e84fe2471cb675234fce75cd6bb4bc2cf481
>
> regards, tom lane

Thanks Tom,

I think with the documentation expressed this way I don't think I
would have made the error I did originally; from my point of view it
is a welcome improvement.

Cheers,

Ben

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Holzman 2016-02-08 06:24:37 FDW and transaction management
Previous Message Augori 2016-02-07 21:35:44 Re: Trouble installing postgresql server on Amazon Linux