Using non-grouping-keys at HAVING clause

From: Kohei KaiGai <kaigai(at)heterodb(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Using non-grouping-keys at HAVING clause
Date: 2023-09-08 07:42:57
Message-ID: CAOP8fzbzmDRZj4zHb_nCGCW6YM6RhemHgwnwAK4KFPh8LXpR7g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

I got a trouble report here:
https://github.com/heterodb/pg-strom/issues/636

It says that PG-Strom raised an error when the HAVING clause used
non-grouping-keys,
even though the vanilla PostgreSQL successfully processed the query.

SELECT MAX(c0) FROM t0 GROUP BY t0.c1 HAVING t0.c0<MIN(t0.c0);

However, I'm not certain what is the right behavior here.
The "c0" column does not appear in the GROUP BY clause, thus we cannot
know its individual
values after the group-by stage, right?
So, what does the "HAVING t0.c0<MIN(t0.c0)" evaluate here?

Best regards,
--
HeteroDB, Inc / The PG-Strom Project
KaiGai Kohei <kaigai(at)heterodb(dot)com>

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2023-09-08 07:52:42 Re: CHECK Constraint Deferrable
Previous Message Ashutosh Bapat 2023-09-08 07:04:24 Re: Oversight in reparameterize_path_by_child leading to executor crash