Re: UPDATE of partition key

From: Amit Khandekar <amitdkhan(dot)pg(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: UPDATE of partition key
Date: 2017-05-24 10:47:51
Message-ID: CAJ3gD9d1_ywrLxYOin-aijo5xOPvd6QdO6AXZu0qUatErwSTGA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12 May 2017 at 09:27, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> + is_partitioned_table =
> + root_rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE;
> +
> + if (is_partitioned_table)
> + ExecSetupPartitionTupleRouting(
> + root_rel,
> + /* Build WITH CHECK OPTION constraints for leaf partitions */
> + ExecInitPartitionWithCheckOptions(mtstate, root_rel);
> + /* Build a projection for each leaf partition rel. */
> + ExecInitPartitionReturningProjection(mtstate, root_rel);
> ..
> + /* It's not a partitioned table after all; error out. */
> + ExecPartitionCheckEmitError(resultRelInfo, slot, estate);
>
> When we are anyway going to give error if table is not a partitioned
> table, then isn't it better to give it early when we first identify
> that.

Yeah that's right, fixed. Moved the partitioned table check early.
This also showed that there is no need for is_partitioned_table
variable. Accordingly adjusted the code.

> -
> +static void ExecInitPartitionWithCheckOptions(ModifyTableState *mtstate,
> + Relation root_rel);
> Spurious line delete.

Done.

Also rebased the patch over latest code.

Attached v8 patch.

Attachment Content-Type Size
update-partition-key_v8.patch application/octet-stream 32.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-05-24 10:57:08 Re: [HACKERS] Concurrent ALTER SEQUENCE RESTART Regression
Previous Message tushar 2017-05-24 10:33:19 server closed the connection message in the log file of standby while performing logical replication synchronization