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

From: "Euler Taveira" <euler(at)eulerto(dot)com>
To: haogangmao(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19470: PostgreSQL backend aborts (assert failure) when a prepared statement returns a composite type cast t
Date: 2026-05-05 02:36:54
Message-ID: 95eeb76a-74eb-46f8-a579-c1aefdad8d8f@app.fastmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
v1-0001-Fix-a-crash-with-cached-plans-after-changing-comp.patch text/x-patch 5.4 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Previous Message Andrey Borodin 2026-05-04 05:20:04 Re: [BUG] false positive in bt_index_check in case of short 4B varlena datum