From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Eliminate cache lookup errors in SQL functions for object addres
Date: Wed, 15 Jul 2020 00:05:01 +0000
Message-ID: <E1jvUuz-0006Xs-9f@gemulon.postgresql.org> (raw)
Eliminate cache lookup errors in SQL functions for object addresses
When using the following functions, users could see various types of
errors of the type "cache lookup failed for OID XXX" with elog(), that
can only be used for internal errors:
* pg_describe_object()
* pg_identify_object()
* pg_identify_object_as_address()
The set of APIs managing object addresses for all object types are made
smarter by gaining a new argument "missing_ok" that allows any caller to
control if an error is raised or not on an undefined object. The SQL
functions listed above are changed to handle the case where an object is
missing.
Regression tests are added for all object types for the cases where
these are undefined. Before this commit, these cases failed with cache
lookup errors, and now they basically return NULL (minus the name of the
object type requested).
Author: Michael Paquier
Reviewed-by: Aleksander Alekseev, Dmitry Dolgov, Daniel Gustafsson,
Álvaro Herrera, Kyotaro Horiguchi
Discussion: https://postgr.es/m/CAB7nPqSZxrSmdHK-rny7z8mi=EAFXJ5J-0RbzDw6aus=wB5azQ@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/2a10fdc4307a667883f7a3369cb93a721ade9680
Modified Files
--------------
contrib/sepgsql/database.c | 6 +-
contrib/sepgsql/dml.c | 4 +-
contrib/sepgsql/label.c | 4 +-
contrib/sepgsql/proc.c | 14 +-
contrib/sepgsql/relation.c | 20 +-
contrib/sepgsql/schema.c | 6 +-
doc/src/sgml/func.sgml | 7 +-
src/backend/catalog/dependency.c | 30 +-
src/backend/catalog/objectaddress.c | 997 ++++++++++++++++++++-------
src/backend/catalog/pg_depend.c | 4 +-
src/backend/catalog/pg_shdepend.c | 8 +-
src/backend/commands/event_trigger.c | 9 +-
src/backend/commands/extension.c | 6 +-
src/backend/commands/tablecmds.c | 12 +-
src/backend/utils/adt/regproc.c | 20 +-
src/include/catalog/objectaddress.h | 12 +-
src/include/utils/regproc.h | 5 +-
src/test/regress/expected/object_address.out | 100 +++
src/test/regress/sql/object_address.sql | 64 ++
19 files changed, 996 insertions(+), 332 deletions(-)
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: michael@paquier.xyz
Subject: Re: pgsql: Eliminate cache lookup errors in SQL functions for object addres
In-Reply-To: <E1jvUuz-0006Xs-9f@gemulon.postgresql.org>
References: <E1jvUuz-0006Xs-9f@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