Re: [BUGS] 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: sam(at)samason(dot)me(dot)uk (Sam Mason), pgsql-hackers(at)postgresql(dot)org
Subject: Re: [BUGS] BUG #5053: domain constraints still leak
Date: 2009-09-15 14:05:23
Message-ID: 3625.1253023523@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:
> "Sam" == Sam Mason <sam(at)samason(dot)me(dot)uk> writes:
> Sam> The NOT NULL constraint feels wrong as well, what are the
> Sam> semantics of:

> Sam> CREATE DOMAIN d AS INTEGER NOT NULL;
> Sam> SELECT a.n AS aa, b.n AS bb
> Sam> FROM (VALUES (CAST(1 AS d)),(2)) a(n)
> Sam> LEFT JOIN (VALUES (CAST(1 AS d))) b(n) ON a.n = b.n;

> Sam> in the presence of it? I'm expecting aa and bb both to come out
> Sam> as domain "d", but this shouldn't work with what you're saying
> Sam> the current semantics should be.

> I think that's just another example of Tom's initial comment about how
> broken domain "not null" constraints are currently.

Well, the LEFT JOIN case is exactly why I feel that domain not-null
constraints are inherently broken. The only clean way around it is to
decree that the output of a left join is not of the domain type after
all, but of its base type. Which seems to me to be one side effect of
the wording in 4.17.4, though they are extending it to *all* evaluation
contexts not only outer joins.

I haven't yet read the additional material you guys found ...

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Sam Mason 2009-09-15 14:19:42 Re: [BUGS] BUG #5053: domain constraints still leak
Previous Message Andrew Gierth 2009-09-15 13:54:18 Re: [BUGS] BUG #5053: domain constraints still leak

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2009-09-15 14:08:35 Re: CommitFest 2009-09: Now In Progress
Previous Message Brendan Jurd 2009-09-15 13:54:51 Re: CommitFest 2009-09: Now In Progress