Re: [Patch] Omit virtual generated columns from test_decoding output

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com>, Euler Taveira <euler(at)eulerto(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [Patch] Omit virtual generated columns from test_decoding output
Date: 2026-08-18 00:00:00
Message-ID: CALj2ACWZVDOpiTcJ=JZmYnCym_1NQ41QiFMZYQiySNO4vS6vyA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Mon, Aug 17, 2026 at 2:54 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>
> I agree with the proposed change. It's quite confusing to distinguish
> between a genuine NULL value and a NULL value in a virtual generated
> column, as Bharath mentioned.
>
> Here are some review comments:

Thanks for reviewing.

> +-- Check that virtual generated columns are omitted from the output (their
> +-- values are not stored on disk so heap_getattr() would otherwise emit a
> +-- wrong NULL), while stored generated columns are emitted normally.
>
> How about rewriting it to:
>
> +-- Virtual generated columns are always stored as null in the tuple, so they
> +-- are not printed at all; a printed null would not be distinguishable from a
> +-- column that really contains a null. Stored generated columns are printed
> +-- as usual.

Looks better. Used that.

> A similar change would be required to the comments in test_decoding.c.

Changed.

> ---
> +-- table with only virtual generated columns alongside the key
> +CREATE TABLE gtest2 (
> + a int PRIMARY KEY,
> + b int GENERATED ALWAYS AS (a + 1) VIRTUAL,
> + c text GENERATED ALWAYS AS ('row-' || a::text) VIRTUAL
> +);
> +INSERT INTO gtest2 (a) VALUES (10), (20);
> +SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL,
> NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
>
> I don't think this test is needed as it doesn't improve test coverages.

Makes sense. I added a null column to the one test that we are left with.

> ---
> As for backpatching, IIUC it's not a correctness bug nor causes a
> server crash or data corruption. Given it might affect the existing
> consumers using test_decoding, I think it should be only for HEAD.

Agreed.

Please have a look at the v5 patch.

--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v5-0001-Omit-virtual-generated-columns-from-test_decoding.patch application/octet-stream 5.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-08-18 00:17:15 Re: Optimize UUID parse using SIMD
Previous Message Bharath Rupireddy 2026-08-17 23:45:00 Re: Optimize UUID parse using SIMD