BUG #19551: TRAP: failed Assert("max_pinned_buffers > 0")

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: r(dot)zharkov(at)postgrespro(dot)ru
Subject: BUG #19551: TRAP: failed Assert("max_pinned_buffers > 0")
Date: 2026-07-10 07:36:39
Message-ID: 19551-d4a55b8fe81db4f2@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 19551
Logged by: Roman Zharkov
Email address: r(dot)zharkov(at)postgrespro(dot)ru
PostgreSQL version: 17.10
Operating system: WSL2 on Windows 11
Description:

Hello,
This error occurred when attempting run the temp.sql regression test from
the master branch on the REL_17_STABLE (#bab0a2db).
It seems, REL_16_STABLE and REL_18_STABLE work fine.

Trimmed script:
SET temp_buffers = 100;

CREATE TEMPORARY TABLE test_temp(a int not null unique, b TEXT not null, cnt
int not null);
INSERT INTO test_temp SELECT generate_series(1, 10000) as id, repeat('a',
200), 0;
-- should be at least 2x as large than temp_buffers
SELECT pg_relation_size('test_temp') / current_setting('block_size')::int8 >
200;

-- Don't want cursor names and plpgsql function lines in the error messages
\set VERBOSITY terse

/* helper function to create cursors for each page in [p_start, p_end] */
CREATE FUNCTION test_temp_pin(p_start int, p_end int)
RETURNS void
LANGUAGE plpgsql
AS $f$
DECLARE
cursorname text;
query text;
BEGIN
FOR i IN p_start..p_end LOOP
cursorname = 'c_'||i;
query = format($q$DECLARE %I CURSOR FOR SELECT ctid FROM test_temp
WHERE ctid >= '( %s, 1)'::tid $q$, cursorname, i);
EXECUTE query;
EXECUTE 'FETCH NEXT FROM '||cursorname;
-- for test development
-- RAISE NOTICE '%: %', cursorname, query;
END LOOP;
END;
$f$;

-- Test overflow of temp table buffers is handled correctly
BEGIN;
-- should work, below max
SELECT test_temp_pin(0, 9);
-- should fail, too many buffers pinned
SELECT test_temp_pin(10, 105);
ROLLBACK;

Backtrace:

#5 0x0000643754e9190c in ExceptionalCondition (conditionName=0x6437550ccf79
"max_pinned_buffers > 0", fileName=0x6437550cccf0
"/home/roman/git/connpool_build/build/../../connpool/src/backend/storage/aio/read_stream.c",
lineNumber=473)
at
/home/roman/git/connpool_build/build/../../connpool/src/backend/utils/error/assert.c:66
#6 0x0000643754c37a4f in read_stream_begin_relation (flags=2, strategy=0x0,
rel=0x7179e34caf78, forknum=MAIN_FORKNUM, callback=0x64375471e46b
<heap_scan_stream_read_next_serial>, callback_private_data=0x6437817b95a8,
per_buffer_data_size=0)
at
/home/roman/git/connpool_build/build/../../connpool/src/backend/storage/aio/read_stream.c:473
#7 0x000064375471f92d in heap_beginscan (relation=0x7179e34caf78,
snapshot=0x64378169b868, nkeys=0, key=0x0, parallel_scan=0x0, flags=272) at
/home/roman/git/connpool_build/build/../../connpool/src/backend/access/heap/heapam.c:1185
#8 0x0000643754a1df61 in table_beginscan_tidrange (rel=0x7179e34caf78,
snapshot=0x64378169b868, mintid=0x6437817b87e0, maxtid=0x6437817b87e6) at
/home/roman/git/connpool_build/build/../../connpool/src/include/access/tableam.h:1097
#9 0x0000643754a1e787 in TidRangeNext (node=0x6437817b86f8) at
/home/roman/git/connpool_build/build/../../connpool/src/backend/executor/nodeTidrangescan.c:243
#10 0x00006437549d23cc in ExecScanFetch (node=0x6437817b86f8,
accessMtd=0x643754a1e6d8 <TidRangeNext>, recheckMtd=0x643754a1e805
<TidRangeRecheck>) at
/home/roman/git/connpool_build/build/../../connpool/src/backend/executor/execScan.c:139
#11 0x00006437549d2471 in ExecScan (node=0x6437817b86f8,
accessMtd=0x643754a1e6d8 <TidRangeNext>, recheckMtd=0x643754a1e805
<TidRangeRecheck>) at
/home/roman/git/connpool_build/build/../../connpool/src/backend/executor/execScan.c:205
#12 0x0000643754a1e8ff in ExecTidRangeScan (pstate=0x6437817b86f8) at
/home/roman/git/connpool_build/build/../../connpool/src/backend/executor/nodeTidrangescan.c:308
#13 0x00006437549cdc93 in ExecProcNodeFirst (node=0x6437817b86f8) at
/home/roman/git/connpool_build/build/../../connpool/src/backend/executor/execProcnode.c:464
#14 0x00006437549c0c12 in ExecProcNode (node=0x6437817b86f8) at
/home/roman/git/connpool_build/build/../../connpool/src/include/executor/executor.h:278
#15 0x00006437549c3b4e in ExecutePlan (queryDesc=0x6437816c3520,
operation=CMD_SELECT, sendTuples=true, numberTuples=1,
direction=ForwardScanDirection, dest=0x6437552bda80 <spi_printtupDR>)
at
/home/roman/git/connpool_build/build/../../connpool/src/backend/executor/execMain.c:1689
#16 0x00006437549c12dd in standard_ExecutorRun (queryDesc=0x6437816c3520,
direction=ForwardScanDirection, count=1, execute_once=false) at
/home/roman/git/connpool_build/build/../../connpool/src/backend/executor/execMain.c:360
#17 0x00006437549c1136 in ExecutorRun (queryDesc=0x6437816c3520,
direction=ForwardScanDirection, count=1, execute_once=false) at
/home/roman/git/connpool_build/build/../../connpool/src/backend/executor/execMain.c:306
#18 0x0000643754c9b597 in PortalRunSelect (portal=0x6437816c6b78,
forward=true, count=1, dest=0x6437552bda80 <spi_printtupDR>) at
/home/roman/git/connpool_build/build/../../connpool/src/backend/tcop/pquery.c:922
#19 0x0000643754c9c763 in DoPortalRunFetch (portal=0x6437816c6b78,
fdirection=FETCH_FORWARD, count=1, dest=0x6437552bda80 <spi_printtupDR>) at
/home/roman/git/connpool_build/build/../../connpool/src/backend/tcop/pquery.c:1665
#20 0x0000643754c9c0ff in PortalRunFetch (portal=0x6437816c6b78,
fdirection=FETCH_FORWARD, count=1, dest=0x6437552bda80 <spi_printtupDR>) at
/home/roman/git/connpool_build/build/../../connpool/src/backend/tcop/pquery.c:1416
#21 0x0000643754930f24 in PerformPortalFetch (stmt=0x64378153d3f0,
dest=0x6437552bda80 <spi_printtupDR>, qc=0x7ffc60e51fc0) at
/home/roman/git/connpool_build/build/../../connpool/src/backend/commands/portalcmds.c:198
#22 0x0000643754c9d8c9 in standard_ProcessUtility (pstmt=0x64378153d2e0,
queryString=0x643781539a20 "FETCH NEXT FROM c_99", readOnlyTree=true,
context=PROCESS_UTILITY_QUERY, params=0x0, queryEnv=0x0, dest=0x6437552bda80
<spi_printtupDR>,
qc=0x7ffc60e51fc0) at
/home/roman/git/connpool_build/build/../../connpool/src/backend/tcop/utility.c:703

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Hüseyin Demir 2026-07-10 17:37:26 Re: BUG #19483: pg_upgrade fails with orphan records in pg_init_priv catalog table
Previous Message Hüseyin Demir 2026-07-10 07:00:35 Re: BUG #19483: pg_upgrade fails with orphan records in pg_init_priv catalog table