aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_target.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/parser/parse_target.c')
-rw-r--r--src/backend/parser/parse_target.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c
index 9c6c202c8e6..d56e00ffde6 100644
--- a/src/backend/parser/parse_target.c
+++ b/src/backend/parser/parse_target.c
@@ -839,18 +839,20 @@ transformAssignmentSubscripts(ParseState *pstate,
/* If target was a domain over array, need to coerce up to the domain */
if (arrayType != targetTypeId)
{
+ Oid resulttype = exprType(result);
+
result = coerce_to_target_type(pstate,
- result, exprType(result),
+ result, resulttype,
targetTypeId, targetTypMod,
COERCION_ASSIGNMENT,
COERCE_IMPLICIT_CAST,
-1);
- /* probably shouldn't fail, but check */
+ /* can fail if we had int2vector/oidvector, but not for true domains */
if (result == NULL)
ereport(ERROR,
(errcode(ERRCODE_CANNOT_COERCE),
errmsg("cannot cast type %s to %s",
- format_type_be(exprType(result)),
+ format_type_be(resulttype),
format_type_be(targetTypeId)),
parser_errposition(pstate, location)));
}