pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Generalize ri_RootToPartitionMap to use for non-partition childr
Date: Fri, 02 Dec 2022 09:36:55 +0000
Message-ID: <E1p12TW-001gN5-8N@gemulon.postgresql.org> (raw)

Generalize ri_RootToPartitionMap to use for non-partition children

ri_RootToPartitionMap is currently only initialized for tuple routing
target partitions, though a future commit will need the ability to use
it even for the non-partition child tables, so make adjustments to the
decouple it from the partitioning code.

Also, make it lazily initialized via ExecGetRootToChildMap(), making
that function its preferred access path.  Existing third-party code
accessing it directly should no longer do so; consequently, it's been
renamed to ri_RootToChildMap, which also makes it consistent with
ri_ChildToRootMap.

ExecGetRootToChildMap() houses the logic of setting the map appropriately
depending on whether a given child relation is partition or not.

To support this, also add a separate entry point for TupleConversionMap
creation that receives an AttrMap.  No new code here, just split an
existing function in two.

Author: Amit Langote <amitlangote09@gmail.com>
Discussion: https://postgr.es/m/CA+HiwqEYUhDXSK5BTvG_xk=eaAEJCD4GS3C6uH7ybBvv+Z_Tmg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/fb958b5da86da69651f6fb9f540c2cfb1346cdc5

Modified Files
--------------
src/backend/access/common/tupconvert.c   | 19 +++++++++--
src/backend/commands/copyfrom.c          |  2 +-
src/backend/executor/execMain.c          |  8 +++--
src/backend/executor/execPartition.c     | 27 +++++----------
src/backend/executor/execUtils.c         | 57 +++++++++++++++++++++++++++-----
src/backend/executor/nodeModifyTable.c   |  2 +-
src/backend/replication/logical/worker.c |  4 +--
src/include/access/tupconvert.h          |  3 ++
src/include/executor/executor.h          |  1 +
src/include/nodes/execnodes.h            | 30 +++++++++--------
10 files changed, 104 insertions(+), 49 deletions(-)



Message-ID: <E1p12TW-001gN5-8N@gemulon.postgresql.org>
Permalink:  ../E1p12TW-001gN5-8N@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1p12TW-001gN5-8N@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: alvherre@alvh.no-ip.org
  Subject: Re: pgsql: Generalize ri_RootToPartitionMap to use for non-partition childr
  In-Reply-To: <E1p12TW-001gN5-8N@gemulon.postgresql.org>
  References: <E1p12TW-001gN5-8N@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox