How to upsert multiple rows in PostgreSQL How to upsert multiple rows in PostgreSQL postgresql postgresql

How to upsert multiple rows in PostgreSQL


The conflicting values are available through the excluded alias:

INSERT INTO a (id, x)SELECT id, x FROM bON CONFLICT (id) DO UPDATE    SET x = excluded.x;