Re: Useless code in ExecInitModifyTable

From: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Useless code in ExecInitModifyTable
Date: 2017-09-04 10:05:38
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 2017/06/21 17:57, Amit Langote wrote:
> On 2017/06/21 16:59, Etsuro Fujita wrote:
>> Commit d3cc37f1d801a6b5cad9bf179274a8d767f1ee50 added this to
>> ExecInitModifyTable:
>> + /* The root table RT index is at the head of the partitioned_rels list */
>> + if (node->partitioned_rels)
>> + {
>> + Index root_rti;
>> + Oid root_oid;
>> +
>> + root_rti = linitial_int(node->partitioned_rels);
>> + root_oid = getrelid(root_rti, estate->es_range_table);
>> + rel = heap_open(root_oid, NoLock); /* locked by InitPlan */
>> + }
>> but I noticed that that function doesn't use the relation descriptor at
>> all. Since partitioned_rels is given in case of an UPDATE/DELETE on a
>> partitioned table, the relation is opened in that case, but the relation
>> descriptor isn't referenced at all in initializing WITH CHECK OPTION
>> constraints and/or RETURNING projections. (The mtstate->resultRelinfo
>> array is referenced in those initialization, instead.) So, I'd like to
>> propose to remove this from that function. Attached is a patch for that.
> Thanks for cleaning that up. I cannot see any problem in applying the patch.

I noticed that the patch needs to be rebased. Updated patch attached.

Thanks for the review!

Best regards,
Etsuro Fujita

Attachment Content-Type Size
clean-nodeModifyTable-v2.patch text/plain 1.7 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2017-09-04 10:18:27 Re: dropping partitioned tables without CASCADE
Previous Message Alvaro Herrera 2017-09-04 10:03:57 Re: Re: [COMMITTERS] pgsql: pg_rewind: Fix some problems when copying files >2GB.