example for PGRES_COMMAND_OK

Lists: pgsql-docs
From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: pgsql-docs <pgsql-docs(at)postgresql(dot)org>
Subject: example for PGRES_COMMAND_OK
Date: 2012-10-26 23:58:13
Message-ID: CAK3UJRG262OrX4jVZJXvWRFQqQ_B1HaY2qK_r28Efb3wOJDPog@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-docs

Hi all,

This libpq page:
http://www.postgresql.org/docs/current/static/libpq-exec.html#LIBPQ-PQRESULTSTATUS

has claimed since at least the 7.x days:
| PGRES_COMMAND_OK is for commands that can never return rows (INSERT,
UPDATE, etc.)

However, as of 8.2 we support the popular INSERT ... RETURNING and
UPDATE ... RETURNING, both of which will naturally give a successful
PQresultStatus() of PGRES_TUPLES_OK. So I think this explanation
deserves an amendment. We could just change the example commands to
e.g. TRUNCATE for simplicity, but I do like that the current example
commands are INSERT and UPDATE, since it reinforces the notion that a
plain INSERT or UPDATE affecting no rows would still return
PGRES_COMMAND_OK.

Suggested change attached.

Josh

Attachment Content-Type Size
libpq.PGRES_COMMAND_OK.diff application/octet-stream 1.1 KB

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: pgsql-docs <pgsql-docs(at)postgresql(dot)org>
Subject: Re: example for PGRES_COMMAND_OK
Date: 2013-01-19 03:40:43
Message-ID: 1358566843.17277.2.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-docs

On Fri, 2012-10-26 at 16:58 -0700, Josh Kupershmidt wrote:
> However, as of 8.2 we support the popular INSERT ... RETURNING and
> UPDATE ... RETURNING, both of which will naturally give a successful
> PQresultStatus() of PGRES_TUPLES_OK.

committed