Re: proposal: psql \setfileref - Mailing list pgsql-hackers

From Daniel Verite
Subject Re: proposal: psql \setfileref
Date
Msg-id 401c6510-9a4c-439b-96c6-43c60a330b30@mm
Whole thread Raw
In response to Re: proposal: psql \setfileref  (Gilles Darold <gilles.darold@dalibo.com>)
Responses Re: proposal: psql \setfileref
List pgsql-hackers
Gilles Darold wrote:

>    postgres=# \setfileref b /dev/random
>    postgres=# insert into test (:b);
>
> Process need to be killed using SIGTERM.

This can be fixed by setting sigint_interrupt_enabled to true
before operating on the file. Then ctrl-C would be able to cancel
the command.

See comment in common.c, above the declaration of
sigint_interrupt_enabled:

/*[....]* SIGINT is supposed to abort all long-running psql operations, not only* database queries.  In most places,
thisis accomplished by checking* cancel_pressed during long-running loops.  However, that won't work when* blocked on
userinput (in readline() or fgets()).  In those places, we* set sigint_interrupt_enabled TRUE while blocked,
instructingthe signal* catcher to longjmp through sigint_interrupt_jmp.  We assume readline and* fgets are coded to
handlepossible interruption.  (XXX currently this does* not work on win32, so control-C is less useful there)*/ 


Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Using pg_ctl promote -w in TAP tests
Next
From: Andreas Joseph Krogh
Date:
Subject: Re: pg_upgrade 9.5 -> 9.6 fails when pg_largeobject is in separate tablespace