Martijn van Oosterhout <kleptog@svana.org> writes:
> As anyone who has been following -hackers knows, there's been a bit of
> discussion about how psql should deal with ^C and pagers. Attached is a
> patch that deals with all the memory leak and descriptor leak issues.
> With this patch, even valgrind can't find any leaked memory (except a
> few things from program startup). With this patch, I find psql a
> pleasure to use, it doesn't bug me at all anymore.
I've applied a modified form of this patch that also tries to clean up
the behavior for COPY and large-object operations. Please redo whatever
testing you did before and make sure I didn't break it.
I'm not totally satisfied with the large-object fix yet; sometimes you
have to hit control-C quite a few times before you manage to abort a
long-running \lo_import or \lo_export. This is because the QueryCancel
request does nothing if it arrives at the backend between lowrite() or
loread() function calls. The only obvious fix is to duplicate libpq's
lo_import() and lo_export() functions into psql so that we can add
cancel_pressed checks into their loops (obviously libpq itself can't
check that). Which is kinda yucky. Any thoughts?
regards, tom lane