Re: SQLSTATE of notice PGresult

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>, Euler Taveira de Oliveira <euler(at)timbira(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: SQLSTATE of notice PGresult
Date: 2010-09-22 14:45:30
Message-ID: 25146.1285166730@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Wed, Sep 22, 2010 at 4:18 AM, Dmitriy Igrishin <dmitigr(at)gmail(dot)com> wrote:
>> Okay, as Robert points, "00000" code in successful messages seems as waste
>> of bytes. But according to the documentation, "All messages emitted by the
>> PostgreSQL server are assigned five-character error codes that follow the
>> SQL
>> standard's conventions for "SQLSTATE" codes." - the first sentence of
>> http://www.postgresql.org/docs/9.0/static/errcodes-appendix.html

> Sounds like that wording needs some adjustment.

That wording is correct as it stands.

If I recall the previous discussion here, the problem is that the OP
is reading that and thinking that it applies also to errors generated
internally by libpq. We should, but don't, have any support for
assigning SQLSTATEs to those. But the server always emits a SQLSTATE
when sending a notice or error message --- read
send_message_to_frontend() if you doubt it.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-09-22 14:50:14 Re: snapshot generation broken
Previous Message Tom Lane 2010-09-22 14:33:49 Re: Needs Suggestion