Re: [HACKERS] UPDATE of partition key

From: Amit Khandekar <amitdkhan(dot)pg(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Subject: Re: [HACKERS] UPDATE of partition key
Date: 2018-01-19 09:37:14
Message-ID: CAJ3gD9cpyM1L0vTrXzrggR=t6MSZtuy_kge1kagMBi0TSKa_UQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 16 January 2018 at 16:09, Amit Khandekar <amitdkhan(dot)pg(at)gmail(dot)com> wrote:
> I have now embedded the above incremental patch changes into the main
> patch (v37) , which is attached.

The patch had to be rebased over commit dca48d145e0e :
Remove useless lookup of root partitioned rel in ExecInitModifyTable().

In ExecInitModifyTable(), "rel" variable was needed only for INSERT.
And node->partitioned_rels is only set in UPDATE/DELETE cases, so the
extra logic of getting the root partitioned rel from
node->partitioned_rels was removed as part of that commit.

But now for update-tuple-routing, we require rel for UPDATE also. So
we need to get the root partitioned rel. But, rather than opening the
root table from node->partitioned_rels, we can re-use the
already-opened mtstate->rootResultInfo. rootResultInfo is the same as
head of partitioned_rels. I have renamed getASTriggerResultRelInfo()
to getTargetResultRelInfo(), and used it to get the root partitioned
table. The rename made sense, because it has become a function for
more general use, rather than specific to triggers-related
functionality.

Attached rebased patch.

--
Thanks,
-Amit Khandekar
EnterpriseDB Corporation
The Postgres Database Company

Attachment Content-Type Size
update-partition-key_v37_rebased.patch application/octet-stream 127.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Emre Hasegeli 2018-01-19 09:38:07 Re: [HACKERS] [PATCH] Improve geometric types
Previous Message Amit Langote 2018-01-19 09:28:41 Re: [Sender Address Forgery]Re: pg_(total_)relation_size and partitioned tables