this example statement works fine in postgresql 9.1 and above. Unfortunately it does not work in older versions, the reason being that update does not support the with statement. How can I put the RETURNING in an array? I am writing a function using plpgsql.
begin
create table testing(
i serial,
t text);
insert into testing
(t)
values (null),(null),(null);
with abc AS (
update testing
set t = null
returning i )
select array_agg(i)
from abc;
rollback
Thank you for your help!