BUG #19469: Prevent SIGSEGV on FETCH after ALTER TYPE of cursor rowtype

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: haogangmao(at)gmail(dot)com
Subject: BUG #19469: Prevent SIGSEGV on FETCH after ALTER TYPE of cursor rowtype
Date: 2026-04-27 10:53:54
Message-ID: 19469-e7612f56d0e1ce34@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 19469
Logged by: HaoGang Mao
Email address: haogangmao(at)gmail(dot)com
PostgreSQL version: 17.3
Operating system: OS: Linux (Docker)
Description:

An open cursor can continue returning tuples built with the old physical
layout of a named composite type. If that type is changed in the same
transaction (for example ALTER TYPE ... ALTER ATTRIBUTE ... TYPE), a later
FETCH may format the tuple using updated descriptor and output metadata.

Minimal Reproduction SQL:
```sql
CREATE TYPE foo AS (a INT, b INT);
BEGIN;
DECLARE c CURSOR FOR
SELECT (i, power(2, 30))::foo
FROM generate_series(1,10) i;
FETCH c;
ALTER TYPE foo ALTER ATTRIBUTE b TYPE TEXT;
FETCH c;
COMMIT;
```

Browse pgsql-bugs by date

  From Date Subject
Next Message Ayush Tiwari 2026-04-27 10:54:55 Re: to_date()/to_timestamp() silently accept month=0 and day=0
Previous Message PG Bug reporting form 2026-04-27 09:48:53 BUG #19468: Prevent SIGSEGV on FETCH after ALTER TYPE of cursor rowtype