public inbox for [email protected]  
help / color / mirror / Atom feed
From: Jingtang Zhang <[email protected]>
To: Michael Paquier <[email protected]>
Cc: [email protected]
Subject: Re: Suspicious redundant assignment in COPY FROM
Date: Fri, 8 Sep 2023 13:54:51 +0800
Message-ID: <CAPsk3_CbXSQ5wZunkCQLrrvbX7XeTUB8iSG7tYuXxLv4B7yXNQ@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAPsk3_CrYeXUVHEiaWAYxY9BKiGvGT3AoXo_+Jm0xP_s_VmXCA@mail.gmail.com>
	<[email protected]>

Michael Paquier <[email protected]> 于2023年9月8日周五 13:42写道:

Thanks, Michael~


> The assignment of num_phys_attrs could be kept at the same place as
> on HEAD, a bit closer to the palloc0() where it is used.
>

Agreed with this principle. Patch is modified and attached.

--
Jingtang


Attachments:

  [application/octet-stream] v2-0001-Remove-redundant-assignment-in-copyfrom.patch (907B, ../CAPsk3_CbXSQ5wZunkCQLrrvbX7XeTUB8iSG7tYuXxLv4B7yXNQ@mail.gmail.com/3-v2-0001-Remove-redundant-assignment-in-copyfrom.patch)
  download | inline diff:
From 1c37980cc84af129fd9f35bb9fdaf577d36217b8 Mon Sep 17 00:00:00 2001
From: Jingtang Zhang <[email protected]>
Date: Fri, 8 Sep 2023 13:48:40 +0800
Subject: [PATCH v2] 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 | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/backend/commands/copyfrom.c b/src/backend/commands/copyfrom.c
index b47cb5c66d..70871ed819 100644
--- a/src/backend/commands/copyfrom.c
+++ b/src/backend/commands/copyfrom.c
@@ -1533,8 +1533,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)



view thread (4+ messages)

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: Suspicious redundant assignment in COPY FROM
  In-Reply-To: <CAPsk3_CbXSQ5wZunkCQLrrvbX7XeTUB8iSG7tYuXxLv4B7yXNQ@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