postgres-github.git / summary / log / commit / refs

commit    36f52a59b31502213a01fb4b0a89afc0f3bfd21d
Author:   Álvaro Herrera <alvherre@kurilemu.de>
Date:     Mon May 11 16:17:46 2026 +0000

    Fix REPACK with WITHOUT OVERLAPS replica identity indexes
    
    REPACK replay builds scan keys for the replica identity index, but it
    hard-coded BTEqualStrategyNumber when looking up the equality operator.
    That is not correct for non-btree identity indexes, such as the GiST
    indexes created for WITHOUT OVERLAPS primary keys.  In addition,
    find_target_tuple() accepted the first tuple returned by the identity
    index scan, which is unsafe for lossy index scans because the index AM may
    return false positives with xs_recheck set.
    
    Fix this by using IndexAmTranslateCompareType() to translate COMPARE_EQ
    to the equality strategy number for the index AM, and by continuing the
    scan when recheck is required until a candidate tuple matches the locator
    tuple on all replica identity key columns.
    
    The recheck uses the same equality operator functions as the identity
    index scan keys, preserving ScanKey argument ordering.
    
    Author: Chao Li <lic@highgo.com>
    Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
    Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
    Discussion: https://postgr.es/m/7B0EC0EC-5461-41EF-9B31-F9BBE608DEA5@gmail.com

[parent: 906ea101d0d5]