Assertion failure with temporary relations in single-user mode

From: Manu <manuelreyesbravo(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>, Melanie Plageman <melanieplageman(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Assertion failure with temporary relations in single-user mode
Date: 2026-11-17 00:32:20
Message-ID: 179487554022.104798.7544124224648387746@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

With assertions enabled, single-user mode fails an assertion as soon
as a temporary relation is read or written through local buffers,
from v16 to master:

$ echo "CREATE TEMP TABLE t AS SELECT 1;" | postgres --single postgres
TRAP: failed Assert("pgstat_tracks_io_op(MyBackendType, ...)")

28e626bde00 put B_STANDALONE_BACKEND in no_temp_rel, in
pgstat_tracks_io_object(), but a single-user backend uses local
buffers like a client backend. Without assertions, that IO is not
counted: pg_stat_io has no "temp relation" row for it.

Patch with a test attached; the test also fails without assertions.
The back branches need small adjustments; tested on 16 to 19.

Regards,
Manu

Attachment Content-Type Size
v1-0001-Fix-IO-tracking-of-temporary-relations-in-single-.patch text/x-patch 6.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Lukas Fittl 2026-11-17 00:51:55 Re: Improve pg_stat_statements scalability
Previous Message Andres Freund 2026-11-16 23:46:50 Re: -Wformat-nonliteral