[PATCH] Add permit_unlogged_tables GUC to control unlogged table creation.

From: harinath kanchu <kanchuharinath(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: [PATCH] Add permit_unlogged_tables GUC to control unlogged table creation.
Date: 2026-01-13 20:47:48
Message-ID: CAO7WNRQkLzXiqPFFaw-Djo8wXgu+EEEwnzhBO=brdiTNw_rKkA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,
This patch implements a new GUC parameter "permit_unlogged_tables" which
allows admins to disable creation of unlogged tables or altering the
existing tables to be unlogged.

This is useful in environments with strict compliance requirements as well
as multi-tenant environments where the provider needs to guarantee
durability of customer data.

The default is "true", which is to say that behavior would remain unchanged.

Implementation
- Boolean GUC with PGC_SIGHUP context (reloadable without restart)
- Check in "DefineRelation()" to block "CREATE UNLOGGED TABLE" commands.
- Check in "ATPrepCmd()" to block "ALTER TABLE SET UNLOGGED" commands.
- "ALTER TABLE SET LOGGED" commands remain unaffected and should always
work.

Attached the patch for review. Happy to make adjustments based on feedback.

Thanks !

Best,
Harinath

Attachment Content-Type Size
v1-0001-Add-permit_unlogged_tables-GUC-to-control-unlogge.patch application/octet-stream 21.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2026-01-13 21:11:24 Re: Enhancing Memory Context Statistics Reporting
Previous Message Peter Geoghegan 2026-01-13 20:36:28 Re: index prefetching