public inbox for [email protected]
help / color / mirror / Atom feedFrom: Dean Rasheed <[email protected]>
To: Peter Eisentraut <[email protected]>
Cc: pgsql-hackers <[email protected]>
Cc: jian he <[email protected]>
Subject: Re: Virtual generated columns
Date: Wed, 15 Jan 2025 14:12:52 +0000
Message-ID: <CAEZATCXnp5XTkUCsmfjLXVWZ7TaibWatnXDdu52J6zN3XsyZhw@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
<CAEZATCV=RX0M58-uqSR6tFjwQAFnEcx3hvW-9ZZfRQJLg5LzRw@mail.gmail.com>
<[email protected]>
<CAEZATCU3q=znAL7X1aSxuMpjfSyB1cT5j398HPb9ix9ci_HUqA@mail.gmail.com>
<[email protected]>
<CAEZATCVLfMzNwT1J0bnvtv6YbmNSN9QSXb+1QSGyX6vK4q67Ow@mail.gmail.com>
<[email protected]>
<[email protected]>
<[email protected]>
<CAEZATCUHnmOu7RtDuP+PCtS_dqvU8hFsAYYFPdiB8gyFszj5WQ@mail.gmail.com>
<[email protected]>
<[email protected]>
<[email protected]>
<CAEZATCXQcjZPq+OsczFc13M6v+OP_NiqmUAcRAzi1K60KFuWmQ@mail.gmail.com>
<[email protected]>
On Tue, 14 Jan 2025 at 13:37, Peter Eisentraut <[email protected]> wrote:
>
> Here is a new patch with that fixed and also a few
> tweaks suggested by Jian.
>
I'm hoping to push my RETURNING OLD/NEW patch [1] soon, so I thought
that I would check how it works together with this patch. The good
news is that AFAICS everything just works, and it's possible to return
old/new virtual generated columns in DML queries as expected.
It did require a minor update, because my patch adds a new
"result_relation" argument to ReplaceVarsFromTargetList() -- needed in
DML queries because, when propagating a Var's old/new
varreturningtype, replacement Vars need to be handled differently
depending on whether or not they refer to the result relation. So that
affects expand_generated_columns_internal(), when called from
fireRIRrules(). OTOH, from expand_generated_columns_in_expr() it's OK
to just pass 0 as the result relation index, because there won't be
any old/new Vars in an expression that's not part of a DML query.
Attached is the delta patch I used to handle this, along with a couple
of simple test cases. It doesn't really matter which feature makes it
in first, but the one that comes second will need to do something like
this.
Regards,
Dean
[1] https://commitfest.postgresql.org/51/4723/
Attachments:
[application/octet-stream] virt-gen-cols-with-returning-old-new.patch.no-cfbot (5.0K, ../CAEZATCXnp5XTkUCsmfjLXVWZ7TaibWatnXDdu52J6zN3XsyZhw@mail.gmail.com/2-virt-gen-cols-with-returning-old-new.patch.no-cfbot)
download
view thread (75+ 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]
Subject: Re: Virtual generated columns
In-Reply-To: <CAEZATCXnp5XTkUCsmfjLXVWZ7TaibWatnXDdu52J6zN3XsyZhw@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