Thread: SHOW ALL with descriptions

SHOW ALL with descriptions

From
Matthias Schmidt
Date:
Hi *,

here's a tiny patch showing the description of the backend parameters
alongside the 'SHOW ALL' Command.
I'm not quite shure wether this should be the default output or not.
Probably this needs to be configurable itself.

What do you think?

cheers,

Matthias

----------------------------------------------------------------------
Matthias Schmidt
Viehtriftstr. 49

67346 Speyer
GERMANY

Tel.: +49 6232 4867
Fax.: +49 6232 640089


Attachment

Re: SHOW ALL with descriptions

From
Bruce Momjian
Date:
This has been saved for the 8.1 release:

    http:/momjian.postgresql.org/cgi-bin/pgpatches2

---------------------------------------------------------------------------

Matthias Schmidt wrote:
> Hi *,
>
> here's a tiny patch showing the description of the backend parameters
> alongside the 'SHOW ALL' Command.
> I'm not quite shure wether this should be the default output or not.
> Probably this needs to be configurable itself.
>
> What do you think?
>
> cheers,
>
> Matthias
>
> ----------------------------------------------------------------------
> Matthias Schmidt
> Viehtriftstr. 49
>
> 67346 Speyer
> GERMANY
>
> Tel.: +49 6232 4867
> Fax.: +49 6232 640089
>

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: SHOW ALL with descriptions

From
Bruce Momjian
Date:
I will test this to see if should be the default, or whether we need
VERBOSE.

Your patch has been added to the PostgreSQL unapplied patches list at:

    http://momjian.postgresql.org/cgi-bin/pgpatches

It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.

---------------------------------------------------------------------------


Matthias Schmidt wrote:
> Hi *,
>
> here's a tiny patch showing the description of the backend parameters
> alongside the 'SHOW ALL' Command.
> I'm not quite shure wether this should be the default output or not.
> Probably this needs to be configurable itself.
>
> What do you think?
>
> cheers,
>
> Matthias
>
> ----------------------------------------------------------------------
> Matthias Schmidt
> Viehtriftstr. 49
>
> 67346 Speyer
> GERMANY
>
> Tel.: +49 6232 4867
> Fax.: +49 6232 640089
>

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: SHOW ALL with descriptions

From
Bruce Momjian
Date:
Matthias Schmidt wrote:
> Hi *,
>
> here's a tiny patch showing the description of the backend parameters
> alongside the 'SHOW ALL' Command.
> I'm not quite shure wether this should be the default output or not.
> Probably this needs to be configurable itself.
>
> What do you think?

Good question.  psql \dT shows descriptions, but \df does not, only
\df+, so that doesn't give us a pattern.

We could add a VERBOSE option to SHOW ALL to show descriptions, but that
seems like overkill.

I have applied your patch that show descriptions for SHOW ALL, but not
for SHOW varname.  That seems like the cleanest solution.  I also
updated the documentation to mention SHOW ALL includes descriptions.

Any modification suggestions from the group?

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: doc/src/sgml/ref/show.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/ref/show.sgml,v
retrieving revision 1.38
diff -c -c -r1.38 show.sgml
*** doc/src/sgml/ref/show.sgml    8 Apr 2005 00:59:58 -0000    1.38
--- doc/src/sgml/ref/show.sgml    14 Jun 2005 20:39:20 -0000
***************
*** 118,124 ****
      <term><literal>ALL</literal></term>
      <listitem>
       <para>
!       Show the values of all configuration parameters.
       </para>
      </listitem>
     </varlistentry>
--- 118,124 ----
      <term><literal>ALL</literal></term>
      <listitem>
       <para>
!       Show the values of all configuration parameters, with descriptions.
       </para>
      </listitem>
     </varlistentry>
***************
*** 164,180 ****
     Show all settings:
  <programlisting>
  SHOW ALL;
!               name              |                     setting
! --------------------------------+----------------------------------------------
!  add_missing_from               | off
!  archive_command                | unset
!  australian_timezones           | off
      .
      .
      .
!  work_mem                       | 1024
!  zero_damaged_pages             | off
! (140 rows)
  </programlisting>
    </para>
   </refsect1>
--- 164,180 ----
     Show all settings:
  <programlisting>
  SHOW ALL;
!               name              |            setting             |
description                                          
!
--------------------------------+--------------------------------+----------------------------------------------------------------------------------------------
!  add_missing_from               | off                            | Automatically adds missing table references to
FROMclauses. 
!  archive_command                | unset                          | WAL archiving command.
!  australian_timezones           | off                            | Interprets ACST, CST, EST, and SAT as Australian
timezones. 
      .
      .
      .
!  work_mem                       | 1024                           | Sets the maximum memory to be used for query
workspaces.
!  zero_damaged_pages             | off                            | Continues processing past damaged page headers.
! (146 rows)
  </programlisting>
    </para>
   </refsect1>
Index: src/backend/utils/misc/guc.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v
retrieving revision 1.265
diff -c -c -r1.265 guc.c
*** src/backend/utils/misc/guc.c    14 Jun 2005 17:43:13 -0000    1.265
--- src/backend/utils/misc/guc.c    14 Jun 2005 20:39:24 -0000
***************
*** 4337,4348 ****

      if (pg_strcasecmp(name, "all") == 0)
      {
!         /* need a tuple descriptor representing two TEXT columns */
!         tupdesc = CreateTemplateTupleDesc(2, false);
          TupleDescInitEntry(tupdesc, (AttrNumber) 1, "name",
                             TEXTOID, -1, 0);
          TupleDescInitEntry(tupdesc, (AttrNumber) 2, "setting",
                             TEXTOID, -1, 0);
      }
      else
      {
--- 4337,4351 ----

      if (pg_strcasecmp(name, "all") == 0)
      {
!         /* need a tuple descriptor representing three TEXT columns */
!         tupdesc = CreateTemplateTupleDesc(3, false);
          TupleDescInitEntry(tupdesc, (AttrNumber) 1, "name",
                             TEXTOID, -1, 0);
          TupleDescInitEntry(tupdesc, (AttrNumber) 2, "setting",
                             TEXTOID, -1, 0);
+         TupleDescInitEntry(tupdesc, (AttrNumber) 3, "description",
+                            TEXTOID, -1, 0);
+
      }
      else
      {
***************
*** 4415,4428 ****
      int            i;
      TupOutputState *tstate;
      TupleDesc    tupdesc;
!     char       *values[2];

!     /* need a tuple descriptor representing two TEXT columns */
!     tupdesc = CreateTemplateTupleDesc(2, false);
      TupleDescInitEntry(tupdesc, (AttrNumber) 1, "name",
                         TEXTOID, -1, 0);
      TupleDescInitEntry(tupdesc, (AttrNumber) 2, "setting",
                         TEXTOID, -1, 0);

      /* prepare for projection of tuples */
      tstate = begin_tup_output_tupdesc(dest, tupdesc);
--- 4418,4434 ----
      int            i;
      TupOutputState *tstate;
      TupleDesc    tupdesc;
!     char       *values[3];

!     /* need a tuple descriptor representing three TEXT columns */
!     tupdesc = CreateTemplateTupleDesc(3, false);
      TupleDescInitEntry(tupdesc, (AttrNumber) 1, "name",
                         TEXTOID, -1, 0);
      TupleDescInitEntry(tupdesc, (AttrNumber) 2, "setting",
                         TEXTOID, -1, 0);
+     TupleDescInitEntry(tupdesc, (AttrNumber) 3, "description",
+                        TEXTOID, -1, 0);
+

      /* prepare for projection of tuples */
      tstate = begin_tup_output_tupdesc(dest, tupdesc);
***************
*** 4438,4443 ****
--- 4444,4450 ----
          /* assign to the values array */
          values[0] = (char *) conf->name;
          values[1] = _ShowOption(conf);
+         values[2] = (char *) conf->short_desc;

          /* send it to dest */
          do_tup_output(tstate, values);