File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -1140,15 +1140,17 @@ DefineIndex(Oid relationId,
1140
1140
1141
1141
if (partitioned )
1142
1142
{
1143
+ PartitionDesc partdesc ;
1144
+
1143
1145
/*
1144
1146
* Unless caller specified to skip this step (via ONLY), process each
1145
1147
* partition to make sure they all contain a corresponding index.
1146
1148
*
1147
1149
* If we're called internally (no stmt->relation), recurse always.
1148
1150
*/
1149
- if (!stmt -> relation || stmt -> relation -> inh )
1151
+ partdesc = RelationGetPartitionDesc (rel );
1152
+ if ((!stmt -> relation || stmt -> relation -> inh ) && partdesc -> nparts > 0 )
1150
1153
{
1151
- PartitionDesc partdesc = RelationGetPartitionDesc (rel );
1152
1154
int nparts = partdesc -> nparts ;
1153
1155
Oid * part_oids = palloc (sizeof (Oid ) * nparts );
1154
1156
bool invalidate_parent = false;
You can’t perform that action at this time.
0 commit comments