Re: PQresult() return value not very handy...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Peter de Vroomen" <peterv(at)geenspam_jaytown(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PQresult() return value not very handy...
Date: 2002-06-21 21:04:14
Message-ID: 28729.1024693454@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Peter de Vroomen" <peterv(at)geenspam_jaytown(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2002-06-21 21:16:22 Re: NetBSD Live CD/PostgreSQL?
Previous Message Bruno Baguette 2002-06-21 20:59:54 Unable to run one pl/pgSQL function :-(