DELETE...RETURNING problem with libpq

From: Brice André <brice(at)famille-andre(dot)be>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: DELETE...RETURNING problem with libpq
Date: 2013-05-25 11:07:09
Message-ID: CAOBG12=oT4ghBHgO+z-scf4fDEeMwunPBGbdi2ES9CoPPSy4Nw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Dear all,

I am trying to translate a code written in php to C++. So, I am now using
lipq in order to access my postgresql database from C++.

As performance is an important feature, I am using prepared statements.

I have a SQL statement that performs a 'DELETE ... RETURNING ... ' stuff
and I execute it from a prepared statement (using PQprepare and
PQexecPrepared). Now, when I execute this command, it properly deletes
requested row, but when I use command PQntuples, it returns 0, as if no
data was returned.

When I execute the same sql command from PgAdmin or from my old php script
(that did not use prepared statements), everything works fine.

Note that, in another part of my script, I use the same technique to
perform an 'UPDATE ... RETURNING' and it works properly...

Does anyone has an idea of what may fail and how I can solve this problem ?

Regards,
Brice

PS : my postgresql server version is 8.4 and it is running on a Debian
server, if it may help.

Browse pgsql-sql by date

  From Date Subject
Next Message Marc Mamin 2013-05-25 11:57:02 Re: reduce many loosely related rows down to one
Previous Message Bill MacArthur 2013-05-25 07:19:38 reduce many loosely related rows down to one