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

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Sebastion Calbaza <sebastian(dot)calbaza(at)hgdata(dot)com>
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-15 14:51:50
Message-ID: CAKFQuwYRNvL3xR2NOm9V=9G1LRpLcAc5a=6Du-NbVkXa3UU6ow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sun, May 14, 2017 at 11:29 PM, Sebastion Calbaza <
sebastian(dot)calbaza(at)hgdata(dot)com> wrote:

> You are correct, this is how it behaves.
> For my dev mind (probably for others ) this was pretty non intuitive. In
> the end I used array_length and sum to compute the count.
>
> Still, is this the intended behaviour (I guess so from a mathematical
> point of view ?? )? If it is I can argue that is not too intuitive and
> adding a doc note near the unnest function description would be good.
>
>
Yes, its intentional, and it isn't specific to just the unnest function so
documenting it just there doesn't seem correct. I don't know where it is
documented but I suspect that even just reading the documentation for this
would be of minimal help - I think its likely best learned after
experiencing the aforementioned problem.

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2017-05-15 14:57:46 Re: BUG #14648: counts for queries using array unnesting is incorrect
Previous Message Tom Lane 2017-05-15 14:37:12 Re: Commenting a FK crashes ALTER TABLE statements