• Michael Paquier's avatar
    Improve handling of dropped relations for REINDEX DATABASE/SCHEMA/SYSTEM · 1d654166
    Michael Paquier authored
    When multiple relations are reindexed, a scan of pg_class is done first
    to build the list of relations to work on.  However the REINDEX logic
    has never checked if a relation listed still exists when beginning the
    work on it, causing for example sudden cache lookup failures.
    
    This commit adds safeguards against dropped relations for REINDEX,
    similarly to VACUUM or CLUSTER where we try to open the relation,
    ignoring it if it is missing.  A new option is added to the REINDEX
    routines to control if a missed relation is OK to ignore or not.
    
    An isolation test, based on REINDEX SCHEMA, is added for the concurrent
    and non-concurrent cases.
    
    Author: Michael Paquier
    Reviewed-by: Anastasia Lubennikova
    Discussion: https://postgr.es/m/20200813043805.GE11663@paquier.xyz
    1d654166
isolation_schedule 2.13 KB