Re: BUG #18430: syntax error when using aggregate function in where clause of subquery

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: eatkin(at)certusllc(dot)us, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18430: syntax error when using aggregate function in where clause of subquery
Date: 2024-04-12 18:59:30
Message-ID: CAKFQuwa7hVExSqxd18JvZqE-bA76MFUgiUQO=0uBGAZqZb-EwQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Apr 12, 2024 at 10:32 AM PG Bug reporting form <
noreply(at)postgresql(dot)org> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 18430
> Logged by: Eric Atkin
> Email address: eatkin(at)certusllc(dot)us
> PostgreSQL version: 16.2
> Operating system: Arch Linux
> Description:
>
> (SELECT count(*) FROM delivery WHERE driver_id IN array_agg(driver.id
> ))
>
>
This doesn't seem to have anything to do with scoping of inner and outer
queries. Where did you come to believe that:

scalar IN array

is a valid operator/expression.

i.e., your query fails for the same reason this one does:

select 1 in array[1,2,3];

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-04-12 19:01:50 Re: BUG #18429: Inconsistent results on similar queries with join lateral
Previous Message Eric Atkin 2024-04-12 18:35:46 Re: BUG #18430: syntax error when using aggregate function in where clause of subquery