diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-03-30 18:10:20 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-03-30 18:10:20 +0000 |
commit | b65a5097463d6dc5d75661f5236a742c4023f989 (patch) | |
tree | 02548a4bd092afcd5476002623d0dc0856436943 /src | |
parent | 2be368a5af44b1a1c509d16256036acc9ba6d78b (diff) | |
download | postgresql-b65a5097463d6dc5d75661f5236a742c4023f989.tar.gz postgresql-b65a5097463d6dc5d75661f5236a742c4023f989.zip |
Show database access privileges in psql's \l command. For \l+, also show
database size, when available to the current user.
Andrew Gilligan
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/psql/describe.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 96c578aa70e..8b9422ac9c1 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2008, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.165 2008/03/30 17:50:11 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.166 2008/03/30 18:10:20 tgl Exp $ */ #include "postgres_fe.h" #include "describe.h" @@ -417,13 +417,21 @@ listAllDbs(bool verbose) printfPQExpBuffer(&buf, "SELECT d.datname as \"%s\",\n" " r.rolname as \"%s\",\n" - " pg_catalog.pg_encoding_to_char(d.encoding) as \"%s\"", + " pg_catalog.pg_encoding_to_char(d.encoding) as \"%s\",\n" + " d.datacl as \"%s\"", gettext_noop("Name"), gettext_noop("Owner"), - gettext_noop("Encoding")); + gettext_noop("Encoding"), + gettext_noop("Access Privileges")); if (verbose) { 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")); + appendPQExpBuffer(&buf, ",\n t.spcname as \"%s\"", gettext_noop("Tablespace")); appendPQExpBuffer(&buf, |