Generate ALTER TABLE SET UNLOGGED/LOGGED when persistence is changed (#9768)

Wire the relpersistence change through to the table update SQL across all
version buckets (default, 11_plus, 12_plus, 15_plus) so the Unlogged toggle
emits ALTER TABLE ... SET LOGGED/UNLOGGED on every supported server.

Closes #9677.
This commit is contained in:
pavanmanishd authored and Dave Page committed 2026-06-09 14:00:15 +01:00
1 parent 4c5702dd47
commit 39684cdf48
5 files changed
+33

No files matched your search

+1
View File
@@ -30,6 +30,7 @@ Housekeeping
Bug fixes
*********
| `Issue #9677 <https://github.com/pgadmin-org/pgadmin4/issues/9677>`_ - Fix the Unlogged table toggle in table properties not generating any ALTER TABLE ... SET LOGGED/UNLOGGED statement.
| `Issue #9892 <https://github.com/pgadmin-org/pgadmin4/issues/9892>`_ - Fix blank difference counts on the top-level group rows in Schema Diff.
| `Issue #9896 <https://github.com/pgadmin-org/pgadmin4/issues/9896>`_ - Fix invalid DDL reconstruction for SERIAL columns in Schema Diff and the generated SQL/CREATE Script so the output round-trips on a clean target.
| `Issue #9935 <https://github.com/pgadmin-org/pgadmin4/issues/9935>`_ - Fix "Illegal instruction" crash on startup of the Linux DEB and RPM packages on older x86_64 CPUs by pinning the psycopg C extension build to the x86-64 baseline.
@@ -49,6 +49,14 @@ ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}}
ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}}
SET {% if data.relhasoids %}WITH{% else %}WITHOUT{% endif %} OIDS;
{% endif %}
{#####################################################}
{## Change table persistence (UNLOGGED / LOGGED) ##}
{#####################################################}
{% if data.relpersistence is defined and data.relpersistence != o_data.relpersistence %}
ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}}
SET {% if data.relpersistence %}UNLOGGED{% else %}LOGGED{% endif %};
{% endif %}
{#####################################################}
{## Change tablespace ##}
@@ -41,6 +41,14 @@ ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}}
NO INHERIT {{val}};
{% endfor %}
{% endif %}
{#####################################################}
{## Change table persistence (UNLOGGED / LOGGED) ##}
{#####################################################}
{% if data.relpersistence is defined and data.relpersistence != o_data.relpersistence %}
ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}}
SET {% if data.relpersistence %}UNLOGGED{% else %}LOGGED{% endif %};
{% endif %}
{#####################################################}
{## Change tablespace ##}
@@ -49,6 +49,14 @@ ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}}
NO INHERIT {{val}};
{% endfor %}
{% endif %}
{#####################################################}
{## Change table persistence (UNLOGGED / LOGGED) ##}
{#####################################################}
{% if data.relpersistence is defined and data.relpersistence != o_data.relpersistence %}
ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}}
SET {% if data.relpersistence %}UNLOGGED{% else %}LOGGED{% endif %};
{% endif %}
{#####################################################}
{## Change tablespace ##}
@@ -49,6 +49,14 @@ ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}}
ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}}
SET {% if data.relhasoids %}WITH{% else %}WITHOUT{% endif %} OIDS;
{% endif %}
{#####################################################}
{## Change table persistence (UNLOGGED / LOGGED) ##}
{#####################################################}
{% if data.relpersistence is defined and data.relpersistence != o_data.relpersistence %}
ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}}
SET {% if data.relpersistence %}UNLOGGED{% else %}LOGGED{% endif %};
{% endif %}
{#####################################################}
{## Change tablespace ##}