Re: Is this a buggy behavior?

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: Thiemo Kellner <thiemo(at)gelassene-pferde(dot)biz>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Is this a buggy behavior?
Date: 2024-03-25 13:48:10
Message-ID: 72EB494A-3644-4B0B-A18B-2672D5842AF5@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On Mar 25, 2024, at 02:50, Thiemo Kellner <thiemo(at)gelassene-pferde(dot)biz> wrote:
> My bad. I was under the impression that the create table statement was an atomic process/transaction with all its bells and whistles for constraints and keys, instead of a succession of alter statements.

That may be a bit judgmental. :-) It's not a series of ALTER statements, really. The basic issue is that the parser throws away a bare NULL very early in the process, so it is not available to consult at the point that PostgreSQL is creating the constraint. The underlying implementation of the actual table creation isn't the issue here.

There seems to be general consensus that:

1. It would be handy to have a warning in the particular case that NULL is specified, however,
2. It would be undesirable to have a warning in the case where no NULL at all is specified, which means,
3. The presence of an existing bare NULL would have to be retained through the whole process, which is,
4. Not trivial.

The reason the SQL standard is relevant here is that if bare NULL were part of the standard, that would be an argument for taking the pains. Since it's not, it's not clear that doing the work to add the warning is worth the effort.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christophe Pettus 2024-03-25 13:54:30 No warning for a no-op REVOKE
Previous Message Merlin Moncure 2024-03-25 13:44:11 Re: PostgreSQL as advanced job queuing system