| From: | jian he <jian(dot)universality(at)gmail(dot)com> |
|---|---|
| To: | Kirill Reshke <reshkekirill(at)gmail(dot)com> |
| Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: COPY WHERE clause generated/system column reference |
| Date: | 2025-10-28 05:28:55 |
| Message-ID: | CACJufxGM=umA-qLkCOX7nPDJ5=xuum4EnK8h3f13vztVZ8jfUA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Oct 28, 2025 at 2:02 AM Kirill Reshke <reshkekirill(at)gmail(dot)com> wrote:
>
> Small comment: in 0002:
>
> > + if (has_stored_generated)
> > + ExecComputeStoredGenerated(resultRelInfo, estate, myslot,
> > + CMD_INSERT);
>
> Should we use CMD_UTILITY here? Comment in nodes.h suggests so. Also,
> ExecComputeStoredGenerated only check for equality with CMD_UPDATE, so
> this is just a cosmetic change.
>
hi.
use CMD_UTILITY will also work as expected.
ExecComputeStoredGenerated expects the command type (cmdtype) to be either
UPDATE or INSERT.
in ExecComputeStoredGenerated, we have:
if (cmdtype == CMD_UPDATE)
else
{
if (resultRelInfo->ri_GeneratedExprsI == NULL)
ExecInitGenerated(resultRelInfo, estate, cmdtype);
/* Early exit is impossible given the prior Assert */
Assert(resultRelInfo->ri_NumGeneratedNeededI > 0);
ri_GeneratedExprs = resultRelInfo->ri_GeneratedExprsI;
}
in struct ResultRelInfo also has comments like:
/*
* Arrays of stored generated columns ExprStates for INSERT/UPDATE/MERGE.
*/
ExprState **ri_GeneratedExprsI;
ExprState **ri_GeneratedExprsU;
I think using CMD_INSERT should be fine. Also, note that below
ExecComputeStoredGenerated uses CMD_INSERT too.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Rahila Syed | 2025-10-28 05:36:06 | Re: Enhancing Memory Context Statistics Reporting |
| Previous Message | Alexander Lakhin | 2025-10-28 05:00:01 | Re: GNU/Hurd portability patches |