postgres.git / summary / log / commit / refs

commit    7b565843a94412395149c6add0cbfc21d2bca0d4
Author:   Michael Paquier <michael@paquier.xyz>
Date:     Tue Aug 10 03:21:05 2021 +0000
First released in: 15.0

    Add call to object access hook at the end of table rewrite in ALTER TABLE
    
    ALTER TABLE .. SET {LOGGED,UNLOGGED,ACCESS METHOD} would never do a
    table-level object access hook, which was inconsistent with SET
    TABLESPACE.  Note that contrary to SET TABLESPACE, the no-op case is
    left off for those commands as this requires tracking if commands have
    been called, but they may not execute a physical rewrite.  Another thing
    worth noting is that the physical file swap at the end of a rewrite
    does a couple of access calls for internal objects created for the swap
    operation (internal objects are for example skipped by the tests of
    sepgsql), but this does not trigger the hook for the table on which the
    operation is done.
    
    f41872d, that added support for SET LOGGED/UNLOGGED in ALTER TABLE,
    visibly forgot to consider that.
    
    Based on what I checked, two regression tests of sepgsql in ddl.sql are
    going to log more information with this test, something that buildfarm
    member rhinoceros will tell soon enough.  I am not completely sure of
    their format though, so these are not refreshed yet.
    
    This is arguably a bug, but no backpatch is done as this could cause a
    behavior change for anybody using object access hooks.
    
    Reported-by: Jeff Davis
    Discussion: https://postgr.es/m/YQJKV29/1a60uG68@paquier.xyz


src/backend/commands/tablecmds.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index fcd778c62a5..b18de38e737 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -5475,6 +5475,8 @@ ATRewriteTables(AlterTableStmt *parsetree, List **wqueue, LOCKMODE lockmode, RecentXmin, ReadNextMultiXactId(), persistence); + + InvokeObjectPostAlterHook(RelationRelationId, tab->relid, 0); } else { [parent: 18bac60ede44]