Re: PQresult() return value not very handy... - Mailing list pgsql-general

From Tom Lane
Subject Re: PQresult() return value not very handy...
Date
Msg-id 28729.1024693454@sss.pgh.pa.us
Whole thread Raw
In response to PQresult() return value not very handy...  ("Peter de Vroomen" <peterv@geenspam_jaytown.com>)
List pgsql-general
"Peter de Vroomen" <peterv@geenspam_jaytown.com> writes:
> It would have been better if PQresult() would return NULL when an error
> occurs and also return NULL when the field is NULL.

But field-is-NULL is not an error condition.

There's some merit in your suggestion, but it's not as obvious a win
as you seem to think.  The caller really needs to distinguish three
cases (error, NULL field value, normal case) and there's no clean
way to do so with only one return value.

> Any chance that this will be changed in the future?

Not much; it'd break too much existing code.  And PQgetisnull is not
so slow that anyone's going to get very excited about removing it
from the normal code path...

            regards, tom lane

pgsql-general by date:

Previous
From: "Thomas F. O'Connell"
Date:
Subject: comp.databases.postgresql.hackers
Next
From: Bill Moran
Date:
Subject: Re: NetBSD Live CD/PostgreSQL?