• Tom Lane's avatar
    Adjust behavior of single-user -j mode for better initdb error reporting. · 66d947b9
    Tom Lane authored
    Previously, -j caused the entire input file to be read in and executed as
    a single command string.  That's undesirable, not least because any error
    causes the entire file to be regurgitated as the "failing query".  Some
    experimentation suggests a better rule: end the command string when we see
    a semicolon immediately followed by two newlines, ie, an empty line after
    a query.  This serves nicely to break up the existing examples such as
    information_schema.sql and system_views.sql.  A limitation is that it's
    no longer possible to write such a sequence within a string literal or
    multiline comment in a file meant to be read with -j; but there are no
    instances of such a problem within the data currently used by initdb.
    (If someone does make such a mistake in future, it'll be obvious because
    they'll get an unterminated-literal or unterminated-comment syntax error.)
    Other than that, there shouldn't be any negative consequences; you're not
    forced to end statements that way, it's just a better idea in most cases.
    
    In passing, remove src/include/tcop/tcopdebug.h, which is dead code
    because it's not included anywhere, and hasn't been for more than
    ten years.  One of the debug-support symbols it purported to describe
    has been unreferenced for at least the same amount of time, and the
    other is removed by this commit on the grounds that it was useless:
    forcing -j mode all the time would have broken initdb.  The lack of
    complaints about that, or about the missing inclusion, shows that
    no one has tried to use TCOP_DONTUSENEWLINE in many years.
    66d947b9
snowball_func.sql.in 1.27 KB