Re: Virtual generated columns

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: Richard Guo <guofenglinux(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Zhang Mingli <zmlpostgres(at)gmail(dot)com>, Alexander Lakhin <exclusion(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Virtual generated columns
Date: 2025-02-21 04:43:41
Message-ID: CACJufxEFS4jfnJCnLH=C0hFFmMVw3rmMYmD47ZP32EjBNNHQhA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Feb 19, 2025 at 11:25 PM Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)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 Content-Type Size
v4-0001-fix-expanding-virtual-generated-columns-with-g.no-cfbot application/octet-stream 4.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2025-02-21 04:47:59 Re: Enhance 'pg_createsubscriber' to retrieve databases automatically when no database is provided.
Previous Message Hayato Kuroda (Fujitsu) 2025-02-21 04:25:43 pg_recvlogical requires -d but not described on the documentation