From: Sebastion Calbaza <sebastian.calbaza@hgdata.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: BUG #14648: counts for queries using array unnesting is incorrect
Date: Fri, 12 May 2017 17:55:56 +0300
Message-ID: <CAHTsN0eawXJ1XvzekGHfk7jCSX-G9-WfXKM4VpyWDTkMmAob1g@mail.gmail.com> (raw)
In-Reply-To: <18166.1494598847@sss.pgh.pa.us>
References: <20170512130033.1796.93117@wrigleys.postgresql.org>
<18166.1494598847@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Thanks for replying.... I know it's complicated to follow it (even if
formatted ) , but probably I did not emphasize enough that by using
unnest(ids) in the second query, the distinct count for company is not
computed correctly anymore.
Focusing on the used select clauses is important, they are just distinct
counts, it would have been logical to stay the same for both queries,
ignoring the unnest(ids)(the data set is in the milions of rows so you need
to take my word that the first query return the correct values :) ).
Anyway, will try to test it with latest version, also will try to provide
some sql test case for this, but again... There surely is an issue with the
unnesting arrays (at least in the relase that I'm using)
Seb
On Fri, May 12, 2017 at 5:20 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> sebastian.calbaza@hgdata.com writes:
> > Below is a query that we are using to calculate some counts:
> > * first version of the query lacks ```unnest(ids) as id,```, but
> second
> > one has it
> > * ```companies``` count value is incorrect for the second one, first
> > query has the correct value
>
> My first suggestion would be to see if updating to 9.6.3 fixes it.
> If not, please try to create a self-contained test case. These
> queries are unreadable, and without the underlying data, nobody
> else can even tell whether the answers are wrong or not.
>
> https://wiki.postgresql.org/wiki/Guide_to_reporting_problems
>
> regards, tom lane
>
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: sebastian.calbaza@hgdata.com
Subject: Re: BUG #14648: counts for queries using array unnesting is incorrect
In-Reply-To: <CAHTsN0eawXJ1XvzekGHfk7jCSX-G9-WfXKM4VpyWDTkMmAob1g@mail.gmail.com>
References: <20170512130033.1796.93117@wrigleys.postgresql.org> <18166.1494598847@sss.pgh.pa.us> <CAHTsN0eawXJ1XvzekGHfk7jCSX-G9-WfXKM4VpyWDTkMmAob1g@mail.gmail.com>
* 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