Re: Bug: Rule actions see wrong values for generated columns (NEW.gen reads OLD value)

Richard Guo <guofenglinux@gmail.com>

From: Richard Guo <guofenglinux@gmail.com>
To: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Peter Eisentraut <peter@eisentraut.org>
Date: 2026-04-13T02:35:52Z
Lists: pgsql-hackers
On Mon, Apr 13, 2026 at 10:59 AM SATYANARAYANA NARLAPURAM
<satyanarlapuram@gmail.com> wrote:
> NEW.<generated_coulmn> is resolved to the OLD row's value
> for update or NULL for insert cases in a DO ALSO rule action for
> generated columns.  This bug affects both stored and virtual
> generated columns. Reporting here to see if this is a known issue
> with generated columns.

I didn't find related item in open items.  This does not seem to be a
known issue.  I think we should fix it anyway.

cc-ing Peter.

- Richard



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix incorrect NEW references to generated columns in rule rewriting