agora inbox for pgsql-bugs@postgresql.org
help / color / mirror / Atom feedBUG #19686: Rolling back SET TABLESPACE + INSERT leads to index corruption
2+ messages / 2 participants
[nested] [flat]
* BUG #19686: Rolling back SET TABLESPACE + INSERT leads to index corruption
@ 2026-09-13 16:00 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2026-09-13 16:00 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: exclusion@gmail.com
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:
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 = off;
SET enable_bitmapscan = 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=0.14..40.39 rows=14 width=32)
Index Cond: (a && '[0,100)'::int4range)
(2 rows)
a
-------
[0,5)
[0,5)
(2 rows)
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #19686: Rolling back SET TABLESPACE + INSERT leads to index corruption
@ 2026-09-15 08:59 Alexandre Felipe <o.alexandre.felipe@gmail.com>
parent: PG Bug reporting form <noreply@postgresql.org>
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Felipe @ 2026-09-15 08:59 UTC (permalink / raw)
To: exclusion@gmail.com; pgsql-bugs@lists.postgresql.org
I started investigating.
The first thing I noticed is that we have no debugging on what happens
during
the SET TABLESPACE, I think that creating or deleting files deserves a line
in the log, so I will start by adding DEBUG1 around it.
Anyone else looking into this?
Regards,
Alexandre
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-09-15 08:59 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-13 16:00 BUG #19686: Rolling back SET TABLESPACE + INSERT leads to index corruption PG Bug reporting form <noreply@postgresql.org>
2026-09-15 08:59 ` Alexandre Felipe <o.alexandre.felipe@gmail.com>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox