Commit 9491c82f authored by Bruce Momjian's avatar Bruce Momjian

This makes all the \dX commands (most importantly to most: \df) work

like \dt does, in that it requires a \dXS to see system items.

Greg Sabino Mullane
parent e825fac2
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (c) 2000-2009, PostgreSQL Global Development Group * Copyright (c) 2000-2009, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.200 2009/01/01 17:23:54 momjian Exp $ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.201 2009/01/06 21:10:30 momjian Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
#include "command.h" #include "command.h"
...@@ -327,13 +327,14 @@ exec_command(const char *cmd, ...@@ -327,13 +327,14 @@ exec_command(const char *cmd,
else if (cmd[0] == 'd') else if (cmd[0] == 'd')
{ {
char *pattern; char *pattern;
bool show_verbose; bool show_verbose, show_system;
/* We don't do SQLID reduction on the pattern yet */ /* We don't do SQLID reduction on the pattern yet */
pattern = psql_scan_slash_option(scan_state, pattern = psql_scan_slash_option(scan_state,
OT_NORMAL, NULL, true); OT_NORMAL, NULL, true);
show_verbose = strchr(cmd, '+') ? true : false; show_verbose = strchr(cmd, '+') ? true : false;
show_system = strchr(cmd, 'S') ? true: false;
switch (cmd[1]) switch (cmd[1])
{ {
...@@ -343,28 +344,28 @@ exec_command(const char *cmd, ...@@ -343,28 +344,28 @@ exec_command(const char *cmd,
success = describeTableDetails(pattern, show_verbose); success = describeTableDetails(pattern, show_verbose);
else else
/* standard listing of interesting things */ /* standard listing of interesting things */
success = listTables("tvs", NULL, show_verbose); success = listTables("tvs", NULL, show_verbose, show_system);
break; break;
case 'a': case 'a':
success = describeAggregates(pattern, show_verbose); success = describeAggregates(pattern, show_verbose, show_system);
break; break;
case 'b': case 'b':
success = describeTablespaces(pattern, show_verbose); success = describeTablespaces(pattern, show_verbose);
break; break;
case 'c': case 'c':
success = listConversions(pattern); success = listConversions(pattern, show_system);
break; break;
case 'C': case 'C':
success = listCasts(pattern); success = listCasts(pattern);
break; break;
case 'd': case 'd':
success = objectDescription(pattern); success = objectDescription(pattern, show_system);
break; break;
case 'D': case 'D':
success = listDomains(pattern); success = listDomains(pattern, show_system);
break; break;
case 'f': case 'f':
success = describeFunctions(pattern, show_verbose); success = describeFunctions(pattern, show_verbose, show_system);
break; break;
case 'g': case 'g':
/* no longer distinct from \du */ /* no longer distinct from \du */
...@@ -377,20 +378,20 @@ exec_command(const char *cmd, ...@@ -377,20 +378,20 @@ exec_command(const char *cmd,
success = listSchemas(pattern, show_verbose); success = listSchemas(pattern, show_verbose);
break; break;
case 'o': case 'o':
success = describeOperators(pattern); success = describeOperators(pattern, show_system);
break; break;
case 'p': case 'p':
success = permissionsList(pattern); success = permissionsList(pattern);
break; break;
case 'T': case 'T':
success = describeTypes(pattern, show_verbose); success = describeTypes(pattern, show_verbose, show_system);
break; break;
case 't': case 't':
case 'v': case 'v':
case 'i': case 'i':
case 's': case 's':
case 'S': case 'S':
success = listTables(&cmd[1], pattern, show_verbose); success = listTables(&cmd[1], pattern, show_verbose, show_system);
break; break;
case 'u': case 'u':
success = describeRoles(pattern, show_verbose); success = describeRoles(pattern, show_verbose);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* Copyright (c) 2000-2009, PostgreSQL Global Development Group * Copyright (c) 2000-2009, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.193 2009/01/01 17:23:54 momjian Exp $ * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.194 2009/01/06 21:10:30 momjian Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
...@@ -53,7 +53,7 @@ static void printACLColumn(PQExpBuffer buf, const char *colname); ...@@ -53,7 +53,7 @@ static void printACLColumn(PQExpBuffer buf, const char *colname);
* Takes an optional regexp to select particular aggregates * Takes an optional regexp to select particular aggregates
*/ */
bool bool
describeAggregates(const char *pattern, bool verbose) describeAggregates(const char *pattern, bool verbose, bool showSystem)
{ {
PQExpBufferData buf; PQExpBufferData buf;
PGresult *res; PGresult *res;
...@@ -76,7 +76,7 @@ describeAggregates(const char *pattern, bool verbose) ...@@ -76,7 +76,7 @@ describeAggregates(const char *pattern, bool verbose)
" ELSE\n" " ELSE\n"
" pg_catalog.array_to_string(ARRAY(\n" " pg_catalog.array_to_string(ARRAY(\n"
" SELECT\n" " SELECT\n"
" pg_catalog.format_type(p.proargtypes[s.i], NULL)\n" " pg_catalog.format_type(p.proargtypes[s.i], NULL)\n"
" FROM\n" " FROM\n"
" pg_catalog.generate_series(0, pg_catalog.array_upper(p.proargtypes, 1)) AS s(i)\n" " pg_catalog.generate_series(0, pg_catalog.array_upper(p.proargtypes, 1)) AS s(i)\n"
" ), ', ')\n" " ), ', ')\n"
...@@ -94,6 +94,9 @@ describeAggregates(const char *pattern, bool verbose) ...@@ -94,6 +94,9 @@ describeAggregates(const char *pattern, bool verbose)
"WHERE p.proisagg\n", "WHERE p.proisagg\n",
gettext_noop("Description")); gettext_noop("Description"));
if (!showSystem)
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, true, false, processSQLNamePattern(pset.db, &buf, pattern, true, false,
"n.nspname", "p.proname", NULL, "n.nspname", "p.proname", NULL,
"pg_catalog.pg_function_is_visible(p.oid)"); "pg_catalog.pg_function_is_visible(p.oid)");
...@@ -182,7 +185,7 @@ describeTablespaces(const char *pattern, bool verbose) ...@@ -182,7 +185,7 @@ describeTablespaces(const char *pattern, bool verbose)
* Takes an optional regexp to select particular functions * Takes an optional regexp to select particular functions
*/ */
bool bool
describeFunctions(const char *pattern, bool verbose) describeFunctions(const char *pattern, bool verbose, bool showSystem)
{ {
PQExpBufferData buf; PQExpBufferData buf;
PGresult *res; PGresult *res;
...@@ -278,6 +281,9 @@ describeFunctions(const char *pattern, bool verbose) ...@@ -278,6 +281,9 @@ describeFunctions(const char *pattern, bool verbose)
" AND p.proargtypes[0] IS DISTINCT FROM 'pg_catalog.cstring'::pg_catalog.regtype\n" " AND p.proargtypes[0] IS DISTINCT FROM 'pg_catalog.cstring'::pg_catalog.regtype\n"
" AND NOT p.proisagg\n"); " AND NOT p.proisagg\n");
if (!showSystem)
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, true, false, processSQLNamePattern(pset.db, &buf, pattern, true, false,
"n.nspname", "p.proname", NULL, "n.nspname", "p.proname", NULL,
"pg_catalog.pg_function_is_visible(p.oid)"); "pg_catalog.pg_function_is_visible(p.oid)");
...@@ -306,7 +312,7 @@ describeFunctions(const char *pattern, bool verbose) ...@@ -306,7 +312,7 @@ describeFunctions(const char *pattern, bool verbose)
* describe types * describe types
*/ */
bool bool
describeTypes(const char *pattern, bool verbose) describeTypes(const char *pattern, bool verbose, bool showSystem)
{ {
PQExpBufferData buf; PQExpBufferData buf;
PGresult *res; PGresult *res;
...@@ -366,6 +372,9 @@ describeTypes(const char *pattern, bool verbose) ...@@ -366,6 +372,9 @@ describeTypes(const char *pattern, bool verbose)
else else
appendPQExpBuffer(&buf, " AND t.typname !~ '^_'\n"); appendPQExpBuffer(&buf, " AND t.typname !~ '^_'\n");
if (!showSystem)
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
/* Match name pattern against either internal or external name */ /* Match name pattern against either internal or external name */
processSQLNamePattern(pset.db, &buf, pattern, true, false, processSQLNamePattern(pset.db, &buf, pattern, true, false,
"n.nspname", "t.typname", "n.nspname", "t.typname",
...@@ -393,7 +402,7 @@ describeTypes(const char *pattern, bool verbose) ...@@ -393,7 +402,7 @@ describeTypes(const char *pattern, bool verbose)
/* \do /* \do
*/ */
bool bool
describeOperators(const char *pattern) describeOperators(const char *pattern, bool showSystem)
{ {
PQExpBufferData buf; PQExpBufferData buf;
PGresult *res; PGresult *res;
...@@ -418,7 +427,10 @@ describeOperators(const char *pattern) ...@@ -418,7 +427,10 @@ describeOperators(const char *pattern)
gettext_noop("Result type"), gettext_noop("Result type"),
gettext_noop("Description")); gettext_noop("Description"));
processSQLNamePattern(pset.db, &buf, pattern, false, true, if (!showSystem)
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, !showSystem, true,
"n.nspname", "o.oprname", NULL, "n.nspname", "o.oprname", NULL,
"pg_catalog.pg_operator_is_visible(o.oid)"); "pg_catalog.pg_operator_is_visible(o.oid)");
...@@ -580,7 +592,7 @@ permissionsList(const char *pattern) ...@@ -580,7 +592,7 @@ permissionsList(const char *pattern)
* lists of things, there are other \d? commands. * lists of things, there are other \d? commands.
*/ */
bool bool
objectDescription(const char *pattern) objectDescription(const char *pattern, bool showSystem)
{ {
PQExpBufferData buf; PQExpBufferData buf;
PGresult *res; PGresult *res;
...@@ -607,6 +619,10 @@ objectDescription(const char *pattern) ...@@ -607,6 +619,10 @@ objectDescription(const char *pattern)
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n" " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
" WHERE p.proisagg\n", " WHERE p.proisagg\n",
gettext_noop("aggregate")); gettext_noop("aggregate"));
if (!showSystem)
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, true, false, processSQLNamePattern(pset.db, &buf, pattern, true, false,
"n.nspname", "p.proname", NULL, "n.nspname", "p.proname", NULL,
"pg_catalog.pg_function_is_visible(p.oid)"); "pg_catalog.pg_function_is_visible(p.oid)");
...@@ -626,6 +642,10 @@ objectDescription(const char *pattern) ...@@ -626,6 +642,10 @@ objectDescription(const char *pattern)
" OR p.proargtypes[0] <> 'pg_catalog.cstring'::pg_catalog.regtype)\n" " OR p.proargtypes[0] <> 'pg_catalog.cstring'::pg_catalog.regtype)\n"
" AND NOT p.proisagg\n", " AND NOT p.proisagg\n",
gettext_noop("function")); gettext_noop("function"));
if (!showSystem)
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, true, false, processSQLNamePattern(pset.db, &buf, pattern, true, false,
"n.nspname", "p.proname", NULL, "n.nspname", "p.proname", NULL,
"pg_catalog.pg_function_is_visible(p.oid)"); "pg_catalog.pg_function_is_visible(p.oid)");
...@@ -640,7 +660,11 @@ objectDescription(const char *pattern) ...@@ -640,7 +660,11 @@ objectDescription(const char *pattern)
" FROM pg_catalog.pg_operator o\n" " FROM pg_catalog.pg_operator o\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = o.oprnamespace\n", " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = o.oprnamespace\n",
gettext_noop("operator")); gettext_noop("operator"));
processSQLNamePattern(pset.db, &buf, pattern, false, false,
if (!showSystem)
appendPQExpBuffer(&buf, " WHERE n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, !showSystem, false,
"n.nspname", "o.oprname", NULL, "n.nspname", "o.oprname", NULL,
"pg_catalog.pg_operator_is_visible(o.oid)"); "pg_catalog.pg_operator_is_visible(o.oid)");
...@@ -654,7 +678,11 @@ objectDescription(const char *pattern) ...@@ -654,7 +678,11 @@ objectDescription(const char *pattern)
" FROM pg_catalog.pg_type t\n" " FROM pg_catalog.pg_type t\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n", " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n",
gettext_noop("data type")); gettext_noop("data type"));
processSQLNamePattern(pset.db, &buf, pattern, false, false,
if (!showSystem)
appendPQExpBuffer(&buf, " WHERE n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, !showSystem, false,
"n.nspname", "pg_catalog.format_type(t.oid, NULL)", "n.nspname", "pg_catalog.format_type(t.oid, NULL)",
NULL, NULL,
"pg_catalog.pg_type_is_visible(t.oid)"); "pg_catalog.pg_type_is_visible(t.oid)");
...@@ -675,6 +703,9 @@ objectDescription(const char *pattern) ...@@ -675,6 +703,9 @@ objectDescription(const char *pattern)
gettext_noop("view"), gettext_noop("view"),
gettext_noop("index"), gettext_noop("index"),
gettext_noop("sequence")); gettext_noop("sequence"));
if (!showSystem)
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, true, false, processSQLNamePattern(pset.db, &buf, pattern, true, false,
"n.nspname", "c.relname", NULL, "n.nspname", "c.relname", NULL,
"pg_catalog.pg_table_is_visible(c.oid)"); "pg_catalog.pg_table_is_visible(c.oid)");
...@@ -691,6 +722,10 @@ objectDescription(const char *pattern) ...@@ -691,6 +722,10 @@ objectDescription(const char *pattern)
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n" " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n"
" WHERE r.rulename != '_RETURN'\n", " WHERE r.rulename != '_RETURN'\n",
gettext_noop("rule")); gettext_noop("rule"));
if (!showSystem)
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
/* XXX not sure what to do about visibility rule here? */ /* XXX not sure what to do about visibility rule here? */
processSQLNamePattern(pset.db, &buf, pattern, true, false, processSQLNamePattern(pset.db, &buf, pattern, true, false,
"n.nspname", "r.rulename", NULL, "n.nspname", "r.rulename", NULL,
...@@ -707,8 +742,11 @@ objectDescription(const char *pattern) ...@@ -707,8 +742,11 @@ objectDescription(const char *pattern)
" JOIN pg_catalog.pg_class c ON c.oid = t.tgrelid\n" " JOIN pg_catalog.pg_class c ON c.oid = t.tgrelid\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n", " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n",
gettext_noop("trigger")); gettext_noop("trigger"));
if (!showSystem)
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
/* XXX not sure what to do about visibility rule here? */ /* XXX not sure what to do about visibility rule here? */
processSQLNamePattern(pset.db, &buf, pattern, false, false, processSQLNamePattern(pset.db, &buf, pattern, !showSystem, false,
"n.nspname", "t.tgname", NULL, "n.nspname", "t.tgname", NULL,
"pg_catalog.pg_table_is_visible(c.oid)"); "pg_catalog.pg_table_is_visible(c.oid)");
...@@ -1856,13 +1894,12 @@ add_role_attribute(PQExpBuffer buf, const char *const str) ...@@ -1856,13 +1894,12 @@ add_role_attribute(PQExpBuffer buf, const char *const str)
* (any order of the above is fine) * (any order of the above is fine)
*/ */
bool bool
listTables(const char *tabtypes, const char *pattern, bool verbose) listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSystem)
{ {
bool showTables = strchr(tabtypes, 't') != NULL; bool showTables = strchr(tabtypes, 't') != NULL;
bool showIndexes = strchr(tabtypes, 'i') != NULL; bool showIndexes = strchr(tabtypes, 'i') != NULL;
bool showViews = strchr(tabtypes, 'v') != NULL; bool showViews = strchr(tabtypes, 'v') != NULL;
bool showSeq = strchr(tabtypes, 's') != NULL; bool showSeq = strchr(tabtypes, 's') != NULL;
bool showSystem = strchr(tabtypes, 'S') != NULL;
PQExpBufferData buf; PQExpBufferData buf;
PGresult *res; PGresult *res;
...@@ -1981,7 +2018,7 @@ listTables(const char *tabtypes, const char *pattern, bool verbose) ...@@ -1981,7 +2018,7 @@ listTables(const char *tabtypes, const char *pattern, bool verbose)
* Describes domains. * Describes domains.
*/ */
bool bool
listDomains(const char *pattern) listDomains(const char *pattern, bool showSystem)
{ {
PQExpBufferData buf; PQExpBufferData buf;
PGresult *res; PGresult *res;
...@@ -2009,6 +2046,9 @@ listDomains(const char *pattern) ...@@ -2009,6 +2046,9 @@ listDomains(const char *pattern)
gettext_noop("Modifier"), gettext_noop("Modifier"),
gettext_noop("Check")); gettext_noop("Check"));
if (!showSystem)
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, true, false, processSQLNamePattern(pset.db, &buf, pattern, true, false,
"n.nspname", "t.typname", NULL, "n.nspname", "t.typname", NULL,
"pg_catalog.pg_type_is_visible(t.oid)"); "pg_catalog.pg_type_is_visible(t.oid)");
...@@ -2036,7 +2076,7 @@ listDomains(const char *pattern) ...@@ -2036,7 +2076,7 @@ listDomains(const char *pattern)
* Describes conversions. * Describes conversions.
*/ */
bool bool
listConversions(const char *pattern) listConversions(const char *pattern, bool showSystem)
{ {
PQExpBufferData buf; PQExpBufferData buf;
PGresult *res; PGresult *res;
...@@ -2061,6 +2101,9 @@ listConversions(const char *pattern) ...@@ -2061,6 +2101,9 @@ listConversions(const char *pattern)
gettext_noop("yes"), gettext_noop("no"), gettext_noop("yes"), gettext_noop("no"),
gettext_noop("Default?")); gettext_noop("Default?"));
if (!showSystem)
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, true, false, processSQLNamePattern(pset.db, &buf, pattern, true, false,
"n.nspname", "c.conname", NULL, "n.nspname", "c.conname", NULL,
"pg_catalog.pg_conversion_is_visible(c.oid)"); "pg_catalog.pg_conversion_is_visible(c.oid)");
......
...@@ -3,26 +3,26 @@ ...@@ -3,26 +3,26 @@
* *
* Copyright (c) 2000-2009, PostgreSQL Global Development Group * Copyright (c) 2000-2009, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/bin/psql/describe.h,v 1.37 2009/01/01 17:23:55 momjian Exp $ * $PostgreSQL: pgsql/src/bin/psql/describe.h,v 1.38 2009/01/06 21:10:30 momjian Exp $
*/ */
#ifndef DESCRIBE_H #ifndef DESCRIBE_H
#define DESCRIBE_H #define DESCRIBE_H
/* \da */ /* \da */
extern bool describeAggregates(const char *pattern, bool verbose); extern bool describeAggregates(const char *pattern, bool verbose, bool showSystem);
/* \db */ /* \db */
extern bool describeTablespaces(const char *pattern, bool verbose); extern bool describeTablespaces(const char *pattern, bool verbose);
/* \df */ /* \df */
extern bool describeFunctions(const char *pattern, bool verbose); extern bool describeFunctions(const char *pattern, bool verbose, bool showSystem);
/* \dT */ /* \dT */
extern bool describeTypes(const char *pattern, bool verbose); extern bool describeTypes(const char *pattern, bool verbose, bool showSystem);
/* \do */ /* \do */
extern bool describeOperators(const char *pattern); extern bool describeOperators(const char *pattern, bool showSystem);
/* \du, \dg */ /* \du, \dg */
extern bool describeRoles(const char *pattern, bool verbose); extern bool describeRoles(const char *pattern, bool verbose);
...@@ -31,7 +31,7 @@ extern bool describeRoles(const char *pattern, bool verbose); ...@@ -31,7 +31,7 @@ extern bool describeRoles(const char *pattern, bool verbose);
extern bool permissionsList(const char *pattern); extern bool permissionsList(const char *pattern);
/* \dd */ /* \dd */
extern bool objectDescription(const char *pattern); extern bool objectDescription(const char *pattern, bool showSystem);
/* \d foo */ /* \d foo */
extern bool describeTableDetails(const char *pattern, bool verbose); extern bool describeTableDetails(const char *pattern, bool verbose);
...@@ -52,13 +52,13 @@ extern bool listTSTemplates(const char *pattern, bool verbose); ...@@ -52,13 +52,13 @@ extern bool listTSTemplates(const char *pattern, bool verbose);
extern bool listAllDbs(bool verbose); extern bool listAllDbs(bool verbose);
/* \dt, \di, \ds, \dS, etc. */ /* \dt, \di, \ds, \dS, etc. */
extern bool listTables(const char *tabtypes, const char *pattern, bool verbose); extern bool listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSystem);
/* \dD */ /* \dD */
extern bool listDomains(const char *pattern); extern bool listDomains(const char *pattern, bool showSystem);
/* \dc */ /* \dc */
extern bool listConversions(const char *pattern); extern bool listConversions(const char *pattern, bool showSystem);
/* \dC */ /* \dC */
extern bool listCasts(const char *pattern); extern bool listCasts(const char *pattern);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (c) 2000-2009, PostgreSQL Global Development Group * Copyright (c) 2000-2009, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.133 2009/01/01 17:23:55 momjian Exp $ * $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.134 2009/01/06 21:10:30 momjian Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
...@@ -194,32 +194,37 @@ slashUsage(unsigned short int pager) ...@@ -194,32 +194,37 @@ slashUsage(unsigned short int pager)
fprintf(output, "\n"); fprintf(output, "\n");
fprintf(output, _("Informational\n")); fprintf(output, _("Informational\n"));
fprintf(output, _(" \\d [NAME] describe table, index, sequence, or view\n")); fprintf(output, _(" Modifiers: S = show system objects + = Additional detail\n"));
fprintf(output, _(" \\d{t|i|s|v|S} [PATTERN] (add \"+\" for more detail)\n" fprintf(output, _(" \\l[+] list all databases\n"));
" list tables/indexes/sequences/views/system tables\n")); fprintf(output, _(" \\d[S] list tables, views, and sequences\n"));
fprintf(output, _(" \\da [PATTERN] list aggregate functions\n")); fprintf(output, _(" \\d[S] NAME describe table, view, sequence, or index\n"));
fprintf(output, _(" \\db [PATTERN] list tablespaces (add \"+\" for more detail)\n")); fprintf(output, _(" \\dt[S+] [PATTERN] list tables\n"));
fprintf(output, _(" \\dc [PATTERN] list conversions\n")); fprintf(output, _(" \\dv[S+] [PATTERN] list views\n"));
fprintf(output, _(" \\dC [PATTERN] list casts\n")); fprintf(output, _(" \\ds[S+] [PATTERN] list sequences\n"));
fprintf(output, _(" \\dd [PATTERN] show comment for object\n")); fprintf(output, _(" \\di[S+] [PATTERN] list indexes\n"));
fprintf(output, _(" \\dD [PATTERN] list domains\n")); fprintf(output, _(" \\df[S+] [PATTERN] list functions\n"));
fprintf(output, _(" \\des [PATTERN] list foreign servers (add \"+\" for more detail)\n")); fprintf(output, _(" \\dT[S+] [PATTERN] list data types\n"));
fprintf(output, _(" \\deu [PATTERN] list user mappings (add \"+\" for more detail)\n")); fprintf(output, _(" \\dd[S] [PATTERN] list comments on objects\n"));
fprintf(output, _(" \\dew [PATTERN] list foreign-data wrappers (add \"+\" for more detail)\n")); fprintf(output, _(" \\dD[S] [PATTERN] list domains\n"));
fprintf(output, _(" \\df [PATTERN] list functions (add \"+\" for more detail)\n")); fprintf(output, _(" \\des[+] [PATTERN] list foreign servers\n"));
fprintf(output, _(" \\dF [PATTERN] list text search configurations (add \"+\" for more detail)\n")); fprintf(output, _(" \\deu[+] [PATTERN] list user mappings\n"));
fprintf(output, _(" \\dFd [PATTERN] list text search dictionaries (add \"+\" for more detail)\n")); fprintf(output, _(" \\dew[+] [PATTERN] list foreign-data wrappers\n"));
fprintf(output, _(" \\dFt [PATTERN] list text search templates\n")); fprintf(output, _(" \\do[S] [PATTERN] list operators\n"));
fprintf(output, _(" \\dFp [PATTERN] list text search parsers (add \"+\" for more detail)\n")); fprintf(output, _(" \\da[S] [PATTERN] list aggregate functions\n"));
fprintf(output, _(" \\dg [PATTERN] list roles (groups)\n")); fprintf(output, _(" \\dc[S] [PATTERN] list conversions\n"));
fprintf(output, _(" \\dn [PATTERN] list schemas (add \"+\" for more detail)\n")); fprintf(output, _(" \\db[+] [PATTERN] list tablespaces\n"));
fprintf(output, _(" \\do [NAME] list operators\n")); fprintf(output, _(" \\dn[+] [PATTERN] list schemas\n"));
fprintf(output, _(" \\dl list large objects, same as \\lo_list\n")); fprintf(output, _(" \\dC list casts\n"));
fprintf(output, _(" \\dp [PATTERN] list table, view, and sequence access privileges\n")); fprintf(output, _(" \\dd [PATTERN] show comment for object\n"));
fprintf(output, _(" \\dT [PATTERN] list data types (add \"+\" for more detail)\n")); fprintf(output, _(" \\dF[+] [PATTERN] list text search configurations\n"));
fprintf(output, _(" \\du [PATTERN] list roles (users)\n")); fprintf(output, _(" \\dFd[+] [PATTERN] list text search dictionaries\n"));
fprintf(output, _(" \\l list all databases (add \"+\" for more detail)\n")); fprintf(output, _(" \\dFt [PATTERN] list text search templates\n"));
fprintf(output, _(" \\z [PATTERN] list table, view, and sequence access privileges (same as \\dp)\n")); fprintf(output, _(" \\dFp[+] [PATTERN] list text search parsers\n"));
fprintf(output, _(" \\dg [PATTERN] list roles (groups)\n"));
fprintf(output, _(" \\dl list large objects, same as \\lo_list\n"));
fprintf(output, _(" \\du [PATTERN] list roles (users)\n"));
fprintf(output, _(" \\dp [PATTERN] list table, view, and sequence access privileges\n"));
fprintf(output, _(" \\z [PATTERN] same as \\dp\n"));
fprintf(output, "\n"); fprintf(output, "\n");
fprintf(output, _("Formatting\n")); fprintf(output, _("Formatting\n"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment