Re: SQLSTATE of notice PGresult

From: Euler Taveira de Oliveira <euler(at)timbira(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: SQLSTATE of notice PGresult
Date: 2010-08-25 01:44:10
Message-ID: 4C74756A.5070703@timbira.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas escreveu:
> On Fri, Aug 20, 2010 at 11:05 AM, Euler Taveira de Oliveira
> <euler(at)timbira(dot)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/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-08-25 02:00:22 Re: SQLSTATE of notice PGresult
Previous Message David Fetter 2010-08-25 01:23:43 Re: gSoC add MERGE command new patch -- merge_v104