Re: BUG #14648: counts for queries using array unnesting is incorrect

From: Sebastion Calbaza <sebastian(dot)calbaza(at)hgdata(dot)com>
To:
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14648: counts for queries using array unnesting is incorrect
Date: 2017-05-12 14:55:56
Message-ID: CAHTsN0eawXJ1XvzekGHfk7jCSX-G9-WfXKM4VpyWDTkMmAob1g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> sebastian(dot)calbaza(at)hgdata(dot)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
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2017-05-12 15:46:04 Re: BUG #14648: counts for queries using array unnesting is incorrect
Previous Message Peter Eisentraut 2017-05-12 14:35:56 Re: [HACKERS] Concurrent ALTER SEQUENCE RESTART Regression