diff options
author | Michael Paquier <michael@paquier.xyz> | 2020-07-15 09:03:10 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2020-07-15 09:03:10 +0900 |
commit | 2a10fdc4307a667883f7a3369cb93a721ade9680 (patch) | |
tree | 634b6964507faa666395bef8542be4c5c7eef5f4 /doc/src | |
parent | 689696c7110f148ede8004aae50d7543d05b5587 (diff) | |
download | postgresql-2a10fdc4307a667883f7a3369cb93a721ade9680.tar.gz postgresql-2a10fdc4307a667883f7a3369cb93a721ade9680.zip |
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
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/func.sgml | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index cc83d6652e4..959f6a1c2f2 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -22826,7 +22826,8 @@ SELECT collation for ('foo' COLLATE "de_DE"); object). This description is intended to be human-readable, and might be translated, depending on server configuration. This is especially useful to determine the identity of an object referenced in the - <structname>pg_depend</structname> catalog. + <structname>pg_depend</structname> catalog. This function returns + <literal>NULL</literal> values for undefined objects. </para></entry> </row> @@ -22858,7 +22859,8 @@ SELECT collation for ('foo' COLLATE "de_DE"); otherwise <literal>NULL</literal>; <parameter>identity</parameter> is the complete object identity, with the precise format depending on object type, and each name within the - format being schema-qualified and quoted as necessary. + format being schema-qualified and quoted as necessary. Undefined + objects are identified with <literal>NULL</literal> values. </para></entry> </row> @@ -22915,6 +22917,7 @@ SELECT collation for ('foo' COLLATE "de_DE"); <parameter>objsubid</parameter> is the sub-object ID, or zero if none. This function is the inverse of <function>pg_identify_object_as_address</function>. + Undefined objects are identified with <literal>NULL</literal> values. </para></entry> </row> </tbody> |