Re: test aggregate functions without a dummy table - Mailing list pgsql-general

From Tom Lane
Subject Re: test aggregate functions without a dummy table
Date
Msg-id 16088.1213971068@sss.pgh.pa.us
Whole thread Raw
In response to test aggregate functions without a dummy table  ("Willy-Bas Loos" <willybas@gmail.com>)
Responses Re: test aggregate functions without a dummy table  (Michael Fuhr <mike@fuhr.org>)
List 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 by date:

Previous
From: Bill Moran
Date:
Subject: Re: Connection to second database on server
Next
From: "Scott Marlowe"
Date:
Subject: Re: Connection to second database on server