"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 ...