On 12 May 2017 at 09:27, Amit Kapila <amit.kapil...@gmail.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.
update-partition-key_v8.patch
Description: Binary data
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers