Q: ecpg and UPDATE/DELETE ... RETURNING ... for multiple returned rows

From: "Enke, Dr(dot), Michael" <michael(dot)enke(at)wincor-nixdorf(dot)com>
To: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Q: ecpg and UPDATE/DELETE ... RETURNING ... for multiple returned rows
Date: 2012-10-23 20:55:38
Message-ID: D0705BB737A20D4EA166124FF1BA8C63BCBD01F5D6@DEEXVS61.wincor-nixdorf.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello experts,
I try to do an update together with a RETURNING clause but without success (postgresql 9.1 on CentOS 6.2),
the returned data can be multiple rows (not only one row expected like in src/interfaces/ecpg/test/sql/insupd.pgc):

1:
EXEC SQL DECLARE cur CURSOR FOR UPDATE t set a=0 where a=3 RETURNING b;
This fails (ecpg fails) with: ERROR: syntax error at or near "t"

2:
char *stmt = "UPDATE t set a=0 where a=3 RETURNING b"
EXEC SQL PREPARE stmt1 FROM :stmt;
EXEC SQL DECLARE cur CURSOR FOR stmt1;
This fails (sql fails in the server) with: syntax error at or near "UPDATE" at character 24

What is the proper way to do that in pgc or is this not possible?

Kind regards,
Michael

WINCOR NIXDORF International GmbH
Sitz der Gesellschaft: Paderborn
Registergericht Paderborn HRB 3507
Geschäftsführer: Eckard Heidloff (Vorsitzender), Dr. Jürgen Wunram
Vorsitzender des Aufsichtsrats: Karl-Heinz Stiller
Steuernummer: 339/5884/0020 - Ust-ID Nr.: DE812927716 - WEEE-Reg.-Nr. DE44477193

Diese E-Mail enthält vertrauliche Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben,
informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.

This e-mail may contain confidential information.
If you are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail.
Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Browse pgsql-general by date

  From Date Subject
Next Message Ben Chobot 2012-10-23 21:08:10 Re: Streaming replication failed to start scenarios
Previous Message damien clochard 2012-10-23 20:12:58 PostgreSQL Magazine now available in Chinese