The following bug has been logged online:
Bug reference: 4715
Logged by: VEN
Email address: bsditer(at)gmail(dot)com
PostgreSQL version: 8.3.7
Operating system: FreeBSD
Description: libpq `PQgetlength' return invalid field length.
Details:
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.