Re: Get the offset of a tuple inside a table

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Pei He <hepeimail(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Szymon Guz <mabewlun(at)gmail(dot)com>, Kevin(dot)Grittner(at)wicourts(dot)gov, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Get the offset of a tuple inside a table
Date: 2010-09-22 10:31:13
Message-ID: AANLkTi=5YO49BCjay+E07cKFH=23_J3KA-gnO1Y7Q_p1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 21, 2010 at 10:58 PM, Pei He <hepeimail(at)gmail(dot)com> wrote:
> Hi Tom,
> The bitmapset works for me.
>
> I want to implement the operator for the following query:
>
> Select * from a left join b on a.id = b.id order by b.id;
>
> In a left outer join, I want the tuples that have matches in the inner table
> appear first. So, the order by clause is need.

Why can't you just write SELECT * FROM a LEFT JOIN b ON a.id = b.id
ORDER BY b.id NULLS FIRST? "I want my query results in a different
order" is almost never something that requires modifying the source
code.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-09-22 10:35:36 Re: Compute the number of tuples in a block
Previous Message Stefan Kaltenbrunner 2010-09-22 10:28:18 Re: snapshot generation broken