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

From Tom Lane
Subject Re: BUG #5053: domain constraints still leak
Date
Msg-id 29541.1252895316@sss.pgh.pa.us
Whole thread Raw
In response to BUG #5053: domain constraints still leak  ("Andrew Gierth" <andrew@tao11.riddles.org.uk>)
Responses Re: BUG #5053: domain constraints still leak  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-bugs
"Andrew Gierth" <andrew@tao11.riddles.org.uk> writes:
> Domain NOT NULL constraints (and probably other constraints too) aren't
> being enforced in some code paths. e.g.

The example you give seems to tie really closely into the debate about
whether a composite null is identically the same thing as ROW(NULL,NULL)
or not.  In short, we have

regression=# create domain tstdom as integer not null;
CREATE DOMAIN
regression=# create table test (a tstdom);
CREATE TABLE
regression=# select null::test;
 test
------

(1 row)

regression=# select row(null)::test;
ERROR:  domain tstdom does not allow null values

It's possible to argue that in the first form, there isn't any tstdom
column there at all, so no constraint violation.  So I guess this is
a case that we need to think about while debating the what-is-a-null
question.

            regards, tom lane

PS: of course, domain not null constraints are horribly broken and
impossible to make behave sanely anyhow ...

pgsql-bugs by date:

Previous
From: "Andrew Gierth"
Date:
Subject: BUG #5053: domain constraints still leak
Next
From: "Yujin"
Date:
Subject: BUG #5054: PDO -> Query returns "" from Boolean type field, if it has false value.