Thread: Warning for psql history not supported

Warning for psql history not supported

From
Bruce Momjian
Date:
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;

Re: Warning for psql history not supported

From
Peter Eisentraut
Date:
Bruce Momjian wrote:
> 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.

But "history is not supported on this platform" is not really true, is
it?

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


Re: Warning for psql history not supported

From
Bruce Momjian
Date:
Peter Eisentraut wrote:
> Bruce Momjian wrote:
> > 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.
>
> But "history is not supported on this platform" is not really true, is
> it?

No, not really, but that's what we say when we can't create a symlink so
I used the same wording.  What would be the proper wording?  I couldn't
find another example.

--
  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: Warning for psql history not supported

From
Bruce Momjian
Date:
I changed it to "history is not supported".

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

Bruce Momjian wrote:
> Peter Eisentraut wrote:
> > Bruce Momjian wrote:
> > > 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.
> >
> > But "history is not supported on this platform" is not really true, is
> > it?
>
> No, not really, but that's what we say when we can't create a symlink so
> I used the same wording.  What would be the proper wording?  I couldn't
> find another example.
>
> --
>   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
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>

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