diff options
| author | Dean Rasheed <dean.a.rasheed@gmail.com> | 2021-07-15 08:49:45 +0100 | 
|---|---|---|
| committer | Dean Rasheed <dean.a.rasheed@gmail.com> | 2021-07-15 08:49:45 +0100 | 
| commit | 2bfb50b3df11399ed80347dd03bfaf8cd5acf962 (patch) | |
| tree | 126051120d4735ba8619d4102a65e92d366f36e0 /src/test | |
| parent | ffc9ddaea33f6dfd3dfa95828a0970fbb617bf8a (diff) | |
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=gFrjti9ROfynqSAGA@mail.gmail.com
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/copy2.out | 2 | ||||
| -rw-r--r-- | src/test/regress/expected/foreign_data.out | 4 | ||||
| -rw-r--r-- | src/test/regress/expected/publication.out | 2 | 
3 files changed, 8 insertions, 0 deletions
diff --git a/src/test/regress/expected/copy2.out b/src/test/regress/expected/copy2.out index c64f0719e7b..5f3685e9efe 100644 --- a/src/test/regress/expected/copy2.out +++ b/src/test/regress/expected/copy2.out @@ -67,6 +67,8 @@ LINE 1: COPY x from stdin (force_not_null (a), force_not_null (b));                                                 ^  COPY x from stdin (force_null (a), force_null (b));  ERROR:  conflicting or redundant options +LINE 1: COPY x from stdin (force_null (a), force_null (b)); +                                           ^  COPY x from stdin (convert_selectively (a), convert_selectively (b));  ERROR:  conflicting or redundant options  LINE 1: COPY x from stdin (convert_selectively (a), convert_selectiv... diff --git a/src/test/regress/expected/foreign_data.out b/src/test/regress/expected/foreign_data.out index 809d40a79a9..426080ae39b 100644 --- a/src/test/regress/expected/foreign_data.out +++ b/src/test/regress/expected/foreign_data.out @@ -95,6 +95,8 @@ CREATE FOREIGN DATA WRAPPER test_fdw HANDLER invalid_fdw_handler;  -- ERROR  ERROR:  function invalid_fdw_handler must return type fdw_handler  CREATE FOREIGN DATA WRAPPER test_fdw HANDLER test_fdw_handler HANDLER invalid_fdw_handler;  -- ERROR  ERROR:  conflicting or redundant options +LINE 1: ...GN DATA WRAPPER test_fdw HANDLER test_fdw_handler HANDLER in... +                                                             ^  CREATE FOREIGN DATA WRAPPER test_fdw HANDLER test_fdw_handler;  DROP FOREIGN DATA WRAPPER test_fdw;  -- ALTER FOREIGN DATA WRAPPER @@ -201,6 +203,8 @@ ALTER FOREIGN DATA WRAPPER foo HANDLER invalid_fdw_handler;  -- ERROR  ERROR:  function invalid_fdw_handler must return type fdw_handler  ALTER FOREIGN DATA WRAPPER foo HANDLER test_fdw_handler HANDLER anything;  -- ERROR  ERROR:  conflicting or redundant options +LINE 1: ...FOREIGN DATA WRAPPER foo HANDLER test_fdw_handler HANDLER an... +                                                             ^  ALTER FOREIGN DATA WRAPPER foo HANDLER test_fdw_handler;  WARNING:  changing the foreign-data wrapper handler can change behavior of existing foreign tables  DROP FUNCTION invalid_fdw_handler(); diff --git a/src/test/regress/expected/publication.out b/src/test/regress/expected/publication.out index 63d6ab7a4ef..b5b065a1b6f 100644 --- a/src/test/regress/expected/publication.out +++ b/src/test/regress/expected/publication.out @@ -27,6 +27,8 @@ CREATE PUBLICATION testpub_xxx WITH (publish = 'cluster, vacuum');  ERROR:  unrecognized "publish" value: "cluster"  CREATE PUBLICATION testpub_xxx WITH (publish_via_partition_root = 'true', publish_via_partition_root = '0');  ERROR:  conflicting or redundant options +LINE 1: ...ub_xxx WITH (publish_via_partition_root = 'true', publish_vi... +                                                             ^  \dRp                                                List of publications          Name        |          Owner           | All tables | Inserts | Updates | Deletes | Truncates | Via root   | 
