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

commit    26269fe3c83beed1601e3bd156a98cf7696e9e08
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Mon May 18 03:09:37 2026 +0000

    Fix IGNORE NULLS nullness cache for volatile window arguments.
    
    The IGNORE NULLS implementation caches whether a window function argument
    evaluated to NULL or NOT NULL for a given partition row.  That is safe for
    ordinary expressions, but not for volatile expressions, where evaluating the
    same argument on the same row can produce a different NULL/NOT NULL result
    later.
    
    This could produce wrong results in two ways.  A row previously cached as
    NULL could be skipped even though a later evaluation would return NOT NULL.
    Conversely, a row cached as NOT NULL could be chosen as the target row, then
    re-evaluated to fetch the actual value and return NULL.
    
    Make the nullness cache conditional per argument.  Do not use it for
    arguments containing volatile functions or subplans, following the same
    conservative approach used for moving window aggregates.  Also avoid
    re-evaluating non-cacheable partition arguments after the scan has already
    found the target row.
    
    Add regression tests covering volatile arguments and subplan arguments with
    IGNORE NULLS.
    
    Author: Chao Li <lic@highgo.com>
    Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>
    Discussion: https://postgr.es/m/42B42506-6972-4266-8422-FB73E61D9DA7@gmail.com

[parent: e7b416b2fa44]