Re: COALESCE and NULLIF semantics

Поиск
Список
Период
Сортировка
От Sam Mason
Тема Re: COALESCE and NULLIF semantics
Дата
Msg-id 20090911173310.GR5407@samason.me.uk
обсуждение исходный текст
Ответ на Re: COALESCE and NULLIF semantics  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Ответы Re: COALESCE and NULLIF semantics  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Список pgsql-hackers
On Fri, Sep 11, 2009 at 12:26:45PM -0500, Kevin Grittner wrote:
> Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > if that weren't true then we wouldn't be arguing about whether
> > COALESCE is wrong.
>  
> Yeah, I am.  When you have queries built based on which fields on a
> QBE window are filled by a user, it's not hard to come up with a
> clause like:
>  
> AND (somedate < COALESCE(NULL, NULL) OR ...)
>  
> We solved this by modifying our framework to pass down metadata about
> the values in addition to the values themselves.

You need a *much* more invasive change to fix this.  PG's type checker
only looks one level deep when choosing what types to replace "unknown"
with; what you you want is full type-inference as it's only that which
will allow you to track back up the layers and assign consistent types
to arbitrary expressions like the above.

--  Sam  http://samason.me.uk/


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Sam Mason
Дата:
Сообщение: Re: COALESCE and NULLIF semantics
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: RfD: more powerful "any" types