pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedError code handling in perl
2+ messages / 2 participants
[nested] [flat]
* Error code handling in perl
@ 2004-05-16 11:56 Elinor Medezinski <elinor@bellatrix.tau.ac.il>
2004-05-22 01:00 ` Re: Error code handling in perl Greg Sabino Mullane <greg@turnstep.com>
0 siblings, 1 reply; 2+ messages in thread
From: Elinor Medezinski @ 2004-05-16 11:56 UTC (permalink / raw)
To: pgsql-interfaces; +Cc: elinor@wise.tau.ac.il
Hi all,
I am populating a table in postgres, writing the script in perl (using DBI),
and I am trying to do some error handling. For example - this should return
an error due to unique violation:
>$sth=$conn->prepare("INSERT INTO tablename (names) values ($name)") or die
"error1 is: ".$sth->err;
>$sth->execute() or do{
> print "state is: ".$sth->state."\n";
> print "err is: ".$sth->err."\n";
>};
I always get the same SQLSTATE and ERROR, no matter what the error is:
>state is: S1000
>err is: 7
although in the documentation it says that the error code is "23505" (unique
violation).
Is there no way to identify the error by code from postgres via perl?
Thanks,
Elinor
-------------------------------------------------------
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Error code handling in perl
2004-05-16 11:56 Error code handling in perl Elinor Medezinski <elinor@bellatrix.tau.ac.il>
@ 2004-05-22 01:00 ` Greg Sabino Mullane <greg@turnstep.com>
0 siblings, 0 replies; 2+ messages in thread
From: Greg Sabino Mullane @ 2004-05-22 01:00 UTC (permalink / raw)
To: pgsql-interfaces
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> although in the documentation it says that the error code is
> "23505" (unique violation).
> Is there no way to identify the error by code from postgres
> via perl?
Currently, DBD::Pg does not support the $sth->state method, but
it is high on the todo list and should appear in the next
version.
- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200405212100
-----BEGIN PGP SIGNATURE-----
iD8DBQFArqaMvJuQZxSWSsgRAlYLAKDykM8K4Fyfy+neIjA2a3B+NI4x2wCbBc04
GiaVC2lYiMfuVQfEG/2jKiY=
=1kvf
-----END PGP SIGNATURE-----
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2004-05-22 01:00 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-05-16 11:56 Error code handling in perl Elinor Medezinski <elinor@bellatrix.tau.ac.il>
2004-05-22 01:00 ` Greg Sabino Mullane <greg@turnstep.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox