Re: BUG #5053: domain constraints still leak

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5053: domain constraints still leak
Date: 2009-09-14 15:16:23
Message-ID: 603c8f070909140816i4593838cge45c396adba777e9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Mon, Sep 14, 2009 at 10:22 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> It seems like regardless of this discussion you oughtn't to be able to
>> store a NULL into that table column.  But maybe I'm just confused.
>
> The system is relying on the not-unreasonable assumption that if it
> extracts a column of type X from someplace, what it has is a valid value
> of type X.  Depending on what we decide about the whole composite-null
> mess, maybe we will be forced to abandon that assumption ... but I'm
> sure not going to do so until my back is to the wall.

I haven't read the code in this area, but for what it's worth, I guess
I lean toward the view that treating a row of NULLs as being the same
thing as an undecorated NULL does not make very much sense. If I have
a table row which contains (1, NULL, NULL) and I update the first
column to be NULL, I feel like I now have (NULL, NULL, NULL), not just
NULL. Every other programming language I'm aware of makes this
distinction - for good reasons - and I don't really see any reason why
SQL should do anything different.

Under that view, null::test is not itself a test, but denotes the
absence of one. Trying to store this value in a table can either fail
outright (on the theory that you can't store the absence of something
in a table), or else we can - as a special case - treat assignment
from null to an actual object as a request to assign null to each
column (which will fail if there exists a column into which a NULL of
the associated column type can't be stored).

...Robert

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Sam Mason 2009-09-14 15:52:46 Re: BUG #5053: domain constraints still leak
Previous Message Sam Mason 2009-09-14 14:48:49 Re: BUG #5053: domain constraints still leak

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-09-14 15:21:06 Re: [PATCH] 8.5 plpgsql change for named notation: treat word following AS keyword as label v3
Previous Message Jeff Janes 2009-09-14 15:08:27 Re: Patch LWlocks instrumentation