Patch for psql History Display on MacOSX - Mailing list pgsql-hackers

From Stepan Rutz
Subject Patch for psql History Display on MacOSX
Date
Msg-id 7D95025B-E8D3-4FF7-AAC2-3B947F57DE64@gmx.de
Whole thread Raw
Responses Re: Patch for psql History Display on MacOSX  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi everbody,

My first mail to this one, so please be mild. I fired up the debugger to get this item going, which is also on the Todo
List. 

Attached is a very trivial patch as a basis for discussion that at least makes \s (show history) work in psql on Macs.
Macsuses libedit, which has a libreadline interface.  

A short investigation showed that the way psql iterates over the history does not work with libedit. I changed the
iterationscheme to an index based loop (see code and comments), which seemed to be the only working option for both
readlineand libedit. In any case, i have tested and compiled this on MacOX 10.9.3 and Linux. Windows doesn’t have the
pagerin the first place.  

As noted in the todo I have made this code pay attention to the pager configuration from psql. The odd part is when
yourhistory opens in less you see the top part rather then the bottom part, but the bottom is just a single keystroke
away.If pager is disabled history is just printed fine. Please note that this didn’t work at all on Mac before. Could
thisgo into …./regress/sql/psql.sql at all? I am not sure on that one. 

Regards, Stepan






Attachment

pgsql-hackers by date:

Previous
From: David G Johnston
Date:
Subject: Re: PL/pgSQL 2
Next
From: Tom Lane
Date:
Subject: Re: PL/pgSQL 2