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

commit    49cc0d41488b92a1d547e278b459c3b224393c8f
Author:   Michael Paquier <michael@paquier.xyz>
Date:     Tue Apr 07 06:22:49 2026 +0000

    Mark JumbleState as a const in the post_parse_analyze hook
    
    This commit changes the post_parse_analyze_hook_type() hook to take a
    const JumbleState, to tell external modules that they are not allowed to
    touch the JumbleState that has been compiled by the core code.  This
    fixes a pretty old problem with pg_stat_statements, that had always the
    idea of modifying the lengths of the constants stored in the
    JumbleState.  The previous state could confuse extensions that need to
    look at a JumbleState depending on the loading order, if
    pg_stat_statements is part of the stack loaded.
    
    Another piece included in this commit is the move of the routine
    fill_in_constant_lengths() to queryjumblefuncs.c, to give an option to
    extensions to compile the lengths of the constants, if necessary.  I was
    surprised by the number of external code that carries a copy of this
    routine (see the thread for details).  Previously, this routine modified
    JumbleState.  It now copies the set of LocationLens from JumbleState,
    and fills the constant lengths for separate use.
    
    pg_stat_statements is updated to use the new ComputeConstantLengths().
    JumbleState is now marked with a const in the module, where relevant.
    
    Author: Sami Imseih <samimseih@gmail.com>
    Co-authored-by: Lukas Fittl <lukas@fittl.com>
    Discussion: https://postgr.es/m/CAA5RZ0tZp5qU0ikZEEqJnxvdSNGh1DWv80sb-k4QAUmiMoOp_Q@mail.gmail.com

[parent: 51098839cfb4]