Re: BUG #18430: syntax error when using aggregate function in where clause of subquery - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #18430: syntax error when using aggregate function in where clause of subquery
Date
Msg-id CAKFQuwa7hVExSqxd18JvZqE-bA76MFUgiUQO=0uBGAZqZb-EwQ@mail.gmail.com
Whole thread Raw
In response to BUG #18430: syntax error when using aggregate function in where clause of subquery  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
On Fri, Apr 12, 2024 at 10:32 AM PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:

Bug reference:      18430
Logged by:          Eric Atkin
Email address:      eatkin@certusllc.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.

pgsql-bugs by date:

Previous
From: Eric Atkin
Date:
Subject: Re: BUG #18430: syntax error when using aggregate function in where clause of subquery
Next
From: Tom Lane
Date:
Subject: Re: BUG #18429: Inconsistent results on similar queries with join lateral