Re: select where expr in - result order?

From: Doug McNaught <doug(at)mcnaught(dot)org>
To: "Andy Kriger" <akriger(at)greaterthanone(dot)com>
Cc: "Pgsql-General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: select where expr in - result order?
Date: 2002-11-19 23:20:01
Message-ID: m3ptt1jgf2.fsf@varsoon.wireboard.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Andy Kriger" <akriger(at)greaterthanone(dot)com> writes:

> Is there any way to guarantee that the when using
> SELECT * FROM tbl WHERE expr IN (scalar[,...])
> the results are returned in the same order as the scalar list?
>
> I realize I can do this by sorting the scalar list and using ORDER BY expr,
> but I'd like to not count on a sorted list of scalars if at all possible.

Nope, I'm pretty sure ORDER BY is the only way to do this. SQL
queries don't in general guarantee any ordering unless an ORDER BY
clause is used.

-Doug

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Magnus 2002-11-20 00:23:32 Re: Getting a list of tables in a database with Perl
Previous Message Craig H. Anderson 2002-11-19 23:13:37 ssh tunnel problem