Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 421a2c4

Browse files
committed
Tie loose ends in psql's new \dP command
* 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
1 parent b036982 commit 421a2c4

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

doc/src/sgml/ref/psql-ref.sgml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,15 +1675,15 @@ testdb=>
16751675

16761676
<para>
16771677
If the modifier <literal>n</literal> (<quote>nested</quote>) is used,
1678-
or a pattern is specified, then non-root partitioned tables are
1678+
or a pattern is specified, then non-root partitioned relations are
16791679
included, and a column is shown displaying the parent of each
16801680
partitioned relation.
16811681
</para>
16821682

16831683
<para>
1684-
If <literal>+</literal> is appended to the command, the sum of sizes of
1685-
table's partitions (including that of their indexes) is also displayed,
1686-
along with the associated description.
1684+
If <literal>+</literal> is appended to the command name, the sum of the
1685+
sizes of each relation's partitions is also displayed, along with the
1686+
relation's description.
16871687
If <literal>n</literal> is combined with <literal>+</literal>, two
16881688
sizes are shown: one including the total size of directly-attached
16891689
leaf partitions, and another showing the total size of all partitions,

src/bin/psql/describe.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3861,13 +3861,13 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
38613861

38623862
if (showNested || pattern)
38633863
appendPQExpBuffer(&buf,
3864-
",\n c3.oid::regclass as \"%s\"",
3864+
",\n inh.inhparent::regclass as \"%s\"",
38653865
gettext_noop("Parent name"));
38663866

38673867
if (showIndexes)
38683868
appendPQExpBuffer(&buf,
38693869
",\n c2.oid::regclass as \"%s\"",
3870-
gettext_noop("On table"));
3870+
gettext_noop("Table"));
38713871

38723872
if (verbose)
38733873
{
@@ -3902,8 +3902,7 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
39023902

39033903
if (showNested || pattern)
39043904
appendPQExpBufferStr(&buf,
3905-
"\n LEFT JOIN pg_catalog.pg_inherits inh ON c.oid = inh.inhrelid"
3906-
"\n LEFT JOIN pg_catalog.pg_class c3 ON c3.oid = inh.inhparent");
3905+
"\n LEFT JOIN pg_catalog.pg_inherits inh ON c.oid = inh.inhrelid");
39073906

39083907
if (verbose)
39093908
{

src/test/regress/expected/psql.out

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4615,7 +4615,7 @@ create index testpart_orange_index on testpart_orange(logdate);
46154615
-- only partition related object should be displayed
46164616
\dP test*apple*
46174617
List of partitioned relations
4618-
Schema | Name | Owner | Type | Parent name | On table
4618+
Schema | Name | Owner | Type | Parent name | Table
46194619
----------+----------------------+-----------------------+-------------------+-------------+----------------
46204620
testpart | testpart_apple | testrole_partitioning | partitioned table | |
46214621
testpart | testpart_apple_index | testrole_partitioning | partitioned index | | testpart_apple
@@ -4630,7 +4630,7 @@ create index testpart_orange_index on testpart_orange(logdate);
46304630

46314631
\dPi test*apple*
46324632
List of partitioned indexes
4633-
Schema | Name | Owner | Parent name | On table
4633+
Schema | Name | Owner | Parent name | Table
46344634
----------+----------------------+-----------------------+-------------+----------------
46354635
testpart | testpart_apple_index | testrole_partitioning | | testpart_apple
46364636
(1 row)
@@ -4665,14 +4665,14 @@ insert into parent_tab values (generate_series(30,39));
46654665

46664666
\dPi
46674667
List of partitioned indexes
4668-
Schema | Name | Owner | On table
4668+
Schema | Name | Owner | Table
46694669
----------+--------------+-----------------------+------------
46704670
testpart | parent_index | testrole_partitioning | parent_tab
46714671
(1 row)
46724672

46734673
\dP testpart.*
46744674
List of partitioned relations
4675-
Schema | Name | Owner | Type | Parent name | On table
4675+
Schema | Name | Owner | Type | Parent name | Table
46764676
----------+--------------------+-----------------------+-------------------+--------------+-------------
46774677
testpart | parent_tab | testrole_partitioning | partitioned table | |
46784678
testpart | child_30_40 | testrole_partitioning | partitioned table | parent_tab |
@@ -4682,7 +4682,7 @@ insert into parent_tab values (generate_series(30,39));
46824682

46834683
\dP
46844684
List of partitioned relations
4685-
Schema | Name | Owner | Type | On table
4685+
Schema | Name | Owner | Type | Table
46864686
----------+--------------+-----------------------+-------------------+------------
46874687
testpart | parent_tab | testrole_partitioning | partitioned table |
46884688
testpart | parent_index | testrole_partitioning | partitioned index | parent_tab
@@ -4698,15 +4698,15 @@ insert into parent_tab values (generate_series(30,39));
46984698

46994699
\dPin
47004700
List of partitioned indexes
4701-
Schema | Name | Owner | Parent name | On table
4701+
Schema | Name | Owner | Parent name | Table
47024702
----------+--------------------+-----------------------+--------------+-------------
47034703
testpart | parent_index | testrole_partitioning | | parent_tab
47044704
testpart | child_30_40_id_idx | testrole_partitioning | parent_index | child_30_40
47054705
(2 rows)
47064706

47074707
\dPn
47084708
List of partitioned relations
4709-
Schema | Name | Owner | Type | Parent name | On table
4709+
Schema | Name | Owner | Type | Parent name | Table
47104710
----------+--------------------+-----------------------+-------------------+--------------+-------------
47114711
testpart | parent_tab | testrole_partitioning | partitioned table | |
47124712
testpart | child_30_40 | testrole_partitioning | partitioned table | parent_tab |
@@ -4716,7 +4716,7 @@ insert into parent_tab values (generate_series(30,39));
47164716

47174717
\dPn testpart.*
47184718
List of partitioned relations
4719-
Schema | Name | Owner | Type | Parent name | On table
4719+
Schema | Name | Owner | Type | Parent name | Table
47204720
----------+--------------------+-----------------------+-------------------+--------------+-------------
47214721
testpart | parent_tab | testrole_partitioning | partitioned table | |
47224722
testpart | child_30_40 | testrole_partitioning | partitioned table | parent_tab |

0 commit comments

Comments
 (0)