I isolatet the problem from a much more complex query. Here the test scenario
DROP TABLE test;
CREATE TABLE test (
INSERT INTO test(id, description) VALUES (1,'new');
INSERT INTO test(id, description) VALUES (2,'new');
SELECT * FROM test WHERE id IN (UPDATE test set description='test' RETURNING id)
UPDATE test set value='test' RETURNING id
SELECT * FROM test WHERE id IN (1,2);
Before PostgreSQL 9.1 INSERT/UPDATE/DELETE could only be used as top level statements. This is why you are getting a syntax error.
Starting from 9.1 you can use data-modifying statements with common table expressions. Your example query would look like this:
WITH updated AS (UPDATE test SET description = 'test' RETURNING id) SELECT * FROM test WHERE id IN (SELECT id FROM updated);
Be careful with selecting from the just modified table. You can get confusing results that way. Becuse the queries are executed in the same snapshot, the SELECT will not see the effects of the UPDATE statement.