aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/functions.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2020-04-14 17:30:13 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2020-04-14 17:30:36 -0400
commit2d59643dbccaf73bc1f90875ea02dcad641379cd (patch)
tree6e7f3825a1532e50708ac693e1066e9f5ad0e5ab /src/backend/executor/functions.c
parent0516f94d18c57cc5dce72ff8fb84a05d24a67063 (diff)
downloadpostgresql-2d59643dbccaf73bc1f90875ea02dcad641379cd.tar.gz
postgresql-2d59643dbccaf73bc1f90875ea02dcad641379cd.zip
Account for collation when coercing the output of a SQL function.
Commit 913bbd88d overlooked that the result of coerce_to_target_type might need collation fixups. Per report from Andreas Joseph Krogh. Discussion: https://postgr.es/m/VisenaEmail.72.37d08ec2b8cb8fb5.17179940cd3@tc7-visena
Diffstat (limited to 'src/backend/executor/functions.c')
-rw-r--r--src/backend/executor/functions.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index 1c387a952e3..f940f48c6da 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -24,6 +24,7 @@
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "parser/parse_coerce.h"
+#include "parser/parse_collate.h"
#include "parser/parse_func.h"
#include "storage/proc.h"
#include "tcop/utility.h"
@@ -1989,6 +1990,7 @@ coerce_fn_result_column(TargetEntry *src_tle,
-1);
if (cast_result == NULL)
return false;
+ assign_expr_collations(NULL, cast_result);
src_tle->expr = (Expr *) cast_result;
/* Make a Var referencing the possibly-modified TLE */
new_tle_expr = (Expr *) makeVarFromTargetEntry(1, src_tle);
@@ -2007,6 +2009,7 @@ coerce_fn_result_column(TargetEntry *src_tle,
-1);
if (cast_result == NULL)
return false;
+ assign_expr_collations(NULL, cast_result);
/* Did the coercion actually do anything? */
if (cast_result != (Node *) var)
*upper_tlist_nontrivial = true;