Lists: | pgsql-bugs |
---|
From: | Unprivileged user <nobody> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | General Bug Report: Documentation problem |
Date: | 1999-04-17 09:06:33 |
Message-ID: | 199904170906.FAA02883@hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================
Your name : Dan Merillat
Your email address : Dan(at)merillat(dot)org
Category : install: other
Severity : non-critical
Summary: Documentation problem
System Configuration
--------------------
Operating System : N/A
PostgreSQL version : 6.3
Compiler used : N/A
Hardware:
---------
N/A
Versions of other tools:
------------------------
N/A
--------------------------------------------------------------------------
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.
--Dan
--------------------------------------------------------------------------
Test Case:
----------
--------------------------------------------------------------------------
Solution:
---------
--------------------------------------------------------------------------
From: | Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Dan(at)merillat(dot)org |
Cc: | pgsql-bugs(at)postgreSQL(dot)org |
Subject: | Re: [BUGS] General Bug Report: Documentation problem |
Date: | 1999-04-17 17:18:55 |
Message-ID: | 199904171718.NAA12784@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026