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

SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>

From: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>
To: Richard Guo <guofenglinux@gmail.com>
Cc: Chao Li <li.evan.chao@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Peter Eisentraut <peter@eisentraut.org>
Date: 2026-04-13T08:42:49Z
Lists: pgsql-hackers
Hi Richard,

On Mon, Apr 13, 2026 at 1:30 AM Richard Guo <guofenglinux@gmail.com> wrote:

> On Mon, Apr 13, 2026 at 4:27 PM SATYANARAYANA NARLAPURAM
> <satyanarlapuram@gmail.com> wrote:
> > On Mon, Apr 13, 2026 at 12:21 AM Chao Li <li.evan.chao@gmail.com> wrote:
> >> Do either of you plan to propose a patch for this? If so, please go
> ahead and I can review it. Otherwise, I can propose a patch in a couple of
> days.
>
> > I have a patch with me, let me post it shortly.
>
> Please feel free to share your patches.  I've been looking into this
> as well, but I'd be happy to see independent takes on it.
>

I reviewed your patch, it looks good. I ran the tests you added and a few
additional tests and they are passing. Please continue with your patch.
Maybe a test like "WHERE NEW.b > threshold" to confirm the expansion
happens before qual evaluation would be good.

Thanks,
Satya

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