pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedv8.1: Error severity on libpq PGconn*
3+ messages / 3 participants
[nested] [flat]
* v8.1: Error severity on libpq PGconn*
@ 2007-11-26 23:52 Jeffrey Brendecke <yakhki@yahoo.de>
2007-11-27 02:24 ` Re: v8.1: Error severity on libpq PGconn* Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: Jeffrey Brendecke @ 2007-11-26 23:52 UTC (permalink / raw)
To: pgsql-interfaces
Is there a recommended way to get the error severity (ERROR vs. FATAL vs. PANIC, etc.) off a PGconn* as there is for a PGresult* using PQresultErrorField()?
For example, when I pass in a non-existent database name when creating a connection, I get the following message:
FATAL: database "xxxxxx" does not exist
as returned by PQerrorMessage().
This message format does not fit into my messaging framework and the status returned from PQstatus() is unfortunately too vague to be of use in this regard.
I would like to avoid parsing the message, chopping off the text up to the double space, and do some sort of lookup on the preceeding localized text to determine the severity.
The 8.1 docs say there is no PQerrorField() function and the 8.2 and 8.3 docs make the same disclaimer.
I saw some mails back from 2003 in the archives that seem to propose such a solution as PQerrorField(), but it appears to have never been implemented.
Thanks very much.
__________________________________ Ihre erste Baustelle? Wissenswertes für Bastler und Hobby Handwerker. www.yahoo.de/clever
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: v8.1: Error severity on libpq PGconn*
2007-11-26 23:52 v8.1: Error severity on libpq PGconn* Jeffrey Brendecke <yakhki@yahoo.de>
@ 2007-11-27 02:24 ` Tom Lane <tgl@sss.pgh.pa.us>
2008-03-07 17:54 ` Re: v8.1: Error severity on libpq PGconn* Bruce Momjian <bruce@momjian.us>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2007-11-27 02:24 UTC (permalink / raw)
To: Jeffrey Brendecke <yakhki@yahoo.de>; +Cc: pgsql-interfaces
Jeffrey Brendecke <yakhki@yahoo.de> writes:
> Is there a recommended way to get the error severity (ERROR vs. FATAL vs. PANIC, etc.) off a PGconn* as there is for a PGresult* using PQresultErrorField()?
> For example, when I pass in a non-existent database name when creating a connection, I get the following message:
> FATAL: database "xxxxxx" does not exist
What you're really wishing here is that errors generated within libpq
itself had SQLSTATE and other decoration. They don't :-(. Improving
this is on the to-do list, but someone is going to have to sit down and
do several days/weeks of hard and mostly-boring work to make it happen.
Do you want to volunteer?
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: v8.1: Error severity on libpq PGconn*
2007-11-26 23:52 v8.1: Error severity on libpq PGconn* Jeffrey Brendecke <yakhki@yahoo.de>
2007-11-27 02:24 ` Re: v8.1: Error severity on libpq PGconn* Tom Lane <tgl@sss.pgh.pa.us>
@ 2008-03-07 17:54 ` Bruce Momjian <bruce@momjian.us>
0 siblings, 0 replies; 3+ messages in thread
From: Bruce Momjian @ 2008-03-07 17:54 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Jeffrey Brendecke <yakhki@yahoo.de>; pgsql-interfaces
Added to TODO:
o Add SQLSTATE severity to PGconn return status
http://archives.postgresql.org/pgsql-interfaces/2007-11/msg00015.php
---------------------------------------------------------------------------
Tom Lane wrote:
> Jeffrey Brendecke <yakhki@yahoo.de> writes:
> > Is there a recommended way to get the error severity (ERROR vs. FATAL vs. PANIC, etc.) off a PGconn* as there is for a PGresult* using PQresultErrorField()?
> > For example, when I pass in a non-existent database name when creating a connection, I get the following message:
>
> > FATAL: database "xxxxxx" does not exist
>
> What you're really wishing here is that errors generated within libpq
> itself had SQLSTATE and other decoration. They don't :-(. Improving
> this is on the to-do list, but someone is going to have to sit down and
> do several days/weeks of hard and mostly-boring work to make it happen.
> Do you want to volunteer?
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2008-03-07 17:54 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-11-26 23:52 v8.1: Error severity on libpq PGconn* Jeffrey Brendecke <yakhki@yahoo.de>
2007-11-27 02:24 ` Tom Lane <tgl@sss.pgh.pa.us>
2008-03-07 17:54 ` Bruce Momjian <bruce@momjian.us>
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