Fix two crashes on a concurrently dropped schema

pg_identify_object() looks up the object's schema name without a lock
on the schema, so a concurrent DROP SCHEMA can make get_namespace_name()
return NULL, which was then passed to quote_identifier().  Report the
schema as NULL instead, as is already done for objects that have gone
away.

Similarly, schema_to_xml() and the related SQL/XML functions look up
the schema name without a lock on the schema, and a concurrent DROP
SCHEMA can make get_namespace_name() return NULL, which was then
dereferenced.  Report that the schema does not exist, or skip it when
mapping all schemas of the database.

Author: Baji Shaik <[email protected]>
Discussion: 
https://www.postgresql.org/message-id/CA+fm-RPD0m9QL8W+804SGBBxn5iFz5wn=kncap9skm-s4pu...@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a2732c98671d86a06f7ec21d469a52a7bf4efdc9

Modified Files
--------------
src/backend/catalog/objectaddress.c | 13 +++++++-----
src/backend/utils/adt/xml.c         | 40 ++++++++++++++++++++++++++++++-------
2 files changed, 41 insertions(+), 12 deletions(-)

Reply via email to