Cannot SELECT from UPDATE RETURNING clause in postgres

前端 未结 7 1055
旧时难觅i
旧时难觅i 2020-12-03 10:36

I isolatet the problem from a much more complex query. Here the test scenario

DROP TABLE test; 
CREATE TABLE test (
  id integer,
  description varchar(100)
         


        
7条回答
  •  醉梦人生
    2020-12-03 11:26

    Are you missing an IN: ... WHERE id IN (UPDATE ...?

    However if I only run the statemennt "UPDATE test set value='test' RETURNING id", I get a result with 2 rows. Why is that?

    Your UPDATE has no WHERE clause and therefore it updates every row, of which there are two.

提交回复
热议问题