Re: [HACKERS] psql and Control-C - Mailing list pgsql-hackers

From Chris Bitmead
Subject Re: [HACKERS] psql and Control-C
Date
Msg-id 38ACE178.40AB502A@nimrod.itg.telecom.com.au
Whole thread Raw
In response to psql and Control-C  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: [HACKERS] psql and Control-C
List pgsql-hackers
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.


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] queries on 2+ indices
Next
From: root
Date:
Subject: Large object problem in 6.5.2 & 3