Re: [BUGS] General Bug Report: Documentation problem - Mailing list pgsql-bugs

From Bruce Momjian
Subject Re: [BUGS] General Bug Report: Documentation problem
Date
Msg-id 199904171718.NAA12784@candle.pha.pa.us
Whole thread Raw
In response to General Bug Report: Documentation problem  (Unprivileged user <nobody>)
List pgsql-bugs
> Problem Description:  -------------------- libpq documentation
> has a few errors.  Most notably, the reccomended style of error
> handling.  psuedocode: res=PQexec(conn, "error-prone-statement");
> if (PQresultStatus(res) != PGRES_TUPLES_OK) { do_error_code();
> } This is actually incorrect, since on error, PQexec returns
> null, so PQresultStatus (which I can't find documented)
> derefrences a null pointer.  Correct example code would be
> res=PQexec(conn, "error-prone-statment"); if (!res) {
> printf("PQexec(): %s\n", PQerrorMessage(conn)); exit(1) }
>
> If nobody else is working on the documentation reply to me, and
> I'll submit diffs.

Very good point.  I have added !res || resultStatus(...) to the man
pages and sgml examples.

Thanks.

--
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-bugs by date:

Previous
From: Unprivileged user
Date:
Subject: General Bug Report: Documentation problem
Next
From: "Mike Erickson"
Date:
Subject: int8 & primary key error