example for PGRES_COMMAND_OK

Started by Josh Kupershmidtover 13 years ago2 messagesdocs
Jump to latest
#1Josh Kupershmidt
schmiddy@gmail.com

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

Attachments:

libpq.PGRES_COMMAND_OK.diffapplication/octet-stream; name=libpq.PGRES_COMMAND_OK.diffDownload+3-3
#2Peter Eisentraut
peter_e@gmx.net
In reply to: Josh Kupershmidt (#1)
Re: example for PGRES_COMMAND_OK

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

--
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs