From: Jan Bakuwel <jan.bakuwel@greenpeace.org>
To: pgsql-sql@postgresql.org
Subject: Different order by behaviour depending on where clause?
Date: Fri, 28 Oct 2011 17:53:36 +1300
Message-ID: <4EAA3550.7080609@greenpeace.org> (raw)
Hi,
I have a compound query with some grouping, having and order by's saved
as a view, say with name "myview".
A) select * from "myview" returns the results as expected in the correct
order (the order by is on fields "Category", "Year", "Month" and a few
other fields). The results are correctly ordered by these fields as
specified in the view.
B) select * from "myview" where "Year"=2011 and "Month"=1 also returns
the results as expected in the correct order (a subset of A).
however
C) select * from "myview" where "Year"=2011 and "Month" >= 1 and "Month"
<= 1 returns the same resultset as B but the order of the rows is not
correct (not even close; haven't been able to see any pattern).
Any idea how I can further analyse/diagnose this?
regards,
Jan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jan.bakuwel@greenpeace.org
Subject: Re: Different order by behaviour depending on where clause?
In-Reply-To: <4EAA3550.7080609@greenpeace.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox