public inbox for [email protected]  
help / color / mirror / Atom feed
From: Dean Rasheed <[email protected]>
To: Richard Guo <[email protected]>
Cc: Chao Li <[email protected]>
Cc: SATYANARAYANA NARLAPURAM <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Cc: Peter Eisentraut <[email protected]>
Subject: Re: Bug: Rule actions see wrong values for generated columns (NEW.gen reads OLD value)
Date: Mon, 20 Apr 2026 09:42:31 +0100
Message-ID: <CAEZATCURLESGChXr5ZweoGCGQ9dadM4Hs2eSUjBmXV3OguN4WQ@mail.gmail.com> (raw)
In-Reply-To: <CAMbWs49GX=-p_dD=2zQvHB4yfjwCttWSXg8Pz8xcZJJYAjcp1Q@mail.gmail.com>
References: <CAHg+QDexGTmCZzx=73gXkY2ZADS6LRhpnU+-8Y_QmrdTS6yUhA@mail.gmail.com>
	<CAMbWs4-SJ6B26ciFu_K_2M1ObDA=GirV87N1BKeAtSRmQGATUA@mail.gmail.com>
	<[email protected]>
	<CAMbWs48=QrLy8gZprTfCmEtzoaUku54JXvAcnoRSo+OC8vUpwA@mail.gmail.com>
	<CAEZATCWYqyJJJcMNEj-LEvCSwog2H_HS61hTROZLKYuaiy5YTg@mail.gmail.com>
	<CAMbWs49DcHqOtd_BzuFcr9Va+tD-2fNs8bGsbH_Zy2bXUTNM1g@mail.gmail.com>
	<[email protected]>
	<CAEZATCUacsV=ffircCgh+uYj7FBh4vy5mFKCAR7g=EkXuJZBng@mail.gmail.com>
	<CAMbWs48s9EVTz__xq9s0nAGeh-Z918t4VoGD+pxCXOq0mnc_7Q@mail.gmail.com>
	<CAMbWs49GX=-p_dD=2zQvHB4yfjwCttWSXg8Pz8xcZJJYAjcp1Q@mail.gmail.com>

On Mon, 20 Apr 2026 at 08:29, Richard Guo <[email protected]> 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





view thread (16+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Bug: Rule actions see wrong values for generated columns (NEW.gen reads OLD value)
  In-Reply-To: <CAEZATCURLESGChXr5ZweoGCGQ9dadM4Hs2eSUjBmXV3OguN4WQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox