summaryrefslogtreecommitdiffstats
path: root/src/backend/parser/analyze.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/parser/analyze.c')
-rw-r--r--src/backend/parser/analyze.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index 7a1dfb6..aad46fe 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -1072,17 +1072,28 @@ transformInsertRow(ParseState *pstate, List *exprlist,
if (strip_indirection)
{
+ /*
+ * We need to remove top-level FieldStores and SubscriptingRefs,
+ * as well as any CoerceToDomain appearing above one of those ---
+ * but not a CoerceToDomain that isn't above one of those.
+ */
while (expr)
{
- if (IsA(expr, FieldStore))
+ Expr *subexpr = expr;
+
+ while (IsA(subexpr, CoerceToDomain))
+ {
+ subexpr = ((CoerceToDomain *) subexpr)->arg;
+ }
+ if (IsA(subexpr, FieldStore))
{
- FieldStore *fstore = (FieldStore *) expr;
+ FieldStore *fstore = (FieldStore *) subexpr;
expr = (Expr *) linitial(fstore->newvals);
}
- else if (IsA(expr, SubscriptingRef))
+ else if (IsA(subexpr, SubscriptingRef))
{
- SubscriptingRef *sbsref = (SubscriptingRef *) expr;
+ SubscriptingRef *sbsref = (SubscriptingRef *) subexpr;
if (sbsref->refassgnexpr == NULL)
break;