Re: Suspicious redundant assignment in COPY FROM

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Jingtang Zhang <mrdrivingduck(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Suspicious redundant assignment in COPY FROM
Date: 2023-09-08 05:41:54
Message-ID: ZPq0Iqg3j9D3wWvc@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 08, 2023 at 12:23:17PM +0800, Jingtang Zhang wrote:
> Hi all, I was reading code of COPY FROM and I found some suspicious
> redundant assignment for tuple descriptor and number of attributes. Is
> it a behavior on purpose, or an accidently involved by the refactor in
> c532d15? Patch is attached.

This looks like a copy-pasto to me, as the tuple descriptor coming
from the relation is just used for sanity checks on the attributes
depending on the options by the caller for the COPY.

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.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2023-09-08 05:45:59 Re: Eager page freeze criteria clarification
Previous Message Andres Freund 2023-09-08 05:36:34 Re: Eager page freeze criteria clarification