Re: Reject access to unlogged tables in contrib modules

From: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: surya poondla <suryapoondla4(at)gmail(dot)com>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Subject: Re: Reject access to unlogged tables in contrib modules
Date: 2026-11-06 18:59:14
Message-ID: d4ca68e6-bc15-4f47-bec1-b0be35d12e8f@uni-muenster.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 06/11/2026 06:26, Michael Paquier wrote:
> Note that for pg_visibility, read_stream has some protections when it
> comes to temp tables of other sessions, but that does not fly under
> !include_pd. Merged 0004 and 0005 together, tweaked a bit the whole,
> and applied.
>
> pgrowlocks (uses read_stream, safe for temp from other settions,
> complains about recovery) has a single point of failure, with a weird
> error message. Done as well.

Thanks!

> Regarding pg_freespacemap, I am not convinced. Returning 0 reflects
> also the reality: there is no FSM for the temp-from-other-session case
> and temp/unlogged at recovery.

Fair enough.

> For pageinspect, we have a pageinspect.h, where I'd suggest to have a
> common routine for the whole to remove the duplication. For
> pgstattuple, we don't have a "common" path, but that seems worth
> having to avoid duplicating this kind of check all over the place.

PFA v5.

0001 (pageinspect) and 0002 (pgstattuple) add the helper function
check_relation_accessible(), where the tests for unlogged and temporary
tables now live. While at it, I moved the existing
RELATION_IS_OTHER_TEMP(rel) check to the same function, so that all
checks are kept in one place.

Best, Jim

Attachment Content-Type Size
v5-0001-pageinspect-Reject-unlogged-relations-during-reco.patch text/x-patch 8.4 KB
v5-0002-pgstattuple-Reject-unlogged-relations-during-reco.patch text/x-patch 8.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikhil Sontakke 2026-11-06 19:08:38 Re: [***DKIM violation***] Re: [PATCH] Fix JSON_SERIALIZE() coercion placeholder type for jsonb input
Previous Message Salma Elsayed 2026-11-06 18:52:53 Re: PoC: Simplify recovery after dropping a table by LOGGING the restore LSN