Re: Is this a buggy behavior?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thiemo Kellner <thiemo(at)gelassene-pferde(dot)biz>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Is this a buggy behavior?
Date: 2024-03-24 15:17:11
Message-ID: 2005111.1711293431@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thiemo Kellner <thiemo(at)gelassene-pferde(dot)biz> writes:
> Am 24.03.2024 um 15:54 schrieb Erik Wienhold:
>> This is required by the SQL standard: columns of a primary key must be
>> NOT NULL. Postgres automatically adds the missing NOT NULL constraints
>> when defining a primary key. You can verify that with \d test1 in psql.

> To me, this behaviour, while correct, is not too concise. I wished, that
> PG issued a warning about a definition conflict. In PostgreSQL, a PK
> must always be not nullable, so explicitly defining on of a PK's columns
> as nullable is contradictory, one should get notified of.

To do that, we'd have to remember that you'd said NULL, which we
don't: the word is just discarded as a noise clause. Considering
that this usage of NULL isn't even permitted by the SQL standard,
that seems like a bit too much work.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thiemo Kellner 2024-03-24 15:28:22 Re: Is this a buggy behavior?
Previous Message Thiemo Kellner 2024-03-24 14:59:46 Re: Is this a buggy behavior?