On Thu, Sep 28, 2006 at 05:16:10AM -0700, erkan kolemen wrote:
> res = PQexec(conn, "select * from lists;");
> if (PQresultStatus(res) != PGRES_COMMAND_OK)
You're checking for the wrong result status. Here are some excerpts
from the libpq documentation:
PGRES_COMMAND_OK
Successful completion of a command returning no data.
PGRES_TUPLES_OK
Successful completion of a command returning data (such as a SELECT
or SHOW).
Note that a SELECT command that happens to retrieve zero rows still
shows PGRES_TUPLES_OK. PGRES_COMMAND_OK is for commands that can
never return rows (INSERT, UPDATE, etc.).
--
Michael Fuhr