![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I can successfully connect to PostgreSQL (pgsql extension). However, when I make a deliberate mistake, I'm unable to capture the connection error with pg_last_error() as one would with the *_last_error() functions of other database extensions. Here is an example: ?php $c = pg_connect('host=127.0.0.1 user=postgres password=xxx dbname=yyy') or var_dump( pg_last_error() ); ? The following output (with warnings) is returned: Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: FATAL: password authentication failed for user "postgres" in .. Warning: pg_last_error() [function.pg-last-error]: No PostgreSQL link opened yet in ... bool(false) One would expect pg_last_error() to return "password authentication failed" instead of FALSE! |
#3
| |||
| |||
|
|
Alternatively, does pg_errormessage() have the same flaw...? |
|
That behaviour doesn't seem particularly unnatural to me,... |
#4
| |||
| |||
|
|
Hi Andrew, Thank you very much for the reply! Alternatively, does pg_errormessage() have the same flaw...? Unfortunately pg_errormessage() doesn't work either. It returns: Warning: pg_errormessage() [function.pg-errormessage]: No PostgreSQL link opened yet in... That behaviour doesn't seem particularly unnatural to me,... It is inconsistent with how the other DB modules behave. I can provide you with some examples if it would help. Best regards. Frank -- Sent via pgsql-php mailing list (pgsql-php (AT) postgresql (DOT) org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-php |
#5
| |||
| |||
|
|
Try this function... |
#6
| |||
| |||
|
|
Since I've migrated to PDO, and only have a bit of legacy stuff around that uses pg_* I don't think it will do me any good at all! *I really try to let other people do all of the coding against other databases, so I can luxuriate in the One True SQL :-) |
![]() |
| Thread Tools | |
| Display Modes | |
| |