diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2022-01-17 21:18:49 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2022-01-17 21:18:49 -0500 |
commit | 3886785b4ce59147b92319e7204ab64a9d8801cb (patch) | |
tree | 5cf93513b91af08d106b29a177925c910e8ac2fc /src/backend/access/gist/gistxlog.c | |
parent | 4e8726566e4d7c0e712d16c0dc7a27d212ece090 (diff) | |
download | postgresql-3886785b4ce59147b92319e7204ab64a9d8801cb.tar.gz postgresql-3886785b4ce59147b92319e7204ab64a9d8801cb.zip |
Fix psql \d's query for identifying parent triggers.
The original coding (from c33869cc3) failed with "more than one row
returned by a subquery used as an expression" if there were unrelated
triggers of the same tgname on parent partitioned tables. (That's
possible because statement-level triggers don't get inherited.) Fix
by applying LIMIT 1 after sorting the candidates by inheritance level.
Also, wrap the subquery in a CASE so that we don't have to execute it at
all when the trigger is visibly non-inherited. Aside from saving some
cycles, this avoids the need for a confusing and undocumented NULLIF().
While here, tweak the format of the emitted query to look a bit
nicer for "psql -E", and add some explanation of this subquery,
because it badly needs it.
Report and patch by Justin Pryzby (with some editing by me).
Back-patch to v13 where the faulty code came in.
Discussion: https://postgr.es/m/20211217154356.GJ17618@telsasoft.com
Diffstat (limited to 'src/backend/access/gist/gistxlog.c')
0 files changed, 0 insertions, 0 deletions