• Michael Paquier's avatar
    Preserve pg_attribute.attstattarget across REINDEX CONCURRENTLY · bd120809
    Michael Paquier authored
    For an index, attstattarget can be updated using ALTER INDEX SET
    STATISTICS.  This data was lost on the new index after REINDEX
    CONCURRENTLY.
    
    The update of this field is done when the old and new indexes are
    swapped to make the fix back-patchable.  Another approach we could look
    after in the long-term is to change index_create() to pass the wanted
    values of attstattarget when creating the new relation, but, as this
    would cause an ABI breakage this can be done only on HEAD.
    
    Reported-by: Ronan Dunklau
    Author: Michael Paquier
    Reviewed-by: Ronan Dunklau, Tomas Vondra
    Discussion: https://postgr.es/m/16628084.uLZWGnKmhe@laptop-ronand
    Backpatch-through: 12
    bd120809
index.c 136 KB