Verified that one may use MERGE which contains up to 254 WHEN-conditions (with trivial statements like: when NOT matched and s.id = 254 then insert values(s.id, s.x) or when matched and s.id = 254 then update set t.x = t.x + s.x).
::: NB :::
JFYI: Statement MERGE ... RETURNING will fail always if SOURCE contain more than 1 row. Even if MERGE condition doesn not affected more than one record in TARGET.
Discussion (rus): sql.ru/forum/actualutils.aspx?action=gotomsg&tid=1159066&msg=17706227