Re: [COMMITTERS] pgsql: This makes all the \dX commands (most importantly to most: \df) - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [COMMITTERS] pgsql: This makes all the \dX commands (most importantly to most: \df)
Date
Msg-id 200901062301.n06N1M720590@momjian.us
Whole thread Raw
Responses Re: Re: [COMMITTERS] pgsql: This makes all the \dX commands (most importantly to most: \df)  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
Bruce Momjian wrote:
> Tom Lane wrote:
> > momjian@postgresql.org (Bruce Momjian) writes:
> > > 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.
> >
> > The lack of any documentation change is glaring.
>
> Oh, it sure does.  I will work on that.

OK, documentation added with the attached patch, applied.  The
documentation needed quite a bit of cleanup, independent of this patch,
which I did.

I also found a bug that \do didn't work because the AND system table
check was being added to the LEFT JOIN and not to the WHERE clause
(trigger display was also a problem).

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: doc/src/sgml/ref/psql-ref.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v
retrieving revision 1.214
diff -c -c -r1.214 psql-ref.sgml
*** doc/src/sgml/ref/psql-ref.sgml    19 Dec 2008 16:25:16 -0000    1.214
--- doc/src/sgml/ref/psql-ref.sgml    6 Jan 2009 22:48:33 -0000
***************
*** 815,822 ****
        </varlistentry>

        <varlistentry>
!         <term><literal>\d [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
!         <term><literal>\d+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>

          <listitem>
          <para>
--- 815,821 ----
        </varlistentry>

        <varlistentry>
!         <term><literal>\d[S+] [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>

          <listitem>
          <para>
***************
*** 834,839 ****
--- 833,840 ----
          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 <literal>S</literal> restricts the listing to system objects; without
+         <literal>S</literal>, only non-system objects are shown.
          </para>

          <note>
***************
*** 849,855 ****
        </varlistentry>

        <varlistentry>
!         <term><literal>\da [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>

          <listitem>
          <para>
--- 850,856 ----
        </varlistentry>

        <varlistentry>
!         <term><literal>\da[S] [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>

          <listitem>
          <para>
***************
*** 857,870 ****
          return type and the data types they operate on. If <replaceable
          class="parameter">pattern</replaceable>
          is specified, only aggregates whose names match the pattern are shown.
          </para>
          </listitem>
        </varlistentry>


        <varlistentry>
!         <term><literal>\db [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
!         <term><literal>\db+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>

          <listitem>
          <para>
--- 858,873 ----
          return type and the data types they operate on. If <replaceable
          class="parameter">pattern</replaceable>
          is specified, only aggregates whose names match the pattern are shown.
+         The letter <literal>S</literal> restricts the listing
+         to system objects; without <literal>S</literal>, only
+         non-system objects are shown.
          </para>
          </listitem>
        </varlistentry>


        <varlistentry>
!         <term><literal>\db[+] [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>

          <listitem>
          <para>
***************
*** 879,891 ****


        <varlistentry>
!         <term><literal>\dc [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
          Lists all available conversions between character-set encodings.
          If <replaceable class="parameter">pattern</replaceable>
          is specified, only conversions whose names match the pattern are
          listed.
          </para>
          </listitem>
        </varlistentry>
--- 882,896 ----


        <varlistentry>
!         <term><literal>\dc[S] [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
          Lists all available conversions between character-set encodings.
          If <replaceable class="parameter">pattern</replaceable>
          is specified, only conversions whose names match the pattern are
          listed.
+         The letter <literal>S</literal> restricts the listing to system objects; without
+         <literal>S</literal>, only non-system objects are shown.
          </para>
          </listitem>
        </varlistentry>
***************
*** 905,917 ****


        <varlistentry>
!         <term><literal>\dd [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
          Shows the descriptions of objects matching the <replaceable
          class="parameter">pattern</replaceable>, or of all visible objects if
          no argument is given.  But in either case, only objects that have
          a description are listed.
          (<quote>Object</quote> covers aggregates, functions, operators,
          types, relations (tables, views, indexes, sequences, large
          objects), rules, and triggers.) For example:
--- 910,924 ----


        <varlistentry>
!         <term><literal>\dd[S] [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
          Shows the descriptions of objects matching the <replaceable
          class="parameter">pattern</replaceable>, or of all visible objects if
          no argument is given.  But in either case, only objects that have
          a description are listed.
+         The letter <literal>S</literal> restricts the listing to system objects; without
+         <literal>S</literal>, only non-system objects are shown.
          (<quote>Object</quote> covers aggregates, functions, operators,
          types, relations (tables, views, indexes, sequences, large
          objects), rules, and triggers.) For example:
***************
*** 935,954 ****


        <varlistentry>
!         <term><literal>\dD [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
          Lists all available domains. If <replaceable
          class="parameter">pattern</replaceable>
          is specified, only matching domains are shown.
          </para>
          </listitem>
        </varlistentry>


        <varlistentry>
!         <term><literal>\des [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
!         <term><literal>\des+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
          Lists all foreign servers (mnemonic: <quote>external
--- 942,962 ----


        <varlistentry>
!         <term><literal>\dD[S] [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
          Lists all available domains. If <replaceable
          class="parameter">pattern</replaceable>
          is specified, only matching domains are shown.
+         The letter <literal>S</literal> restricts the listing to system objects; without
+         <literal>S</literal>, only non-system objects are shown.
          </para>
          </listitem>
        </varlistentry>


        <varlistentry>
!         <term><literal>\des[+] [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
          Lists all foreign servers (mnemonic: <quote>external
***************
*** 964,971 ****


        <varlistentry>
!         <term><literal>\deu [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
!         <term><literal>\deu+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
          Lists all user mappings (mnemonic: <quote>external
--- 972,978 ----


        <varlistentry>
!         <term><literal>\deu[+] [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
          Lists all user mappings (mnemonic: <quote>external
***************
*** 988,995 ****


        <varlistentry>
!         <term><literal>\dew [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
!         <term><literal>\dew+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
          Lists all foreign-data wrappers (mnemonic: <quote>external
--- 995,1001 ----


        <varlistentry>
!         <term><literal>\dew[+] [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
          Lists all foreign-data wrappers (mnemonic: <quote>external
***************
*** 1005,1012 ****


        <varlistentry>
!         <term><literal>\df [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
!         <term><literal>\df+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>

          <listitem>
          <para>
--- 1011,1017 ----


        <varlistentry>
!         <term><literal>\df[S+] [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>

          <listitem>
          <para>
***************
*** 1016,1021 ****
--- 1021,1028 ----
          is specified, only functions whose names match the pattern are shown.
          If the form <literal>\df+</literal> is used, additional information about
          each function, including volatility, language, source code and description, is shown.
+         The letter <literal>S</literal> restricts the listing to system objects; without
+         <literal>S</literal>, only non-system objects are shown.
          </para>

          <note>
***************
*** 1037,1044 ****


        <varlistentry>
!         <term><literal>\dF [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
!         <term><literal>\dF+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
           Lists available text search configurations.
--- 1044,1050 ----


        <varlistentry>
!         <term><literal>\dF[+] [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
           Lists available text search configurations.
***************
*** 1052,1059 ****
        </varlistentry>

        <varlistentry>
!         <term><literal>\dFd [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
!         <term><literal>\dFd+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
           Lists available text search dictionaries.
--- 1058,1064 ----
        </varlistentry>

        <varlistentry>
!         <term><literal>\dFd[+] [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
           Lists available text search dictionaries.
***************
*** 1067,1074 ****
        </varlistentry>

        <varlistentry>
!         <term><literal>\dFp [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
!         <term><literal>\dFp+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
           Lists available text search parsers.
--- 1072,1078 ----
        </varlistentry>

        <varlistentry>
!         <term><literal>\dFp[+] [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
           Lists available text search parsers.
***************
*** 1082,1089 ****
        </varlistentry>

        <varlistentry>
!         <term><literal>\dFt [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
!         <term><literal>\dFt+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
           Lists available text search templates.
--- 1086,1092 ----
        </varlistentry>

        <varlistentry>
!         <term><literal>\dFt[+] [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
           Lists available text search templates.
***************
*** 1110,1116 ****


        <varlistentry>
!         <term><literal>\distvS [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>

          <listitem>
          <para>
--- 1113,1119 ----


        <varlistentry>
!         <term><literal>\distv[S+] [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>

          <listitem>
          <para>
***************
*** 1120,1130 ****
          <literal>S</literal> stand for index, sequence, table, view,
          and system table, respectively. You can specify any or all of
          these letters, in any order, to obtain a listing of all the
!         matching objects.  The letter <literal>S</literal> restricts
!         the listing to system objects; without <literal>S</literal>,
!         only non-system objects are shown.  If <literal>+</literal> is
          appended to the command name, each object is listed with its
          physical size on disk and its associated description, if any.
          </para>

          <para>
--- 1123,1134 ----
          <literal>S</literal> stand for index, sequence, table, view,
          and system table, respectively. You can specify any or all of
          these letters, in any order, to obtain a listing of all the
!         matching objects.  If <literal>+</literal> is
          appended to the command name, each object is listed with its
          physical size on disk and its associated description, if any.
+         The letter <literal>S</literal> restricts the listing
+         to system objects; without <literal>S</literal>, only
+         non-system objects are shown.
          </para>

          <para>
***************
*** 1147,1154 ****


        <varlistentry>
!         <term><literal>\dn [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
!         <term><literal>\dn+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>

          <listitem>
          <para>
--- 1151,1157 ----


        <varlistentry>
!         <term><literal>\dn[+] [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>

          <listitem>
          <para>
***************
*** 1164,1175 ****


        <varlistentry>
!         <term><literal>\do [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
          Lists available operators with their operand and return types.
          If <replaceable class="parameter">pattern</replaceable> is
          specified, only operators whose names match the pattern are listed.
          </para>
          </listitem>
        </varlistentry>
--- 1167,1181 ----


        <varlistentry>
!         <term><literal>\do[S] [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
          Lists available operators with their operand and return types.
          If <replaceable class="parameter">pattern</replaceable> is
          specified, only operators whose names match the pattern are listed.
+         The letter <literal>S</literal> restricts the listing
+         to system objects; without <literal>S</literal>, only
+         non-system objects are shown.
          </para>
          </listitem>
        </varlistentry>
***************
*** 1195,1208 ****


        <varlistentry>
!         <term><literal>\dT [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
!         <term><literal>\dT+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
          Lists all data types or only those that match <replaceable
          class="parameter">pattern</replaceable>. The command form
          <literal>\dT+</literal> shows extra information, namely the type's internal name, size, and
          allowed values for <type>enum</> types.
          </para>
          </listitem>
        </varlistentry>
--- 1201,1215 ----


        <varlistentry>
!         <term><literal>\dT[S+] [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
          <listitem>
          <para>
          Lists all data types or only those that match <replaceable
          class="parameter">pattern</replaceable>. The command form
          <literal>\dT+</literal> shows extra information, namely the type's internal name, size, and
          allowed values for <type>enum</> types.
+         The letter <literal>S</literal> restricts the listing to system objects; without
+         <literal>S</literal>, only non-system objects are shown.
          </para>
          </listitem>
        </varlistentry>
Index: src/bin/psql/describe.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/psql/describe.c,v
retrieving revision 1.194
diff -c -c -r1.194 describe.c
*** src/bin/psql/describe.c    6 Jan 2009 21:10:30 -0000    1.194
--- src/bin/psql/describe.c    6 Jan 2009 22:48:34 -0000
***************
*** 428,434 ****
                        gettext_noop("Description"));

       if (!showSystem)
!          appendPQExpBuffer(&buf, "      AND n.nspname <> 'pg_catalog'\n");

      processSQLNamePattern(pset.db, &buf, pattern, !showSystem, true,
                            "n.nspname", "o.oprname", NULL,
--- 428,434 ----
                        gettext_noop("Description"));

       if (!showSystem)
!          appendPQExpBuffer(&buf, "      WHERE n.nspname <> 'pg_catalog'\n");

      processSQLNamePattern(pset.db, &buf, pattern, !showSystem, true,
                            "n.nspname", "o.oprname", NULL,
***************
*** 743,749 ****
      "       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n",
                        gettext_noop("trigger"));
       if (!showSystem)
!          appendPQExpBuffer(&buf, "      AND n.nspname <> 'pg_catalog'\n");

      /* XXX not sure what to do about visibility rule here? */
      processSQLNamePattern(pset.db, &buf, pattern, !showSystem, false,
--- 743,749 ----
      "       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n",
                        gettext_noop("trigger"));
       if (!showSystem)
!          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,
Index: src/bin/psql/help.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/psql/help.c,v
retrieving revision 1.134
diff -c -c -r1.134 help.c
*** src/bin/psql/help.c    6 Jan 2009 21:10:30 -0000    1.134
--- src/bin/psql/help.c    6 Jan 2009 22:48:34 -0000
***************
*** 194,230 ****
      fprintf(output, "\n");

      fprintf(output, _("Informational\n"));
!      fprintf(output, _("  Modifiers: S = show system objects  + = Additional detail\n"));
!      fprintf(output, _("  \\l[+]             list all databases\n"));
!      fprintf(output, _("  \\d[S]             list tables, views, and sequences\n"));
!      fprintf(output, _("  \\d[S] NAME        describe table, view, sequence, or index\n"));
!      fprintf(output, _("  \\dt[S+] [PATTERN] list tables\n"));
!      fprintf(output, _("  \\dv[S+] [PATTERN] list views\n"));
!      fprintf(output, _("  \\ds[S+] [PATTERN] list sequences\n"));
!      fprintf(output, _("  \\di[S+] [PATTERN] list indexes\n"));
!      fprintf(output, _("  \\df[S+] [PATTERN] list functions\n"));
!      fprintf(output, _("  \\dT[S+] [PATTERN] list data types\n"));
!      fprintf(output, _("  \\dd[S] [PATTERN]  list comments on objects\n"));
!      fprintf(output, _("  \\dD[S] [PATTERN]  list domains\n"));
!     fprintf(output, _("  \\des[+] [PATTERN] list foreign servers\n"));
!     fprintf(output, _("  \\deu[+] [PATTERN] list user mappings\n"));
!     fprintf(output, _("  \\dew[+] [PATTERN] list foreign-data wrappers\n"));
!      fprintf(output, _("  \\do[S] [PATTERN]  list operators\n"));
!      fprintf(output, _("  \\da[S] [PATTERN]  list aggregate functions\n"));
!      fprintf(output, _("  \\dc[S] [PATTERN]  list conversions\n"));
!      fprintf(output, _("  \\db[+] [PATTERN]  list tablespaces\n"));
!      fprintf(output, _("  \\dn[+] [PATTERN]  list schemas\n"));
!     fprintf(output, _("  \\dC               list casts\n"));
!     fprintf(output, _("  \\dd [PATTERN]     show comment for object\n"));
!     fprintf(output, _("  \\dF[+] [PATTERN]  list text search configurations\n"));
!     fprintf(output, _("  \\dFd[+] [PATTERN] list text search dictionaries\n"));
!     fprintf(output, _("  \\dFt [PATTERN]    list text search templates\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, _("Formatting\n"));
--- 194,230 ----
      fprintf(output, "\n");

      fprintf(output, _("Informational\n"));
!     fprintf(output, _("  Modifiers: S = show system objects  + = Additional detail\n"));
!     fprintf(output, _("  \\l[+]                list all databases\n"));
!     fprintf(output, _("  \\d[S+]               list tables, views, and sequences\n"));
!     fprintf(output, _("  \\d[S+] NAME          describe table, view, sequence, or index\n"));
!     fprintf(output, _("  \\da[S] [PATTERN]     list aggregate functions\n"));
!     fprintf(output, _("  \\db[+] [PATTERN]     list tablespaces\n"));
!     fprintf(output, _("  \\dc[S] [PATTERN]     list conversions\n"));
!     fprintf(output, _("  \\dC [PATTERN]        list casts\n"));
!     fprintf(output, _("  \\dd [PATTERN]        show comment for object\n"));
!     fprintf(output, _("  \\dd[S] [PATTERN]     list comments on objects\n"));
!     fprintf(output, _("  \\dD[S] [PATTERN]     list domains\n"));
!     fprintf(output, _("  \\des[+] [PATTERN]    list foreign servers\n"));
!     fprintf(output, _("  \\deu[+] [PATTERN]    list user mappings\n"));
!     fprintf(output, _("  \\dew[+] [PATTERN]    list foreign-data wrappers\n"));
!     fprintf(output, _("  \\df[S+] [PATTERN]    list functions\n"));
!     fprintf(output, _("  \\dF[+] [PATTERN]     list text search configurations\n"));
!     fprintf(output, _("  \\dFd[+] [PATTERN]    list text search dictionaries\n"));
!     fprintf(output, _("  \\dFp[+] [PATTERN]    list text search parsers\n"));
!     fprintf(output, _("  \\dFt[+] [PATTERN]    list text search templates\n"));
!     fprintf(output, _("  \\dg [PATTERN]        list roles (groups)\n"));
!     fprintf(output, _("  \\di[S+] [PATTERN]    list indexes\n"));
!     fprintf(output, _("  \\dl                  list large objects, same as \\lo_list\n"));
!     fprintf(output, _("  \\dn[+] [PATTERN]     list schemas\n"));
!     fprintf(output, _("  \\do[S] [PATTERN]     list operators\n"));
!     fprintf(output, _("  \\dp [PATTERN]        list table, view, and sequence access privileges\n"));
!     fprintf(output, _("    \\z [PATTERN]       same as \\dp\n"));
!     fprintf(output, _("  \\ds[S+] [PATTERN]    list sequences\n"));
!     fprintf(output, _("  \\dt[S+] [PATTERN]    list tables\n"));
!     fprintf(output, _("  \\dT[S+] [PATTERN]    list data types\n"));
!     fprintf(output, _("  \\du [PATTERN]        list roles (users)\n"));
!     fprintf(output, _("  \\dv[S+] [PATTERN]    list views\n"));
      fprintf(output, "\n");

      fprintf(output, _("Formatting\n"));

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: parallel restore
Next
From: Bruce Momjian
Date:
Subject: Re: Re: [COMMITTERS] pgsql: This makes all the \dX commands (most importantly to most: \df)