• Tom Lane's avatar
    Add psql \errverbose command to see last server error at full verbosity. · 3cc38ca7
    Tom Lane authored
    Often, upon getting an unexpected error in psql, one's first wish is that
    the verbosity setting had been higher; for example, to be able to see the
    schema-name field or the server code location info.  Up to now the only way
    has been to adjust the VERBOSITY variable and repeat the failing query.
    That's a pain, and it doesn't work if the error isn't reproducible.
    
    This commit adds a psql feature that redisplays the most recent server
    error at full verbosity, without needing to make any variable changes or
    re-execute the failed command.  We just need to hang onto the latest error
    PGresult in case the user executes \errverbose, and then apply libpq's
    new PQresultVerboseErrorMessage() function to it.  This will consume
    some trivial amount of psql memory, but otherwise the cost when the
    feature isn't used should be negligible.
    
    Alex Shulgin, reviewed by Daniel Vérité, some improvements by me
    3cc38ca7
help.c 26.4 KB