Re: BUG #17897: Crash on assignment to array of constraint-less domain over composite type

From: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
To: exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17897: Crash on assignment to array of constraint-less domain over composite type
Date: 2023-04-15 15:17:09
Message-ID: 20230415151709.jh7ygoak2fc2msdb@erthalion.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> On Fri, Apr 14, 2023 at 07:00:01PM +0000, PG Bug reporting form wrote:
>
> The following modified excerpt from regress/sql/domain.sql:
> create type comptype as (cf1 int, cf2 int);
> create domain dcomptype as comptype;
>
> create table dcomptable (f1 dcomptype[]);
> insert into dcomptable values (null);
> update dcomptable set f1[1].cf2 = 5;
>
> causes a server crash with the following stack trace:
> [...]
> Not reproduced on REL_11_STABLE, but reproduced on REL_12_STABLE .. master
> since 04fe805a1 made a constraint-less domain represented as a RelabelType
> (not CoerceToDomain) and thus the fix for [1] (ae7b1dd59) doesn't cover
> this
> case.

Looks like it could be fixed in the same way as in ae7b1dd59 ?

diff --git a/src/backend/executor/execExpr.c b/src/backend/executor/execExpr.c
index 4c6700de04..06fbf19423 100644
--- a/src/backend/executor/execExpr.c
+++ b/src/backend/executor/execExpr.c
@@ -3253,6 +3253,12 @@ isAssignmentIndirectionExpr(Expr *expr)

return isAssignmentIndirectionExpr(cd->arg);
}
+ else if (IsA(expr, RelabelType))
+ {
+ RelabelType *rt = (RelabelType *) expr;
+
+ return isAssignmentIndirectionExpr(rt->arg);
+ }
return false;
}

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2023-04-15 15:26:04 Re: BUG #17897: Crash on assignment to array of constraint-less domain over composite type
Previous Message Tom Lane 2023-04-15 14:45:42 Re: BUG #17896: xmlagg exponentially slower than string_agg equivalent