pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix infelicities in describeOneTableDetails' partitioned-table h
Date: Wed, 24 Jul 2019 22:15:11 +0000
Message-ID: <E1hqPXT-00035N-R9@gemulon.postgresql.org> (raw)

Fix infelicities in describeOneTableDetails' partitioned-table handling.

describeOneTableDetails issued a partition-constraint-fetching query
for every table, even ones it knows perfectly well are not partitions.

To add insult to injury, it then proceeded to leak the empty PGresult
if the table wasn't a partition.  Doing that a lot of times might
amount to a meaningful leak, so this seems like a back-patchable bug.

Fix that, and also fix a related PGresult leak in the partition-parent
case (though that leak would occur only if we got no row, which is
unexpected).

Minor code beautification too, to make this code look more like the
pre-existing code around it.

Back-patch the whole change into v12.  However, the fact that we already
know whether the table is a partition dates only to commit 1af25ca0c;
back-patching the relevant changes from that is probably more churn
than is justified in released branches.  Hence, in v11 and v10, just
do the minimum to fix the PGresult leaks.

Noted while messing around with adjacent code for yesterday's \d
improvements.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4e784f35145bc6e01d54282afe10d9bb5200ebfe

Modified Files
--------------
src/bin/psql/describe.c | 43 ++++++++++++++++++++++---------------------
1 file changed, 22 insertions(+), 21 deletions(-)



view thread (4+ messages)

Message-ID: <E1hqPXT-00035N-R9@gemulon.postgresql.org>
Permalink:  ../E1hqPXT-00035N-R9@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1hqPXT-00035N-R9@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix infelicities in describeOneTableDetails' partitioned-table h
  In-Reply-To: <E1hqPXT-00035N-R9@gemulon.postgresql.org>
  References: <E1hqPXT-00035N-R9@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox