I found some quite odd today and I am wondering if anyone else has encountered this (or can reproduce it) - or maybe I am just going crazy.

The function pg_connection_status() should return PGSQL_CONNECTION_BAD or null if the PostgreSQL service/database has stopped/restarted/ is not responding - after you have connected to it.

But what I encountered today suggests that is continues to return PGSQL_CONNECTION_OK after the stop / restart. It will only start returning PGSQL_CONNECTION_BAD if you try to run a query.

For example - this is what I am experiencing:

$link_id = pg_connect("dbname=test");

//do some queries ... etc ...

// pg_connection_status($link_id) equals PGSQL_CONNECTION_OK;

*** PostgreSQL database/service is stopped or restarted ***

// pg_connection_status($link_id) still equals PGSQL_CONNECTION_OK;

pg_query($link_id,$query); // this fails - outputs an error

// pg_connection_status($link_id) now equals PGSQL_CONNECTION_BAD or null;

Any comments or suggestions would be appreciated.  Thanks.


PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to