"VEN" <bsdi...@gmail.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

-
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to