• H
    Clean up OptVersion(). · 3bbe7b7b
    Heikki Linnakangas 提交于
    Using a StringInfo just to copy a string is quite pointless. Simplify by
    changing OptVersion() to return a plain palloc'd string instead.
    
    This fixes a memory management bug too: OptVersion() is called like a
    normal Postgres C function, not as a subroutine of PplStmtOptimize. As a
    result, if OptVersion() throws a C++ exception, there is nothing to catch
    it, and it will cause the process to exit, bringing down the server.
    The gpdb::SiMakeStringInfo() wrapper, used in OptVersion(), would translate
    any ereport() (e.g. out-of-memory error) into a C++ error, but that's not
    what we want in this context. A plain makeStringInfo() would be correct
    here, and LibraryVersion() got that right, but for OptVersion it's simpler
    to just return a plain string anyway.
    3bbe7b7b
funcs.cpp 2.6 KB