diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-06-18 06:14:31 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-06-18 06:14:31 +0000 |
commit | 2467394ee1566e82d0314d12a0d1c0a5670a28c9 (patch) | |
tree | 57b87b8c181a9c3eb0f33bf775a5f31b9de8b890 /src/bin/psql/describe.c | |
parent | 474875f4438ea0d18f9f4170117bc407e6812515 (diff) |
Tablespaces. Alternate database locations are dead, long live tablespaces.
There are various things left to do: contrib dbsize and oid2name modules
need work, and so does the documentation. Also someone should think about
COMMENT ON TABLESPACE and maybe RENAME TABLESPACE. Also initlocation is
dead, it just doesn't know it yet.
Gavin Sherry and Tom Lane.
Diffstat (limited to 'src/bin/psql/describe.c')
-rw-r--r-- | src/bin/psql/describe.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index e06c2001581..0f75d97d23d 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2003, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.98 2004/05/07 00:24:58 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.99 2004/06/18 06:14:04 tgl Exp $ */ #include "postgres_fe.h" #include "describe.h" @@ -99,6 +99,45 @@ describeAggregates(const char *pattern, bool verbose) return true; } +/* \db + * Takes an optional regexp to select particular tablespaces + */ +bool +describeTablespaces(const char *pattern) +{ + PQExpBufferData buf; + PGresult *res; + printQueryOpt myopt = pset.popt; + + initPQExpBuffer(&buf); + + printfPQExpBuffer(&buf, + "SELECT spcname AS \"%s\",\n" + " pg_catalog.pg_get_userbyid(spcowner) AS \"%s\",\n" + " spclocation AS \"%s\"\n" + "FROM pg_catalog.pg_tablespace\n", + _("Name"), _("Owner"), _("Location")); + + processNamePattern(&buf, pattern, false, false, + NULL, "spcname", NULL, + NULL); + + appendPQExpBuffer(&buf, "ORDER BY 1;"); + + res = PSQLexec(buf.data, false); + termPQExpBuffer(&buf); + if (!res) + return false; + + myopt.nullPrint = NULL; + myopt.title = _("List of tablespaces"); + + printQuery(res, &myopt, pset.queryFout); + + PQclear(res); + return true; +} + /* \df * Takes an optional regexp to select particular functions @@ -351,7 +390,7 @@ permissionsList(const char *pattern) printfPQExpBuffer(&buf, "SELECT n.nspname as \"%s\",\n" " c.relname as \"%s\",\n" - " CASE c.relkind WHEN 'r' THEN '%s' WHEN 'v' THEN '%s' WHEN 'S' THEN '%s' END as \"%s\",\n" + " CASE c.relkind WHEN 'r' THEN '%s' WHEN 'v' THEN '%s' WHEN 'S' THEN '%s' END as \"%s\",\n" " c.relacl as \"%s\"\n" "FROM pg_catalog.pg_class c\n" " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n" |