pgsql-bugs@postgresql.org writes:
> I get into a situation, in which I think it is a bug in either psql or
> the database. I have experienced that when I ran two queries in psql,
> which are equivalent, I received two different results
Does EXPLAIN show that the failing query has a Merge Join directly
underneath another Merge Join? If so, this is a known bug. It's
fixed in 7.0.3.
regards, tom lane