diff options
author | Robert Haas <rhaas@postgresql.org> | 2017-02-14 12:12:34 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2017-02-14 12:13:41 -0500 |
commit | e28b1156122f4d48d6f6f7a7f26381ee7af65a91 (patch) | |
tree | 347f926ed6f1525cdab3f7e0299b48250251b90a /src/backend/commands/tablecmds.c | |
parent | 8d396a0a7046438ced8d8ada6ceb7c0756e58351 (diff) | |
download | postgresql-e28b1156122f4d48d6f6f7a7f26381ee7af65a91.tar.gz postgresql-e28b1156122f4d48d6f6f7a7f26381ee7af65a91.zip |
Don't disallow dropping NOT NULL for a list partition key.
Range partitioning doesn't support nulls in the partitioning columns,
but list partitioning does.
Amit Langote, per a complaint from Amul Sul
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))); + } } } |