Re: test aggregate functions without a dummy table

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: test aggregate functions without a dummy table
Дата
Msg-id 16088.1213971068@sss.pgh.pa.us
обсуждение исходный текст
Ответ на test aggregate functions without a dummy table  ("Willy-Bas Loos" <willybas@gmail.com>)
Ответы Re: test aggregate functions without a dummy table  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-general
"Willy-Bas Loos" <willybas@gmail.com> writes:
> I want to test the behavior of an an aggregate without creating a dummy
> table for it.
> But the code for it is horrible.
> Is there no simpler way?

> select max(foo)
> from (select 1 as foo union select 2 as foo)bar;

Perhaps VALUES?

regression=# select max(foo) from (values(1,2),(3,4),(5,6)) as v(foo,bar);
 max
-----
   5
(1 row)


            regards, tom lane

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

Предыдущее
От: Bill Moran
Дата:
Сообщение: Re: Connection to second database on server
Следующее
От: "Scott Marlowe"
Дата:
Сообщение: Re: Connection to second database on server