Re: Bug: Rule actions see wrong values for generated columns (NEW.gen reads OLD value)
Dean Rasheed <dean.a.rasheed@gmail.com>
From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: Richard Guo <guofenglinux@gmail.com>
Cc: Chao Li <li.evan.chao@gmail.com>, SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Peter Eisentraut <peter@eisentraut.org>
Date: 2026-04-20T08:42:31Z
Lists: pgsql-hackers
On Mon, 20 Apr 2026 at 08:29, Richard Guo <guofenglinux@gmail.com> wrote: > > I noticed a couple of issues after a further look. > > 1. The ReplaceVarsFromTargetList call on "gen_cols" fails to handle > hasSubLinks. This can cause error if targetList contains SubLinks: > > update t set a = (select max(a) from t); > ERROR: replace_rte_variables inserted a SubLink, but has noplace to record it > Doh, yes, careless copy-and-pasting. The updates look good. > 2. The same bug fixed in this patch also exists in rule quals: > > I think we should apply the same fix to CopyAndAddInvertedQual. > Agreed. > Attached v3 fixes them. > LGTM. Regards, Dean
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix incorrect NEW references to generated columns in rule rewriting
- 8e39951beac7 14.23 landed
- 7062bd577ec9 15.18 landed
- 07b257189ea4 16.14 landed
- 9d6208939a0a 17.10 landed
- e528bfe97190 18.4 landed
- c6a79be3f3c7 19 (unreleased) landed