Re: [PATCH] Fix Ctrl-C related issues in psql (not for 8.1) - Mailing list pgsql-patches

From Tom Lane
Subject Re: [PATCH] Fix Ctrl-C related issues in psql (not for 8.1)
Date
Msg-id 299.1150304110@sss.pgh.pa.us
Whole thread Raw
In response to [PATCH] Fix Ctrl-C related issues in psql (not for 8.1)  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: [PATCH] Fix Ctrl-C related issues in psql (not for 8.1)
List pgsql-patches
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

pgsql-patches by date:

Previous
From: Greg Stark
Date:
Subject: Re: ADD/DROPS inherits
Next
From: Bruce Momjian
Date:
Subject: Re: Free WAL caches on switching segments