pgsql: Refactor some code for ALTER TABLE SET LOGGED/UNLOGGED in tablec

Started by Michael Paquieralmost 2 years ago1 messagescomitters
Jump to latest
#1Michael Paquier
michael@paquier.xyz

Refactor some code for ALTER TABLE SET LOGGED/UNLOGGED in tablecmds.c

Both sub-commands use the same routine to switch the relpersistence of a
relation, duplicated the same checks, and used a style inconsistent with
access methods and tablespaces.

SET LOGEED/UNLOGGED is refactored to avoid any duplication, setting the
reason why a relation rewrite happens within ATPrepChangePersistence().
This shaves some code.

Discussion: /messages/by-id/ZiiyGFTBNkqcMQi_@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9f87da1cffda0e07ff3babcfa84abe9e849ccd95

Modified Files
--------------
src/backend/commands/tablecmds.c | 44 +++++++++++++---------------------------
1 file changed, 14 insertions(+), 30 deletions(-)