Re: proposal: fix corner use case of variadic fuctions usage

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: proposal: fix corner use case of variadic fuctions usage
Дата
Msg-id
21285.1358960284@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Vik Reykja <vikreykja@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Heikki Linnakangas <hlinnakangas@vmware.com>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Heikki Linnakangas <hlinnakangas@vmware.com>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Stephen Frost <sfrost@snowman.net>
Re: proposal: fix corner use case of variadic fuctions usage Tom Lane <tgl@sss.pgh.pa.us>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Stephen Frost <sfrost@snowman.net>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Tom Lane <tgl@sss.pgh.pa.us>
Re: proposal: fix corner use case of variadic fuctions usage Robert Haas <robertmhaas@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Tom Lane <tgl@sss.pgh.pa.us>
Re: proposal: fix corner use case of variadic fuctions usage Robert Haas <robertmhaas@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Tom Lane <tgl@sss.pgh.pa.us>
Re: proposal: fix corner use case of variadic fuctions usage Robert Haas <robertmhaas@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Tom Lane <tgl@sss.pgh.pa.us>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Tom Lane <tgl@sss.pgh.pa.us>
Re: proposal: fix corner use case of variadic fuctions usage Robert Haas <robertmhaas@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Tom Lane <tgl@sss.pgh.pa.us>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Craig Ringer <craig@2ndQuadrant.com>
Re: proposal: fix corner use case of variadic fuctions usage Tom Lane <tgl@sss.pgh.pa.us>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Robert Haas <robertmhaas@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Tom Lane <tgl@sss.pgh.pa.us>
Re: proposal: fix corner use case of variadic fuctions usage Robert Haas <robertmhaas@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Pavel Stehule <pavel.stehule@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Andrew Dunstan <andrew@dunslane.net>
Re: proposal: fix corner use case of variadic fuctions usage Robert Haas <robertmhaas@gmail.com>
Re: proposal: fix corner use case of variadic fuctions usage Vik Reykja <vikreykja@gmail.com>
Pavel Stehule  writes:
> next related example

> CREATE OR REPLACE FUNCTION public.myleast(VARIADIC integer[])
>  RETURNS integer
>  LANGUAGE sql
> AS $function$
> select min(v) from unnest($1) g(v)
> $function$

The reason you get a null from that is that (1) unnest() produces zero
rows out for either a null or empty-array input, and (2) min() over
zero rows produces NULL.

In a lot of cases, it's not very sane for aggregates over no rows to
produce NULL; the best-known example is that SUM() produces NULL, when
anyone who'd not suffered brain-damage from sitting on the SQL committee
would have made it return zero.  So I'm not very comfortable with
generalizing from this specific case to decide that NULL is the
universally right result.
		regards, tom lane


В списке pgsql-hackers по дате отправления
От: Robert Haas
Дата:
От: Andrew Dunstan
Дата:
FAQ