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 1x683N-00030w-0h for pgsql-bugs@arkaria.postgresql.org; Mon, 14 Sep 2026 14:53:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x683M-00DqW9-23 for pgsql-bugs@arkaria.postgresql.org; Mon, 14 Sep 2026 14:53:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x5mcl-009p5A-0M for pgsql-bugs@lists.postgresql.org; Sun, 13 Sep 2026 16:00:11 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x5mch-00000000DRe-0VTi for pgsql-bugs@lists.postgresql.org; Sun, 13 Sep 2026 16:00:10 +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=6GCcERZ8Xh4lWsHjGEjyONY3MQ67eAHkdKDPqdgU4Nc=; b=1rT3MzniDHrYKzWr+xge2iYR/r hIbAb2AAQmz0MOFIPLou1DP2kJTKva2mNPzz1q1Vl4+A9u2I6330rmpKTPeWQMA2JAIBZIybqJXOv Gb397HRGqMTU3pxlt5QQVSQsuuAyY02nxANKUK7dfnTwAm7dWC8GXro9He3iXeBdtRyAWHmMe11Gm +PAjbI47Rx8sLaTP2fBy53GnoenFJYg5gy54uNAMEeMzfEJrRmplJq17kRzT04s8z4CGTobryrBYp /0kqcJjWI1JHAfS0fCM8YqMexo5boBOBs0cz15F5QdvYLw9vgEI/HwIXnWYsDugE6sKo7M29d++cN 80RXOOBQ==; 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 1x5mcg-000auZ-0o for pgsql-bugs@lists.postgresql.org; Sun, 13 Sep 2026 16:00:06 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1x5mce-00000001NL3-3yoK for pgsql-bugs@lists.postgresql.org; Sun, 13 Sep 2026 16:00:04 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19686: Rolling back SET TABLESPACE + INSERT leads to index corruption To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: exclusion@gmail.com Reply-To: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org Date: Sun, 13 Sep 2026 16:00:01 +0000 Message-ID: <19686-30f4da834585129f@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: 19686 Logged by: Alexander Lakhin Email address: exclusion@gmail.com PostgreSQL version: 19beta3 Operating system: Ubuntu 24.04 Description: =20 The following script: rm -rf /tmp/ts mkdir /tmp/ts echo " CREATE TABLESPACE ts LOCATION '/tmp/ts'; CREATE TABLE t (a int); CREATE INDEX ON t(a); BEGIN; ALTER TABLE t SET TABLESPACE ts; INSERT INTO t VALUES (0); ROLLBACK; INSERT INTO t VALUES (0); INSERT INTO t SELECT i FROM generate_series(1, 4000) i; " | psql triggers: 2026-09-13 18:09:42.598 EEST|postgres|regression|6aa6bcb6.297fd6|LOG: statement: INSERT INTO t SELECT i FROM generate_series(1, 4000) i; TRAP: failed Assert("_bt_posting_valid(itup)"), File: "nbtdedup.c", Line: 900, PID: 2719702 ExceptionalCondition at assert.c:51:13 _bt_form_posting at nbtdedup.c:905:7 _bt_dedup_finish_pending at nbtdedup.c:584:11 _bt_dedup_pass at nbtdedup.c:173:15 _bt_delete_or_dedup_one_page at nbtinsert.c:2827:3 _bt_findinsertloc at nbtinsert.c:918:4 _bt_doinsert at nbtinsert.c:261:16 btinsert at nbtree.c:219:11 index_insert at indexam.c:231:9 The assertion failure is reproduced starting from 0d861bbb7. The index corruption is also reproduced with gist: echo " CREATE TABLESPACE ts LOCATION '/tmp/ts'; CREATE TABLE t (a int4range); CREATE INDEX ON t USING gist (a); BEGIN; ALTER TABLE t SET TABLESPACE ts; INSERT INTO t VALUES (int4range(0, 5)); ROLLBACK; INSERT INTO t VALUES (int4range(0, 5)); " | psql echo " SELECT * FROM t; SET enable_seqscan =3D off; SET enable_bitmapscan =3D off; EXPLAIN SELECT * FROM t WHERE a && int4range(0, 100); SELECT * FROM t WHERE a && int4range(0, 100); " | psql returns: ROLLBACK INSERT 0 1 a ------- [0,5) (1 row) SET SET QUERY PLAN ------------------------------------------------------------------------- Index Only Scan using t_a_idx on t (cost=3D0.14..40.39 rows=3D14 width=3D= 32) Index Cond: (a && '[0,100)'::int4range) (2 rows) a ------- [0,5) [0,5) (2 rows)