Thread

  1. Refactor StringInfo usage in subscriptioncmds.c

    Mats Kindahl <mats.kindahl@gmail.com> — 2025-11-06T11:38:07Z

    Hi all,
    
    As discussed in [1] the functions check_publications_origin_tables() and 
    check_publications_origin_sequences() are building error messages using 
    dynamically allocated StringInfo instances only to avoid duplicating a 
    call of ereport().
    
    Attached is a proposal that instead of building error message and hints 
    dynamically, it will use ereport() directly and as a result does not 
    have to allocate the error message strings and error message hints 
    dynamically and these can be removed.
    
    This also means that a previous use of gettext() (in the form of the "_" 
    macro) is not needed any more and we can use errmsg() and errhint() 
    rather than errmsg_internal() and errhint_internal() with ereport().
    
    It also replaces the usage a dynamically allocated StringInfo of 
    pubnames containing the publication names with a stack allocated 
    StringInfoData, along the same line as in [2].
    
    [1]: 
    https://www.postgresql.org/message-id/CAApHDvrZnM28wa2VY58cvtY0y9XbMhKJH4m%3Dga3c1wfsx%3DMF4Q%40mail.gmail.com
    
    [2]: 
    https://www.postgresql.org/message-id/flat/CAApHDvrZnM28wa2VY58cvtY0y9XbMhKJH4m%3Dga3c1wfsx%3DMF4Q%40mail.gmail.com#ba34970e59f9fd847f1ab52777d57edc