public inbox for [email protected]  
help / color / mirror / Atom feed
From: jian he <[email protected]>
To: Richard Guo <[email protected]>
Cc: Dean Rasheed <[email protected]>
Cc: Peter Eisentraut <[email protected]>
Cc: Zhang Mingli <[email protected]>
Cc: Alexander Lakhin <[email protected]>
Cc: pgsql-hackers <[email protected]>
Subject: Re: Virtual generated columns
Date: Mon, 24 Feb 2025 14:50:19 +0800
Message-ID: <CACJufxFCqCDMaH403R8nFjvWQ3fDXyzuypaDhBVjeB+YJHEpMw@mail.gmail.com> (raw)
In-Reply-To: <CAMbWs4-cXOHx4D_UxsRKsnqF_EvsGj25WTW8FL2RNBhyxZh-bw@mail.gmail.com>
References: <[email protected]>
	<[email protected]>
	<CAEZATCXnp5XTkUCsmfjLXVWZ7TaibWatnXDdu52J6zN3XsyZhw@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<CAEZATCX6SHevKrVfAOq+88b4Ysm4Rqq2yeO6He3N0pttEbjYag@mail.gmail.com>
	<[email protected]>
	<CAEZATCVsfdp5MQpENpbrFAAfpC2tYU7y-Q=uOG57UubGy48Gyw@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<8d6a3d4c-f630-4cf9-aced-6cead95776e5@Spark>
	<CAMbWs4-h49s0ehfSq4CnztRLSwOF79ZQUkSPzGCQLNroAG7joA@mail.gmail.com>
	<CACJufxHVsCoxhqeDV973Hny3EtgCGztDJj=KKvErexnH=2k6yQ@mail.gmail.com>
	<12d5cce9-917f-4a99-86d3-715bb3b363bb@Spark>
	<CAMbWs4_xiGiB5Oufdn62cJ=MoiS9cJWLzq=jR_7xnTO8x_oPqg@mail.gmail.com>
	<CACJufxEWnz__Bf-KhVaiisHZd-5JcRRY_xttCKLs_m2xaUJmQA@mail.gmail.com>
	<[email protected]>
	<CAEZATCUpzF0XZGVpuJ-O4WLnDWBmddSc+yMWvg6zsz_ekegfPg@mail.gmail.com>
	<CAMbWs4-JmGEBDucPw8iJ3H8hg-7TkbOqE0WTVzhJ5iyzQyP=-A@mail.gmail.com>
	<CAMbWs4_LRNGAxbQbLOrj+VMy80dUR5v2JQ9fVcre10C4KVYUDg@mail.gmail.com>
	<CAEZATCWhr=FM4X5kCPvVs-g2XEk+ceLsNtBK_zZMkqFn9vUjsw@mail.gmail.com>
	<CAEZATCWsKqCtZ=ud26-gGV3zHt-hjS4OKG43GCBhSaYUWyfKiw@mail.gmail.com>
	<CAMbWs4_Rg-F=jQ7-WfBztnVZG2i5kAUwoQv0O5GbGPzxpjDeTQ@mail.gmail.com>
	<CAEZATCV+msUomqYUc-M70epBn7WppLqiw1z=4u4yf6w4vUECiQ@mail.gmail.com>
	<CAMbWs4_DVtFfonq7eL6Ocor4apV9dBb6wOhJ5iUZPEddKc-_vg@mail.gmail.com>
	<CAMbWs4-cXOHx4D_UxsRKsnqF_EvsGj25WTW8FL2RNBhyxZh-bw@mail.gmail.com>

On Sat, Feb 22, 2025 at 11:12 PM Richard Guo <[email protected]> wrote:
>
> On Sat, Feb 22, 2025 at 11:55 PM Richard Guo <[email protected]> wrote:
> > Attached are the updated patches to fix all the mentioned issues.  I
> > plan to push them early next week after staring at the code for a bit
> > longer, barring any objections.
>
> Sign... I neglected to make the change in 0001 that a Var newnode
> compares its varlevelsup with 0 when deciding to wrap it in a
> ReturningExpr.  I made this change in 0002 though, so maybe we're good
> here.  Still, I'll fix this later.
>
i also noticed this issue...

some minor comments about v7.

         * In order to be able to cache the results, we always generate the
         * expansion with varlevelsup = 0.  The caller is responsible for
         * adjusting it if needed.
         *
        expandRTE(target_rte,
                  var->varno, 0 /* not varlevelsup */ ,
                  var->varreturningtype, var->location,
                  (var->vartype != RECORDOID),
                  &colnames, &fields);
the above comments should be put on top of ReplaceVarFromTargetList?
so people can easily catch it.
when using ReplaceVarFromTargetList,
they’ll be aware that they might need to call IncrementVarSublevelsUp
in the caller.



src/include/nodes/primnodes.h
 * ReturningExpr nodes never appear in a parsed Query --- they are only ever
 * inserted by the rewriter.
 */
typedef struct ReturningExpr
this comment needs to change?



on top of src/test/regress/sql/generated_virtual.sql, we have:
-- keep these tests aligned with generated_stored.sql

but gtest32 is only related to virtual generated column.
maybe add a comment saying gtest32 related tests do not
apply to stored generated column.






view thread (29+ 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: Virtual generated columns
  In-Reply-To: <CACJufxFCqCDMaH403R8nFjvWQ3fDXyzuypaDhBVjeB+YJHEpMw@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