pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: maxim.boguk@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17084: Wrong results of distinct node.
Date: Tue, 06 Jul 2021 11:25:30 -0400
Message-ID: <1679023.1625585130@sss.pgh.pa.us> (raw)
In-Reply-To: <17084-9f83b67ab464cc69@postgresql.org>
References: <17084-9f83b67ab464cc69@postgresql.org>

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





view thread (3+ messages)

Message-ID: <1679023.1625585130@sss.pgh.pa.us>
Permalink:  ../1679023.1625585130@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1679023.1625585130@sss.pgh.pa.us

 · 

reply

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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, maxim.boguk@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17084: Wrong results of distinct node.
  In-Reply-To: <1679023.1625585130@sss.pgh.pa.us>

* 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