|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-04-01 08:51 UTC] gwood at ewebengine dot com
Description: ------------ According to the documentation: "An important summary. Persistent connections were designed to have one-to-one mapping to regular connections. That means that you should always be able to replace persistent connections with non-persistent connections, and it won't change the way your script behaves. It may (and probably will) change the efficiency of the script, but not its behavior!" This does not appear to be the case with pg_pconnect. Specifically, creating two database connections using pg_pconnect with the same connection parameters, results in only a single database connection. This means that instead of being able to execute queries in parallel, all queries are executed sequentially. This happens with both the CLI interface and mod_php. Reproduce code: --------------- $conn1 = pg_pconnect($connect_string); $conn2 = pg_pconnect($connect_string); pg_query($conn1, 'BEGIN'); pg_query($conn2, 'BEGIN'); pg_query($conn1, 'INSERT INTO test (int1) VALUES (1)'); pg_query($conn2, 'INSERT INTO test (int1) VALUES (2)'); pg_query($conn1, 'ROLLBACK'); pg_query($conn2, 'COMMIT'); Expected result: ---------------- This should result in the second insert to the database being committed, while the first insert is rolled back. This is what happens when pg_connect() is substituted for pg_pconnect. Actual result: -------------- Both inserts are rolled back. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 12:00:02 2025 UTC |
It seems that it already exist, but it's not documented or no longer working correctly anymore. It *seems* that you can can pass it like this: pg_connect("conectionstring", PGSQL_CONNECT_FORCE_NEW); also, the order of parameters documented in the manaul for the old *deprecated* way for connecting to PGSQL is wrong: pg_connect("host", "port", "options", "tty", "dbname") from what I read from the source it should be: pg_connect(string connect_string [, int options ]) or pg_connect(string host, string port, string db_name ) or pg_connect(string host, string port, int options, string db_name) or pg_connect(string host, string port, int options, string db_name, string tty)