Improve reporting of "conflicting or redundant options" errors. When reporting "conflicting or redundant options" errors, try to ensure that errposition() is used, to help the user identify the offending option.
Formerly, errposition() was invoked in less than 60% of cases. This patch raises that to over 90%, but there remain a few places where the ParseState is not readily available. Using errdetail() might improve the error in such cases, but that is left as a task for the future. Additionally, since this error is thrown from over 100 places in the codebase, introduce a dedicated function to throw it, reducing code duplication. Extracted from a slightly larger patch by Vignesh C. Reviewed by Bharath Rupireddy, Alvaro Herrera, Dilip Kumar, Hou Zhijie, Peter Smith, Daniel Gustafsson, Julien Rouhaud and me. Discussion: https://postgr.es/m/CALDaNm33FFSS5tVyvmkoK2cCMuDVxcui=gfrjti9rofynqs...@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/2bfb50b3df11399ed80347dd03bfaf8cd5acf962 Modified Files -------------- src/backend/catalog/aclchk.c | 11 +-- src/backend/commands/copy.c | 59 ++++----------- src/backend/commands/dbcommands.c | 70 ++++-------------- src/backend/commands/define.c | 12 ++++ src/backend/commands/extension.c | 20 ++---- src/backend/commands/foreigncmds.c | 18 ++--- src/backend/commands/functioncmds.c | 53 ++++---------- src/backend/commands/publicationcmds.c | 27 ++++--- src/backend/commands/sequence.c | 45 +++--------- src/backend/commands/subscriptioncmds.c | 66 +++++++---------- src/backend/commands/typecmds.c | 31 +++----- src/backend/commands/user.c | 112 +++++++---------------------- src/backend/parser/parse_utilcmd.c | 4 +- src/backend/tcop/utility.c | 20 +++--- src/include/commands/defrem.h | 7 +- src/include/commands/publicationcmds.h | 4 +- src/include/commands/subscriptioncmds.h | 4 +- src/include/commands/typecmds.h | 2 +- src/include/commands/user.h | 2 +- src/test/regress/expected/copy2.out | 2 + src/test/regress/expected/foreign_data.out | 4 ++ src/test/regress/expected/publication.out | 2 + 22 files changed, 180 insertions(+), 395 deletions(-)