From: | "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Harald Fuchs <hari(dot)fuchs(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Is PRIMARY KEY the same as UNIQUE NOT NULL? |
Date: | 2016-01-31 17:48:11 |
Message-ID: | 56AE48DB.6000309@commandprompt.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 01/31/2016 09:02 AM, Tom Lane wrote:
> Harald Fuchs <hari(dot)fuchs(at)gmail(dot)com> writes:
>> Ben Leslie <benno(at)benno(dot)id(dot)au> writes:
>>> "Technically, PRIMARY KEY is merely a combination of UNIQUE and NOT NULL"
>>>
>>> I wanted to clarify if that was, technically, true.
>
>> Yes, but see below.
>
>>> "identifying a set of columns as primary key also provides metadata
>>> about the design of the schema, as a primary key implies that other
>>> tables can rely on this set of columns as a unique identifier for
>>> rows."
>
> Yeah. The extra metadata has several other effects. Perhaps it would be
> better to reword this sentence to make it clear that PRIMARY KEY is
> equivalent to UNIQUE+NOTNULL in terms of the data constraint that it
> enforces, without implying that there is no other difference. I'm not
> sure about a short and clear expression of that though ...
The practical implementation of a PRIMARY KEY is the equivalent to
UNIQUE+NOTNULL. However, ...
>
> regards, tom lane
>
>
--
Command Prompt, Inc. http://the.postgres.company/
+1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
From | Date | Subject | |
---|---|---|---|
Next Message | Sachin Jain | 2016-01-31 18:34:58 | Re: BDR replication on Postgresql 9.5.0 |
Previous Message | Bill Moran | 2016-01-31 17:17:00 | Re: Is PRIMARY KEY the same as UNIQUE NOT NULL? |