Re: [SQL] Use of delete...returning in function problem

2007-09-04 Thread Tom Lane
Richard Huxton <[EMAIL PROTECTED]> writes: > I think it's just the brackets () - plpgsql's parser isn't terribly > sophisticated. It's not plpgsql's fault --- you'll get the same result if you put parentheses around a DELETE command at the SQL command line. regression=# (delete from fool); ERROR

Re: [SQL] Use of delete...returning in function problem

2007-09-04 Thread Bart Degryse
Amazing what a bracket can do :) Thanks for the help. >>> Richard Huxton <[EMAIL PROTECTED]> 2007-09-04 12:45 >>> Bart Degryse wrote: > I'm trying to use a delete statement with returning clause in a function: > FOR rec IN ( > delete from billing_errors_new where errortypeid IN (1,2) re

Re: [SQL] Use of delete...returning in function problem

2007-09-04 Thread Richard Huxton
Bart Degryse wrote: I'm trying to use a delete statement with returning clause in a function: FOR rec IN ( delete from billing_errors_new where errortypeid IN (1,2) returning *) LOOP I get following error though: ERROR: syntax error at or near "delete" at character 4 QU

[SQL] Use of delete...returning in function problem

2007-09-04 Thread Bart Degryse
I'm trying to use a delete statement with returning clause in a function: CREATE OR REPLACE FUNCTION "public"."test_delete"() RETURNS void AS $body$ DECLARE rec billing_errors_new; BEGIN FOR rec IN ( delete from billing_errors_new where errortypeid IN (1,2) returning *) LO