Cannot SELECT from UPDATE RETURNING clause in postgres

前端 未结 7 1056
旧时难觅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:24

    You update two rows in your UPDATE query, add a WHERE clause to restrict the rows affected.

    UPDATE test SET description = 'test' WHERE id = 1 RETURNING id
    

    to return a single row.

提交回复
热议问题