Re: BUG #19468: Prevent SIGSEGV on FETCH after ALTER TYPE of cursor rowtype - Mailing list pgsql-bugs

From Ayush Tiwari
Subject Re: BUG #19468: Prevent SIGSEGV on FETCH after ALTER TYPE of cursor rowtype
Date
Msg-id CAJTYsWU6BxT5T_kqdAhnQncGGj0aCR-P1aKQdxexdd3aW_WdiA@mail.gmail.com
Whole thread
In response to BUG #19468: Prevent SIGSEGV on FETCH after ALTER TYPE of cursor rowtype  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
Hi,

On Mon, 27 Apr 2026 at 17:03, PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:

Bug reference:      19468
Logged by:          HaoGang Mao
Email address:      haogangmao@gmail.com
PostgreSQL version: 17.3
Operating system:   OS: Linux (Docker)
Description:       

Summary:
PostgreSQL crashes with SIGSEGV when a cursor is open over a composite
type and the type is modified via ALTER TYPE during the same transaction,
followed by a second FETCH.

Reproduction steps (minimal):
  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;

Expected: Error message (type modified during active cursor)
Actual:   Server process terminated with signal 11 (Segmentation fault)

Confirmed environment:
  PostgreSQL 18.3, built from source with --enable-cassert --enable-debug
  Docker image: sqleek-pg18-debug:18.3
  Reproduction / stack script: report/postgres/get_stack3.sh
  Full stack output: report/postgres/crash_stack4.txt

pgsql-bugs by date:

Previous
From: Ayush Tiwari
Date:
Subject: Re: to_date()/to_timestamp() silently accept month=0 and day=0
Next
From: John Naylor
Date:
Subject: Re: BUG #19467: Inconsistency in MOD() result involving POWER() and floating-point precision in PostgreSQL