Re: BUG #17084: Wrong results of distinct node. - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #17084: Wrong results of distinct node.
Date
Msg-id 1679023.1625585130@sss.pgh.pa.us
Whole thread Raw
In response to BUG #17084: Wrong results of distinct node.  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
PG Bug reporting form <noreply@postgresql.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



pgsql-bugs by date:

Previous
From: Pantelis Theodosiou
Date:
Subject: Re: BUG #17084: Wrong results of distinct node.
Next
From: Peter Eisentraut
Date:
Subject: Re: BUG #17061: Impossible to query the fields of the tuple created by SEARCH BREADTH FIRST BY .. SET ..