[BioC] RdbiPgSQL error reporting
Herve Pages
hpages at fhcrc.org
Fri Jan 6 04:38:24 CET 2006
Hi Mitch,
Thanks for the patch!
It works nice when the server actually does return an error, like in:
> res = dbSendQuery(con, 'SELECT FROM mytable')
> dbGetResult(res)
Error in dbGetResult.PgSQL.result(res) : ERROR: syntax error at or near
"FROM" at character 8
But you can still have PQresultStatus(result) != PGRES_TUPLES_OK
without having the sever actually return any error.
This is what happens when the query doesn't return any tuple, like in:
> res = dbSendQuery(con, "INSERT INTO mytable VALUES ('bla', 'bla')")
Then with the patched PgSQLgetResult() function, you get:
> dbGetResult(res)
Error in dbGetResult.PgSQL.result(res) :
No error message at all!
I agree this is the consequence of the user misusing the dbGetResult()
function.
But it would be nice if we could keep the "Query did not produce any tuples"
message for this special case. Also, the PgSQLcolumnInfo() C function
(internal for dbColumnInfo() R function) starts with:
if (PQresultStatus(result) != PGRES_TUPLES_OK)
error(PQresultErrorMessage(result));
Wouldn't it make sense to make the same change here too?
Just wondering... I'm not really familiar with the RdbiPgSQL
package though.
The patch has been applied and RdbiPgSQL 1.5.1 should show
up on the Bioconductor repository next Saturday morning.
Regards,
H.
Mitch Skinner wrote:
> On Thu, 2006-01-05 at 17:00 -0800, Mitch Skinner wrote:
>
>> One-line patch attached.
>
>
> Hmmm, the patch attachment seems to have gotten stripped somewhere along
> the way--it goes like this:
>
> Index: PgSQL.c
> ===================================================================
> --- PgSQL.c (revision 15587)
> +++ PgSQL.c (working copy)
> @@ -229,7 +229,7 @@
> matrix = (int)LOGICAL(asMatrix)[0];
>
> if (PQresultStatus(result) != PGRES_TUPLES_OK)
> - error("Query did not produce any tuples");
> + error(PQresultErrorMessage(result));
>
> if (PQbinaryTuples(result)) error("Binary tuples not supported");
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
>
--
------------------------
Hervé Pagès
E-mail: hpages at fhcrc.org
Phone: (206) 667-5791
Fax: (206) 667-1319
More information about the Bioconductor
mailing list