# New function: pg_get_socket

- Thread: https://externals.io/message/42817
- Original archive: https://news-web.php.net/php.internals/42817
- Started by Charles on 2009-01-25T00:05:10+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #42817 — Charles — 2009-01-25T00:05:10+00:00

URL: https://externals.io/message/42817#42817

This is a patch for 5.2.x to return a select()-able variable for a given 
PostgreSQL connection.

PG allows ASync queries, pg_send_query, and notifications, 
pg_get_notify. Currently (afaik), there is no way to add a PostgreSQL
socket to the event notification array in used with `stream_select()`;

usage:

$db=pg_connect(...);
$db_socket = pg_get_socket($db);
pg_send_query("select 1,pg_sleep(3)");
stream_select($db_socket, ...);
pg_get_result($db);

feature was requested Jan 2005 on
the pg_get_result page of the main English manual.


-Charles
