Re: BUG #17084: Wrong results of distinct node.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: maxim(dot)boguk(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17084: Wrong results of distinct node.
Date: 2021-07-06 15:25:30
Message-ID: 1679023.1625585130@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> During investigation of weird app behaviour I found very strange results
> with sorting/dising of some dataset.

I am not sure there is a PG bug here. Your query is doing DISTINCT
on (among other things)

> array_agg(geo_id) AS geo_ids

which is going to have results that vary depending on the unspecified
order in which the first-level aggregation is done. So you might
by luck have more or fewer distinct array values with different
plans.

If you still get unstable results after changing that to, say,

array_agg(geo_id order by geo_id) AS geo_ids

then I'd agree we need to investigate.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2021-07-06 17:56:10 Re: BUG #17061: Impossible to query the fields of the tuple created by SEARCH BREADTH FIRST BY .. SET ..
Previous Message Pantelis Theodosiou 2021-07-06 15:22:23 Re: BUG #17084: Wrong results of distinct node.