Re: BUG #19470: PostgreSQL backend aborts (assert failure) when a prepared statement returns a composite type cast t - Mailing list pgsql-bugs

From Euler Taveira
Subject Re: BUG #19470: PostgreSQL backend aborts (assert failure) when a prepared statement returns a composite type cast t
Date
Msg-id 95eeb76a-74eb-46f8-a579-c1aefdad8d8f@app.fastmail.com
Whole thread
In response to BUG #19470: PostgreSQL backend aborts (assert failure) when a prepared statement returns a composite type cast t  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
On Wed, Apr 29, 2026, at 8:27 AM, PG Bug reporting form wrote:
>
> Reproduction steps (minimal):
>   BEGIN;
>   CREATE TYPE foo AS (a int, b text);
>   PREPARE p AS SELECT CAST(ROW(1, 'hello') AS foo)::text;
>   EXECUTE p;
>   ALTER TYPE foo ALTER ATTRIBUTE a TYPE VARCHAR(100);
>   EXECUTE p;
>   COMMIT;
>

Thanks for your report! The attached patch fixes this case. I included a
similar test case but I'm fine if the test is not included with this fix. I
decided to create a separate function instead of adding the new conditions to
record_plan_type_dependency() because it keeps the fix simple and isolated.

The crash is reproduced back to v11 which means this fix should be backpatched
to all supported versions.


-- 
Euler Taveira
EDB   https://www.enterprisedb.com/
Attachment

pgsql-bugs by date:

Previous
From: Andrey Borodin
Date:
Subject: Re: [BUG] false positive in bt_index_check in case of short 4B varlena datum
Next
From: Álvaro Rodríguez
Date:
Subject: pg_dumpall can't be restored with different bootstrap superuser