aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_utilcmd.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2020-09-28 14:12:38 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2020-09-28 14:12:38 -0400
commit61a78c71a656593bf4121e624348a990ba5b91da (patch)
treeb92bc2d6dcda325611550168d48b4d07605040d1 /src/backend/parser/parse_utilcmd.c
parentf7873900f353ff210ef2ef2aa587e39196b8bf5a (diff)
downloadpostgresql-61a78c71a656593bf4121e624348a990ba5b91da.tar.gz
postgresql-61a78c71a656593bf4121e624348a990ba5b91da.zip
Assign collations in partition bound expressions.
Failure to do this can result in errors during evaluation of the bound expression, as illustrated by the new regression test. Back-patch to v12 where the ability for partition bounds to be expressions was added. Discussion: https://postgr.es/m/CAJV4CdrZ5mKuaEsRSbLf2URQ3h6iMtKD=hik8MaF5WwdmC9uZw@mail.gmail.com
Diffstat (limited to 'src/backend/parser/parse_utilcmd.c')
-rw-r--r--src/backend/parser/parse_utilcmd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c
index 7b5502a06df..6b59538b138 100644
--- a/src/backend/parser/parse_utilcmd.c
+++ b/src/backend/parser/parse_utilcmd.c
@@ -4239,7 +4239,10 @@ transformPartitionBoundValue(ParseState *pstate, Node *val,
/* Simplify the expression, in case we had a coercion */
if (!IsA(value, Const))
+ {
+ assign_expr_collations(pstate, value);
value = (Node *) expression_planner((Expr *) value);
+ }
/*
* transformExpr() should have already rejected column references,