Warning for psql history not supported - Mailing list pgsql-patches

From Bruce Momjian
Subject Warning for psql history not supported
Date
Msg-id 200410061838.i96IcaQ13480@candle.pha.pa.us
Whole thread Raw
Responses Re: Warning for psql history not supported
List pgsql-patches
Here is an applied patch that suppresses psql \s help display for
platforms like Win32 that don't typically install with readline.
It also prints and error if you try to access it.

--
  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/psql-ref.sgml
===================================================================
RCS file: /cvsroot/pgsql-server/doc/src/sgml/ref/psql-ref.sgml,v
retrieving revision 1.122
diff -c -c -r1.122 psql-ref.sgml
*** doc/src/sgml/ref/psql-ref.sgml    20 Sep 2004 18:51:17 -0000    1.122
--- doc/src/sgml/ref/psql-ref.sgml    6 Oct 2004 18:34:40 -0000
***************
*** 1603,1609 ****
          class="parameter">filename</replaceable> is omitted, the history
          is written to the standard output. This option is only available
          if <application>psql</application> is configured to use the
!         <acronym>GNU</acronym> history library.
          </para>

          <note>
--- 1603,1609 ----
          class="parameter">filename</replaceable> is omitted, the history
          is written to the standard output. This option is only available
          if <application>psql</application> is configured to use the
!         <acronym>GNU</acronym> readline (or history) library.
          </para>

          <note>
Index: src/bin/psql/help.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/psql/help.c,v
retrieving revision 1.93
diff -c -c -r1.93 help.c
*** src/bin/psql/help.c    29 Aug 2004 05:06:54 -0000    1.93
--- src/bin/psql/help.c    6 Oct 2004 18:34:44 -0000
***************
*** 194,200 ****
--- 194,202 ----
      fprintf(output, _("  \\g [FILE]      send query buffer to server (and results to file or |pipe)\n"));
      fprintf(output, _("  \\p             show the contents of the query buffer\n"));
      fprintf(output, _("  \\r             reset (clear) the query buffer\n"));
+ #ifdef USE_READLINE
      fprintf(output, _("  \\s [FILE]      display history or save it to file\n"));
+ #endif
      fprintf(output, _("  \\w FILE        write query buffer to file\n"));
      fprintf(output, "\n");

Index: src/bin/psql/input.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/psql/input.c,v
retrieving revision 1.38
diff -c -c -r1.38 input.c
*** src/bin/psql/input.c    27 Sep 2004 19:16:02 -0000    1.38
--- src/bin/psql/input.c    6 Oct 2004 18:34:44 -0000
***************
*** 209,214 ****
--- 209,216 ----

          psql_error("could not save history to file \"%s\": %s\n", fname, strerror(errno));
      }
+ #else
+         psql_error("history is not supported on this platform\n");
  #endif

      return false;

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: CREATE DATABASE with tablespace fix
Next
From: Peter Eisentraut
Date:
Subject: Re: Warning for psql history not supported