pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jakob Egger <jakob@eggerapps.at>
To: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: PG_DIAG_SEVERITY and a possible bug in pq_parse_errornotice()
Date: Thu, 25 Aug 2016 17:22:38 +0200
Message-ID: <A88E0006-13CB-49C6-95CC-1A77D717213C@eggerapps.at> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Hi,

My PostgreSQL client checks the PG_DIAG_SEVERITY error field to determine the error level.

However, I have now learned that this field is localized. This means that a server configured with --enable-nls might for example return the string ERREUR instead of ERROR.

So if I want to determine the error level, do I need to compare against all localised variations in my app? Or is there another way?

I browsed through the PostgreSQL source and discovered that pq_parse_errornotice() (in src/backend/libpq/pqmq.c) uses the same naive strcmp() approach to determine error level. This means that it will fail when the server is compiled with --enable-nls. I am not sure what the impact of this is, since I couldn't really figure out where that function is used.

Best regards,
Jakob

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (15+ messages)  latest in thread

Message-ID: <A88E0006-13CB-49C6-95CC-1A77D717213C@eggerapps.at>
Permalink:  ../A88E0006-13CB-49C6-95CC-1A77D717213C@eggerapps.at/
Also on:    postgresql.org/message-id/A88E0006-13CB-49C6-95CC-1A77D717213C@eggerapps.at

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: jakob@eggerapps.at
  Subject: Re: PG_DIAG_SEVERITY and a possible bug in pq_parse_errornotice()
  In-Reply-To: <A88E0006-13CB-49C6-95CC-1A77D717213C@eggerapps.at>
  References: <A88E0006-13CB-49C6-95CC-1A77D717213C@eggerapps.at>

* 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