Re: longjmp in psql considered harmful - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: longjmp in psql considered harmful
Date
Msg-id 20060611210623.GE20757@svana.org
Whole thread Raw
In response to Re: longjmp in psql considered harmful  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: longjmp in psql considered harmful  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sun, Jun 11, 2006 at 03:23:50PM -0400, Tom Lane wrote:
> Martijn van Oosterhout <kleptog@svana.org> writes:
> > If you're asking me, yes. I use it a lot and would miss it if it were
> > gone. Is there another shortcut for "abort current command and don't
> > store in history but don't clear it from the screen"?
>
> Why are you expecting editing niceties (or history for that matter) when
> you're not using readline?  This code isn't used if readline is enabled.

But the effect would change still, even with readline enabled. If
readline is compiled in and you press control-C, our handler is still
called. Currently, we siglongjmp out of readline() and start again. If
you only set a flag like proposed, we won't break out of the readline
call. readline will clear any partial state, but that's it.

It's been a long time since I wrote that patch, but I remember there
being a reason I left the siglongjmp() in, even with readline()
compiled in. I just can't remember what it was... it might have had
something to do with aborting input from files... I'll have to
experiment.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: How to avoid transaction ID wrap
Next
From: "Marc G. Fournier"
Date:
Subject: Re: postgresql and process titles