Re: Get the offset of a tuple inside a table - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Get the offset of a tuple inside a table
Date
Msg-id AANLkTi=5YO49BCjay+E07cKFH=23_J3KA-gnO1Y7Q_p1@mail.gmail.com
Whole thread Raw
In response to Re: Get the offset of a tuple inside a table  (Pei He <hepeimail@gmail.com>)
List pgsql-hackers
On Tue, Sep 21, 2010 at 10:58 PM, Pei He <hepeimail@gmail.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


pgsql-hackers by date:

Previous
From: Stefan Kaltenbrunner
Date:
Subject: Re: snapshot generation broken
Next
From: Dennis Björklund
Date:
Subject: Documentation, window functions