Skip site navigation (1) Skip section navigation (2)

Re: BUG #4715: libpq `PQgetlength' return invalid field length.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "VEN" <bsditer(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4715: libpq `PQgetlength' return invalid field length.
Date: 2009-03-18 12:41:01
Message-ID: 8381.1237380061@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"VEN" <bsditer(at)gmail(dot)com> writes:
> Database have below table:
> CREATE TABLE TEST {
>     NUM BIGINT NOT NULL DEFAULT 0
> };


> EXEC "SELECT NUM FROM TEST LIMIT 1"
>    PQgetlength return valid length (sizeof(int64)), it's ok.

> but
> EXEC "SELECT SUM(NUM)::BIGINT FROM TEST"
> or
> EXEC "SELECT SUM(NUM) FROM TEST"

>    PQgetlength already return zero.

I see no bug here.  For such a case (with no rows in the table)
SUM() is defined to return NULL, and PQgetvalue() is defined to
return an empty string for a null, and PQgetlength() is defined
to return the length of whatever PQgetvalue() returns.

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Heikki LinnakangasDate: 2009-03-18 14:55:27
Subject: Re: BUG #4714: Unicode Big5 Conversion
Previous:From: Heikki LinnakangasDate: 2009-03-18 09:44:43
Subject: Re: BUG #4714: Unicode Big5 Conversion

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group