pgsql: Use LEFT JOINs in some system views in case referenced row doesn

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Use LEFT JOINs in some system views in case referenced row doesn
Date: 2016-08-19 21:13:52
Message-ID: E1bar6u-0003s8-2k@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Use LEFT JOINs in some system views in case referenced row doesn't exist.

In particular, left join to pg_authid so that rows in pg_stat_activity
don't disappear if the session's owning user has been dropped.
Also convert a few joins to pg_database to left joins, in the same spirit,
though that case might be harder to hit. We were doing this in other
views already, so it was a bit inconsistent that these views didn't.

Oskari Saarenmaa, with some further tweaking by me

Discussion: <56E87CD8(dot)60007(at)ohmu(dot)fi>

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/8299471c37fff0b0f5a777a12f920125310c0efe

Modified Files
--------------
src/backend/catalog/system_views.sql | 20 +++++++++-----------
src/include/catalog/catversion.h | 2 +-
src/test/regress/expected/rules.out | 20 +++++++++-----------
3 files changed, 19 insertions(+), 23 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-08-19 21:33:04 pgsql: Allow empty queries in pgbench.
Previous Message Tom Lane 2016-08-19 18:35:51 pgsql: Guard against parallel-restricted functions in VALUES expression

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-08-19 21:16:26 Re: Show dropped users' backends in pg_stat_activity
Previous Message Piotr Stefaniak 2016-08-19 21:05:55 Re: Re: PROPOSAL: make PostgreSQL sanitizers-friendly (and prevent information disclosure)