Thread: 7.0 psql, readline and history.
I saw a note a few days ago about the arrow keys not working in psql in 7.0. As I recall the answer was to make sure the configure script could find "readline.h". I had the same problem as the original questioner, and attempted the suggested fix. The fix did allow configure to find "readline.h" as well as "readline/readline.h", but the problem wasn't fixed. After some investigation (i.e. reading the source), I determined the real problem was my version of readline. It *appears* to me that 7.0 requires readline version 4.1 in order for the readline history features to work, whereas 6.5.3 was happy with an earlier version. When I updated my version of readline, the readline history functions started working. I hope this isn't a repeat of earlier mail on this topic (I only joined the mailing list about a week ago), and I hope it helps people with the same problem that I had. Jeff Collins
Jeffery Collins <collins@onyx-technologies.com> writes: > It *appears* to me that 7.0 requires readline version 4.1 in order for > the readline history features to work, whereas 6.5.3 was happy with an > earlier version. When I updated my version of readline, the readline > history functions started working. We had realized that the new code didn't work with some older versions of libreadline, but we thought we'd fixed the configure test to tell the difference. Were you seeing that configure thought it found readline support and then it didn't work? regards, tom lane
On Tue, 16 May 2000, Tom Lane wrote: > Date: Tue, 16 May 2000 23:35:17 -0400 > From: Tom Lane <tgl@sss.pgh.pa.us> > To: Jeffery Collins <collins@onyx-technologies.com> > Cc: pgsql-general@postgresql.org > Subject: Re: [GENERAL] 7.0 psql, readline and history. > > Jeffery Collins <collins@onyx-technologies.com> writes: > > It *appears* to me that 7.0 requires readline version 4.1 in order for > > the readline history features to work, whereas 6.5.3 was happy with an > > earlier version. When I updated my version of readline, the readline > > history functions started working. > > We had realized that the new code didn't work with some older versions > of libreadline, but we thought we'd fixed the configure test to tell > the difference. Were you seeing that configure thought it found > readline support and then it didn't work? > > regards, tom lane > I have libreadline4 4.1-1, libreadline4-dev 4.1-1 (debian potato) but it doesn't work with pgsql as well (postgres-7.0 installed from sources with configure without parameters). regards, mi
Tom Lane wrote: > Jeffery Collins <collins@onyx-technologies.com> writes: > > It *appears* to me that 7.0 requires readline version 4.1 in order for > > the readline history features to work, whereas 6.5.3 was happy with an > > earlier version. When I updated my version of readline, the readline > > history functions started working. > > We had realized that the new code didn't work with some older versions > of libreadline, but we thought we'd fixed the configure test to tell > the difference. Were you seeing that configure thought it found > readline support and then it didn't work? > > regards, tom lane Yes, this is what confused me for a while. Configure found readline.h, readline/readline.h and -lreadline, but it didn't find readline/history.h. So readline was configured and actually used (I walked through src/bin/psql/input.c to make sure), but the history features were not being used. So I could edit the current line, but I couldn't go backwards in history. Evidently the version of readline that I had installed didn't contain a history.h file (although it did find the using_history entry point in the library), and this caused configure to disable the history features? Jeff
Peter Eisentraut wrote: > On Tue, 16 May 2000, Jeffery Collins wrote: > > > It *appears* to me that 7.0 requires readline version 4.1 in order for > > the readline history features to work, whereas 6.5.3 was happy with an > > earlier version. > > That can't be it because I run something at or near 2.5 and it works fine. Wanna' bet? Perhaps I had an even older version? I do know that updating my version "fixed" the problem. > > > Readline support is enabled if all of the following are true: > > 1) #include <readline.h> or #include <readline/readline.h> works. > > 2) libreadline.a can be linked against. > > Now to history. History is enabled if and only if the following are true: > > 1) #include <history.h> or #include <readline/history.h> works. > > Failure modes: see above > > Check: HAVE_HISTORY_H or HAVE_READLINE_HISTORY_H > > 2) One of the following is true (checked in that order): > > a) the function "using_history" is defined in libreadline > > b) libhistory.a can be linked against > The problem, as I attempted to explain in my original message [but must have failed :-(], is not with readline, but with readline's history features. Using your check list, the failure was because it couldn't find history.h (either one). I am not certain which version of readline I had installed, but evidently it didn't contain a history.h file, although it did have a "using_history" entry point in libreadline.a. The previous version of postgresql must have had slightly different rules to determine whether or not to support readline w/ history because it worked in that version. When I installed the latest version (4.1.1)of readline, which contains a readline/history.h file, history started working. I don't know alot about the readline library, but perhaps it would be sufficient to check for the presence of "using_history" in the library and not bother to check for the presence of history.h? Jeff
Jeffery Collins writes: > Wanna' bet? Perhaps I had an even older version? FWIW, it turns out that mine is actually 2.2.1. > I don't know alot about the readline library, but perhaps it would be > sufficient to check for the presence of "using_history" in the library > and not bother to check for the presence of history.h? After reviewing the old code, this is seemingly what it did. The history functions are then used without declaring them. I should probably squeeze a patch for this into 7.0.1. Of course, updating readline to a "sane" version is a valid workaround as well. (And believe me, there are plenty of "insane" versions out there that we already had to put up with.) -- Peter Eisentraut Sernanders väg 10:115 peter_e@gmx.net 75262 Uppsala http://yi.org/peter-e/ Sweden
Thanks Jeff. I'm the guy that started that thread. Been meaning to get back to the problem but had other issues on the project. Now I know what to do next. Appreciate your posting the solution. -=michael=- ***************************************************** * Michael S. Kelly * 4800 SW Griffith Dr., Ste. 202 * Beaverton, OR 97005 USA * voice: (503)644-6106 x122 fax: (503)643-8425 * <michaelk@axian.com> * http://www.axian.com/ ***************************************************** * Axian: Software Consulting and Training ***************************************************** -----Original Message----- From: Jeffery Collins [mailto:collins@onyx-technologies.com] Sent: Tuesday, May 16, 2000 4:58 PM To: pgsql-general@postgresql.org Subject: 7.0 psql, readline and history. I saw a note a few days ago about the arrow keys not working in psql in 7.0. As I recall the answer was to make sure the configure script could find "readline.h". I had the same problem as the original questioner, and attempted the suggested fix. The fix did allow configure to find "readline.h" as well as "readline/readline.h", but the problem wasn't fixed. After some investigation (i.e. reading the source), I determined the real problem was my version of readline. It *appears* to me that 7.0 requires readline version 4.1 in order for the readline history features to work, whereas 6.5.3 was happy with an earlier version. When I updated my version of readline, the readline history functions started working. I hope this isn't a repeat of earlier mail on this topic (I only joined the mailing list about a week ago), and I hope it helps people with the same problem that I had. Jeff Collins