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

Started by Nonameabout 17 years ago18 messages
#1Noname
momjian@postgresql.org

Log Message:
-----------
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

Modified Files:
--------------
pgsql/src/bin/psql:
command.c (r1.200 -> r1.201)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/bin/psql/command.c?r1=1.200&r2=1.201)
describe.c (r1.193 -> r1.194)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/bin/psql/describe.c?r1=1.193&r2=1.194)
describe.h (r1.37 -> r1.38)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/bin/psql/describe.h?r1=1.37&r2=1.38)
help.c (r1.133 -> r1.134)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/bin/psql/help.c?r1=1.133&r2=1.134)

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Noname (#1)
Re: pgsql: This makes all the \dX commands (most importantly to most: \df)

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.

regards, tom lane

#3Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#2)
Re: pgsql: This makes all the \dX commands (most importantly to most: \df)

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.

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

+ If your life is a hard drive, Christ can be your backup. +

#4Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#3)
1 attachment(s)
Re: [COMMITTERS] pgsql: This makes all the \dX commands (most importantly to most: \df)

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. +

Attachments:

/rtmp/difftext/x-diffDownload
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"));
#5Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#4)
Re: Re: [COMMITTERS] pgsql: This makes all the \dX commands (most importantly to most: \df)

Bruce Momjian wrote:

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).

Let me also say that that \d* display is ready to fall over from its own
weight:

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

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

+ If your life is a hard drive, Christ can be your backup. +

#6Joshua D. Drake
jd@commandprompt.com
In reply to: Bruce Momjian (#5)
Re: Re: [COMMITTERS] pgsql: This makes all the \dX commands (most importantly to most: \df)

On Tue, 2009-01-06 at 18:08 -0500, Bruce Momjian wrote:

Bruce Momjian wrote:

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).

Let me also say that that \d* display is ready to fall over from its own
weight:

Informational
Modifiers: S = show system objects + = Additional detail
\l[+] list all databases
\d[S+] list tables, views, and sequences
\d[S+] NAME describe table, view, sequence, or index
\da[S] [PATTERN] list aggregate functions
\db[+] [PATTERN] list tablespaces
\dc[S] [PATTERN] list conversions

Hmmm, I wonder if it makes sense to make it four column instead of two
column.

Joshua D. Drake

--
PostgreSQL
Consulting, Development, Support, Training
503-667-4564 - http://www.commandprompt.com/
The PostgreSQL Company, serving since 1997

#7Bruce Momjian
bruce@momjian.us
In reply to: Joshua D. Drake (#6)
Re: Re: [COMMITTERS] pgsql: This makes all the \dX commands (most importantly to most: \df)

Joshua D. Drake wrote:

On Tue, 2009-01-06 at 18:08 -0500, Bruce Momjian wrote:

Bruce Momjian wrote:

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).

Let me also say that that \d* display is ready to fall over from its own
weight:

Informational
Modifiers: S = show system objects + = Additional detail
\l[+] list all databases
\d[S+] list tables, views, and sequences
\d[S+] NAME describe table, view, sequence, or index
\da[S] [PATTERN] list aggregate functions
\db[+] [PATTERN] list tablespaces
\dc[S] [PATTERN] list conversions

Hmmm, I wonder if it makes sense to make it four column instead of two
column.

You mean like this?

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");

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

+ If your life is a hard drive, Christ can be your backup. +

#8Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#7)
Re: Re: [COMMITTERS] pgsql: This makes all the \dX commands (most importantly to most: \df)

Bruce Momjian wrote:

Joshua D. Drake wrote:

On Tue, 2009-01-06 at 18:08 -0500, Bruce Momjian wrote:

Bruce Momjian wrote:

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).

Let me also say that that \d* display is ready to fall over from its own
weight:

Informational
Modifiers: S = show system objects + = Additional detail
\l[+] list all databases
\d[S+] list tables, views, and sequences
\d[S+] NAME describe table, view, sequence, or index
\da[S] [PATTERN] list aggregate functions
\db[+] [PATTERN] list tablespaces
\dc[S] [PATTERN] list conversions

Hmmm, I wonder if it makes sense to make it four column instead of two
column.

OK, done (below). 'list' seems kind of redundant. Can we factor that
out somehow?

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

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

+ If your life is a hard drive, Christ can be your backup. +

#9Joshua D. Drake
jd@commandprompt.com
In reply to: Bruce Momjian (#8)
Re: Re: [COMMITTERS] pgsql: This makes all the \dX commands (most importantly to most: \df)

On Tue, 2009-01-06 at 19:06 -0500, Bruce Momjian wrote:

Bruce Momjian wrote:

OK, done (below). 'list' seems kind of redundant. Can we factor that
out somehow?

Informational
Modifiers: S = show system objects + = Additional detail
\l[+] list all databases
\d[S+] list tables, views, and sequences
\d[S+] NAME describe table, view, sequence, or index
\da[S] [PATTERN] list aggregate functions
\db[+] [PATTERN] list tablespaces
\dc[S] [PATTERN] list conversions
\dC [PATTERN] list casts
\dd [PATTERN] show comment for object

Per offline comments my thoughts were something like:

Informational: S = show system objects + = Additional detail
Display:
\l[+] all databases
\d[S+] tables, views, and sequences
\d[S+] NAME describe table, view, sequence, or index
\da[S] [PATTERN] aggregate functions
\db[+] [PATTERN] tablespaces
\dc[S] [PATTERN] conversions
\dC [PATTERN] casts
\dd [PATTERN] show comment for object
\dd[S] [PATTERN] comments on objects

But I am not putting up any sandbags :)

Joshua D. Drake

--
PostgreSQL
Consulting, Development, Support, Training
503-667-4564 - http://www.commandprompt.com/
The PostgreSQL Company, serving since 1997

#10Bruce Momjian
bruce@momjian.us
In reply to: Joshua D. Drake (#9)
Re: Re: [COMMITTERS] pgsql: This makes all the \dX commands (most importantly to most: \df)

Joshua D. Drake wrote:

On Tue, 2009-01-06 at 19:06 -0500, Bruce Momjian wrote:

Bruce Momjian wrote:

OK, done (below). 'list' seems kind of redundant. Can we factor that
out somehow?

Informational
Modifiers: S = show system objects + = Additional detail
\l[+] list all databases
\d[S+] list tables, views, and sequences
\d[S+] NAME describe table, view, sequence, or index
\da[S] [PATTERN] list aggregate functions
\db[+] [PATTERN] list tablespaces
\dc[S] [PATTERN] list conversions
\dC [PATTERN] list casts
\dd [PATTERN] show comment for object

Per offline comments my thoughts were something like:

Informational: S = show system objects + = Additional detail
Display:

I don't like the "Display:" here because it mimicks the heading above
it.

\l[+] all databases
\d[S+] tables, views, and sequences
\d[S+] NAME describe table, view, sequence, or index
\da[S] [PATTERN] aggregate functions
\db[+] [PATTERN] tablespaces
\dc[S] [PATTERN] conversions
\dC [PATTERN] casts
\dd [PATTERN] show comment for object
\dd[S] [PATTERN] comments on objects

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

+ If your life is a hard drive, Christ can be your backup. +

#11Joshua D. Drake
jd@commandprompt.com
In reply to: Bruce Momjian (#10)
Re: Re: [COMMITTERS] pgsql: This makes all the \dX commands (most importantly to most: \df)

On Tue, 2009-01-06 at 19:13 -0500, Bruce Momjian wrote:

Joshua D. Drake wrote:

Per offline comments my thoughts were something like:

Informational: S = show system objects + = Additional detail
Display:

I don't like the "Display:" here because it mimicks the heading above
it.

Fair enough. I would be fine without it.

Joshua D. Drake

--
PostgreSQL
Consulting, Development, Support, Training
503-667-4564 - http://www.commandprompt.com/
The PostgreSQL Company, serving since 1997

#12Alvaro Herrera
alvherre@commandprompt.com
In reply to: Bruce Momjian (#8)
Re: Re: [COMMITTERS] pgsql: This makes all the \dX commands (most importantly to most: \df)

Bruce Momjian wrote:

Informational
Modifiers: S = show system objects + = Additional detail
\l[+] list all databases
\d[S+] list tables, views, and sequences
\d[S+] NAME describe table, view, sequence, or index
\da[S] [PATTERN] list aggregate functions

If we do this, is there a way to abstract the translation marker _()
from the alignment whitespace?

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

#13Joshua D. Drake
jd@commandprompt.com
In reply to: Alvaro Herrera (#12)
Re: Re: [COMMITTERS] pgsql: This makes all the \dX commands (most importantly to most: \df)

On Tue, 2009-01-06 at 21:58 -0300, Alvaro Herrera wrote:

Bruce Momjian wrote:

Informational
Modifiers: S = show system objects + = Additional detail
\l[+] list all databases
\d[S+] list tables, views, and sequences
\d[S+] NAME describe table, view, sequence, or index
\da[S] [PATTERN] list aggregate functions

If we do this, is there a way to abstract the translation marker _()
from the alignment whitespace?

O.k. I might just be stupid here but can we just seek until we hit a non
space or \t?

Joshua D. Drake

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

--
PostgreSQL
Consulting, Development, Support, Training
503-667-4564 - http://www.commandprompt.com/
The PostgreSQL Company, serving since 1997

#14Bruce Momjian
bruce@momjian.us
In reply to: Alvaro Herrera (#12)
Re: Re: [COMMITTERS] pgsql: This makes all the \dX commands (most importantly to most: \df)

Alvaro Herrera wrote:

Bruce Momjian wrote:

Informational
Modifiers: S = show system objects + = Additional detail
\l[+] list all databases
\d[S+] list tables, views, and sequences
\d[S+] NAME describe table, view, sequence, or index
\da[S] [PATTERN] list aggregate functions

If we do this, is there a way to abstract the translation marker _()
from the alignment whitespace?

So they don't have to re-translate?

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

+ If your life is a hard drive, Christ can be your backup. +

#15Alvaro Herrera
alvherre@commandprompt.com
In reply to: Bruce Momjian (#14)
Re: Re: [COMMITTERS] pgsql: This makes all the \dX commands (most importantly to most: \df)

Bruce Momjian wrote:

Alvaro Herrera wrote:

Bruce Momjian wrote:

Informational
Modifiers: S = show system objects + = Additional detail
\l[+] list all databases
\d[S+] list tables, views, and sequences
\d[S+] NAME describe table, view, sequence, or index
\da[S] [PATTERN] list aggregate functions

If we do this, is there a way to abstract the translation marker _()
from the alignment whitespace?

So they don't have to re-translate?

No, so that the translators don't have to worry about getting alignment
right; and also so that they don't have to translate \\d[S+] etc which
obviously doesn't need any translation.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

#16Bruce Momjian
bruce@momjian.us
In reply to: Alvaro Herrera (#15)
Re: Re: [COMMITTERS] pgsql: This makes all the \dX commands (most importantly to most: \df)

Alvaro Herrera wrote:

Bruce Momjian wrote:

Alvaro Herrera wrote:

Bruce Momjian wrote:

Informational
Modifiers: S = show system objects + = Additional detail
\l[+] list all databases
\d[S+] list tables, views, and sequences
\d[S+] NAME describe table, view, sequence, or index
\da[S] [PATTERN] list aggregate functions

If we do this, is there a way to abstract the translation marker _()
from the alignment whitespace?

So they don't have to re-translate?

No, so that the translators don't have to worry about getting alignment
right; and also so that they don't have to translate \\d[S+] etc which
obviously doesn't need any translation.

I am thinking we can do:

fprintf(output, " \\da[S] %.9s %s\n", _("[PATTERN]"),
_("list aggregate"));

What do you think?

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

+ If your life is a hard drive, Christ can be your backup. +

#17Alvaro Herrera
alvherre@commandprompt.com
In reply to: Bruce Momjian (#16)
Re: Re: [COMMITTERS] pgsql: This makes all the \dX commands (most importantly to most: \df)

Bruce Momjian wrote:

Alvaro Herrera wrote:

No, so that the translators don't have to worry about getting alignment
right; and also so that they don't have to translate \\d[S+] etc which
obviously doesn't need any translation.

I am thinking we can do:

fprintf(output, " \\da[S] %.9s %s\n", _("[PATTERN]"),
_("list aggregate"));

What do you think?

Right, something like that ... I'm wondering, though, if there are any
translations where [PATTERN] ends up longer than 9 chars. At least none
of the existing translations has that problem, so it seems we're good ...

Hmm, what's the difference here:

\dd [PATTERN] show comment for object
\dd[S] [PATTERN] list comments on objects
?

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

#18Bruce Momjian
bruce@momjian.us
In reply to: Alvaro Herrera (#17)
Re: Re: [COMMITTERS] pgsql: This makes all the \dX commands (most importantly to most: \df)

Alvaro Herrera wrote:

Bruce Momjian wrote:

Alvaro Herrera wrote:

No, so that the translators don't have to worry about getting alignment
right; and also so that they don't have to translate \\d[S+] etc which
obviously doesn't need any translation.

I am thinking we can do:

fprintf(output, " \\da[S] %.9s %s\n", _("[PATTERN]"),
_("list aggregate"));

What do you think?

Right, something like that ... I'm wondering, though, if there are any
translations where [PATTERN] ends up longer than 9 chars. At least none
of the existing translations has that problem, so it seems we're good ...

I probably should have suggested:

fprintf(output, " \\da[S] %-12s %s\n", _("[PATTERN]"),
_("list aggregate"));

I am hesistant to use -12.12 because that might cut off a long word, or
a bracket.

The larger question is how does printf(3) handle width, as bytes or
characters. My Ubuntu says:

If the converted value has fewer characters than the
field width, it will be padded with spaces on the left
(or right, if the left-adjustment flag has been given).

This talks about characters, but is it really multibyte characters?
Alvaro says we have to use %ls, but he says that is wchar_t, which we
don't use.

Hmm, what's the difference here:

\dd [PATTERN] show comment for object
\dd[S] [PATTERN] list comments on objects

I don't know what you're talking about --- LOOK THERE! (removes duplicate
line while no one is looking)

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

+ If your life is a hard drive, Christ can be your backup. +