On Wednesday, August 29, 2018, Dave Bolt <
dave@davebolt.co.uk> wrote:
I am (unfortunately) using PG 8.4
Then writable cte (with) is not an optibn for you. That requires version 9.1 ROs later.
with d as (delete from foo where id=$1 RETURNING *)
select count(*)
You would have to write “from d” to get that to work but as above the delete only works in 9.1+
I would expect “get diagnostics var = row_count” (something like that) to work after executing delete by itself. Might want to read more recent docs since the 8.4 seems to not cover this as thoroughly.
David J.