Re: test aggregate functions without a dummy table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Willy-Bas Loos" <willybas(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: test aggregate functions without a dummy table
Date: 2008-06-20 14:11:08
Message-ID: 16088.1213971068@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Willy-Bas Loos" <willybas(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2008-06-20 14:24:01 Re: Connection to second database on server
Previous Message Bill Moran 2008-06-20 14:06:25 Re: Connection to second database on server