Re: [BUGS] BUG #14648: counts for queries using array unnesting is incorrect - Mailing list pgsql-bugs

From Sebastion Calbaza
Subject Re: [BUGS] BUG #14648: counts for queries using array unnesting is incorrect
Date
Msg-id CAHTsN0eawXJ1XvzekGHfk7jCSX-G9-WfXKM4VpyWDTkMmAob1g@mail.gmail.com
Whole thread Raw
In response to Re: [BUGS] BUG #14648: counts for queries using array unnesting is incorrect  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [BUGS] BUG #14648: counts for queries using array unnesting is incorrect  ("David G. Johnston" <david.g.johnston@gmail.com>)
List 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@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

pgsql-bugs by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] [BUGS] Concurrent ALTER SEQUENCE RESTART Regression
Next
From: "David G. Johnston"
Date:
Subject: Re: [BUGS] BUG #14648: counts for queries using array unnesting is incorrect