Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wGYw4-006LaD-0j for pgsql-bugs@arkaria.postgresql.org; Sat, 25 Apr 2026 09:04:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wGYw3-008d4H-1b for pgsql-bugs@arkaria.postgresql.org; Sat, 25 Apr 2026 09:04:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wGXQt-008S7t-1z for pgsql-bugs@lists.postgresql.org; Sat, 25 Apr 2026 07:28:07 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wGXQr-00000002hAM-1yNV for pgsql-bugs@lists.postgresql.org; Sat, 25 Apr 2026 07:28:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=ZdJlnS8c/1qYxPRKtaWQacqI9oDtbrbOx4L+iwcW7JY=; b=5EWYEbh/PXj0JAkqnfxOGt7Jbo D3lv9GdX7NSdmaGH5661Ny1yqRpJRRJW82lq92bxdW6h/W/5mql79QrznwEGhX++Gw2a+nbVVjUqM no3XWAErjNL0nzegESDfcTna6E/tl57ynNtlnNlAgs7YqLPY8NEb6TtZG6JRQVv4r9Ww1RRoxZCv8 nM2mPQ/jG1mx8Kb9pxgslz0JuoXzWXVw0QGScDPhSlQgKZCtPZ7c4GJtkbVct9Cq5n++yPSbtfwqq Fr69xObMn7wPdTddjFJnDjGp9zQfw6fo/NUnaagCCTPtTDbJloPkHZ2NamROClsVQ9jEbEL8LM2ue VG7UkQng==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wGXQq-008Ay4-0q for pgsql-bugs@lists.postgresql.org; Sat, 25 Apr 2026 07:28:04 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wGXQo-000ZNI-10 for pgsql-bugs@lists.postgresql.org; Sat, 25 Apr 2026 07:28:02 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19466: Server crash (SIGSEGV) when FETCH after ALTER TYPE during open cursor To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: haogangmao@gmail.com Reply-To: haogangmao@gmail.com, pgsql-bugs@lists.postgresql.org Date: Sat, 25 Apr 2026 07:27:28 +0000 Message-ID: <19466-dc32827173299fd4@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The following bug has been logged on the website: Bug reference: 19466 Logged by: HaoGang Mao Email address: haogangmao@gmail.com PostgreSQL version: 18.3 Operating system: Linux Description: =20 PostgreSQL version: 18.3 OS: Linux (Docker) 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) Server log: client backend (PID 85) was terminated by signal 11: Segmentation fault Failed process was running: [above SQL] Hypothesis: The cursor holds a reference to the tuple descriptor for type "foo". After ALTER TYPE modifies the type, the descriptor may be invalidated while the cursor still holds a dangling pointer to it. The second FETCH dereferences this invalid pointer.