Re: [Feature request] Add a way to get the length of a PQerrorMessage in libpq - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [Feature request] Add a way to get the length of a PQerrorMessage in libpq
Date
Msg-id 204959.1755188673@sss.pgh.pa.us
Whole thread Raw
In response to Re: [Feature request] Add a way to get the length of a PQerrorMessage in libpq  (Benoît Dufour <benoit.dufour@mail.com>)
List pgsql-hackers
=?UTF-8?Q?Beno=C3=AEt_Dufour?= <benoit.dufour@mail.com> writes:
> It recalculates the strlen of the error message.
> This is a bad behaviour for softwares that need to execute quickly.

If you're concerned about the cost of a strlen() in an error-handling
path, you've got your priorities wrong.  Not having gotten an error
in the first place is always going to be preferable.  Moreover, the
cost of that strlen() is utterly negligible in comparison to the work
the server did to detect and report the error (to say nothing of
possible network transmission costs).

            regards, tom lane



pgsql-hackers by date:

Previous
From: Benoît Dufour
Date:
Subject: Re: [Feature request] Add a way to get the length of a PQerrorMessage in libpq
Next
From: "Peter Geoghegan"
Date:
Subject: Re: index prefetching