mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
Allow whole-row Vars to be used in partitioning expressions.
In the wake of commit 5b9312378
, there's no particular reason
for this restriction (previously, it was problematic because of
the implied rowtype reference). A simple constraint on a whole-row
Var probably isn't that useful, but conceivably somebody would want
to pass one to a function that extracts a partitioning key. Besides
which, we're expending much more code to enforce the restriction than
we save by having it, since the latter quantity is now zero.
So drop the restriction.
Amit Langote
Discussion: https://postgr.es/m/CA+HiwqFUzjfj9HEsJtYWcr1SgQ_=iCAvQ=O2Sx6aQxoDu4OiHw@mail.gmail.com
This commit is contained in:
7
src/backend/utils/cache/partcache.c
vendored
7
src/backend/utils/cache/partcache.c
vendored
@ -342,7 +342,6 @@ generate_partition_qual(Relation rel)
|
||||
List *my_qual = NIL,
|
||||
*result = NIL;
|
||||
Relation parent;
|
||||
bool found_whole_row;
|
||||
|
||||
/* Guard against stack overflow due to overly deep partition tree */
|
||||
check_stack_depth();
|
||||
@ -388,11 +387,7 @@ generate_partition_qual(Relation rel)
|
||||
* in it to bear this relation's attnos. It's safe to assume varno = 1
|
||||
* here.
|
||||
*/
|
||||
result = map_partition_varattnos(result, 1, rel, parent,
|
||||
&found_whole_row);
|
||||
/* There can never be a whole-row reference here */
|
||||
if (found_whole_row)
|
||||
elog(ERROR, "unexpected whole-row reference found in partition key");
|
||||
result = map_partition_varattnos(result, 1, rel, parent);
|
||||
|
||||
/* Assert that we're not leaking any old data during assignments below */
|
||||
Assert(rel->rd_partcheckcxt == NULL);
|
||||
|
Reference in New Issue
Block a user