From a26c9da0edb229091e3b3f9eb0c62cd62c50f7be Mon Sep 17 00:00:00 2001 From: Jingtang Zhang Date: Fri, 8 Sep 2023 11:42:07 +0800 Subject: [PATCH] Remove redundant assignment in copyfrom There is redundant assignment of tuple descriptor and number of attributes in BeginCopyFrom, which I believe is involved due to COPY refactor in c532d15. --- src/backend/commands/copyfrom.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/backend/commands/copyfrom.c b/src/backend/commands/copyfrom.c index b47cb5c66d..8597021d10 100644 --- a/src/backend/commands/copyfrom.c +++ b/src/backend/commands/copyfrom.c @@ -1383,14 +1383,13 @@ BeginCopyFrom(ParseState *pstate, cstate->rel = rel; tupDesc = RelationGetDescr(cstate->rel); + num_phys_attrs = tupDesc->natts; /* process common options or initialization */ /* Generate or convert list of attributes to process */ cstate->attnumlist = CopyGetAttnums(tupDesc, cstate->rel, attnamelist); - num_phys_attrs = tupDesc->natts; - /* Convert FORCE_NOT_NULL name list to per-column flags, check validity */ cstate->opts.force_notnull_flags = (bool *) palloc0(num_phys_attrs * sizeof(bool)); if (cstate->opts.force_notnull) @@ -1533,8 +1532,6 @@ BeginCopyFrom(ParseState *pstate, cstate->rteperminfos = pstate->p_rteperminfos; } - tupDesc = RelationGetDescr(cstate->rel); - num_phys_attrs = tupDesc->natts; num_defaults = 0; volatile_defexprs = false; -- 2.39.2 (Apple Git-143)