Re: strange IS NULL behaviour

Поиск
Список
Период
Сортировка
Искать
От
Merlin Moncure
Тема
Re: strange IS NULL behaviour
Дата
Msg-id
CAHyXU0z+uegE3nu_vaZCas4YYpwrL9YJeckemwbzbHdoGOO70g@mail.gmail.com
Ответ на
Список
Дерево обсуждения
WIP json generation enhancements Andrew Dunstan <andrew@dunslane.net>
Re: WIP json generation enhancements Andrew Dunstan <andrew@dunslane.net>
Re: WIP json generation enhancements Peter Eisentraut <peter_e@gmx.net>
Re: WIP json generation enhancements Hannu Krosing <hannu@2ndQuadrant.com>
Re: WIP json generation enhancements Tom Lane <tgl@sss.pgh.pa.us>
Re: WIP json generation enhancements : strange IS NULL behaviour Hannu Krosing <hannu@2ndQuadrant.com>
Re: WIP json generation enhancements : strange IS NULL behaviour Tom Lane <tgl@sss.pgh.pa.us>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: strange IS NULL behaviour Tom Lane <tgl@sss.pgh.pa.us>
Re: strange IS NULL behaviour Alvaro Herrera <alvherre@2ndquadrant.com>
Re: strange IS NULL behaviour Peter Eisentraut <peter_e@gmx.net>
Re: strange IS NULL behaviour Alvaro Herrera <alvherre@2ndquadrant.com>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: strange IS NULL behaviour Tom Lane <tgl@sss.pgh.pa.us>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: strange IS NULL behaviour Tom Lane <tgl@sss.pgh.pa.us>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: strange IS NULL behaviour Tom Lane <tgl@sss.pgh.pa.us>
Re: strange IS NULL behaviour Tom Lane <tgl@sss.pgh.pa.us>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: strange IS NULL behaviour Robert Haas <robertmhaas@gmail.com>
Re: strange IS NULL behaviour Tom Lane <tgl@sss.pgh.pa.us>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: strange IS NULL behaviour Tom Lane <tgl@sss.pgh.pa.us>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: strange IS NULL behaviour Andres Freund <andres@2ndquadrant.com>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: strange IS NULL behaviour Robert Haas <robertmhaas@gmail.com>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: strange IS NULL behaviour Robert Haas <robertmhaas@gmail.com>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: strange IS NULL behaviour Kevin Grittner <kgrittn@ymail.com>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: strange IS NULL behaviour Kevin Grittner <kgrittn@ymail.com>
Re: strange IS NULL behaviour Merlin Moncure <mmoncure@gmail.com>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: strange IS NULL behaviour Merlin Moncure <mmoncure@gmail.com>
Re: strange IS NULL behaviour Merlin Moncure <mmoncure@gmail.com>
Re: strange IS NULL behaviour Bruce Momjian <bruce@momjian.us>
Re: WIP json generation enhancements Robert Haas <robertmhaas@gmail.com>
Re: WIP json generation enhancements Andrew Dunstan <andrew@dunslane.net>
Re: WIP json generation enhancements "David E. Wheeler" <david@justatheory.com>
Re: WIP json generation enhancements Robert Haas <robertmhaas@gmail.com>
Re: WIP json generation enhancements Andrew Dunstan <andrew@dunslane.net>
Re: WIP json generation enhancements Robert Haas <robertmhaas@gmail.com>
Re: WIP json generation enhancements Andrew Dunstan <andrew@dunslane.net>
Re: WIP json generation enhancements Andrew Dunstan <andrew@dunslane.net>
Re: WIP json generation enhancements Dimitri Fontaine <dimitri@2ndQuadrant.fr>
Re: WIP json generation enhancements Andrew Dunstan <andrew@dunslane.net>
Re: WIP json generation enhancements: fk-tree-to-json() Hannu Krosing <hannu@krosing.net>
Re: WIP json generation enhancements Merlin Moncure <mmoncure@gmail.com>
On Tue, Sep 10, 2013 at 8:56 AM, Bruce Momjian  wrote:
> On Tue, Sep 10, 2013 at 08:45:14AM -0400, Robert Haas wrote:
>> On Mon, Sep 9, 2013 at 3:51 PM, Bruce Momjian  wrote:
>> > The problem is that I don't believe this patch is commit-ready ---
>> > someone needs to research the IS NULL tests in all areas of our code to
>> > see if they match this patch, and I can't do that.  Is that something a
>> > reviewer is going to be willing to do?  I don't think I have ever seen a
>> > commit-fest item that still required serious research outside the patch
>> > area before committing.  I could ask just for feedback, but I have
>> > already received enough feedback to know I can't get the patch to a
>> > ready-enough state.
>>
>> OK, well then there's probably not much point.
>
> FYI, I think these queries below prove that NOT NULL constraints do not
> follow the single-depth ROW NULL inspection rule that PL/pgSQL follows,
> and that my patch was trying to promote for queries:
>
>         CREATE TABLE test2(x test NOT NULL);
>         CREATE TABLE
>         INSERT INTO test2 VALUES (null);
>         ERROR:  null value in column "x" violates not-null constraint
>         DETAIL:  Failing row contains (null).
> -->     INSERT INTO test2 VALUES (row(null));
>         INSERT 0 1
>
> So, in summary, NOT NULL constraints don't inspect into ROW values for
> NULLs, PL/pgSQL goes one level deep into ROW, and queries go two levels
> deep. I am not sure what other areas need checking.

Our composite null handling (as noted) is an absolute minefield of
issues.  Consider:

postgres=# select coalesce(row(null,null), row('no', 'bueno'));coalesce
----------(,)

postgres=# select case when row(null,null) is null then row('no', 'bueno') end;   case
------------(no,bueno)

It's just a mess.  So it bears repeating: do we or do we not want to
implement SQL standard composite null handing?  If so, you probably
have to hit all the targets.  If not, I'd either A: leave things alone
or B: remove the special case logic in IS NULL (so that it behaves as
coalesce() does) and document our divergence from the standard.  Point
being: B might actually be the best choice, but it should be
understood that we are not going in that direction before pushing
patches that go in the other direction.

merlin


В списке pgsql-hackers по дате отправления
От: Tom Lane
Дата:
Сообщение: Re: Custom Plan node
От: Pavel Stehule
Дата:
FAQ