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

commit    bd94845e8c90475b8149f6a091876a1827b6b305
Author:   Richard Guo <rguo@postgresql.org>
Date:     Mon Apr 06 02:52:33 2026 +0000

    Fix collation handling for grouping keys in eager aggregation
    
    When determining if it is safe to use an expression as a grouping key
    for partial aggregation, eager aggregation relies on the B-tree
    equalimage support function to ensure that equality implies image
    equality.
    
    Previously, the code incorrectly passed the default collation of the
    expression's data type to the equalimage procedure, rather than the
    expression's actual collation.  As a result, if a column used a
    non-deterministic collation but the base type's default collation was
    deterministic, eager aggregation would incorrectly assume that the
    column was safe for byte-level grouping.  This could cause rows to be
    prematurely grouped and subsequently discarded by strict join
    conditions, resulting in incorrect query results.
    
    This patch fixes the issue by passing the expression's actual
    collation to the equalimage procedure.
    
    Author: Richard Guo <guofenglinux@gmail.com>
    Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
    Discussion: https://postgr.es/m/CAMbWs48A53PY1Y4zoj7YhxPww9fO1hfnbdntKfA855zpXfVFRA@mail.gmail.com

[parent: a8f45dee9176]