postgres.git / summary / log / commit / refs

commit    a3906b44c5b920cd7beb569a097660f487adf883
Author:   Peter Eisentraut <peter@eisentraut.org>
Date:     Fri Aug 08 10:06:06 2025 +0000
First released in: 19.0, 13.22, 14.19, 15.14, 16.10, 17.6, 18.0

    Fix incorrect lack of Datum conversion in _int_matchsel()
    
    The code used
    
        return (Selectivity) 0.0;
    
    where
    
        PG_RETURN_FLOAT8(0.0);
    
    would be correct.
    
    On 64-bit systems, these are pretty much equivalent, but on 32-bit
    systems, PG_RETURN_FLOAT8() correctly produces a pointer, but the old
    wrong code would return a null pointer, possibly leading to a crash
    elsewhere.
    
    We think this code is actually not reachable because bqarr_in won't
    accept an empty query, and there is no other function that will
    create query_int values.  But better be safe and not let such
    incorrect code lie around.
    
    Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
    Discussion: https://www.postgresql.org/message-id/flat/8246d7ff-f4b7-4363-913e-827dadfeb145%40eisentraut.org


contrib/intarray/_int_selfuncs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/intarray/_int_selfuncs.c b/contrib/intarray/_int_selfuncs.c index 01d6fe14a70..17dc6768ea5 100644 --- a/contrib/intarray/_int_selfuncs.c +++ b/contrib/intarray/_int_selfuncs.c @@ -178,7 +178,7 @@ _int_matchsel(PG_FUNCTION_ARGS) if (query->size == 0) { ReleaseVariableStats(vardata); - return (Selectivity) 0.0; + PG_RETURN_FLOAT8(0.0); } /* [parent: 3863c6fb696c]