clear markdown compare help donate or buy diddy dollings comments/suggestions/bugs a leap of faith? bible365
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 635452 fiddles created (13085 in the last week).

CREATE TABLE tab(i INT); INSERT INTO tab VALUES (1); INSERT INTO tab VALUES(2);
1 rows affected
1 rows affected
 hidden batch(es)


SELECT * FROM tab
i
1
2
 hidden batch(es)


UPDATE tab SET i =10 * i RETURNING COUNT(*); -- aggregate functions are not allowed in RETURNING
ERROR: aggregate functions are not allowed in RETURNING LINE 3: RETURNING COUNT(*); ^
 hidden batch(es)


SELECT COUNT(*), STRING_AGG(i, ',') OVER(ORDER BY i) FROM (UPDATE tab SET i =10 * i RETURNING *) s -- syntax error at or near "SET"
ERROR: syntax error at or near "SET" LINE 3: SET i =10 * i ^
 hidden batch(es)


WITH cte AS ( UPDATE tab SET i =10 * i RETURNING * ) SELECT COUNT(*), STRING_AGG(i::text, ',' ORDER BY i) FROM cte
count string_agg
2 10,20
 hidden batch(es)