On Wed, Feb 19, 2025 at 11:25 PM Dean Rasheed <dean.a.rash...@gmail.com> wrote: > > One of the new regression tests fails, which actually appears to be a > pre-existing grouping sets bug, due to the fact that only non-Vars are > wrapped in PHVs. This bug can be triggered without virtual generated > columns: > > CREATE TABLE t (a int, b int); > INSERT INTO t VALUES (1, 1); > > SELECT * FROM (SELECT a, a AS b FROM t) AS vt > GROUP BY GROUPING SETS (a, b) > HAVING b = 1; > > a | b > ---+--- > 1 | > (1 row) > > whereas the result should be > > a | b > ---+--- > | 1 > (1 row) > > For reference, this code dates back to 90947674fc. >
sorry for the noise. i misunderstood your message. you’ve already mentioned this problem. in struct pullup_replace_vars_context adding a field (bool wrap_vars) and setting it appropriately in function pullup_replace_vars_callback seems to solve this problem.
v4-0001-fix-expanding-virtual-generated-columns-with-g.no-cfbot
Description: Binary data