Re: Selecting pairs of numbers

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: 'Charles Clavadetscher *EXTERN*' <clavadetscher(at)swisspug(dot)org>, "'Adrian Klaver'" <adrian(dot)klaver(at)aklaver(dot)com>, "rod(at)iol(dot)ie" <rod(at)iol(dot)ie>, 'PostgreSQL' <pgsql-general(at)postgresql(dot)org>
Subject: Re: Selecting pairs of numbers
Date: 2015-10-06 07:33:43
Message-ID: A737B7A37273E048B164557ADEF4A58B50FB371E@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Charles Clavadetscher wrote:
>> aklaver(at)test=> create table pr_test(x int, y int);
>>
>> aklaver(at)test=> select * from pr_test where (x, y) between (1, 3) and
>> (3,2) order by x,y;
>> x | y
>> ---+---
>> 1 | 3
>> 1 | 4
>> 2 | 1
>> 2 | 2
>> 2 | 3
>> 2 | 4
>> 3 | 1
>> 3 | 2
>
> +1, nice.

And the really cool thing about it is that it will work well
with a combined index on (x, y).

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve Pritchard 2015-10-06 09:38:25 Recording exceptions within function (autonomous transactions?)
Previous Message Craig Ringer 2015-10-06 05:35:33 Re: BDR Rejoin of failed node, hangs.