pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeffrey Brendecke <yakhki@yahoo.de>
To: pgsql-interfaces@postgresql.org
Subject: v8.1: Error severity on libpq PGconn*
Date: Mon, 26 Nov 2007 23:52:50 +0000 (GMT)
Message-ID: <315963.85252.qm@web26909.mail.ukl.yahoo.com> (raw)

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



view thread (3+ messages)  latest in thread

Message-ID: <315963.85252.qm@web26909.mail.ukl.yahoo.com>
Permalink:  ../315963.85252.qm@web26909.mail.ukl.yahoo.com/
Also on:    postgresql.org/message-id/315963.85252.qm@web26909.mail.ukl.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: yakhki@yahoo.de
  Subject: Re: v8.1: Error severity on libpq PGconn*
  In-Reply-To: <315963.85252.qm@web26909.mail.ukl.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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