Tom Lane wrote:
> Something I've noticed that might or might not be related to this
> issue is that if psql exits due to backend crash, it fails to save the
> last few lines of command history into the history file. Not closing
> down libreadline, maybe?
This is actually the gnu history library. Currently psql issues a save
command when you exit or when you enter \s. I'm not sure why gnu
history appears to require you to write the whole history at once
rather than appending to a file but anyway...
A better way of doing it might be to have psql's finishInput() passed
to atexit(), just to make sure it's always called, and have
signal handlers in place for *every* signal whose handlers call exit(),
so finishing up is done neatly.
It might even be worthwhile to write the history after every command.
BTW, is it necessary to print "\q" when you hit ctrl-d ? Seems just a
little tacky to me.