Re: BUG #5053: domain constraints still leak

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Andrew Gierth" <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5053: domain constraints still leak
Date: 2009-09-14 02:28:36
Message-ID: 29541.1252895316@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

"Andrew Gierth" <andrew(at)tao11(dot)riddles(dot)org(dot)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 ...

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Yujin 2009-09-14 09:59:47 BUG #5054: PDO -> Query returns "" from Boolean type field, if it has false value.
Previous Message Andrew Gierth 2009-09-14 02:03:53 BUG #5053: domain constraints still leak

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-09-14 02:32:44 Re: Patch for 8.5, transformationHook
Previous Message Tom Lane 2009-09-14 02:18:53 Re: [PATCH] 8.5 plpgsql change for named notation: treat word following AS keyword as label v3