]> granicus.if.org Git - postgresql/commitdiff
Tie loose ends in psql's new \dP command
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 17 Apr 2019 22:35:41 +0000 (18:35 -0400)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 17 Apr 2019 22:38:49 +0000 (18:38 -0400)
* Remove one unnecessary pg_class join in SQL command.  Not needed,
  because we use a regclass cast instead.

* Doc: refer to "partitioned relations" rather than specifically tables,
  since indexes are also displayed.

* Rename "On table" column to "Table", for consistency with \di.

Author: Justin Pryzby
Discussion: https://postgr.es/m/20190407212525.GB10080@telsasoft.com

doc/src/sgml/ref/psql-ref.sgml
src/bin/psql/describe.c
src/test/regress/expected/psql.out

index 636df6c0ec43e7847247883f040a847634f49d64..d5441a9e4115bdc27e99c75507695f1efd377215 100644 (file)
@@ -1675,15 +1675,15 @@ testdb=&gt;
 
         <para>
         If the modifier <literal>n</literal> (<quote>nested</quote>) is used,
-        or a pattern is specified, then non-root partitioned tables are
+        or a pattern is specified, then non-root partitioned relations are
         included, and a column is shown displaying the parent of each
         partitioned relation.
         </para>
 
         <para>
-        If <literal>+</literal> is appended to the command, the sum of sizes of
-        table's partitions (including that of their indexes) is also displayed,
-        along with the associated description.
+        If <literal>+</literal> is appended to the command name, the sum of the
+        sizes of each relation's partitions is also displayed, along with the
+        relation's description.
         If <literal>n</literal> is combined with <literal>+</literal>, two
         sizes are shown: one including the total size of directly-attached
         leaf partitions, and another showing the total size of all partitions,
index 8a269016333abae54b10cf450de886ae4eaf9867..ee00c5da08aabcf03d4ab19d9f7b2cd422ff3e4b 100644 (file)
@@ -3861,13 +3861,13 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
 
        if (showNested || pattern)
                appendPQExpBuffer(&buf,
-                                                 ",\n  c3.oid::regclass as \"%s\"",
+                                                 ",\n  inh.inhparent::regclass as \"%s\"",
                                                  gettext_noop("Parent name"));
 
        if (showIndexes)
                appendPQExpBuffer(&buf,
                                                  ",\n c2.oid::regclass as \"%s\"",
-                                                 gettext_noop("On table"));
+                                                 gettext_noop("Table"));
 
        if (verbose)
        {
@@ -3902,8 +3902,7 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
 
        if (showNested || pattern)
                appendPQExpBufferStr(&buf,
-                                                        "\n     LEFT JOIN pg_catalog.pg_inherits inh ON c.oid = inh.inhrelid"
-                                                        "\n     LEFT JOIN pg_catalog.pg_class c3 ON c3.oid = inh.inhparent");
+                                                        "\n     LEFT JOIN pg_catalog.pg_inherits inh ON c.oid = inh.inhrelid");
 
        if (verbose)
        {
index 23e540d2bba77359dceaa22f91892b703ed5068c..35856bffdd273a12b4e1f2b77535a1a286ebd3aa 100644 (file)
@@ -4615,7 +4615,7 @@ create index testpart_orange_index on testpart_orange(logdate);
 -- only partition related object should be displayed
 \dP test*apple*
                                        List of partitioned relations
-  Schema  |         Name         |         Owner         |       Type        | Parent name |    On table    
+  Schema  |         Name         |         Owner         |       Type        | Parent name |     Table      
 ----------+----------------------+-----------------------+-------------------+-------------+----------------
  testpart | testpart_apple       | testrole_partitioning | partitioned table |             | 
  testpart | testpart_apple_index | testrole_partitioning | partitioned index |             | testpart_apple
@@ -4630,7 +4630,7 @@ create index testpart_orange_index on testpart_orange(logdate);
 
 \dPi test*apple*
                               List of partitioned indexes
-  Schema  |         Name         |         Owner         | Parent name |    On table    
+  Schema  |         Name         |         Owner         | Parent name |     Table      
 ----------+----------------------+-----------------------+-------------+----------------
  testpart | testpart_apple_index | testrole_partitioning |             | testpart_apple
 (1 row)
@@ -4665,14 +4665,14 @@ insert into parent_tab values (generate_series(30,39));
 
 \dPi
                  List of partitioned indexes
-  Schema  |     Name     |         Owner         |  On table  
+  Schema  |     Name     |         Owner         |   Table    
 ----------+--------------+-----------------------+------------
  testpart | parent_index | testrole_partitioning | parent_tab
 (1 row)
 
 \dP testpart.*
                                      List of partitioned relations
-  Schema  |        Name        |         Owner         |       Type        | Parent name  |  On table   
+  Schema  |        Name        |         Owner         |       Type        | Parent name  |    Table    
 ----------+--------------------+-----------------------+-------------------+--------------+-------------
  testpart | parent_tab         | testrole_partitioning | partitioned table |              | 
  testpart | child_30_40        | testrole_partitioning | partitioned table | parent_tab   | 
@@ -4682,7 +4682,7 @@ insert into parent_tab values (generate_series(30,39));
 
 \dP
                           List of partitioned relations
-  Schema  |     Name     |         Owner         |       Type        |  On table  
+  Schema  |     Name     |         Owner         |       Type        |   Table    
 ----------+--------------+-----------------------+-------------------+------------
  testpart | parent_tab   | testrole_partitioning | partitioned table | 
  testpart | parent_index | testrole_partitioning | partitioned index | parent_tab
@@ -4698,7 +4698,7 @@ insert into parent_tab values (generate_series(30,39));
 
 \dPin
                             List of partitioned indexes
-  Schema  |        Name        |         Owner         | Parent name  |  On table   
+  Schema  |        Name        |         Owner         | Parent name  |    Table    
 ----------+--------------------+-----------------------+--------------+-------------
  testpart | parent_index       | testrole_partitioning |              | parent_tab
  testpart | child_30_40_id_idx | testrole_partitioning | parent_index | child_30_40
@@ -4706,7 +4706,7 @@ insert into parent_tab values (generate_series(30,39));
 
 \dPn
                                      List of partitioned relations
-  Schema  |        Name        |         Owner         |       Type        | Parent name  |  On table   
+  Schema  |        Name        |         Owner         |       Type        | Parent name  |    Table    
 ----------+--------------------+-----------------------+-------------------+--------------+-------------
  testpart | parent_tab         | testrole_partitioning | partitioned table |              | 
  testpart | child_30_40        | testrole_partitioning | partitioned table | parent_tab   | 
@@ -4716,7 +4716,7 @@ insert into parent_tab values (generate_series(30,39));
 
 \dPn testpart.*
                                      List of partitioned relations
-  Schema  |        Name        |         Owner         |       Type        | Parent name  |  On table   
+  Schema  |        Name        |         Owner         |       Type        | Parent name  |    Table    
 ----------+--------------------+-----------------------+-------------------+--------------+-------------
  testpart | parent_tab         | testrole_partitioning | partitioned table |              | 
  testpart | child_30_40        | testrole_partitioning | partitioned table | parent_tab   |