pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve reporting of "conflicting or redundant options" errors.
Date: Thu, 15 Jul 2021 07:54:22 +0000
Message-ID: <E1m3wCM-0003o9-Bs@gemulon.postgresql.org> (raw)

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

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(-)



Message-ID: <E1m3wCM-0003o9-Bs@gemulon.postgresql.org>
Permalink:  ../E1m3wCM-0003o9-Bs@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1m3wCM-0003o9-Bs@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: dean.a.rasheed@gmail.com
  Subject: Re: pgsql: Improve reporting of "conflicting or redundant options" errors.
  In-Reply-To: <E1m3wCM-0003o9-Bs@gemulon.postgresql.org>
  References: <E1m3wCM-0003o9-Bs@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox