Re: BUG #5053: domain constraints still leak - Mailing list pgsql-bugs

From Robert Haas
Subject Re: BUG #5053: domain constraints still leak
Date
Msg-id 603c8f070909211022k9126186ifac452e8c95345fb@mail.gmail.com
Whole thread Raw
In response to Re: BUG #5053: domain constraints still leak  (Bruce Momjian <bruce@momjian.us>)
List pgsql-bugs
On Mon, Sep 21, 2009 at 12:31 PM, Bruce Momjian <bruce@momjian.us> wrote:
> Sam Mason wrote:
>> On Mon, Sep 14, 2009 at 10:54:07AM -0500, Kevin Grittner wrote:
>> > Sam Mason <sam@samason.me.uk> wrote:
>> > > the deeper problem seems to be that the table was created as:
>> > >
>> > > =A0 create table test (a tstdom);
>> > >
>> > > and not as:
>> > >
>> > > =A0 create table test (a tstdom not null);
>> >
>> > Given that tstdom is declared as NOT NULL, is this difference
>> > considered a *feature* or is it an implementation quirk?
>>
>> That's why I pointed it out!
>>
>> Based on my reading of the SQL spec (and reading about Codd's
>> descriptions of domains) I'd say it was a bug/implementation quirk.
>
> Do we need a TODO for this item? =A0Also, I see this odd behavior even
> without domains:
>
> =A0 =A0 =A0 =A0test=3D> CREATE TYPE xx AS (x INT);
> =A0 =A0 =A0 =A0CREATE TYPE
> =A0 =A0 =A0 =A0test=3D> CREATE TABLE test4(col1 xx NOT NULL);
> =A0 =A0 =A0 =A0CREATE TABLE
> =A0 =A0 =A0 =A0test=3D> INSERT INTO test4 VALUES (ROW(NULL));
> =A0 =A0 =A0 =A0INSERT 0 1
> =A0 =A0 =A0 =A0test=3D> SELECT * FROM test4 WHERE col1 IS NULL;
> =A0 =A0 =A0 =A0 col1
> =A0 =A0 =A0 =A0------
> =A0 =A0 =A0 =A0 ()
> =A0 =A0 =A0 =A0(1 row)
>
> Here I am illustrating that NOT NULL and IS NULL have different ideas of
> what a NULL is? =A0That seems odd too.

I think what you're demonstrating is that there is a difference
between a NULL, and a row consisting of a single NULL.  We've had some
dispute (on this thread) about whether that ought to be the case, but
this is certainly a lot less weird and more debatable than the domain
example, at least IMO.

...Robert

pgsql-bugs by date:

Previous
From: Robert Haas
Date:
Subject: Re: BUG #5066: plperl issues with perl_destruct() and END blocks
Next
From: David Fetter
Date:
Subject: Re: BUG #5066: plperl issues with perl_destruct() and END blocks