diff options
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r-- | src/backend/commands/tablecmds.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 37a4c4a3d6a..f33aa70da69 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -5593,18 +5593,22 @@ ATExecDropNotNull(Relation rel, const char *colName, LOCKMODE lockmode) if (rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE) { PartitionKey key = RelationGetPartitionKey(rel); - int partnatts = get_partition_natts(key), - i; - for (i = 0; i < partnatts; i++) + if (get_partition_strategy(key) == PARTITION_STRATEGY_RANGE) { - AttrNumber partattnum = get_partition_col_attnum(key, i); + int partnatts = get_partition_natts(key), + i; - if (partattnum == attnum) - ereport(ERROR, - (errcode(ERRCODE_INVALID_TABLE_DEFINITION), - errmsg("column \"%s\" is in range partition key", - colName))); + for (i = 0; i < partnatts; i++) + { + AttrNumber partattnum = get_partition_col_attnum(key, i); + + if (partattnum == attnum) + ereport(ERROR, + (errcode(ERRCODE_INVALID_TABLE_DEFINITION), + errmsg("column \"%s\" is in range partition key", + colName))); + } } } |