I haven't seen any one else reply. I don't know if you've gotten a solution. But the following seemed to work for me:
WITH serie AS (
select s, s*10 as computing
from generate_series(1,10) as s
)
INSERT INTO test_insert_returning (some_value)
SELECT computing
FROM serie
RETURNING gid, some_value;
From my reading on the RETURNING phrase, you can only return values from the table into which you are doing the INSERT. Not any other table or view which might be referenced.
OOPS, I see what I did wrong. You wanted the "s" value from serie and my example showed the other value from serie. My apologies. Why not insert the "s" value into a third column in "test_insert_returning"? That is:
CREATE TABLE test_insert_returning(
gid SERIAL,
s_temp integer,
some_value int
);
WITH serie AS (
SELECT s, s*10 as computing
FROM generate_series(1,10) as s
)
INSERT INTO test_insert_returning(some_value,s)
SELECT computing, s
FROM serie
RETURNING gid, s_temp
;
You end up getting what is desired, at the cost of a "junk" column in your table.