Avoid crash in rare case of concurrent DROP

Alvaro Herrera <alvherre@alvh.no-ip.org>

Commit: 02e20bb2dcaa523782a8fe7de1c2ddfefaeff033
Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: 2021-11-05T15:29:35Z
Releases: 14.1
Avoid crash in rare case of concurrent DROP

When a role being dropped contains is referenced by catalog objects that
are concurrently also being dropped, a crash can result while trying to
construct the string that describes the objects.  Suppress that by
ignoring objects whose descriptions are returned as NULL.

The majority of relevant codesites were already cautious about this
already; we had just missed a couple.

This is an old bug, so backpatch all the way back.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/17126-21887f04508cb5c8@postgresql.org

Files

PathChange+/−
src/backend/catalog/dependency.c modified +20 −11
src/backend/catalog/pg_shdepend.c modified +6 −0

Discussion