pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Fetter <david@fetter.org>
To: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: Rafia Sabih <rafia.pghackers@gmail.com>
Cc: PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: [PATCH v5] Show detailed table persistence in \dt+
Date: Mon, 29 Apr 2019 16:23:58 +0200
Message-ID: <20190429142358.GE2954@fetter.org> (raw)
In-Reply-To: <alpine.DEB.2.21.1904290831550.8815@lancre>
References: <CA+FpmFdx2aDtyiVD2av9+QAunA1L5uscm3dL1SFbcOs8-W678g@mail.gmail.com>
	<CA+FpmFeurtDiutfh2yv0T4S=zY0iegcSStR-5xJ9H7vP2XKQsg@mail.gmail.com>
	<20190427041849.GL28936@fetter.org>
	<alpine.DEB.2.21.1904270844180.29865@lancre>
	<20190427174330.GN28936@fetter.org>
	<alpine.DEB.2.21.1904272214030.29865@lancre>
	<20190428151541.GQ28936@fetter.org>
	<alpine.DEB.2.21.1904281917330.29865@lancre>
	<20190429041902.GC2954@fetter.org>
	<alpine.DEB.2.21.1904290831550.8815@lancre>

On Mon, Apr 29, 2019 at 08:48:17AM +0200, Fabien COELHO wrote:
> 
> Hello David,
> 
> > My mistake. Fixed.
> 
> About v6: applies, compiles, make check ok.
> 
> Code is ok.
> 
> Maybe there could be a comment to tell that prior version are not addressed,
> something like:
> 
>     ...
>   }
>   /* else do not bother guessing the temporary status on old version */

Did something like this.

> No tests, pending an added TAP test infrastructure for psql.

Right.

> I have a question a out the index stuff: indexes seem to appear as entries
> in pg_class, and ISTM that they can be temporary/unlogged/permanent as
> attached to corresponding objects. So the guard is not very useful and it
> could make sense to show the information on indexes as well.

Done.

Best,
David.
-- 
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

Attachments:

v7-0001-Show-detailed-relation-persistence-in-dt.patch (text/x-diff, 2.1K) download From 8fdc657cb567ec760802449da80b2aad5ae451f1 Mon Sep 17 00:00:00 2001 From: David Fetter <david.fetter@onelogin.com> Date: Mon, 22 Apr 2019 17:50:48 -0700 Subject: [PATCH v7] Show detailed relation persistence in \dt+ To: hackers MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2.20.1" This is a multi-part message in MIME format. --------------2.20.1 Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit \d would show this for individual relations, but there wasn't an overarching view of all relations. Now, there is. diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index ee00c5da08..4c6f12ba91 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -3631,7 +3631,7 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys PQExpBufferData buf; PGresult *res; printQueryOpt myopt = pset.popt; - static const bool translate_columns[] = {false, false, true, false, false, false, false}; + static const bool translate_columns[] = {false, false, true, false, false, false, false, false}; /* If tabtypes is empty, we default to \dtvmsE (but see also command.c) */ if (!(showTables || showIndexes || showViews || showMatViews || showSeq || showForeign)) @@ -3679,6 +3679,21 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys if (verbose) { + /* + * Show whether a relation is permanent, temporary, or unlogged. + */ + if (pset.sversion >= 90100) + appendPQExpBuffer(&buf, + ",\n CASE c.relpersistence WHEN 'p' THEN 'permanent' WHEN 't' THEN 'temporary' WHEN 'u' THEN 'unlogged' ELSE 'unknown' END as \"%s\"", + gettext_noop("Persistence")); + else if (pset.sversion >= 80400) + appendPQExpBuffer(&buf, + ",\n CASE WHEN c.relistemp THEN 'temporary' ELSE 'permanent' END as \"%s\"", + gettext_noop("Persistence")); + /* + * No attempt is made to show persistence in long-obsolete versions. + */ + /* * As of PostgreSQL 9.0, use pg_table_size() to show a more accurate * size of a table, including FSM, VM and TOAST tables. --------------2.20.1--

view thread (19+ messages)  latest in thread

Message-ID: <20190429142358.GE2954@fetter.org>
Permalink:  ../20190429142358.GE2954@fetter.org/
Also on:    postgresql.org/message-id/20190429142358.GE2954@fetter.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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: david@fetter.org, coelho@cri.ensmp.fr, rafia.pghackers@gmail.com
  Subject: Re: [PATCH v5] Show detailed table persistence in \dt+
  In-Reply-To: <20190429142358.GE2954@fetter.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