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