on 19beta3: repack (concurrently) affects sessions with transaction isolation level repeatable read

From: Jochen Bandhauer <jb(at)jbitc(dot)de>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: on 19beta3: repack (concurrently) affects sessions with transaction isolation level repeatable read
Date: 2026-08-22 07:29:41
Message-ID: 5d2060d5-8145-40c6-9a2e-4ddb9f6b0fc9@jbitc.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello,

while using repack (concurrently) I found a behavior that I didn't
expect. When running a "repack (concurrently) t;" in one session,
another session with "transaction isolation level repeatable read"
reports sometimes 0 for "select count(*) from t;".

PostgreSQL Version: PostgreSQL 19beta3 on x86_64-pc-linux-gnu, compiled
by gcc (GCC) 14.3.1 20251022 (Red Hat 14.3.1-4), 64-bit
configure command: ./configure --prefix=/home/postgres/pginstall
OS: Red Hat Enterprise Linux 10.2 (Coughlan)
uname -a: Linux lin8.fritz.box 6.12.0-211.44.1.el10_2.x86_64 #1 SMP
PREEMPT_DYNAMIC Tue Aug  4 03:10:19 EDT 2026 x86_64 GNU/Linux

Test Case:
-- create table
drop table if exists t;
create table t (
    col1 bigint primary key,
    col2 text default 'default text'
);
insert into t (col1) select g from generate_series(1, 10000) as g;

Session 1 runs from time to time: repack (concurrently) t;
Session 2 runs the following script with:  while true; do psql mydb -f
./s2.sql; sleep 0.1; done| grep -v "^$"
Script s2.sql:

\pset tuples_only on
\o /dev/null
begin;
set transaction isolation level repeatable read;
select 1;
select pg_sleep(1);
\o
select count(*) from t;
\o /dev/null
end;

Output Session 2:
 10000
 10000
     0
 10000
 10000
     0
 10000
 10000
 10000
     0
 10000
 10000
     0
 10000

0 always when Session 1 runs: repack (concurrently) t;

Expected Output: Always 10000

Only the (concurrently) option shows this behavior. Wehen using "repack
t;" or "repack t using index t_pkey;" the output is always 10000.

Thanks
Jochen

--
Mit freundlichen Grüßen

Jochen Bandhauer
+49 (0)176 29390012
www.jbitc.de

Attachment Content-Type Size
jb.vcf text/vcard 202 bytes

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message mostafa nabil 2026-08-22 14:54:19 Re: BUG #19628: Uninterruptible vacuum during hash index processing
Previous Message Andrey Rachitskiy 2026-08-22 05:28:49 Re: BUG #19593: area(circle) silently returns Infinity instead of raising "value out of range: overflow"