pg.ddx.io pgsql-general@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Christophe Pettus <xof@thebuild.com>
To: Thiemo Kellner <thiemo@gelassene-pferde.biz>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Is this a buggy behavior?
Date: Sun, 24 Mar 2024 09:15:55 -0700
Message-ID: <879037EC-39F7-49E8-A6D7-0FFD3EC2BA0A@thebuild.com> (raw)
In-Reply-To: <582a40a4-ac92-4247-8cea-bae9f2da5c73@aklaver.com>
References: <CAD=mzVV6SKgj0-vO2+vx2x3qHXDw6ZCSCkm3EnAKpwkOPjUgrA@mail.gmail.com>
<yv3w7fykxqfqyio2mwentwipoojror5ebwhthpw4xfoiwaxikj@jri3ds4u7xfr>
<51eb3063-1d90-40c6-a8c6-9a77fe105a61@gelassene-pferde.biz>
<2005111.1711293431@sss.pgh.pa.us>
<eba267a8-7945-4754-bee5-6113cac477fc@gelassene-pferde.biz>
<582a40a4-ac92-4247-8cea-bae9f2da5c73@aklaver.com>
On 3/24/24 08:28, Thiemo Kellner wrote:
> Sure, my example has lots more side effect than silently do the right thing.
I think the point is that it's not really doing anything "silently." You are asking for a PRIMARY KEY constraint on a column, and it's giving it to you. One of the effects (not even really a side-effect) of that request is that the column is then declared NOT NULL.
The reason it doesn't give you a warning is that by the time it would be in a position to, it's forgotten that you explicitly said NULL. It does see that the column in nullable, but that in itself isn't worth emitting a warning over, since you are explicitly telling it that now the column shouldn't be null. It wouldn't make much more sense to emit a warning there than it would be in this situation:
CREATE TABLE t (i int NULL);
ALTER TABLE t ALTER i SET NOT NULL;
--
Adrian Klaver
adrian.klaver@aklaver.com
view thread (26+ messages) latest in thread
Message-ID: <879037EC-39F7-49E8-A6D7-0FFD3EC2BA0A@thebuild.com> Permalink: ../879037EC-39F7-49E8-A6D7-0FFD3EC2BA0A@thebuild.com/ Also on: postgresql.org/message-id/879037EC-39F7-49E8-A6D7-0FFD3EC2BA0A@thebuild.com ·
reply
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Reply to all the recipients from your mail client; the link fills in the headers below: reply via email Some clients, webmail especially, drop In-Reply-To and References from a link, and the reply then starts a new thread: use the mbox below. To: pgsql-general@postgresql.org Cc: xof@thebuild.com, thiemo@gelassene-pferde.biz Subject: Re: Is this a buggy behavior? In-Reply-To: <879037EC-39F7-49E8-A6D7-0FFD3EC2BA0A@thebuild.com> References: <CAD=mzVV6SKgj0-vO2+vx2x3qHXDw6ZCSCkm3EnAKpwkOPjUgrA@mail.gmail.com> <yv3w7fykxqfqyio2mwentwipoojror5ebwhthpw4xfoiwaxikj@jri3ds4u7xfr> <51eb3063-1d90-40c6-a8c6-9a77fe105a61@gelassene-pferde.biz> <2005111.1711293431@sss.pgh.pa.us> <eba267a8-7945-4754-bee5-6113cac477fc@gelassene-pferde.biz> <582a40a4-ac92-4247-8cea-bae9f2da5c73@aklaver.com> <879037EC-39F7-49E8-A6D7-0FFD3EC2BA0A@thebuild.com> * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox