On Wed, Nov 5, 2008 at 9:21 AM, Hemant Patel <hemant.patel@impetus.co.in> wrote:
> Let Say I have the array of primary key of some table say XYZ.
>
> For e.g. (555,222,333,111)
>
>
>
> When I query for these results I will get the result like in the order of
> (111,222,333,555) .
>
> So now I need to process in the business logic to maintain the search
> criteria.
The fact that you get results in a certain order without using an
order by clause is a happy coincidence, and not to be relied upon.
Should PostgreSQL choose a different query plan they may come back in
some other order.
I.e. you HAVE to use an order by clause if you want a certain order. period.