Commit 33e7eac3 authored by Bruce Momjian's avatar Bruce Momjian

Change psql \d* display so 'S' _or_ a pattern include system objects.

parent 248891f0
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.220 2009/02/26 16:02:37 petere Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.221 2009/04/02 15:15:31 momjian Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -853,9 +853,9 @@ testdb=&gt; ...@@ -853,9 +853,9 @@ testdb=&gt;
more information is displayed: any comments associated with the more information is displayed: any comments associated with the
columns of the table are shown, as is the presence of OIDs in the columns of the table are shown, as is the presence of OIDs in the
table. table.
The letter <literal>S</literal> adds the listing of system By default, only user-created objects are shown; supply a
objects; without <literal>S</literal>, only non-system pattern or the <literal>S</literal> modifier to include system
objects are shown. objects.
</para> </para>
<note> <note>
...@@ -879,9 +879,9 @@ testdb=&gt; ...@@ -879,9 +879,9 @@ testdb=&gt;
return type and the data types they operate on. If <replaceable return type and the data types they operate on. If <replaceable
class="parameter">pattern</replaceable> class="parameter">pattern</replaceable>
is specified, only aggregates whose names match the pattern are shown. is specified, only aggregates whose names match the pattern are shown.
The letter <literal>S</literal> adds the listing of system By default, only user-created objects are shown; supply a
objects; without <literal>S</literal>, only non-system pattern or the <literal>S</literal> modifier to include system
objects are shown. objects.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -910,9 +910,9 @@ testdb=&gt; ...@@ -910,9 +910,9 @@ testdb=&gt;
If <replaceable class="parameter">pattern</replaceable> If <replaceable class="parameter">pattern</replaceable>
is specified, only conversions whose names match the pattern are is specified, only conversions whose names match the pattern are
listed. listed.
The letter <literal>S</literal> adds the listing of system By default, only user-created objects are shown; supply a
objects; without <literal>S</literal>, only non-system pattern or the <literal>S</literal> modifier to include system
objects are shown. objects.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -939,9 +939,9 @@ testdb=&gt; ...@@ -939,9 +939,9 @@ testdb=&gt;
class="parameter">pattern</replaceable>, or of all visible objects if class="parameter">pattern</replaceable>, or of all visible objects if
no argument is given. But in either case, only objects that have no argument is given. But in either case, only objects that have
a description are listed. a description are listed.
The letter <literal>S</literal> adds the listing of system By default, only user-created objects are shown; supply a
objects; without <literal>S</literal>, only non-system pattern or the <literal>S</literal> modifier to include system
objects are shown. objects.
(<quote>Object</quote> covers aggregates, functions, operators, (<quote>Object</quote> covers aggregates, functions, operators,
types, relations (tables, views, indexes, sequences, large types, relations (tables, views, indexes, sequences, large
objects), rules, and triggers.) For example: objects), rules, and triggers.) For example:
...@@ -971,9 +971,9 @@ testdb=&gt; ...@@ -971,9 +971,9 @@ testdb=&gt;
Lists all available domains. If <replaceable Lists all available domains. If <replaceable
class="parameter">pattern</replaceable> class="parameter">pattern</replaceable>
is specified, only matching domains are shown. is specified, only matching domains are shown.
The letter <literal>S</literal> adds the listing of system By default, only user-created objects are shown; supply a
objects; without <literal>S</literal>, only non-system pattern or the <literal>S</literal> modifier to include system
objects are shown. objects.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1045,9 +1045,9 @@ testdb=&gt; ...@@ -1045,9 +1045,9 @@ testdb=&gt;
is specified, only functions whose names match the pattern are shown. is specified, only functions whose names match the pattern are shown.
If the form <literal>\df+</literal> is used, additional information about If the form <literal>\df+</literal> is used, additional information about
each function, including volatility, language, source code and description, is shown. each function, including volatility, language, source code and description, is shown.
The letter <literal>S</literal> adds the listing of system By default, only user-created objects are shown; supply a
objects; without <literal>S</literal>, only non-system pattern or the <literal>S</literal> modifier to include system
objects are shown. objects.
</para> </para>
<note> <note>
...@@ -1155,9 +1155,9 @@ testdb=&gt; ...@@ -1155,9 +1155,9 @@ testdb=&gt;
and tables. If <literal>+</literal> is and tables. If <literal>+</literal> is
appended to the command name, each object is listed with its appended to the command name, each object is listed with its
physical size on disk and its associated description, if any. physical size on disk and its associated description, if any.
The letter <literal>S</literal> adds the listing of system By default, only user-created objects are shown; supply a
objects; without <literal>S</literal>, only non-system pattern or the <literal>S</literal> modifier to include system
objects are shown. objects.
</para> </para>
<para> <para>
...@@ -1202,9 +1202,9 @@ testdb=&gt; ...@@ -1202,9 +1202,9 @@ testdb=&gt;
Lists available operators with their operand and return types. Lists available operators with their operand and return types.
If <replaceable class="parameter">pattern</replaceable> is If <replaceable class="parameter">pattern</replaceable> is
specified, only operators whose names match the pattern are listed. specified, only operators whose names match the pattern are listed.
The letter <literal>S</literal> adds the listing of system By default, only user-created objects are shown; supply a
objects; without <literal>S</literal>, only non-system pattern or the <literal>S</literal> modifier to include system
objects are shown. objects.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1237,9 +1237,9 @@ testdb=&gt; ...@@ -1237,9 +1237,9 @@ testdb=&gt;
class="parameter">pattern</replaceable>. The command form class="parameter">pattern</replaceable>. The command form
<literal>\dT+</literal> shows extra information, namely the type's internal name, size, and <literal>\dT+</literal> shows extra information, namely the type's internal name, size, and
allowed values for <type>enum</> types. allowed values for <type>enum</> types.
The letter <literal>S</literal> adds the listing of system By default, only user-created objects are shown; supply a
objects; without <literal>S</literal>, only non-system pattern or the <literal>S</literal> modifier to include system
objects are shown. objects.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
......
...@@ -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.203 2009/03/26 22:26:07 petere Exp $ * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.204 2009/04/02 15:15:32 momjian Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
...@@ -94,7 +94,7 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem) ...@@ -94,7 +94,7 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
"WHERE p.proisagg\n", "WHERE p.proisagg\n",
gettext_noop("Description")); gettext_noop("Description"));
if (!showSystem) if (!showSystem && !pattern)
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n"); appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, true, false, processSQLNamePattern(pset.db, &buf, pattern, true, false,
...@@ -281,7 +281,7 @@ describeFunctions(const char *pattern, bool verbose, bool showSystem) ...@@ -281,7 +281,7 @@ describeFunctions(const char *pattern, bool verbose, bool showSystem)
" 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) if (!showSystem && !pattern)
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n"); appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, true, false, processSQLNamePattern(pset.db, &buf, pattern, true, false,
...@@ -372,7 +372,7 @@ describeTypes(const char *pattern, bool verbose, bool showSystem) ...@@ -372,7 +372,7 @@ describeTypes(const char *pattern, bool verbose, bool showSystem)
else else
appendPQExpBuffer(&buf, " AND t.typname !~ '^_'\n"); appendPQExpBuffer(&buf, " AND t.typname !~ '^_'\n");
if (!showSystem) if (!showSystem && !pattern)
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n"); 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 */
...@@ -427,10 +427,10 @@ describeOperators(const char *pattern, bool showSystem) ...@@ -427,10 +427,10 @@ describeOperators(const char *pattern, bool showSystem)
gettext_noop("Result type"), gettext_noop("Result type"),
gettext_noop("Description")); gettext_noop("Description"));
if (!showSystem) if (!showSystem && !pattern)
appendPQExpBuffer(&buf, " WHERE n.nspname <> 'pg_catalog'\n"); appendPQExpBuffer(&buf, " WHERE n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, !showSystem, true, processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, 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)");
...@@ -631,7 +631,7 @@ objectDescription(const char *pattern, bool showSystem) ...@@ -631,7 +631,7 @@ objectDescription(const char *pattern, bool showSystem)
" WHERE p.proisagg\n", " WHERE p.proisagg\n",
gettext_noop("aggregate")); gettext_noop("aggregate"));
if (!showSystem) if (!showSystem && !pattern)
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n"); appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, true, false, processSQLNamePattern(pset.db, &buf, pattern, true, false,
...@@ -654,7 +654,7 @@ objectDescription(const char *pattern, bool showSystem) ...@@ -654,7 +654,7 @@ objectDescription(const char *pattern, bool showSystem)
" AND NOT p.proisagg\n", " AND NOT p.proisagg\n",
gettext_noop("function")); gettext_noop("function"));
if (!showSystem) if (!showSystem && !pattern)
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n"); appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, true, false, processSQLNamePattern(pset.db, &buf, pattern, true, false,
...@@ -672,10 +672,10 @@ objectDescription(const char *pattern, bool showSystem) ...@@ -672,10 +672,10 @@ objectDescription(const char *pattern, bool showSystem)
" 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"));
if (!showSystem) if (!showSystem && !pattern)
appendPQExpBuffer(&buf, " WHERE n.nspname <> 'pg_catalog'\n"); appendPQExpBuffer(&buf, " WHERE n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, !showSystem, false, processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, 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)");
...@@ -690,10 +690,10 @@ objectDescription(const char *pattern, bool showSystem) ...@@ -690,10 +690,10 @@ objectDescription(const char *pattern, bool showSystem)
" 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"));
if (!showSystem) if (!showSystem && !pattern)
appendPQExpBuffer(&buf, " WHERE n.nspname <> 'pg_catalog'\n"); appendPQExpBuffer(&buf, " WHERE n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, !showSystem, false, processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, 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)");
...@@ -714,7 +714,7 @@ objectDescription(const char *pattern, bool showSystem) ...@@ -714,7 +714,7 @@ objectDescription(const char *pattern, bool showSystem)
gettext_noop("view"), gettext_noop("view"),
gettext_noop("index"), gettext_noop("index"),
gettext_noop("sequence")); gettext_noop("sequence"));
if (!showSystem) if (!showSystem && !pattern)
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n"); appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, true, false, processSQLNamePattern(pset.db, &buf, pattern, true, false,
...@@ -734,7 +734,7 @@ objectDescription(const char *pattern, bool showSystem) ...@@ -734,7 +734,7 @@ objectDescription(const char *pattern, bool showSystem)
" WHERE r.rulename != '_RETURN'\n", " WHERE r.rulename != '_RETURN'\n",
gettext_noop("rule")); gettext_noop("rule"));
if (!showSystem) if (!showSystem && !pattern)
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n"); 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? */
...@@ -753,11 +753,11 @@ objectDescription(const char *pattern, bool showSystem) ...@@ -753,11 +753,11 @@ objectDescription(const char *pattern, bool showSystem)
" 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) if (!showSystem && !pattern)
appendPQExpBuffer(&buf, " WHERE n.nspname <> 'pg_catalog'\n"); appendPQExpBuffer(&buf, " WHERE 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, !showSystem, false, processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, 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)");
...@@ -808,10 +808,10 @@ describeTableDetails(const char *pattern, bool verbose, bool showSystem) ...@@ -808,10 +808,10 @@ describeTableDetails(const char *pattern, bool verbose, bool showSystem)
"FROM pg_catalog.pg_class c\n" "FROM pg_catalog.pg_class c\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");
if (!showSystem) if (!showSystem && !pattern)
appendPQExpBuffer(&buf, " WHERE n.nspname <> 'pg_catalog'\n"); appendPQExpBuffer(&buf, " WHERE n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, !showSystem, false, processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, 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)");
...@@ -2008,12 +2008,12 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys ...@@ -2008,12 +2008,12 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys
appendPQExpBuffer(&buf, "'i',"); appendPQExpBuffer(&buf, "'i',");
if (showSeq) if (showSeq)
appendPQExpBuffer(&buf, "'S',"); appendPQExpBuffer(&buf, "'S',");
if (showSystem) if (showSystem || pattern)
appendPQExpBuffer(&buf, "'s',"); /* was RELKIND_SPECIAL in <= 8.1 */ appendPQExpBuffer(&buf, "'s',"); /* was RELKIND_SPECIAL in <= 8.1 */
appendPQExpBuffer(&buf, "''"); /* dummy */ appendPQExpBuffer(&buf, "''"); /* dummy */
appendPQExpBuffer(&buf, ")\n"); appendPQExpBuffer(&buf, ")\n");
if (!showSystem) if (!showSystem && !pattern)
/* Exclude system and pg_toast objects, but show temp tables */ /* Exclude system and pg_toast objects, but show temp tables */
appendPQExpBuffer(&buf, appendPQExpBuffer(&buf,
" AND n.nspname <> 'pg_catalog'\n" " AND n.nspname <> 'pg_catalog'\n"
...@@ -2087,7 +2087,7 @@ listDomains(const char *pattern, bool showSystem) ...@@ -2087,7 +2087,7 @@ listDomains(const char *pattern, bool showSystem)
gettext_noop("Modifier"), gettext_noop("Modifier"),
gettext_noop("Check")); gettext_noop("Check"));
if (!showSystem) if (!showSystem && !pattern)
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n"); appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, true, false, processSQLNamePattern(pset.db, &buf, pattern, true, false,
...@@ -2142,7 +2142,7 @@ listConversions(const char *pattern, bool showSystem) ...@@ -2142,7 +2142,7 @@ listConversions(const char *pattern, bool showSystem)
gettext_noop("yes"), gettext_noop("no"), gettext_noop("yes"), gettext_noop("no"),
gettext_noop("Default?")); gettext_noop("Default?"));
if (!showSystem) if (!showSystem && !pattern)
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n"); appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
processSQLNamePattern(pset.db, &buf, pattern, true, false, processSQLNamePattern(pset.db, &buf, pattern, true, false,
......
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