From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Huxton <dev@archonet.com>
Cc: Bart Degryse <Bart.Degryse@indicator.be>
Cc: pgsql-sql@postgresql.org
Subject: Re: Use of delete...returning in function problem
Date: Tue, 04 Sep 2007 11:55:05 -0400
Message-ID: <25973.1188921305@sss.pgh.pa.us> (raw)
In-Reply-To: <46DD373E.1080308@archonet.com>
References: <46DD3B8E.A3DD.0030.0@indicator.be>
<46DD373E.1080308@archonet.com>
Richard Huxton <dev@archonet.com> 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: syntax error at or near "delete"
LINE 1: (delete from fool);
^
The OP may be used to putting parens into his FOR loops because it
works with SELECT:
regression=# (select * from zz1);
f1 | f2 | f3
----+----+----
(0 rows)
The difference is that SELECT can be put into larger groupings (eg
UNIONs) so it has to be parenthesiz-able. If we ever considered
supporting DELETE RETURNING as a component of larger queries, this
syntax difference would likely go away.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, dev@archonet.com, Bart.Degryse@indicator.be
Subject: Re: Use of delete...returning in function problem
In-Reply-To: <25973.1188921305@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox