agora inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH v7] make \d pg_toast.foo show its indices
17+ messages / 3 participants
[nested] [flat]

* [PATCH v3] make \d pg_toast.foo show its indices
@ 2019-05-03 14:24 Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 17+ messages in thread

From: Justin Pryzby @ 2019-05-03 14:24 UTC (permalink / raw)

---
 src/bin/psql/describe.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af2f440..c65bc82 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -2275,6 +2275,7 @@ describeOneTableDetails(const char *schemaname,
 	else if (tableinfo.relkind == RELKIND_RELATION ||
 			 tableinfo.relkind == RELKIND_MATVIEW ||
 			 tableinfo.relkind == RELKIND_FOREIGN_TABLE ||
+			 tableinfo.relkind == RELKIND_TOASTVALUE ||
 			 tableinfo.relkind == RELKIND_PARTITIONED_TABLE)
 	{
 		/* Footer information about a table */
-- 
2.7.4


--LpQ9ahxlCli8rRTG
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
 filename="v3-0002-show-childs-of-partitioned-indices.patch"



^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* [PATCH v5] make \d pg_toast.foo show its indices
@ 2019-05-03 14:24 Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 17+ messages in thread

From: Justin Pryzby @ 2019-05-03 14:24 UTC (permalink / raw)

---
 src/bin/psql/describe.c            | 1 +
 src/test/regress/expected/psql.out | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 13ed2e1..86a7610 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -2303,6 +2303,7 @@ describeOneTableDetails(const char *schemaname,
 	else if (tableinfo.relkind == RELKIND_RELATION ||
 			 tableinfo.relkind == RELKIND_MATVIEW ||
 			 tableinfo.relkind == RELKIND_FOREIGN_TABLE ||
+			 tableinfo.relkind == RELKIND_TOASTVALUE ||
 			 tableinfo.relkind == RELKIND_PARTITIONED_TABLE)
 	{
 		/* Footer information about a table */
diff --git a/src/test/regress/expected/psql.out b/src/test/regress/expected/psql.out
index 5c8e439..d53dbb0 100644
--- a/src/test/regress/expected/psql.out
+++ b/src/test/regress/expected/psql.out
@@ -4757,4 +4757,6 @@ TOAST table "pg_toast.pg_toast_2619"
  chunk_seq  | integer
  chunk_data | bytea
 For table: "pg_catalog.pg_statistic"
+Indexes:
+    "pg_toast_2619_index" PRIMARY KEY, btree (chunk_id, chunk_seq)
 
-- 
2.7.4


--dkEUBIird37B8yKS
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
 filename="v5-0003-show-childs-of-partitioned-indices.patch"



^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* [PATCH v7] make \d pg_toast.foo show its indices
@ 2019-05-03 14:24 Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 17+ messages in thread

From: Justin Pryzby @ 2019-05-03 14:24 UTC (permalink / raw)

---
 src/bin/psql/describe.c            | 1 +
 src/test/regress/expected/psql.out | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 9cd2e7d..b3b94d1 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -2304,6 +2304,7 @@ describeOneTableDetails(const char *schemaname,
 	else if (tableinfo.relkind == RELKIND_RELATION ||
 			 tableinfo.relkind == RELKIND_MATVIEW ||
 			 tableinfo.relkind == RELKIND_FOREIGN_TABLE ||
+			 tableinfo.relkind == RELKIND_TOASTVALUE ||
 			 tableinfo.relkind == RELKIND_PARTITIONED_TABLE)
 	{
 		/* Footer information about a table */
diff --git a/src/test/regress/expected/psql.out b/src/test/regress/expected/psql.out
index 5c8e439..d53dbb0 100644
--- a/src/test/regress/expected/psql.out
+++ b/src/test/regress/expected/psql.out
@@ -4757,4 +4757,6 @@ TOAST table "pg_toast.pg_toast_2619"
  chunk_seq  | integer
  chunk_data | bytea
 For table: "pg_catalog.pg_statistic"
+Indexes:
+    "pg_toast_2619_index" PRIMARY KEY, btree (chunk_id, chunk_seq)
 
-- 
2.7.4


--ryJZkp9/svQ58syV
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
 filename="v7-0003-show-childs-of-partitioned-indices.patch"



^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* [PATCH v5] make \d pg_toast.foo show its indices
@ 2019-05-03 14:24 Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 17+ messages in thread

From: Justin Pryzby @ 2019-05-03 14:24 UTC (permalink / raw)

---
 src/bin/psql/describe.c            | 1 +
 src/test/regress/expected/psql.out | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 13ed2e1..86a7610 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -2303,6 +2303,7 @@ describeOneTableDetails(const char *schemaname,
 	else if (tableinfo.relkind == RELKIND_RELATION ||
 			 tableinfo.relkind == RELKIND_MATVIEW ||
 			 tableinfo.relkind == RELKIND_FOREIGN_TABLE ||
+			 tableinfo.relkind == RELKIND_TOASTVALUE ||
 			 tableinfo.relkind == RELKIND_PARTITIONED_TABLE)
 	{
 		/* Footer information about a table */
diff --git a/src/test/regress/expected/psql.out b/src/test/regress/expected/psql.out
index 5c8e439..d53dbb0 100644
--- a/src/test/regress/expected/psql.out
+++ b/src/test/regress/expected/psql.out
@@ -4757,4 +4757,6 @@ TOAST table "pg_toast.pg_toast_2619"
  chunk_seq  | integer
  chunk_data | bytea
 For table: "pg_catalog.pg_statistic"
+Indexes:
+    "pg_toast_2619_index" PRIMARY KEY, btree (chunk_id, chunk_seq)
 
-- 
2.7.4


--Qxx1br4bt0+wmkIi
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
 filename="v6-0003-show-childs-of-partitioned-indices.patch"



^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* [PATCH v2 1/2] make \d pg_toast.foo show its indices
@ 2019-05-03 14:24 Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 17+ messages in thread

From: Justin Pryzby @ 2019-05-03 14:24 UTC (permalink / raw)

---
 src/bin/psql/describe.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index d7390d5..d26d986 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -2274,6 +2274,7 @@ describeOneTableDetails(const char *schemaname,
 	else if (tableinfo.relkind == RELKIND_RELATION ||
 			 tableinfo.relkind == RELKIND_MATVIEW ||
 			 tableinfo.relkind == RELKIND_FOREIGN_TABLE ||
+			 tableinfo.relkind == RELKIND_TOASTVALUE ||
 			 tableinfo.relkind == RELKIND_PARTITIONED_TABLE)
 	{
 		/* Footer information about a table */
-- 
2.7.4


--brEuL7wsLY8+TuWz
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
 filename="v2-0002-print-table-associated-with-given-TOAST-table.patch"



^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* [PATCH v3] make \d pg_toast.foo show its indices
@ 2019-05-03 14:24 Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 17+ messages in thread

From: Justin Pryzby @ 2019-05-03 14:24 UTC (permalink / raw)

---
 src/bin/psql/describe.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af2f440..c65bc82 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -2275,6 +2275,7 @@ describeOneTableDetails(const char *schemaname,
 	else if (tableinfo.relkind == RELKIND_RELATION ||
 			 tableinfo.relkind == RELKIND_MATVIEW ||
 			 tableinfo.relkind == RELKIND_FOREIGN_TABLE ||
+			 tableinfo.relkind == RELKIND_TOASTVALUE ||
 			 tableinfo.relkind == RELKIND_PARTITIONED_TABLE)
 	{
 		/* Footer information about a table */
-- 
2.7.4


--AqsLC8rIMeq19msA
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
 filename="v4-0002-show-childs-and-tablespaces-of-partitioned-indice.patch"



^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: [HACKERS] proposal: schema variables
@ 2019-06-30 03:10 Pavel Stehule <[email protected]>
  0 siblings, 0 replies; 17+ messages in thread

From: Pavel Stehule @ 2019-06-30 03:10 UTC (permalink / raw)
  To: Artur Zakirov <[email protected]>; +Cc: Dean Rasheed <[email protected]>; Fabien COELHO <[email protected]>; Gilles Darold <[email protected]>; PostgreSQL Hackers <[email protected]>

pá 24. 5. 2019 v 19:12 odesílatel Pavel Stehule <[email protected]>
napsal:

> Hi
>
> čt 9. 5. 2019 v 6:34 odesílatel Pavel Stehule <[email protected]>
> napsal:
>
>> Hi
>>
>> rebased patch
>>
>
> rebase after pgindent
>

fresh rebase

Regards

Pavel


> Regards
>
> Pavel
>
>>
>> Regards
>>
>> Pavel
>>
>>
>>


Attachments:

  [application/gzip] schema-variables-20190630.patch.gz (65.9K, ../../CAFj8pRDog1b+66-8ZW0_7JmKr_hbu1fs+CKrEkfS+RU=ZJNdGw@mail.gmail.com/3-schema-variables-20190630.patch.gz)
  download

^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* [PATCH 4/4] Move the double-plus "Size" columns to the right
@ 2021-12-17 15:35 Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 17+ messages in thread

From: Justin Pryzby @ 2021-12-17 15:35 UTC (permalink / raw)

\dn, \dA, \db, \l, and (for consistency) \d and \dP+

It doesn't make much sense that one cannot show a database's default
tablespace without also showing its size, and stat()ing every segment of
every relation in the DB.
---
 src/bin/psql/describe.c            | 40 ++++++++++++----------
 src/test/regress/expected/psql.out | 54 +++++++++++++++---------------
 2 files changed, 49 insertions(+), 45 deletions(-)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7eff1249015..cc5f00fffe7 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -241,17 +241,15 @@ describeTablespaces(const char *pattern, int verbose)
 		printACLColumn(&buf, "spcacl");
 
 		appendPQExpBuffer(&buf,
-						  ",\n  spcoptions AS \"%s\"",
-						  gettext_noop("Options"));
+						  ",\n  spcoptions AS \"%s\""
+						  ",\n  pg_catalog.shobj_description(oid, 'pg_tablespace') AS \"%s\"",
+						  gettext_noop("Options"),
+						  gettext_noop("Description"));
 
 		if (verbose > 1)
 			appendPQExpBuffer(&buf,
 							  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_tablespace_size(oid)) AS \"%s\"",
 							  gettext_noop("Size"));
-
-		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.shobj_description(oid, 'pg_tablespace') AS \"%s\"",
-						  gettext_noop("Description"));
 	}
 
 	appendPQExpBufferStr(&buf,
@@ -972,13 +970,6 @@ listAllDbs(const char *pattern, int verbose)
 						  gettext_noop("ICU Rules"));
 	appendPQExpBufferStr(&buf, "  ");
 	printACLColumn(&buf, "d.datacl");
-	if (verbose > 1)
-		appendPQExpBuffer(&buf,
-						  ",\n  CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')\n"
-						  "       THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))\n"
-						  "       ELSE 'No Access'\n"
-						  "  END as \"%s\"",
-						  gettext_noop("Size"));
 
 	if (verbose > 0)
 		appendPQExpBuffer(&buf,
@@ -987,6 +978,14 @@ listAllDbs(const char *pattern, int verbose)
 						  gettext_noop("Tablespace"),
 						  gettext_noop("Description"));
 
+	if (verbose > 1)
+		appendPQExpBuffer(&buf,
+						  ",\n  CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')\n"
+						  "       THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))\n"
+						  "       ELSE 'No Access'\n"
+						  "  END as \"%s\"",
+						  gettext_noop("Size"));
+
 	appendPQExpBufferStr(&buf,
 						 "\nFROM pg_catalog.pg_database d\n");
 	if (verbose > 0)
@@ -4012,10 +4011,13 @@ listTables(const char *tabtypes, const char *pattern, int verbose, bool showSyst
 							  gettext_noop("Access method"));
 
 		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as \"%s\""
 						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
-						  gettext_noop("Size"),
 						  gettext_noop("Description"));
+
+		if (verbose > 1)
+			appendPQExpBuffer(&buf,
+							  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as \"%s\"",
+							  gettext_noop("Size"));
 	}
 
 	appendPQExpBufferStr(&buf,
@@ -4199,6 +4201,11 @@ listPartitionedTables(const char *reltypes, const char *pattern, int verbose)
 						  gettext_noop("Table"));
 
 	if (verbose > 0)
+		appendPQExpBuffer(&buf,
+						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
+						  gettext_noop("Description"));
+
+	if (verbose > 1)
 	{
 		if (showNested)
 		{
@@ -4215,9 +4222,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, int verbose)
 							  ",\n  s.tps as \"%s\"",
 							  gettext_noop("Total size"));
 
-		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
-						  gettext_noop("Description"));
 	}
 
 	appendPQExpBufferStr(&buf,
diff --git a/src/test/regress/expected/psql.out b/src/test/regress/expected/psql.out
index 7cd0c27cca8..e623a2df7c9 100644
--- a/src/test/regress/expected/psql.out
+++ b/src/test/regress/expected/psql.out
@@ -2900,47 +2900,47 @@ Access method: heap
 
 -- AM is displayed for tables, indexes and materialized views.
 \d+
-                                                           List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 0 bytes | 
- tableam_display | tbl_heap           | table             | regress_display_role | permanent   | heap          | 0 bytes | 
- tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | heap_psql     | 0 bytes | 
- tableam_display | view_heap_psql     | view              | regress_display_role | permanent   |               | 0 bytes | 
+                                                      List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+---------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 
+ tableam_display | tbl_heap           | table             | regress_display_role | permanent   | heap          | 
+ tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | heap_psql     | 
+ tableam_display | view_heap_psql     | view              | regress_display_role | permanent   |               | 
 (4 rows)
 
 \dt+
-                                                  List of relations
-     Schema      |     Name      | Type  |        Owner         | Persistence | Access method |  Size   | Description 
------------------+---------------+-------+----------------------+-------------+---------------+---------+-------------
- tableam_display | tbl_heap      | table | regress_display_role | permanent   | heap          | 0 bytes | 
- tableam_display | tbl_heap_psql | table | regress_display_role | permanent   | heap_psql     | 0 bytes | 
+                                             List of relations
+     Schema      |     Name      | Type  |        Owner         | Persistence | Access method | Description 
+-----------------+---------------+-------+----------------------+-------------+---------------+-------------
+ tableam_display | tbl_heap      | table | regress_display_role | permanent   | heap          | 
+ tableam_display | tbl_heap_psql | table | regress_display_role | permanent   | heap_psql     | 
 (2 rows)
 
 \dm+
-                                                           List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 0 bytes | 
+                                                      List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+---------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 
 (1 row)
 
 -- But not for views and sequences.
 \dv+
-                                          List of relations
-     Schema      |      Name      | Type |        Owner         | Persistence |  Size   | Description 
------------------+----------------+------+----------------------+-------------+---------+-------------
- tableam_display | view_heap_psql | view | regress_display_role | permanent   | 0 bytes | 
+                                     List of relations
+     Schema      |      Name      | Type |        Owner         | Persistence | Description 
+-----------------+----------------+------+----------------------+-------------+-------------
+ tableam_display | view_heap_psql | view | regress_display_role | permanent   | 
 (1 row)
 
 \set HIDE_TABLEAM on
 \d+
-                                                   List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | 0 bytes | 
- tableam_display | tbl_heap           | table             | regress_display_role | permanent   | 0 bytes | 
- tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | 0 bytes | 
- tableam_display | view_heap_psql     | view              | regress_display_role | permanent   | 0 bytes | 
+                                              List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | 
+ tableam_display | tbl_heap           | table             | regress_display_role | permanent   | 
+ tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | 
+ tableam_display | view_heap_psql     | view              | regress_display_role | permanent   | 
 (4 rows)
 
 RESET ROLE;
-- 
2.34.1


--X119r+cMzLJwahiZ--





^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* [PATCH 4/4] Move the double-plus "Size" columns to the right
@ 2021-12-17 15:35 Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 17+ messages in thread

From: Justin Pryzby @ 2021-12-17 15:35 UTC (permalink / raw)

\dn, \dA, \db, \l, \d and \dP+

It doesn't make much sense that one cannot show a database's default tablespace
without also showing its size, and stat()ing every segment of every relation
in the DB.
---
 src/bin/psql/describe.c            | 42 ++++++++++++++---------
 src/test/regress/expected/psql.out | 54 +++++++++++++++---------------
 2 files changed, 53 insertions(+), 43 deletions(-)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index f7b646062bd..77a883815fe 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -240,11 +240,6 @@ describeTablespaces(const char *pattern, int verbose)
 		appendPQExpBufferStr(&buf, ",\n  ");
 		printACLColumn(&buf, "spcacl");
 
-		if (verbose > 1)
-			appendPQExpBuffer(&buf,
-							  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_tablespace_size(oid)) AS \"%s\"",
-							  gettext_noop("Size"));
-
 		appendPQExpBuffer(&buf,
 						  ",\n  spcoptions AS \"%s\""
 						  ",\n  pg_catalog.shobj_description(oid, 'pg_tablespace') AS \"%s\"",
@@ -252,6 +247,11 @@ describeTablespaces(const char *pattern, int verbose)
 						  gettext_noop("Description"));
 	}
 
+	if (verbose > 1)
+		appendPQExpBuffer(&buf,
+						  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_tablespace_size(oid)) AS \"%s\"",
+						  gettext_noop("Size"));
+
 	appendPQExpBufferStr(&buf,
 						 "\nFROM pg_catalog.pg_tablespace\n");
 
@@ -961,17 +961,22 @@ listAllDbs(const char *pattern, int verbose)
 						  gettext_noop("Locale Provider"));
 	appendPQExpBufferStr(&buf, "       ");
 	printACLColumn(&buf, "d.datacl");
-	if (verbose > 1)
+
+	if (verbose > 0)
 		appendPQExpBuffer(&buf,
-						  ",\n       CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')\n"
-						  "            THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))\n"
-						  "            ELSE 'No Access'\n"
-						  "       END as \"%s\""
 						  ",\n       t.spcname as \"%s\""
 						  ",\n       pg_catalog.shobj_description(d.oid, 'pg_database') as \"%s\"",
-						  gettext_noop("Size"),
 						  gettext_noop("Tablespace"),
 						  gettext_noop("Description"));
+
+	if (verbose > 1)
+		appendPQExpBuffer(&buf,
+						  ",\n       CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')\n"
+						  "            THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))\n"
+						  "            ELSE 'No Access'\n"
+						  "       END as \"%s\"",
+						  gettext_noop("Size"));
+
 	appendPQExpBufferStr(&buf,
 						 "\nFROM pg_catalog.pg_database d\n");
 	if (verbose > 0)
@@ -3941,10 +3946,13 @@ listTables(const char *tabtypes, const char *pattern, int verbose, bool showSyst
 							  gettext_noop("Access method"));
 
 		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as \"%s\""
 						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
-						  gettext_noop("Size"),
 						  gettext_noop("Description"));
+
+		if (verbose > 1)
+			appendPQExpBuffer(&buf,
+							  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as \"%s\"",
+							  gettext_noop("Size"));
 	}
 
 	appendPQExpBufferStr(&buf,
@@ -4128,6 +4136,11 @@ listPartitionedTables(const char *reltypes, const char *pattern, int verbose)
 						  gettext_noop("Table"));
 
 	if (verbose > 0)
+		appendPQExpBuffer(&buf,
+						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
+						  gettext_noop("Description"));
+
+	if (verbose > 1)
 	{
 		if (showNested)
 		{
@@ -4144,9 +4157,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, int verbose)
 							  ",\n  s.tps as \"%s\"",
 							  gettext_noop("Total size"));
 
-		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
-						  gettext_noop("Description"));
 	}
 
 	appendPQExpBufferStr(&buf,
diff --git a/src/test/regress/expected/psql.out b/src/test/regress/expected/psql.out
index 8fc62cebd2d..cd95680994b 100644
--- a/src/test/regress/expected/psql.out
+++ b/src/test/regress/expected/psql.out
@@ -2889,47 +2889,47 @@ Access method: heap
 
 -- AM is displayed for tables, indexes and materialized views.
 \d+
-                                                           List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 0 bytes | 
- tableam_display | tbl_heap           | table             | regress_display_role | permanent   | heap          | 0 bytes | 
- tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | heap_psql     | 0 bytes | 
- tableam_display | view_heap_psql     | view              | regress_display_role | permanent   |               | 0 bytes | 
+                                                      List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+---------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 
+ tableam_display | tbl_heap           | table             | regress_display_role | permanent   | heap          | 
+ tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | heap_psql     | 
+ tableam_display | view_heap_psql     | view              | regress_display_role | permanent   |               | 
 (4 rows)
 
 \dt+
-                                                  List of relations
-     Schema      |     Name      | Type  |        Owner         | Persistence | Access method |  Size   | Description 
------------------+---------------+-------+----------------------+-------------+---------------+---------+-------------
- tableam_display | tbl_heap      | table | regress_display_role | permanent   | heap          | 0 bytes | 
- tableam_display | tbl_heap_psql | table | regress_display_role | permanent   | heap_psql     | 0 bytes | 
+                                             List of relations
+     Schema      |     Name      | Type  |        Owner         | Persistence | Access method | Description 
+-----------------+---------------+-------+----------------------+-------------+---------------+-------------
+ tableam_display | tbl_heap      | table | regress_display_role | permanent   | heap          | 
+ tableam_display | tbl_heap_psql | table | regress_display_role | permanent   | heap_psql     | 
 (2 rows)
 
 \dm+
-                                                           List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 0 bytes | 
+                                                      List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+---------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 
 (1 row)
 
 -- But not for views and sequences.
 \dv+
-                                          List of relations
-     Schema      |      Name      | Type |        Owner         | Persistence |  Size   | Description 
------------------+----------------+------+----------------------+-------------+---------+-------------
- tableam_display | view_heap_psql | view | regress_display_role | permanent   | 0 bytes | 
+                                     List of relations
+     Schema      |      Name      | Type |        Owner         | Persistence | Description 
+-----------------+----------------+------+----------------------+-------------+-------------
+ tableam_display | view_heap_psql | view | regress_display_role | permanent   | 
 (1 row)
 
 \set HIDE_TABLEAM on
 \d+
-                                                   List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | 0 bytes | 
- tableam_display | tbl_heap           | table             | regress_display_role | permanent   | 0 bytes | 
- tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | 0 bytes | 
- tableam_display | view_heap_psql     | view              | regress_display_role | permanent   | 0 bytes | 
+                                              List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | 
+ tableam_display | tbl_heap           | table             | regress_display_role | permanent   | 
+ tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | 
+ tableam_display | view_heap_psql     | view              | regress_display_role | permanent   | 
 (4 rows)
 
 RESET ROLE;
-- 
2.25.1


--H1spWtNR+x+ondvy--





^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* [PATCH v4 4/4] Move the double-plus "Size" columns to the right
@ 2021-12-17 15:35 Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 17+ messages in thread

From: Justin Pryzby @ 2021-12-17 15:35 UTC (permalink / raw)

\dn, \dA, \db, \l, \d and \dP+

It doesn't make much sense that one cannot show a database's default tablespace
without also showing its size, and stat()ing every segment of every relation
in the DB.
---
 src/bin/psql/describe.c            | 42 ++++++++++++++---------
 src/test/regress/expected/psql.out | 54 +++++++++++++++---------------
 2 files changed, 53 insertions(+), 43 deletions(-)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 710bf8ef91..42bad9281e 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -224,11 +224,6 @@ describeTablespaces(const char *pattern, int verbose)
 		appendPQExpBufferStr(&buf, ",\n  ");
 		printACLColumn(&buf, "spcacl");
 
-		if (verbose > 1)
-			appendPQExpBuffer(&buf,
-							  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_tablespace_size(oid)) AS \"%s\"",
-							  gettext_noop("Size"));
-
 		appendPQExpBuffer(&buf,
 						  ",\n  spcoptions AS \"%s\""
 						  ",\n  pg_catalog.shobj_description(oid, 'pg_tablespace') AS \"%s\"",
@@ -236,6 +231,11 @@ describeTablespaces(const char *pattern, int verbose)
 						  gettext_noop("Description"));
 	}
 
+	if (verbose > 1)
+		appendPQExpBuffer(&buf,
+						  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_tablespace_size(oid)) AS \"%s\"",
+						  gettext_noop("Size"));
+
 	appendPQExpBufferStr(&buf,
 						 "\nFROM pg_catalog.pg_tablespace\n");
 
@@ -907,17 +907,22 @@ listAllDbs(const char *pattern, int verbose)
 					  gettext_noop("Ctype"));
 	appendPQExpBufferStr(&buf, "       ");
 	printACLColumn(&buf, "d.datacl");
-	if (verbose > 1)
+
+	if (verbose > 0)
 		appendPQExpBuffer(&buf,
-						  ",\n       CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')\n"
-						  "            THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))\n"
-						  "            ELSE 'No Access'\n"
-						  "       END as \"%s\""
 						  ",\n       t.spcname as \"%s\""
 						  ",\n       pg_catalog.shobj_description(d.oid, 'pg_database') as \"%s\"",
-						  gettext_noop("Size"),
 						  gettext_noop("Tablespace"),
 						  gettext_noop("Description"));
+
+	if (verbose > 1)
+		appendPQExpBuffer(&buf,
+						  ",\n       CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')\n"
+						  "            THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))\n"
+						  "            ELSE 'No Access'\n"
+						  "       END as \"%s\"",
+						  gettext_noop("Size"));
+
 	appendPQExpBufferStr(&buf,
 						 "\nFROM pg_catalog.pg_database d\n");
 	if (verbose > 0)
@@ -3772,10 +3777,13 @@ listTables(const char *tabtypes, const char *pattern, int verbose, bool showSyst
 							  gettext_noop("Access method"));
 
 		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as \"%s\""
 						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
-						  gettext_noop("Size"),
 						  gettext_noop("Description"));
+
+		if (verbose > 1)
+			appendPQExpBuffer(&buf,
+							  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as \"%s\"",
+							  gettext_noop("Size"));
 	}
 
 	appendPQExpBufferStr(&buf,
@@ -3954,6 +3962,11 @@ listPartitionedTables(const char *reltypes, const char *pattern, int verbose)
 						  gettext_noop("Table"));
 
 	if (verbose > 0)
+		appendPQExpBuffer(&buf,
+						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
+						  gettext_noop("Description"));
+
+	if (verbose > 1)
 	{
 		if (showNested)
 		{
@@ -3970,9 +3983,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, int verbose)
 							  ",\n  s.tps as \"%s\"",
 							  gettext_noop("Total size"));
 
-		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
-						  gettext_noop("Description"));
 	}
 
 	appendPQExpBufferStr(&buf,
diff --git a/src/test/regress/expected/psql.out b/src/test/regress/expected/psql.out
index 930ce8597a..9a521a80b3 100644
--- a/src/test/regress/expected/psql.out
+++ b/src/test/regress/expected/psql.out
@@ -2845,47 +2845,47 @@ Access method: heap
 
 -- AM is displayed for tables, indexes and materialized views.
 \d+
-                                                           List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 0 bytes | 
- tableam_display | tbl_heap           | table             | regress_display_role | permanent   | heap          | 0 bytes | 
- tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | heap_psql     | 0 bytes | 
- tableam_display | view_heap_psql     | view              | regress_display_role | permanent   |               | 0 bytes | 
+                                                      List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+---------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 
+ tableam_display | tbl_heap           | table             | regress_display_role | permanent   | heap          | 
+ tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | heap_psql     | 
+ tableam_display | view_heap_psql     | view              | regress_display_role | permanent   |               | 
 (4 rows)
 
 \dt+
-                                                  List of relations
-     Schema      |     Name      | Type  |        Owner         | Persistence | Access method |  Size   | Description 
------------------+---------------+-------+----------------------+-------------+---------------+---------+-------------
- tableam_display | tbl_heap      | table | regress_display_role | permanent   | heap          | 0 bytes | 
- tableam_display | tbl_heap_psql | table | regress_display_role | permanent   | heap_psql     | 0 bytes | 
+                                             List of relations
+     Schema      |     Name      | Type  |        Owner         | Persistence | Access method | Description 
+-----------------+---------------+-------+----------------------+-------------+---------------+-------------
+ tableam_display | tbl_heap      | table | regress_display_role | permanent   | heap          | 
+ tableam_display | tbl_heap_psql | table | regress_display_role | permanent   | heap_psql     | 
 (2 rows)
 
 \dm+
-                                                           List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 0 bytes | 
+                                                      List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+---------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 
 (1 row)
 
 -- But not for views and sequences.
 \dv+
-                                          List of relations
-     Schema      |      Name      | Type |        Owner         | Persistence |  Size   | Description 
------------------+----------------+------+----------------------+-------------+---------+-------------
- tableam_display | view_heap_psql | view | regress_display_role | permanent   | 0 bytes | 
+                                     List of relations
+     Schema      |      Name      | Type |        Owner         | Persistence | Description 
+-----------------+----------------+------+----------------------+-------------+-------------
+ tableam_display | view_heap_psql | view | regress_display_role | permanent   | 
 (1 row)
 
 \set HIDE_TABLEAM on
 \d+
-                                                   List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | 0 bytes | 
- tableam_display | tbl_heap           | table             | regress_display_role | permanent   | 0 bytes | 
- tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | 0 bytes | 
- tableam_display | view_heap_psql     | view              | regress_display_role | permanent   | 0 bytes | 
+                                              List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | 
+ tableam_display | tbl_heap           | table             | regress_display_role | permanent   | 
+ tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | 
+ tableam_display | view_heap_psql     | view              | regress_display_role | permanent   | 
 (4 rows)
 
 RESET ROLE;
-- 
2.17.0


--2fEWJT3hVM9yyfvd--





^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* [PATCH 4/4] Move the double-plus "Size" columns to the right
@ 2021-12-17 15:35 Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 17+ messages in thread

From: Justin Pryzby @ 2021-12-17 15:35 UTC (permalink / raw)

\dn, \dA, \db, \l, \d and \dP+

It doesn't make much sense that one cannot show a database's default tablespace
without also showing its size, and stat()ing every segment of every relation
in the DB.
---
 src/bin/psql/describe.c            | 42 ++++++++++++++---------
 src/test/regress/expected/psql.out | 54 +++++++++++++++---------------
 2 files changed, 53 insertions(+), 43 deletions(-)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index ee7990ab7e4..44ae6ca9a75 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -224,11 +224,6 @@ describeTablespaces(const char *pattern, int verbose)
 		appendPQExpBufferStr(&buf, ",\n  ");
 		printACLColumn(&buf, "spcacl");
 
-		if (verbose > 1)
-			appendPQExpBuffer(&buf,
-							  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_tablespace_size(oid)) AS \"%s\"",
-							  gettext_noop("Size"));
-
 		appendPQExpBuffer(&buf,
 						  ",\n  spcoptions AS \"%s\""
 						  ",\n  pg_catalog.shobj_description(oid, 'pg_tablespace') AS \"%s\"",
@@ -236,6 +231,11 @@ describeTablespaces(const char *pattern, int verbose)
 						  gettext_noop("Description"));
 	}
 
+	if (verbose > 1)
+		appendPQExpBuffer(&buf,
+						  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_tablespace_size(oid)) AS \"%s\"",
+						  gettext_noop("Size"));
+
 	appendPQExpBufferStr(&buf,
 						 "\nFROM pg_catalog.pg_tablespace\n");
 
@@ -907,17 +907,22 @@ listAllDbs(const char *pattern, int verbose)
 					  gettext_noop("Ctype"));
 	appendPQExpBufferStr(&buf, "       ");
 	printACLColumn(&buf, "d.datacl");
-	if (verbose > 1)
+
+	if (verbose > 0)
 		appendPQExpBuffer(&buf,
-						  ",\n       CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')\n"
-						  "            THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))\n"
-						  "            ELSE 'No Access'\n"
-						  "       END as \"%s\""
 						  ",\n       t.spcname as \"%s\""
 						  ",\n       pg_catalog.shobj_description(d.oid, 'pg_database') as \"%s\"",
-						  gettext_noop("Size"),
 						  gettext_noop("Tablespace"),
 						  gettext_noop("Description"));
+
+	if (verbose > 1)
+		appendPQExpBuffer(&buf,
+						  ",\n       CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')\n"
+						  "            THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))\n"
+						  "            ELSE 'No Access'\n"
+						  "       END as \"%s\"",
+						  gettext_noop("Size"));
+
 	appendPQExpBufferStr(&buf,
 						 "\nFROM pg_catalog.pg_database d\n");
 	if (verbose > 0)
@@ -3780,10 +3785,13 @@ listTables(const char *tabtypes, const char *pattern, int verbose, bool showSyst
 							  gettext_noop("Access method"));
 
 		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as \"%s\""
 						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
-						  gettext_noop("Size"),
 						  gettext_noop("Description"));
+
+		if (verbose > 1)
+			appendPQExpBuffer(&buf,
+							  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as \"%s\"",
+							  gettext_noop("Size"));
 	}
 
 	appendPQExpBufferStr(&buf,
@@ -3962,6 +3970,11 @@ listPartitionedTables(const char *reltypes, const char *pattern, int verbose)
 						  gettext_noop("Table"));
 
 	if (verbose > 0)
+		appendPQExpBuffer(&buf,
+						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
+						  gettext_noop("Description"));
+
+	if (verbose > 1)
 	{
 		if (showNested)
 		{
@@ -3978,9 +3991,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, int verbose)
 							  ",\n  s.tps as \"%s\"",
 							  gettext_noop("Total size"));
 
-		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
-						  gettext_noop("Description"));
 	}
 
 	appendPQExpBufferStr(&buf,
diff --git a/src/test/regress/expected/psql.out b/src/test/regress/expected/psql.out
index 6428ebc507d..47166727318 100644
--- a/src/test/regress/expected/psql.out
+++ b/src/test/regress/expected/psql.out
@@ -2857,47 +2857,47 @@ Access method: heap
 
 -- AM is displayed for tables, indexes and materialized views.
 \d+
-                                                           List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 0 bytes | 
- tableam_display | tbl_heap           | table             | regress_display_role | permanent   | heap          | 0 bytes | 
- tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | heap_psql     | 0 bytes | 
- tableam_display | view_heap_psql     | view              | regress_display_role | permanent   |               | 0 bytes | 
+                                                      List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+---------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 
+ tableam_display | tbl_heap           | table             | regress_display_role | permanent   | heap          | 
+ tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | heap_psql     | 
+ tableam_display | view_heap_psql     | view              | regress_display_role | permanent   |               | 
 (4 rows)
 
 \dt+
-                                                  List of relations
-     Schema      |     Name      | Type  |        Owner         | Persistence | Access method |  Size   | Description 
------------------+---------------+-------+----------------------+-------------+---------------+---------+-------------
- tableam_display | tbl_heap      | table | regress_display_role | permanent   | heap          | 0 bytes | 
- tableam_display | tbl_heap_psql | table | regress_display_role | permanent   | heap_psql     | 0 bytes | 
+                                             List of relations
+     Schema      |     Name      | Type  |        Owner         | Persistence | Access method | Description 
+-----------------+---------------+-------+----------------------+-------------+---------------+-------------
+ tableam_display | tbl_heap      | table | regress_display_role | permanent   | heap          | 
+ tableam_display | tbl_heap_psql | table | regress_display_role | permanent   | heap_psql     | 
 (2 rows)
 
 \dm+
-                                                           List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 0 bytes | 
+                                                      List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+---------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 
 (1 row)
 
 -- But not for views and sequences.
 \dv+
-                                          List of relations
-     Schema      |      Name      | Type |        Owner         | Persistence |  Size   | Description 
------------------+----------------+------+----------------------+-------------+---------+-------------
- tableam_display | view_heap_psql | view | regress_display_role | permanent   | 0 bytes | 
+                                     List of relations
+     Schema      |      Name      | Type |        Owner         | Persistence | Description 
+-----------------+----------------+------+----------------------+-------------+-------------
+ tableam_display | view_heap_psql | view | regress_display_role | permanent   | 
 (1 row)
 
 \set HIDE_TABLEAM on
 \d+
-                                                   List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | 0 bytes | 
- tableam_display | tbl_heap           | table             | regress_display_role | permanent   | 0 bytes | 
- tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | 0 bytes | 
- tableam_display | view_heap_psql     | view              | regress_display_role | permanent   | 0 bytes | 
+                                              List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | 
+ tableam_display | tbl_heap           | table             | regress_display_role | permanent   | 
+ tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | 
+ tableam_display | view_heap_psql     | view              | regress_display_role | permanent   | 
 (4 rows)
 
 RESET ROLE;
-- 
2.17.1


--XLWMkxR+mZNQ4WTO--





^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* [PATCH v8 4/4] Move the double-plus "Size" columns to the right
@ 2021-12-17 15:35 Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 17+ messages in thread

From: Justin Pryzby @ 2021-12-17 15:35 UTC (permalink / raw)

\dn, \dA, \db, \l, \d and \dP+

It doesn't make much sense that one cannot show a database's default tablespace
without also showing its size, and stat()ing every segment of every relation
in the DB.
---
 src/bin/psql/describe.c            | 42 ++++++++++++++---------
 src/test/regress/expected/psql.out | 54 +++++++++++++++---------------
 2 files changed, 53 insertions(+), 43 deletions(-)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 2e47ea448f7..22fc19a47dd 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -240,11 +240,6 @@ describeTablespaces(const char *pattern, int verbose)
 		appendPQExpBufferStr(&buf, ",\n  ");
 		printACLColumn(&buf, "spcacl");
 
-		if (verbose > 1)
-			appendPQExpBuffer(&buf,
-							  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_tablespace_size(oid)) AS \"%s\"",
-							  gettext_noop("Size"));
-
 		appendPQExpBuffer(&buf,
 						  ",\n  spcoptions AS \"%s\""
 						  ",\n  pg_catalog.shobj_description(oid, 'pg_tablespace') AS \"%s\"",
@@ -252,6 +247,11 @@ describeTablespaces(const char *pattern, int verbose)
 						  gettext_noop("Description"));
 	}
 
+	if (verbose > 1)
+		appendPQExpBuffer(&buf,
+						  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_tablespace_size(oid)) AS \"%s\"",
+						  gettext_noop("Size"));
+
 	appendPQExpBufferStr(&buf,
 						 "\nFROM pg_catalog.pg_tablespace\n");
 
@@ -961,17 +961,22 @@ listAllDbs(const char *pattern, int verbose)
 						  gettext_noop("Locale Provider"));
 	appendPQExpBufferStr(&buf, "       ");
 	printACLColumn(&buf, "d.datacl");
-	if (verbose > 1)
+
+	if (verbose > 0)
 		appendPQExpBuffer(&buf,
-						  ",\n       CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')\n"
-						  "            THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))\n"
-						  "            ELSE 'No Access'\n"
-						  "       END as \"%s\""
 						  ",\n       t.spcname as \"%s\""
 						  ",\n       pg_catalog.shobj_description(d.oid, 'pg_database') as \"%s\"",
-						  gettext_noop("Size"),
 						  gettext_noop("Tablespace"),
 						  gettext_noop("Description"));
+
+	if (verbose > 1)
+		appendPQExpBuffer(&buf,
+						  ",\n       CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')\n"
+						  "            THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))\n"
+						  "            ELSE 'No Access'\n"
+						  "       END as \"%s\"",
+						  gettext_noop("Size"));
+
 	appendPQExpBufferStr(&buf,
 						 "\nFROM pg_catalog.pg_database d\n");
 	if (verbose > 0)
@@ -3936,10 +3941,13 @@ listTables(const char *tabtypes, const char *pattern, int verbose, bool showSyst
 							  gettext_noop("Access method"));
 
 		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as \"%s\""
 						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
-						  gettext_noop("Size"),
 						  gettext_noop("Description"));
+
+		if (verbose > 1)
+			appendPQExpBuffer(&buf,
+							  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as \"%s\"",
+							  gettext_noop("Size"));
 	}
 
 	appendPQExpBufferStr(&buf,
@@ -4123,6 +4131,11 @@ listPartitionedTables(const char *reltypes, const char *pattern, int verbose)
 						  gettext_noop("Table"));
 
 	if (verbose > 0)
+		appendPQExpBuffer(&buf,
+						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
+						  gettext_noop("Description"));
+
+	if (verbose > 1)
 	{
 		if (showNested)
 		{
@@ -4139,9 +4152,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, int verbose)
 							  ",\n  s.tps as \"%s\"",
 							  gettext_noop("Total size"));
 
-		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
-						  gettext_noop("Description"));
 	}
 
 	appendPQExpBufferStr(&buf,
diff --git a/src/test/regress/expected/psql.out b/src/test/regress/expected/psql.out
index a7f5700edc1..2daa4685b4b 100644
--- a/src/test/regress/expected/psql.out
+++ b/src/test/regress/expected/psql.out
@@ -2858,47 +2858,47 @@ Access method: heap
 
 -- AM is displayed for tables, indexes and materialized views.
 \d+
-                                                           List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 0 bytes | 
- tableam_display | tbl_heap           | table             | regress_display_role | permanent   | heap          | 0 bytes | 
- tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | heap_psql     | 0 bytes | 
- tableam_display | view_heap_psql     | view              | regress_display_role | permanent   |               | 0 bytes | 
+                                                      List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+---------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 
+ tableam_display | tbl_heap           | table             | regress_display_role | permanent   | heap          | 
+ tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | heap_psql     | 
+ tableam_display | view_heap_psql     | view              | regress_display_role | permanent   |               | 
 (4 rows)
 
 \dt+
-                                                  List of relations
-     Schema      |     Name      | Type  |        Owner         | Persistence | Access method |  Size   | Description 
------------------+---------------+-------+----------------------+-------------+---------------+---------+-------------
- tableam_display | tbl_heap      | table | regress_display_role | permanent   | heap          | 0 bytes | 
- tableam_display | tbl_heap_psql | table | regress_display_role | permanent   | heap_psql     | 0 bytes | 
+                                             List of relations
+     Schema      |     Name      | Type  |        Owner         | Persistence | Access method | Description 
+-----------------+---------------+-------+----------------------+-------------+---------------+-------------
+ tableam_display | tbl_heap      | table | regress_display_role | permanent   | heap          | 
+ tableam_display | tbl_heap_psql | table | regress_display_role | permanent   | heap_psql     | 
 (2 rows)
 
 \dm+
-                                                           List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 0 bytes | 
+                                                      List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+---------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 
 (1 row)
 
 -- But not for views and sequences.
 \dv+
-                                          List of relations
-     Schema      |      Name      | Type |        Owner         | Persistence |  Size   | Description 
------------------+----------------+------+----------------------+-------------+---------+-------------
- tableam_display | view_heap_psql | view | regress_display_role | permanent   | 0 bytes | 
+                                     List of relations
+     Schema      |      Name      | Type |        Owner         | Persistence | Description 
+-----------------+----------------+------+----------------------+-------------+-------------
+ tableam_display | view_heap_psql | view | regress_display_role | permanent   | 
 (1 row)
 
 \set HIDE_TABLEAM on
 \d+
-                                                   List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | 0 bytes | 
- tableam_display | tbl_heap           | table             | regress_display_role | permanent   | 0 bytes | 
- tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | 0 bytes | 
- tableam_display | view_heap_psql     | view              | regress_display_role | permanent   | 0 bytes | 
+                                              List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | 
+ tableam_display | tbl_heap           | table             | regress_display_role | permanent   | 
+ tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | 
+ tableam_display | view_heap_psql     | view              | regress_display_role | permanent   | 
 (4 rows)
 
 RESET ROLE;
-- 
2.17.1


--cKDw3XFoqocuprIa--





^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* [PATCH 4/4] Move the double-plus "Size" columns to the right
@ 2021-12-17 15:35 Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 17+ messages in thread

From: Justin Pryzby @ 2021-12-17 15:35 UTC (permalink / raw)

\dn, \dA, \db, \l, and (for consistency) \d and \dP+

It doesn't make much sense that one cannot show a database's default
tablespace without also showing its size, and stat()ing every segment of
every relation in the DB.
---
 src/bin/psql/describe.c            | 40 ++++++++++++----------
 src/test/regress/expected/psql.out | 54 +++++++++++++++---------------
 2 files changed, 49 insertions(+), 45 deletions(-)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7eff1249015..cc5f00fffe7 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -241,17 +241,15 @@ describeTablespaces(const char *pattern, int verbose)
 		printACLColumn(&buf, "spcacl");
 
 		appendPQExpBuffer(&buf,
-						  ",\n  spcoptions AS \"%s\"",
-						  gettext_noop("Options"));
+						  ",\n  spcoptions AS \"%s\""
+						  ",\n  pg_catalog.shobj_description(oid, 'pg_tablespace') AS \"%s\"",
+						  gettext_noop("Options"),
+						  gettext_noop("Description"));
 
 		if (verbose > 1)
 			appendPQExpBuffer(&buf,
 							  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_tablespace_size(oid)) AS \"%s\"",
 							  gettext_noop("Size"));
-
-		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.shobj_description(oid, 'pg_tablespace') AS \"%s\"",
-						  gettext_noop("Description"));
 	}
 
 	appendPQExpBufferStr(&buf,
@@ -972,13 +970,6 @@ listAllDbs(const char *pattern, int verbose)
 						  gettext_noop("ICU Rules"));
 	appendPQExpBufferStr(&buf, "  ");
 	printACLColumn(&buf, "d.datacl");
-	if (verbose > 1)
-		appendPQExpBuffer(&buf,
-						  ",\n  CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')\n"
-						  "       THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))\n"
-						  "       ELSE 'No Access'\n"
-						  "  END as \"%s\"",
-						  gettext_noop("Size"));
 
 	if (verbose > 0)
 		appendPQExpBuffer(&buf,
@@ -987,6 +978,14 @@ listAllDbs(const char *pattern, int verbose)
 						  gettext_noop("Tablespace"),
 						  gettext_noop("Description"));
 
+	if (verbose > 1)
+		appendPQExpBuffer(&buf,
+						  ",\n  CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')\n"
+						  "       THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))\n"
+						  "       ELSE 'No Access'\n"
+						  "  END as \"%s\"",
+						  gettext_noop("Size"));
+
 	appendPQExpBufferStr(&buf,
 						 "\nFROM pg_catalog.pg_database d\n");
 	if (verbose > 0)
@@ -4012,10 +4011,13 @@ listTables(const char *tabtypes, const char *pattern, int verbose, bool showSyst
 							  gettext_noop("Access method"));
 
 		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as \"%s\""
 						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
-						  gettext_noop("Size"),
 						  gettext_noop("Description"));
+
+		if (verbose > 1)
+			appendPQExpBuffer(&buf,
+							  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as \"%s\"",
+							  gettext_noop("Size"));
 	}
 
 	appendPQExpBufferStr(&buf,
@@ -4199,6 +4201,11 @@ listPartitionedTables(const char *reltypes, const char *pattern, int verbose)
 						  gettext_noop("Table"));
 
 	if (verbose > 0)
+		appendPQExpBuffer(&buf,
+						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
+						  gettext_noop("Description"));
+
+	if (verbose > 1)
 	{
 		if (showNested)
 		{
@@ -4215,9 +4222,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, int verbose)
 							  ",\n  s.tps as \"%s\"",
 							  gettext_noop("Total size"));
 
-		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
-						  gettext_noop("Description"));
 	}
 
 	appendPQExpBufferStr(&buf,
diff --git a/src/test/regress/expected/psql.out b/src/test/regress/expected/psql.out
index 7cd0c27cca8..e623a2df7c9 100644
--- a/src/test/regress/expected/psql.out
+++ b/src/test/regress/expected/psql.out
@@ -2900,47 +2900,47 @@ Access method: heap
 
 -- AM is displayed for tables, indexes and materialized views.
 \d+
-                                                           List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 0 bytes | 
- tableam_display | tbl_heap           | table             | regress_display_role | permanent   | heap          | 0 bytes | 
- tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | heap_psql     | 0 bytes | 
- tableam_display | view_heap_psql     | view              | regress_display_role | permanent   |               | 0 bytes | 
+                                                      List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+---------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 
+ tableam_display | tbl_heap           | table             | regress_display_role | permanent   | heap          | 
+ tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | heap_psql     | 
+ tableam_display | view_heap_psql     | view              | regress_display_role | permanent   |               | 
 (4 rows)
 
 \dt+
-                                                  List of relations
-     Schema      |     Name      | Type  |        Owner         | Persistence | Access method |  Size   | Description 
------------------+---------------+-------+----------------------+-------------+---------------+---------+-------------
- tableam_display | tbl_heap      | table | regress_display_role | permanent   | heap          | 0 bytes | 
- tableam_display | tbl_heap_psql | table | regress_display_role | permanent   | heap_psql     | 0 bytes | 
+                                             List of relations
+     Schema      |     Name      | Type  |        Owner         | Persistence | Access method | Description 
+-----------------+---------------+-------+----------------------+-------------+---------------+-------------
+ tableam_display | tbl_heap      | table | regress_display_role | permanent   | heap          | 
+ tableam_display | tbl_heap_psql | table | regress_display_role | permanent   | heap_psql     | 
 (2 rows)
 
 \dm+
-                                                           List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 0 bytes | 
+                                                      List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+---------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 
 (1 row)
 
 -- But not for views and sequences.
 \dv+
-                                          List of relations
-     Schema      |      Name      | Type |        Owner         | Persistence |  Size   | Description 
------------------+----------------+------+----------------------+-------------+---------+-------------
- tableam_display | view_heap_psql | view | regress_display_role | permanent   | 0 bytes | 
+                                     List of relations
+     Schema      |      Name      | Type |        Owner         | Persistence | Description 
+-----------------+----------------+------+----------------------+-------------+-------------
+ tableam_display | view_heap_psql | view | regress_display_role | permanent   | 
 (1 row)
 
 \set HIDE_TABLEAM on
 \d+
-                                                   List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | 0 bytes | 
- tableam_display | tbl_heap           | table             | regress_display_role | permanent   | 0 bytes | 
- tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | 0 bytes | 
- tableam_display | view_heap_psql     | view              | regress_display_role | permanent   | 0 bytes | 
+                                              List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | 
+ tableam_display | tbl_heap           | table             | regress_display_role | permanent   | 
+ tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | 
+ tableam_display | view_heap_psql     | view              | regress_display_role | permanent   | 
 (4 rows)
 
 RESET ROLE;
-- 
2.34.1


--X119r+cMzLJwahiZ--





^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* [PATCH 4/4] Move the double-plus "Size" columns to the right
@ 2021-12-17 15:35 Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 17+ messages in thread

From: Justin Pryzby @ 2021-12-17 15:35 UTC (permalink / raw)

\dn, \dA, \db, \l, and (for consistency) \d and \dP+

It doesn't make much sense that one cannot show a database's default
tablespace without also showing its size, and stat()ing every segment of
every relation in the DB.
---
 src/bin/psql/describe.c            | 40 ++++++++++++----------
 src/test/regress/expected/psql.out | 54 +++++++++++++++---------------
 2 files changed, 49 insertions(+), 45 deletions(-)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 5fc4f5774e8..a64e4ccba4d 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -241,17 +241,15 @@ describeTablespaces(const char *pattern, int verbose)
 		printACLColumn(&buf, "spcacl");
 
 		appendPQExpBuffer(&buf,
-						  ",\n  spcoptions AS \"%s\"",
-						  gettext_noop("Options"));
+						  ",\n  spcoptions AS \"%s\""
+						  ",\n  pg_catalog.shobj_description(oid, 'pg_tablespace') AS \"%s\"",
+						  gettext_noop("Options"),
+						  gettext_noop("Description"));
 
 		if (verbose > 1)
 			appendPQExpBuffer(&buf,
 							  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_tablespace_size(oid)) AS \"%s\"",
 							  gettext_noop("Size"));
-
-		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.shobj_description(oid, 'pg_tablespace') AS \"%s\"",
-						  gettext_noop("Description"));
 	}
 
 	appendPQExpBufferStr(&buf,
@@ -972,13 +970,6 @@ listAllDbs(const char *pattern, int verbose)
 						  gettext_noop("ICU Rules"));
 	appendPQExpBufferStr(&buf, "  ");
 	printACLColumn(&buf, "d.datacl");
-	if (verbose > 1)
-		appendPQExpBuffer(&buf,
-						  ",\n  CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')\n"
-						  "       THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))\n"
-						  "       ELSE 'No Access'\n"
-						  "  END as \"%s\"",
-						  gettext_noop("Size"));
 
 	if (verbose > 0)
 		appendPQExpBuffer(&buf,
@@ -987,6 +978,14 @@ listAllDbs(const char *pattern, int verbose)
 						  gettext_noop("Tablespace"),
 						  gettext_noop("Description"));
 
+	if (verbose > 1)
+		appendPQExpBuffer(&buf,
+						  ",\n  CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')\n"
+						  "       THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))\n"
+						  "       ELSE 'No Access'\n"
+						  "  END as \"%s\"",
+						  gettext_noop("Size"));
+
 	appendPQExpBufferStr(&buf,
 						 "\nFROM pg_catalog.pg_database d\n");
 	if (verbose > 0)
@@ -3954,10 +3953,13 @@ listTables(const char *tabtypes, const char *pattern, int verbose, bool showSyst
 							  gettext_noop("Access method"));
 
 		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as \"%s\""
 						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
-						  gettext_noop("Size"),
 						  gettext_noop("Description"));
+
+		if (verbose > 1)
+			appendPQExpBuffer(&buf,
+							  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as \"%s\"",
+							  gettext_noop("Size"));
 	}
 
 	appendPQExpBufferStr(&buf,
@@ -4141,6 +4143,11 @@ listPartitionedTables(const char *reltypes, const char *pattern, int verbose)
 						  gettext_noop("Table"));
 
 	if (verbose > 0)
+		appendPQExpBuffer(&buf,
+						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
+						  gettext_noop("Description"));
+
+	if (verbose > 1)
 	{
 		if (showNested)
 		{
@@ -4157,9 +4164,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, int verbose)
 							  ",\n  s.tps as \"%s\"",
 							  gettext_noop("Total size"));
 
-		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
-						  gettext_noop("Description"));
 	}
 
 	appendPQExpBufferStr(&buf,
diff --git a/src/test/regress/expected/psql.out b/src/test/regress/expected/psql.out
index c00e28361c7..b9c95502a45 100644
--- a/src/test/regress/expected/psql.out
+++ b/src/test/regress/expected/psql.out
@@ -2889,47 +2889,47 @@ Access method: heap
 
 -- AM is displayed for tables, indexes and materialized views.
 \d+
-                                                           List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 0 bytes | 
- tableam_display | tbl_heap           | table             | regress_display_role | permanent   | heap          | 0 bytes | 
- tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | heap_psql     | 0 bytes | 
- tableam_display | view_heap_psql     | view              | regress_display_role | permanent   |               | 0 bytes | 
+                                                      List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+---------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 
+ tableam_display | tbl_heap           | table             | regress_display_role | permanent   | heap          | 
+ tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | heap_psql     | 
+ tableam_display | view_heap_psql     | view              | regress_display_role | permanent   |               | 
 (4 rows)
 
 \dt+
-                                                  List of relations
-     Schema      |     Name      | Type  |        Owner         | Persistence | Access method |  Size   | Description 
------------------+---------------+-------+----------------------+-------------+---------------+---------+-------------
- tableam_display | tbl_heap      | table | regress_display_role | permanent   | heap          | 0 bytes | 
- tableam_display | tbl_heap_psql | table | regress_display_role | permanent   | heap_psql     | 0 bytes | 
+                                             List of relations
+     Schema      |     Name      | Type  |        Owner         | Persistence | Access method | Description 
+-----------------+---------------+-------+----------------------+-------------+---------------+-------------
+ tableam_display | tbl_heap      | table | regress_display_role | permanent   | heap          | 
+ tableam_display | tbl_heap_psql | table | regress_display_role | permanent   | heap_psql     | 
 (2 rows)
 
 \dm+
-                                                           List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 0 bytes | 
+                                                      List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+---------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 
 (1 row)
 
 -- But not for views and sequences.
 \dv+
-                                          List of relations
-     Schema      |      Name      | Type |        Owner         | Persistence |  Size   | Description 
------------------+----------------+------+----------------------+-------------+---------+-------------
- tableam_display | view_heap_psql | view | regress_display_role | permanent   | 0 bytes | 
+                                     List of relations
+     Schema      |      Name      | Type |        Owner         | Persistence | Description 
+-----------------+----------------+------+----------------------+-------------+-------------
+ tableam_display | view_heap_psql | view | regress_display_role | permanent   | 
 (1 row)
 
 \set HIDE_TABLEAM on
 \d+
-                                                   List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | 0 bytes | 
- tableam_display | tbl_heap           | table             | regress_display_role | permanent   | 0 bytes | 
- tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | 0 bytes | 
- tableam_display | view_heap_psql     | view              | regress_display_role | permanent   | 0 bytes | 
+                                              List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | 
+ tableam_display | tbl_heap           | table             | regress_display_role | permanent   | 
+ tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | 
+ tableam_display | view_heap_psql     | view              | regress_display_role | permanent   | 
 (4 rows)
 
 RESET ROLE;
-- 
2.34.1


--OZ1/qgOAlc2dTU8W--





^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* [PATCH 4/4] Move the double-plus "Size" columns to the right
@ 2021-12-17 15:35 Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 17+ messages in thread

From: Justin Pryzby @ 2021-12-17 15:35 UTC (permalink / raw)

\dn, \dA, \db, \l, and (for consistency) \d and \dP+

It doesn't make much sense that one cannot show a database's default
tablespace without also showing its size, and stat()ing every segment of
every relation in the DB.
---
 src/bin/psql/describe.c            | 40 ++++++++++++----------
 src/test/regress/expected/psql.out | 54 +++++++++++++++---------------
 2 files changed, 49 insertions(+), 45 deletions(-)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 8ab4b4cb46a..1b7e5c5bcd2 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -241,17 +241,15 @@ describeTablespaces(const char *pattern, int verbose)
 		printACLColumn(&buf, "spcacl");
 
 		appendPQExpBuffer(&buf,
-						  ",\n  spcoptions AS \"%s\"",
-						  gettext_noop("Options"));
+						  ",\n  spcoptions AS \"%s\""
+						  ",\n  pg_catalog.shobj_description(oid, 'pg_tablespace') AS \"%s\"",
+						  gettext_noop("Options"),
+						  gettext_noop("Description"));
 
 		if (verbose > 1)
 			appendPQExpBuffer(&buf,
 							  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_tablespace_size(oid)) AS \"%s\"",
 							  gettext_noop("Size"));
-
-		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.shobj_description(oid, 'pg_tablespace') AS \"%s\"",
-						  gettext_noop("Description"));
 	}
 
 	appendPQExpBufferStr(&buf,
@@ -972,13 +970,6 @@ listAllDbs(const char *pattern, int verbose)
 						  gettext_noop("ICU Rules"));
 	appendPQExpBufferStr(&buf, "  ");
 	printACLColumn(&buf, "d.datacl");
-	if (verbose > 1)
-		appendPQExpBuffer(&buf,
-						  ",\n  CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')\n"
-						  "       THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))\n"
-						  "       ELSE 'No Access'\n"
-						  "  END as \"%s\"",
-						  gettext_noop("Size"));
 
 	if (verbose > 0)
 		appendPQExpBuffer(&buf,
@@ -987,6 +978,14 @@ listAllDbs(const char *pattern, int verbose)
 						  gettext_noop("Tablespace"),
 						  gettext_noop("Description"));
 
+	if (verbose > 1)
+		appendPQExpBuffer(&buf,
+						  ",\n  CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')\n"
+						  "       THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))\n"
+						  "       ELSE 'No Access'\n"
+						  "  END as \"%s\"",
+						  gettext_noop("Size"));
+
 	appendPQExpBufferStr(&buf,
 						 "\nFROM pg_catalog.pg_database d\n");
 	if (verbose > 0)
@@ -3951,10 +3950,13 @@ listTables(const char *tabtypes, const char *pattern, int verbose, bool showSyst
 							  gettext_noop("Access method"));
 
 		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as \"%s\""
 						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
-						  gettext_noop("Size"),
 						  gettext_noop("Description"));
+
+		if (verbose > 1)
+			appendPQExpBuffer(&buf,
+							  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as \"%s\"",
+							  gettext_noop("Size"));
 	}
 
 	appendPQExpBufferStr(&buf,
@@ -4138,6 +4140,11 @@ listPartitionedTables(const char *reltypes, const char *pattern, int verbose)
 						  gettext_noop("Table"));
 
 	if (verbose > 0)
+		appendPQExpBuffer(&buf,
+						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
+						  gettext_noop("Description"));
+
+	if (verbose > 1)
 	{
 		if (showNested)
 		{
@@ -4154,9 +4161,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, int verbose)
 							  ",\n  s.tps as \"%s\"",
 							  gettext_noop("Total size"));
 
-		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
-						  gettext_noop("Description"));
 	}
 
 	appendPQExpBufferStr(&buf,
diff --git a/src/test/regress/expected/psql.out b/src/test/regress/expected/psql.out
index 8f930283636..4666333f73f 100644
--- a/src/test/regress/expected/psql.out
+++ b/src/test/regress/expected/psql.out
@@ -2889,47 +2889,47 @@ Access method: heap
 
 -- AM is displayed for tables, indexes and materialized views.
 \d+
-                                                           List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 0 bytes | 
- tableam_display | tbl_heap           | table             | regress_display_role | permanent   | heap          | 0 bytes | 
- tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | heap_psql     | 0 bytes | 
- tableam_display | view_heap_psql     | view              | regress_display_role | permanent   |               | 0 bytes | 
+                                                      List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+---------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 
+ tableam_display | tbl_heap           | table             | regress_display_role | permanent   | heap          | 
+ tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | heap_psql     | 
+ tableam_display | view_heap_psql     | view              | regress_display_role | permanent   |               | 
 (4 rows)
 
 \dt+
-                                                  List of relations
-     Schema      |     Name      | Type  |        Owner         | Persistence | Access method |  Size   | Description 
------------------+---------------+-------+----------------------+-------------+---------------+---------+-------------
- tableam_display | tbl_heap      | table | regress_display_role | permanent   | heap          | 0 bytes | 
- tableam_display | tbl_heap_psql | table | regress_display_role | permanent   | heap_psql     | 0 bytes | 
+                                             List of relations
+     Schema      |     Name      | Type  |        Owner         | Persistence | Access method | Description 
+-----------------+---------------+-------+----------------------+-------------+---------------+-------------
+ tableam_display | tbl_heap      | table | regress_display_role | permanent   | heap          | 
+ tableam_display | tbl_heap_psql | table | regress_display_role | permanent   | heap_psql     | 
 (2 rows)
 
 \dm+
-                                                           List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 0 bytes | 
+                                                      List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+---------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 
 (1 row)
 
 -- But not for views and sequences.
 \dv+
-                                          List of relations
-     Schema      |      Name      | Type |        Owner         | Persistence |  Size   | Description 
------------------+----------------+------+----------------------+-------------+---------+-------------
- tableam_display | view_heap_psql | view | regress_display_role | permanent   | 0 bytes | 
+                                     List of relations
+     Schema      |      Name      | Type |        Owner         | Persistence | Description 
+-----------------+----------------+------+----------------------+-------------+-------------
+ tableam_display | view_heap_psql | view | regress_display_role | permanent   | 
 (1 row)
 
 \set HIDE_TABLEAM on
 \d+
-                                                   List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | 0 bytes | 
- tableam_display | tbl_heap           | table             | regress_display_role | permanent   | 0 bytes | 
- tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | 0 bytes | 
- tableam_display | view_heap_psql     | view              | regress_display_role | permanent   | 0 bytes | 
+                                              List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | 
+ tableam_display | tbl_heap           | table             | regress_display_role | permanent   | 
+ tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | 
+ tableam_display | view_heap_psql     | view              | regress_display_role | permanent   | 
 (4 rows)
 
 RESET ROLE;
-- 
2.34.1


--mDjj41GS8UJ6l/Dp--





^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* [PATCH 4/4] Move the double-plus "Size" columns to the right
@ 2021-12-17 15:35 Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 17+ messages in thread

From: Justin Pryzby @ 2021-12-17 15:35 UTC (permalink / raw)

\dn, \dA, \db, \l, \d and \dP+

It doesn't make much sense that one cannot show a database's default tablespace
without also showing its size, and stat()ing every segment of every relation
in the DB.
---
 src/bin/psql/describe.c            | 42 ++++++++++++++---------
 src/test/regress/expected/psql.out | 54 +++++++++++++++---------------
 2 files changed, 53 insertions(+), 43 deletions(-)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 220262aa84c..9f73e90df23 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -234,11 +234,6 @@ describeTablespaces(const char *pattern, int verbose)
 		appendPQExpBufferStr(&buf, ",\n  ");
 		printACLColumn(&buf, "spcacl");
 
-		if (verbose > 1)
-			appendPQExpBuffer(&buf,
-							  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_tablespace_size(oid)) AS \"%s\"",
-							  gettext_noop("Size"));
-
 		appendPQExpBuffer(&buf,
 						  ",\n  spcoptions AS \"%s\""
 						  ",\n  pg_catalog.shobj_description(oid, 'pg_tablespace') AS \"%s\"",
@@ -246,6 +241,11 @@ describeTablespaces(const char *pattern, int verbose)
 						  gettext_noop("Description"));
 	}
 
+	if (verbose > 1)
+		appendPQExpBuffer(&buf,
+						  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_tablespace_size(oid)) AS \"%s\"",
+						  gettext_noop("Size"));
+
 	appendPQExpBufferStr(&buf,
 						 "\nFROM pg_catalog.pg_tablespace\n");
 
@@ -941,17 +941,22 @@ listAllDbs(const char *pattern, int verbose)
 						  gettext_noop("Locale Provider"));
 	appendPQExpBufferStr(&buf, "       ");
 	printACLColumn(&buf, "d.datacl");
-	if (verbose > 1)
+
+	if (verbose > 0)
 		appendPQExpBuffer(&buf,
-						  ",\n       CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')\n"
-						  "            THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))\n"
-						  "            ELSE 'No Access'\n"
-						  "       END as \"%s\""
 						  ",\n       t.spcname as \"%s\""
 						  ",\n       pg_catalog.shobj_description(d.oid, 'pg_database') as \"%s\"",
-						  gettext_noop("Size"),
 						  gettext_noop("Tablespace"),
 						  gettext_noop("Description"));
+
+	if (verbose > 1)
+		appendPQExpBuffer(&buf,
+						  ",\n       CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')\n"
+						  "            THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))\n"
+						  "            ELSE 'No Access'\n"
+						  "       END as \"%s\"",
+						  gettext_noop("Size"));
+
 	appendPQExpBufferStr(&buf,
 						 "\nFROM pg_catalog.pg_database d\n");
 	if (verbose > 0)
@@ -3898,10 +3903,13 @@ listTables(const char *tabtypes, const char *pattern, int verbose, bool showSyst
 							  gettext_noop("Access method"));
 
 		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as \"%s\""
 						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
-						  gettext_noop("Size"),
 						  gettext_noop("Description"));
+
+		if (verbose > 1)
+			appendPQExpBuffer(&buf,
+							  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as \"%s\"",
+							  gettext_noop("Size"));
 	}
 
 	appendPQExpBufferStr(&buf,
@@ -4082,6 +4090,11 @@ listPartitionedTables(const char *reltypes, const char *pattern, int verbose)
 						  gettext_noop("Table"));
 
 	if (verbose > 0)
+		appendPQExpBuffer(&buf,
+						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
+						  gettext_noop("Description"));
+
+	if (verbose > 1)
 	{
 		if (showNested)
 		{
@@ -4098,9 +4111,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, int verbose)
 							  ",\n  s.tps as \"%s\"",
 							  gettext_noop("Total size"));
 
-		appendPQExpBuffer(&buf,
-						  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
-						  gettext_noop("Description"));
 	}
 
 	appendPQExpBufferStr(&buf,
diff --git a/src/test/regress/expected/psql.out b/src/test/regress/expected/psql.out
index 60acbd1241e..8da23d7216c 100644
--- a/src/test/regress/expected/psql.out
+++ b/src/test/regress/expected/psql.out
@@ -2857,47 +2857,47 @@ Access method: heap
 
 -- AM is displayed for tables, indexes and materialized views.
 \d+
-                                                           List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 0 bytes | 
- tableam_display | tbl_heap           | table             | regress_display_role | permanent   | heap          | 0 bytes | 
- tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | heap_psql     | 0 bytes | 
- tableam_display | view_heap_psql     | view              | regress_display_role | permanent   |               | 0 bytes | 
+                                                      List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+---------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 
+ tableam_display | tbl_heap           | table             | regress_display_role | permanent   | heap          | 
+ tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | heap_psql     | 
+ tableam_display | view_heap_psql     | view              | regress_display_role | permanent   |               | 
 (4 rows)
 
 \dt+
-                                                  List of relations
-     Schema      |     Name      | Type  |        Owner         | Persistence | Access method |  Size   | Description 
------------------+---------------+-------+----------------------+-------------+---------------+---------+-------------
- tableam_display | tbl_heap      | table | regress_display_role | permanent   | heap          | 0 bytes | 
- tableam_display | tbl_heap_psql | table | regress_display_role | permanent   | heap_psql     | 0 bytes | 
+                                             List of relations
+     Schema      |     Name      | Type  |        Owner         | Persistence | Access method | Description 
+-----------------+---------------+-------+----------------------+-------------+---------------+-------------
+ tableam_display | tbl_heap      | table | regress_display_role | permanent   | heap          | 
+ tableam_display | tbl_heap_psql | table | regress_display_role | permanent   | heap_psql     | 
 (2 rows)
 
 \dm+
-                                                           List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 0 bytes | 
+                                                      List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Access method | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+---------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | heap_psql     | 
 (1 row)
 
 -- But not for views and sequences.
 \dv+
-                                          List of relations
-     Schema      |      Name      | Type |        Owner         | Persistence |  Size   | Description 
------------------+----------------+------+----------------------+-------------+---------+-------------
- tableam_display | view_heap_psql | view | regress_display_role | permanent   | 0 bytes | 
+                                     List of relations
+     Schema      |      Name      | Type |        Owner         | Persistence | Description 
+-----------------+----------------+------+----------------------+-------------+-------------
+ tableam_display | view_heap_psql | view | regress_display_role | permanent   | 
 (1 row)
 
 \set HIDE_TABLEAM on
 \d+
-                                                   List of relations
-     Schema      |        Name        |       Type        |        Owner         | Persistence |  Size   | Description 
------------------+--------------------+-------------------+----------------------+-------------+---------+-------------
- tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | 0 bytes | 
- tableam_display | tbl_heap           | table             | regress_display_role | permanent   | 0 bytes | 
- tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | 0 bytes | 
- tableam_display | view_heap_psql     | view              | regress_display_role | permanent   | 0 bytes | 
+                                              List of relations
+     Schema      |        Name        |       Type        |        Owner         | Persistence | Description 
+-----------------+--------------------+-------------------+----------------------+-------------+-------------
+ tableam_display | mat_view_heap_psql | materialized view | regress_display_role | permanent   | 
+ tableam_display | tbl_heap           | table             | regress_display_role | permanent   | 
+ tableam_display | tbl_heap_psql      | table             | regress_display_role | permanent   | 
+ tableam_display | view_heap_psql     | view              | regress_display_role | permanent   | 
 (4 rows)
 
 RESET ROLE;
-- 
2.17.1


--HcAYCG3uE/tztfnV--





^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: Change copyObject() to use typeof_unqual
@ 2026-01-20 15:47 Andres Freund <[email protected]>
  0 siblings, 0 replies; 17+ messages in thread

From: Andres Freund @ 2026-01-20 15:47 UTC (permalink / raw)
  To: Peter Eisentraut <[email protected]>; +Cc: pgsql-hackers; Nazir Bilal Yavuz <[email protected]>

Hi,

On 2026-01-20 10:37:35 +0100, Peter Eisentraut wrote:
> (Even MSVC supports it, if we use a slightly newer version than is on CI.
> For example, the new buildfarm member unicorn would support it.)

FWIW, we've recently installed a newer msvc version in the image, we could
switch to that if desired.

Greetings,

Andres






^ permalink  raw  reply  [nested|flat] 17+ messages in thread


end of thread, other threads:[~2026-01-20 15:47 UTC | newest]

Thread overview: 17+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-05-03 14:24 [PATCH v3] make \d pg_toast.foo show its indices Justin Pryzby <[email protected]>
2019-05-03 14:24 [PATCH v5] make \d pg_toast.foo show its indices Justin Pryzby <[email protected]>
2019-05-03 14:24 [PATCH v7] make \d pg_toast.foo show its indices Justin Pryzby <[email protected]>
2019-05-03 14:24 [PATCH v5] make \d pg_toast.foo show its indices Justin Pryzby <[email protected]>
2019-05-03 14:24 [PATCH v2 1/2] make \d pg_toast.foo show its indices Justin Pryzby <[email protected]>
2019-05-03 14:24 [PATCH v3] make \d pg_toast.foo show its indices Justin Pryzby <[email protected]>
2019-06-30 03:10 Re: [HACKERS] proposal: schema variables Pavel Stehule <[email protected]>
2021-12-17 15:35 [PATCH 4/4] Move the double-plus "Size" columns to the right Justin Pryzby <[email protected]>
2021-12-17 15:35 [PATCH 4/4] Move the double-plus "Size" columns to the right Justin Pryzby <[email protected]>
2021-12-17 15:35 [PATCH v4 4/4] Move the double-plus "Size" columns to the right Justin Pryzby <[email protected]>
2021-12-17 15:35 [PATCH 4/4] Move the double-plus "Size" columns to the right Justin Pryzby <[email protected]>
2021-12-17 15:35 [PATCH v8 4/4] Move the double-plus "Size" columns to the right Justin Pryzby <[email protected]>
2021-12-17 15:35 [PATCH 4/4] Move the double-plus "Size" columns to the right Justin Pryzby <[email protected]>
2021-12-17 15:35 [PATCH 4/4] Move the double-plus "Size" columns to the right Justin Pryzby <[email protected]>
2021-12-17 15:35 [PATCH 4/4] Move the double-plus "Size" columns to the right Justin Pryzby <[email protected]>
2021-12-17 15:35 [PATCH 4/4] Move the double-plus "Size" columns to the right Justin Pryzby <[email protected]>
2026-01-20 15:47 Re: Change copyObject() to use typeof_unqual Andres Freund <[email protected]>

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