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

From Dmitry Dolgov
Subject Re: BUG #17897: Crash on assignment to array of constraint-less domain over composite type
Date
Msg-id 20230415151709.jh7ygoak2fc2msdb@erthalion.local
Whole thread Raw
In response to BUG #17897: Crash on assignment to array of constraint-less domain over composite type  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #17897: Crash on assignment to array of constraint-less domain over composite type
List 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;
 }



pgsql-bugs by date:

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