Re: Avoiding SIGPIPE (was Re: OSDL DBT-2 w/ PostgreSQL - Mailing list pgsql-hackers

From Manfred Spraul
Subject Re: Avoiding SIGPIPE (was Re: OSDL DBT-2 w/ PostgreSQL
Date
Msg-id 3FA572E1.8050609@colorfullife.com
Whole thread Raw
In response to Re: Avoiding SIGPIPE (was Re: OSDL DBT-2 w/ PostgreSQL  (AgentM <agentm@webopticon.com>)
Responses Re: Avoiding SIGPIPE (was Re: OSDL DBT-2 w/ PostgreSQL  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
AgentM wrote:

> That wouldn't offer a solution for people who use SIGPIPE for other 
> things during the lifetime of the program (after creating the 
> connection) and if a SIGPIPE handler is called due to the connection, 
> the handler won't be expecting the source, and polling signal for 
> state is essentially what you do now. Instead, I propose a 
> PQsigpipeOK/PQacceptsigpipe/PQrecvsigpipe(PGconn*) or something to 
> that effect which skips this check for the connection. That way, 
> programmers are aware that the connection could call their SIGPIPE 
> handler because they explicitly request it and the library remains 
> backwards-compatible.

If I understand libpq sources correctly, the first packets are send 
during connection setup - PQsigpipeOK(PGconn *) would be too late.
That's why I added "sigpipe=caller" as a new flag for PQconnectdb.

--   Manfred



pgsql-hackers by date:

Previous
From: "Jon Pastore"
Date:
Subject: suggestion for error statements
Next
From: Andrew Dunstan
Date:
Subject: Re: Experimental patch for inter-page delay in VACUUM