mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
Resolve partition strategy during early parsing
This has little practical value, but there's no reason to let the partition strategy names travel through DDL as strings. Reviewed-by: Japin Li <japinli@hotmail.com> Discussion: https://postgr.es/m/20221021093216.ffupd7epy2mytkux@alvherre.pgsql
This commit is contained in:
6
src/backend/utils/cache/partcache.c
vendored
6
src/backend/utils/cache/partcache.c
vendored
@ -115,6 +115,12 @@ RelationBuildPartitionKey(Relation relation)
|
||||
key->strategy = form->partstrat;
|
||||
key->partnatts = form->partnatts;
|
||||
|
||||
/* Validate partition strategy code */
|
||||
if (key->strategy != PARTITION_STRATEGY_LIST &&
|
||||
key->strategy != PARTITION_STRATEGY_RANGE &&
|
||||
key->strategy != PARTITION_STRATEGY_HASH)
|
||||
elog(ERROR, "invalid partition strategy \"%c\"", key->strategy);
|
||||
|
||||
/*
|
||||
* We can rely on the first variable-length attribute being mapped to the
|
||||
* relevant field of the catalog's C struct, because all previous
|
||||
|
Reference in New Issue
Block a user