aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2024-10-22 11:31:45 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2024-10-22 11:31:45 -0400
commit774171c4f640853b1cf8747a4762631d2f5d25be (patch)
tree39c02f7bde287550d401e2e4fe698e1310053f7c /doc/src
parent14e5680eee19df8b41ef77330d0b3857f498e4f7 (diff)
downloadpostgresql-774171c4f640853b1cf8747a4762631d2f5d25be.tar.gz
postgresql-774171c4f640853b1cf8747a4762631d2f5d25be.zip
Improve reporting of errors in extension script files.
Previously, CREATE/ALTER EXTENSION gave basically no useful context about errors reported while executing script files. I think the idea was that you could run the same commands manually to see the error, but that's often quite inconvenient. Let's improve that. If we get an error during raw parsing, we won't have a current statement identified by a RawStmt node, but we should always get a syntax error position. Show the portion of the script from the last semicolon-newline before the error position to the first one after it. There are cases where this might show only a fragment of a statement, but that should be uncommon, and it seems better than showing the whole script file. Without an error cursor, if we have gotten past raw parsing (which we probably have), we can report just the current SQL statement as an item of error context. In any case also report the script file name as error context, since it might not be entirely obvious which of a series of update scripts failed. We can also show an approximate script line number in case whatever we printed of the query isn't sufficiently identifiable. The error-context code path is already exercised by some test_extensions test cases, but add tests for the syntax-error path. Discussion: https://postgr.es/m/ZvV1ClhnbJLCz7Sm@msg.df7cb.de
Diffstat (limited to 'doc/src')
0 files changed, 0 insertions, 0 deletions