Public bug reported: (I think the package should be php5-pgsql but launchpad wants me to use "php5" for some reason.)
pg_send_query() fails because of an implementation error if connection is done to remote host and query string is long OR transaction is very long. The problem is caused by the implementation not following the PostgreSQL documentation at http://www.postgresql.org/docs/9.1/static/libpq- async.html#LIBPQ-PQFLUSH "PQflush: [...] After sending any command or data on a nonblocking connection, call PQflush. [...]" Related PHP Bug: https://bugs.php.net/bug.php?id=65015 Patch: https://bugs.php.net/patch-display.php?bug_id=65015&patch=pg_send_query_flush_buffer.patch&revision=latest Test script (from PHP bug): --- $len = 100000; // This may need to be increased, depending on db server. $sql = "select 1" . str_repeat(' ', $len - 8); $con = pg_connect('host=db-host.example.com dbname=postgres user=postgres password=password'); pg_send_query($con, $sql); pg_get_result($con); --- Note that the test script only fails if host is remote (connected using TCP/IP). ProblemType: Bug DistroRelease: Ubuntu 12.04 Package: php5-pgsql 5.3.10-1ubuntu3.7 ProcVersionSignature: Ubuntu 3.8.0-27.40~precise3-generic 3.8.13.4 Uname: Linux 3.8.0-27-generic x86_64 ApportVersion: 2.0.1-0ubuntu17.4 Architecture: amd64 Date: Wed Sep 4 15:22:25 2013 InstallationMedia: Ubuntu 12.04.1 LTS "Precise Pangolin" - Release amd64 (20120823.1) MarkForUpload: True SourcePackage: php5 UpgradeStatus: No upgrade log present (probably fresh install) ** Affects: php5 (Ubuntu) Importance: Undecided Status: New ** Tags: amd64 apport-bug precise -- You received this bug notification because you are a member of Ubuntu Server Team, which is subscribed to php5 in Ubuntu. https://bugs.launchpad.net/bugs/1220677 Title: pg_send_query(): Cannot set connection to blocking mode To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1220677/+subscriptions -- Ubuntu-server-bugs mailing list Ubuntu-server-bugs@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs