Skip to content

Commit a1e5331

Browse files
committed
Add tablespace display to psql \l+.
Philip Yarra
1 parent 525de8d commit a1e5331

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/bin/psql/describe.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.133 2006/03/05 15:58:51 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.134 2006/04/26 23:15:45 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "describe.h"
@@ -362,14 +362,21 @@ listAllDbs(bool verbose)
362362
",\n pg_catalog.pg_encoding_to_char(d.encoding) as \"%s\"",
363363
_("Encoding"));
364364
if (verbose)
365+
{
366+
appendPQExpBuffer(&buf,
367+
",\n t.spcname as \"%s\"",
368+
_("Tablespace"));
365369
appendPQExpBuffer(&buf,
366370
",\n pg_catalog.shobj_description(d.oid, 'pg_database') as \"%s\"",
367371
_("Description"));
372+
}
368373
appendPQExpBuffer(&buf,
369374
"\nFROM pg_catalog.pg_database d"
370-
"\n JOIN pg_catalog.pg_roles r ON d.datdba = r.oid\n"
371-
"ORDER BY 1;");
372-
375+
"\n JOIN pg_catalog.pg_roles r ON d.datdba = r.oid\n");
376+
if (verbose)
377+
appendPQExpBuffer(&buf,
378+
" JOIN pg_catalog.pg_tablespace t on d.dattablespace = t.oid\n");
379+
appendPQExpBuffer(&buf,"ORDER BY 1;");
373380
res = PSQLexec(buf.data, false);
374381
termPQExpBuffer(&buf);
375382
if (!res)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy