pg_blocking — Get or set the connection mode - blocking or nonblocking


pg_blocking conn ?newSetting?


pg_blocking changes the blocking mode of a connection, or just gets the current mode.



The handle of the connection.


If supplied, a Tcl boolean value with the new blocking mode setting. Use 1 (or true, yes, or on) to set blocking mode, or 0 (or false, no, or off) for non-blocking mode.

Return Value

If newSetting is provided, returns the blocking state: 1 if blocking, 0 if non-blocking, before changing to the new setting. If newSetting is not provided, returns the current blocking state.

There are no error conditions other than argument errors.


You do not need to set a connection to non-blocking state to use the asynchronous query commands such as pg_sendquery. Furthermore, non-blocking mode has not been tested with other pgtcl commands, so the consequences of using non-blocking mode are generally not known.

This command uses or emulates the PostgreSQL libpq function PQsetnonblocking. Logo

This version of the manual was produced for the Pgtcl-ng Sourceforge project web service site, which requires the logo on each page.

To download a logo-free copy of the manual, see the Pgtcl-ng project downloads area.