Change psql \d* display so 'S' _or_ a pattern include system objects.
authorBruce Momjian
Thu, 2 Apr 2009 15:15:32 +0000 (15:15 +0000)
committerBruce Momjian
Thu, 2 Apr 2009 15:15:32 +0000 (15:15 +0000)
doc/src/sgml/ref/psql-ref.sgml
src/bin/psql/describe.c

index 0f633e91601ae282ff048d283f498389318ce89c..f2ffa503a4a23ad541ab7f6586af7781721f1ec9 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -853,9 +853,9 @@ testdb=>
         more information is displayed: any comments associated with the
         columns of the table are shown, as is the presence of OIDs in the
         table.
-        The letter S adds the listing of system
-        objects; without S, only non-system
-        objects are shown.
+        By default, only user-created objects are shown;  supply a
+        pattern or the S modifier to include system
+        objects.
         
 
         
@@ -879,9 +879,9 @@ testdb=>
         return type and the data types they operate on. If 
         class="parameter">pattern
         is specified, only aggregates whose names match the pattern are shown.
-        The letter S adds the listing of system
-        objects; without S, only non-system
-        objects are shown.
+        By default, only user-created objects are shown;  supply a
+        pattern or the S modifier to include system
+        objects.
         
         
       
@@ -910,9 +910,9 @@ testdb=>
         If pattern
         is specified, only conversions whose names match the pattern are
         listed.
-        The letter S adds the listing of system
-        objects; without S, only non-system
-        objects are shown.
+        By default, only user-created objects are shown;  supply a
+        pattern or the S modifier to include system
+        objects.
         
         
       
@@ -939,9 +939,9 @@ testdb=>
         class="parameter">pattern, or of all visible objects if
         no argument is given.  But in either case, only objects that have
         a description are listed.
-        The letter S adds the listing of system
-        objects; without S, only non-system
-        objects are shown.
+        By default, only user-created objects are shown;  supply a
+        pattern or the S modifier to include system
+        objects.
         (Object covers aggregates, functions, operators,
         types, relations (tables, views, indexes, sequences, large
         objects), rules, and triggers.) For example:
@@ -971,9 +971,9 @@ testdb=>
         Lists all available domains. If 
         class="parameter">pattern
         is specified, only matching domains are shown.
-        The letter S adds the listing of system
-        objects; without S, only non-system
-        objects are shown.
+        By default, only user-created objects are shown;  supply a
+        pattern or the S modifier to include system
+        objects.
         
         
       
@@ -1045,9 +1045,9 @@ testdb=>
         is specified, only functions whose names match the pattern are shown.
         If the form \df+ is used, additional information about
         each function, including volatility, language, source code and description, is shown.
-        The letter S adds the listing of system
-        objects; without S, only non-system
-        objects are shown.
+        By default, only user-created objects are shown;  supply a
+        pattern or the S modifier to include system
+        objects.
         
 
         
@@ -1155,9 +1155,9 @@ testdb=>
         and tables.  If + is
         appended to the command name, each object is listed with its
         physical size on disk and its associated description, if any.
-        The letter S adds the listing of system
-        objects; without S, only non-system
-        objects are shown.
+        By default, only user-created objects are shown;  supply a
+        pattern or the S modifier to include system
+        objects.
         
 
         
@@ -1202,9 +1202,9 @@ testdb=>
         Lists available operators with their operand and return types.
         If pattern is
         specified, only operators whose names match the pattern are listed.
-        The letter S adds the listing of system
-        objects; without S, only non-system
-        objects are shown.
+        By default, only user-created objects are shown;  supply a
+        pattern or the S modifier to include system
+        objects.
         
         
       
@@ -1237,9 +1237,9 @@ testdb=>
         class="parameter">pattern. The command form
         \dT+ shows extra information, namely the type's internal name, size, and
         allowed values for enum types.
-        The letter S adds the listing of system
-        objects; without S, only non-system
-        objects are shown.
+        By default, only user-created objects are shown;  supply a
+        pattern or the S modifier to include system
+        objects.
         
         
       
index 0649573b3ed114604544eb53425a0582515a79b3..28ab203857e91ee4da58bff98c4ea08d454946c6 100644 (file)
@@ -8,7 +8,7 @@
  *
  * 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"
 
@@ -94,7 +94,7 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
                      "WHERE p.proisagg\n",
                      gettext_noop("Description"));
 
-   if (!showSystem)
+   if (!showSystem && !pattern)
        appendPQExpBuffer(&buf, "      AND n.nspname <> 'pg_catalog'\n");
 
    processSQLNamePattern(pset.db, &buf, pattern, true, false,
@@ -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 NOT p.proisagg\n");
 
-   if (!showSystem)
+   if (!showSystem && !pattern)
        appendPQExpBuffer(&buf, "      AND n.nspname <> 'pg_catalog'\n");
 
    processSQLNamePattern(pset.db, &buf, pattern, true, false,
@@ -372,7 +372,7 @@ describeTypes(const char *pattern, bool verbose, bool showSystem)
    else
        appendPQExpBuffer(&buf, "  AND t.typname !~ '^_'\n");
 
-   if (!showSystem)
+   if (!showSystem && !pattern)
        appendPQExpBuffer(&buf, "      AND n.nspname <> 'pg_catalog'\n");
 
    /* Match name pattern against either internal or external name */
@@ -427,10 +427,10 @@ describeOperators(const char *pattern, bool showSystem)
                      gettext_noop("Result type"),
                      gettext_noop("Description"));
 
-   if (!showSystem)
+   if (!showSystem && !pattern)
        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,
                          "pg_catalog.pg_operator_is_visible(o.oid)");
 
@@ -631,7 +631,7 @@ objectDescription(const char *pattern, bool showSystem)
                      "  WHERE p.proisagg\n",
                      gettext_noop("aggregate"));
 
-   if (!showSystem)
+   if (!showSystem && !pattern)
        appendPQExpBuffer(&buf, "      AND n.nspname <> 'pg_catalog'\n");
 
    processSQLNamePattern(pset.db, &buf, pattern, true, false,
@@ -654,7 +654,7 @@ objectDescription(const char *pattern, bool showSystem)
                      "      AND NOT p.proisagg\n",
                      gettext_noop("function"));
 
-   if (!showSystem)
+   if (!showSystem && !pattern)
        appendPQExpBuffer(&buf, "      AND n.nspname <> 'pg_catalog'\n");
 
    processSQLNamePattern(pset.db, &buf, pattern, true, false,
@@ -672,10 +672,10 @@ objectDescription(const char *pattern, bool showSystem)
    "       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = o.oprnamespace\n",
                      gettext_noop("operator"));
 
-   if (!showSystem)
+   if (!showSystem && !pattern)
        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,
                          "pg_catalog.pg_operator_is_visible(o.oid)");
 
@@ -690,10 +690,10 @@ objectDescription(const char *pattern, bool showSystem)
    "       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n",
                      gettext_noop("data type"));
 
-   if (!showSystem)
+   if (!showSystem && !pattern)
        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)",
                          NULL,
                          "pg_catalog.pg_type_is_visible(t.oid)");
@@ -714,7 +714,7 @@ objectDescription(const char *pattern, bool showSystem)
                      gettext_noop("view"),
                      gettext_noop("index"),
                      gettext_noop("sequence"));
-   if (!showSystem)
+   if (!showSystem && !pattern)
        appendPQExpBuffer(&buf, "      AND n.nspname <> 'pg_catalog'\n");
 
    processSQLNamePattern(pset.db, &buf, pattern, true, false,
@@ -734,7 +734,7 @@ objectDescription(const char *pattern, bool showSystem)
                      "  WHERE r.rulename != '_RETURN'\n",
                      gettext_noop("rule"));
 
-   if (!showSystem)
+   if (!showSystem && !pattern)
        appendPQExpBuffer(&buf, "      AND n.nspname <> 'pg_catalog'\n");
 
    /* XXX not sure what to do about visibility rule here? */
@@ -753,11 +753,11 @@ objectDescription(const char *pattern, bool showSystem)
                   "       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",
                      gettext_noop("trigger"));
-   if (!showSystem)
+   if (!showSystem && !pattern)
        appendPQExpBuffer(&buf, "      WHERE n.nspname <> 'pg_catalog'\n");
 
    /* 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,
                          "pg_catalog.pg_table_is_visible(c.oid)");
 
@@ -808,10 +808,10 @@ describeTableDetails(const char *pattern, bool verbose, bool showSystem)
                      "FROM pg_catalog.pg_class c\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");
 
-   processSQLNamePattern(pset.db, &buf, pattern, !showSystem, false,
+   processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, false,
                          "n.nspname", "c.relname", NULL,
                          "pg_catalog.pg_table_is_visible(c.oid)");
 
@@ -2008,12 +2008,12 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys
        appendPQExpBuffer(&buf, "'i',");
    if (showSeq)
        appendPQExpBuffer(&buf, "'S',");
-   if (showSystem)
+   if (showSystem || pattern)
        appendPQExpBuffer(&buf, "'s',");    /* was RELKIND_SPECIAL in <= 8.1 */
    appendPQExpBuffer(&buf, "''");      /* dummy */
    appendPQExpBuffer(&buf, ")\n");
 
-   if (!showSystem)
+   if (!showSystem && !pattern)
        /* Exclude system and pg_toast objects, but show temp tables */
        appendPQExpBuffer(&buf,
                          "  AND n.nspname <> 'pg_catalog'\n"
@@ -2087,7 +2087,7 @@ listDomains(const char *pattern, bool showSystem)
                      gettext_noop("Modifier"),
                      gettext_noop("Check"));
 
-   if (!showSystem)
+   if (!showSystem && !pattern)
        appendPQExpBuffer(&buf, "  AND n.nspname <> 'pg_catalog'\n");
 
    processSQLNamePattern(pset.db, &buf, pattern, true, false,
@@ -2142,7 +2142,7 @@ listConversions(const char *pattern, bool showSystem)
                      gettext_noop("yes"), gettext_noop("no"),
                      gettext_noop("Default?"));
 
-   if (!showSystem)
+   if (!showSystem && !pattern)
        appendPQExpBuffer(&buf, "      AND n.nspname <> 'pg_catalog'\n");
 
    processSQLNamePattern(pset.db, &buf, pattern, true, false,