pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Convert the reg* input functions to report (most) errors softly.
Date: Tue, 27 Dec 2022 17:33:10 +0000
Message-ID: <E1pADp8-000h6a-5b@gemulon.postgresql.org> (raw)

Convert the reg* input functions to report (most) errors softly.

This is not really complete, but it catches most cases of practical
interest.  The main omissions are:

* regtype, regprocedure, and regoperator parse type names by
calling the main grammar, so any grammar-detected syntax error
will still be a hard error.  Also, if one includes a type
modifier in such a type specification, errors detected by the
typmodin function will be hard errors.

* Lookup errors are handled just by passing missing_ok = true
to the relevant catalog lookup function.  Because we've used
quite a restrictive definition of "missing_ok", this means that
edge cases such as "the named schema exists, but you lack
USAGE permission on it" are still hard errors.

It would make sense to me to replace most/all missing_ok
parameters with an escontext parameter and then allow these
additional lookup failure cases to be trapped too.  But that's
a job for some other day.

Discussion: https://postgr.es/m/3342239.1671988406@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/858e776c84f48841e7e16fba7b690b76e54f3675

Modified Files
--------------
src/backend/catalog/objectaddress.c   |   5 +-
src/backend/parser/parse_type.c       |  50 ++++---
src/backend/tsearch/dict_thesaurus.c  |   4 +-
src/backend/utils/adt/misc.c          |   2 +-
src/backend/utils/adt/regproc.c       | 269 +++++++++++++++++++++++-----------
src/backend/utils/adt/tsvector_op.c   |   2 +-
src/backend/utils/cache/ts_cache.c    |  31 +++-
src/backend/utils/fmgr/funcapi.c      |   2 +-
src/include/parser/parse_type.h       |   5 +-
src/include/utils/regproc.h           |   2 +-
src/pl/plperl/plperl.c                |   2 +-
src/pl/plpgsql/src/pl_gram.y          |   2 +-
src/pl/plpython/plpy_spi.c            |   2 +-
src/pl/tcl/pltcl.c                    |   5 +-
src/test/regress/expected/regproc.out | 125 +++++++++++++++-
src/test/regress/sql/regproc.sql      |  23 +++
16 files changed, 403 insertions(+), 128 deletions(-)



Message-ID: <E1pADp8-000h6a-5b@gemulon.postgresql.org>
Permalink:  ../E1pADp8-000h6a-5b@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pADp8-000h6a-5b@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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Convert the reg* input functions to report (most) errors softly.
  In-Reply-To: <E1pADp8-000h6a-5b@gemulon.postgresql.org>
  References: <E1pADp8-000h6a-5b@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