Forum OpenACS Q&A: Catching and reporting SQL Errors

Collapse
Posted by Rob Meyer on
Is there a better way to grab errors from the PostgreSQL driver? It
seems to me (unless I'm doing something wrong) that the only error I
can get back is something akin to "dml operation failed." Is there
anyway to programmatically get back the error so I can respond
appropriately to it? What I want shows up in the server log ("Error:
Ns_PgExec: result status: 7 message: ERROR:  Cannot insert a duplicate
key into unique index oo_sdb_services_pkey"), but I can't figured out
how to get it from the AOL Server API...I realize this only fringely
related to OpenACS, but I figured you guys were a good place to start
(community.aolserver.com seems to be rather slow).
Collapse
Posted by Don Baccus on
This is on my never-ending list of things to look at.  Jan Wieck changed the driver to stuff the error message into the right place in the struct used to communicate with AOLserver, but it doesn't seem to be returned to the Tcl db command.  It's possible he didn't get it right or isn't doing it in the DML case.

I plan to spend much of summer working on PG and OpenACS issues like this, but summer's still about 4-5 weeks away on my (work) calendar.