How can I get the INSERTED and UPDATED rows for an UPSERT operation in postgres
问题 I've got an UPSERT Operation like this: INSERT INTO people (SELECT * FROM people_update) ON CONFLICT (name,surname) DO UPDATE SET age = EXCLUDED.age , street = EXCLUDED.street , city = EXCLUDED.city , postal = EXCLUDED.postal WHERE (people.age,people.street,people.city,people.postal) IS DISTINCT FROM (EXCLUDED.age,EXCLUDED.street,EXCLUDED.city,EXCLUDED.postal) RETURNING case when xmax::text::int > 0 then 'updated' else 'inserted' end,name,surname,age,street,city,postal; (name,surname) is a