CopyFrom() has become way too complicated

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-hackers(at)postgresql(dot)org, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: CopyFrom() has become way too complicated
Date: 2018-10-12 18:13:37
Message-ID: 20181012181337.b43fka3y64wlbvx4@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I've had to whack CopyFrom() around a couple times due to the pluggable
storage patch, and I found that after
commit 0d5f05cde011512e605bb2688d9b1fbb5b3ae152
Author: Peter Eisentraut <peter_e(at)gmx(dot)net>
Date: 2018-08-01 10:23:09 +0200

Allow multi-inserts during COPY into a partitioned table

and also the previous partition support changes, the CopyFrom() code
has, for me at least, become very hard to follow.

I think the code needs to be split up so that CopyFrom() in the loop
body calls CopyFromOneTuple(), which then also splits out the tuple
routing into its own CopyFromOneTupleRoute() function (that's 200 LOC on
its own...). I suspect it'd also be good to refactor the
partition-change code out into its own function.

Greetings,

Andres Freund

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-10-12 18:50:46 Re: AllocSetContextCreate changes breake extensions
Previous Message Andres Freund 2018-10-12 18:00:07 Re: Multi-insert into a partitioned table with before insert row trigger causes server crash on latest HEAD