Re: Virtual generated columns - Mailing list pgsql-hackers

From jian he
Subject Re: Virtual generated columns
Date
Msg-id CACJufxEFS4jfnJCnLH=C0hFFmMVw3rmMYmD47ZP32EjBNNHQhA@mail.gmail.com
Whole thread Raw
In response to Re: Virtual generated columns  (Dean Rasheed <dean.a.rasheed@gmail.com>)
List pgsql-hackers
On Wed, Feb 19, 2025 at 11:25 PM Dean Rasheed <dean.a.rasheed@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.

Attachment

pgsql-hackers by date:

Previous
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: pg_recvlogical requires -d but not described on the documentation
Next
From: Ashutosh Bapat
Date:
Subject: Re: Enhance 'pg_createsubscriber' to retrieve databases automatically when no database is provided.