Re: SQLSTATE of notice PGresult - Mailing list pgsql-hackers

From Euler Taveira de Oliveira
Subject Re: SQLSTATE of notice PGresult
Date
Msg-id 4C74756A.5070703@timbira.com
Whole thread Raw
In response to Re: SQLSTATE of notice PGresult  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: SQLSTATE of notice PGresult  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas escreveu:
> On Fri, Aug 20, 2010 at 11:05 AM, Euler Taveira de Oliveira
> <euler@timbira.com> wrote:
>> Dmitriy Igrishin escreveu:
>>>   /* NOT presents - NULL. Why not "00000" ? */
>>>   const char* sqlstate = Pg::PQresultErrorField(res, PG_DIAG_SQLSTATE);
>>>
>> That's because the protocol doesn't set error field when the command
>> succeeded. IMHO it's an oversight (the documentation is correct but the code
>> is not) and should be correct because the spec enforces it.
> 
> Seems like a waste of bytes.
> 
Ugh? It is a matter of correctness. I'm not arguing in favor of it but if we
don't implement it, it is better document it. I don't actually rely on sql
state to check errors but can have applications out there that expect the spec
behavior but we don't provide it and, also fail to document it. Talking about
the patch, it is just pqSaveMessageField() calls in *Complete messages. I can
provide a patch for it.


--  Euler Taveira de Oliveira http://www.timbira.com/


pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: gSoC add MERGE command new patch -- merge_v104
Next
From: Robert Haas
Date:
Subject: Re: SQLSTATE of notice PGresult