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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Geoff Winkless <pgsqladmin(at)geoff(dot)dj>
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 21:04:35
Message-ID: 25592.1454879075@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Augori 2016-02-07 21:35:44 Re: Trouble installing postgresql server on Amazon Linux
Previous Message Adrian Klaver 2016-02-07 19:52:28 Re: Trouble installing postgresql server on Amazon Linux