| From: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
|---|---|
| To: | Michael Paquier <michael(at)paquier(dot)xyz> |
| Cc: | 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-02 10:06:34 |
| Message-ID: | c11db5b4-eb2c-43ef-9b94-19fe27832b61@uni-muenster.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 02/11/2026 08:38, Michael Paquier wrote:
> I have a question here. Is there a reason why you do not check after
> pg_visibility_map() and pg_visibility_map_summary()? pgstatapprox.c
> also does lookups based on block numbers and you are proposing to
> block temp and unlogged relations there. For the visibility maps, I
> doubt that it makes sense to have them return incorrect results during
> recovery. Here this means vm_readbuf() returning an invalid buffer.
> That feels confusing to me vs the choice of an error.
The only reason is that they didn't fail, so I didn't look any further..
postgres=# select * from pg_visibility_map_summary('pg_temp_1.tmp');
all_visible | all_frozen
-------------+------------
0 | 0
(1 row)
postgres=# SELECT * FROM pg_visibility_map_summary('ut');
all_visible | all_frozen
-------------+------------
0 | 0
(1 row)
...but I agree that an error message is better than incorrect results.
> Another point may be in introducing RELATION_IS_OTHER_TEMP() in
> pg_visibility. It also seems strange to not fail in this case,
> doesn't it? We would just grab incorrect data if trying to fetch VM
> information from a temp relation owned by a different session.
Agreed. I added this check in 0005.
> Rather than copy-pasting the same check N times, you could just group
> them in a shared routine and reduce the duplication. For
> pg_visibility, this could be embedded in check_relation_relkind(),
> perhaps..
Right. I just repeated an existing pattern, but I agree that it can be
done in a single place. It is indeed much better than repeating the
check multiple times. 0004 now adds it in check_relation_relkind().
Thanks!
Best, Jim
| Attachment | Content-Type | Size |
|---|---|---|
| v3-0001-pageinspect-Reject-unlogged-relations-during-reco.patch | text/x-patch | 6.0 KB |
| v3-0002-pgrowlocks-Reject-unlogged-tables-during-recovery.patch | text/x-patch | 1.9 KB |
| v3-0003-pgstattuple-Reject-unlogged-relations-during-reco.patch | text/x-patch | 5.7 KB |
| v3-0004-pg_visibility-Reject-unlogged-tables-during-recov.patch | text/x-patch | 2.5 KB |
| v3-0005-pg_visibility-Reject-temporary-tables-of-other-se.patch | text/x-patch | 1.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ashutosh Bapat | 2026-11-02 10:11:41 | Re: Call CalculateShmemSize() only once |
| Previous Message | Hayato Kuroda (Fujitsu) | 2026-11-02 09:56:48 | RE: Test publication.sql racing with subscription.sql might fail due to cache lookup error |