public inbox for [email protected]help / color / mirror / Atom feed
[PATCH 4/4] Move the double-plus "Size" columns to the right 3+ messages / 3 participants [nested] [flat]
* [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; 3+ 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] 3+ messages in thread
* Re: WIP Incremental JSON Parser @ 2024-04-04 21:34 Jacob Champion <[email protected]> 0 siblings, 1 reply; 3+ messages in thread From: Jacob Champion @ 2024-04-04 21:34 UTC (permalink / raw) To: Jelte Fennema-Nio <[email protected]>; +Cc: Andrew Dunstan <[email protected]>; Tom Lane <[email protected]>; Amit Langote <[email protected]>; Robert Haas <[email protected]>; Peter Smith <[email protected]>; PostgreSQL Hackers <[email protected]> On Thu, Apr 4, 2024 at 1:42 PM Jelte Fennema-Nio <[email protected]> wrote: > Maybe that's something worth addressing too. I expected that > install/install-quiet was a strict superset of a plain ninja > invocation. Maybe that's the intent, but I hope not, because I don't see any reason for `ninja install` to worry about test-only binaries that won't be installed. For the tests, there's a pretty clear rationale for the dependency. --Jacob ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: WIP Incremental JSON Parser @ 2024-04-04 21:52 Jelte Fennema-Nio <[email protected]> parent: Jacob Champion <[email protected]> 0 siblings, 0 replies; 3+ messages in thread From: Jelte Fennema-Nio @ 2024-04-04 21:52 UTC (permalink / raw) To: Jacob Champion <[email protected]>; +Cc: Andrew Dunstan <[email protected]>; Tom Lane <[email protected]>; Amit Langote <[email protected]>; Robert Haas <[email protected]>; Peter Smith <[email protected]>; PostgreSQL Hackers <[email protected]> On Thu, 4 Apr 2024 at 23:34, Jacob Champion <[email protected]> wrote: > > On Thu, Apr 4, 2024 at 1:42 PM Jelte Fennema-Nio <[email protected]> wrote: > > Maybe that's something worth addressing too. I expected that > > install/install-quiet was a strict superset of a plain ninja > > invocation. > > Maybe that's the intent, but I hope not, because I don't see any > reason for `ninja install` to worry about test-only binaries that > won't be installed. For the tests, there's a pretty clear rationale > for the dependency. Fair enough, I guess I'll change my invocation to include the ninja "test" target too: ninja -C build test install-quiet && meson test -C build ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2024-04-04 21:52 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-12-17 15:35 [PATCH 4/4] Move the double-plus "Size" columns to the right Justin Pryzby <[email protected]> 2024-04-04 21:34 Re: WIP Incremental JSON Parser Jacob Champion <[email protected]> 2024-04-04 21:52 ` Re: WIP Incremental JSON Parser Jelte Fennema-Nio <[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