除外
>
キーワード:
INSERT INTO cars
(car_id, car_type, car_model)
values
(1, 'tesla', 'model s')
ON CONFLICT (car_id) DO UPDATE SET
car_type = excluded.car_type,
car_model = excluded.car_model;
これは、複数の行でも正しく機能します(例:
)。INSERT INTO cars
(car_id, car_type, car_model)
values
(1, 'tesla', 'model s'),
(2, 'toyota', 'prius')
ON CONFLICT (car_id) DO UPDATE SET
car_type = excluded.car_type,
car_model = excluded.car_model;