On 12 February 2018 at 15:26, Alvaro Herrera <alvhe...@alvh.no-ip.org> wrote: > Hello, > > Thanks, Peter, Jesper, Amit, for reviewing the patch. Replying to > all review comments at once: >
[... v5 of patch attached ...] Hi Álvaro, attached a tiny patch (on top of yours) that silence two "variables uninitilized" warnings. also noted that if you: """ create table t1(i int) partition by hash (i); create table t1_0 partition of t1 for values with (modulus 2, remainder 0); create table t1_1 partition of t1 for values with (modulus 2, remainder 1); create unique index on t1(i); alter table t1 add primary key using index t1_i_idx ; """ the ALTER TABLE ADD PK does not recurse to partitions, which maybe is perfectly fine because i'm using USING INDEX but it feels like an oversight to me -- Jaime Casanova www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 19233b68cb..677e9cabf8 100644 *** a/src/backend/commands/tablecmds.c --- b/src/backend/commands/tablecmds.c *************** *** 14177,14183 **** AttachPartitionEnsureIndexes(Relation rel, Relation attachrel) */ for (i = 0; i < list_length(attachRelIdxs); i++) { ! Oid cldConstrOid; /* does this index have a parent? if so, can't use it */ if (has_superclass(RelationGetRelid(attachrelIdxRels[i]))) --- 14177,14183 ---- */ for (i = 0; i < list_length(attachRelIdxs); i++) { ! Oid cldConstrOid = InvalidOid; /* does this index have a parent? if so, can't use it */ if (has_superclass(RelationGetRelid(attachrelIdxRels[i]))) *************** *** 14475,14481 **** ATExecAttachPartitionIdx(List **wqueue, Relation parentIdx, RangeVar *name) int i; PartitionDesc partDesc; Oid constraintOid, ! cldConstrId; /* * If this partition already has an index attached, refuse the operation. --- 14475,14481 ---- int i; PartitionDesc partDesc; Oid constraintOid, ! cldConstrId = InvalidOid; /* * If this partition already has an index attached, refuse the operation.