Skip to content

Instantly share code, notes, and snippets.

@meanother
Created October 14, 2021 19:18
Show Gist options
  • Save meanother/a487d07fa4042f0432ec1242dfd8186e to your computer and use it in GitHub Desktop.
Save meanother/a487d07fa4042f0432ec1242dfd8186e to your computer and use it in GitHub Desktop.
insert into {} as t ({}) values ({}) on conflict (id)
do update set
title = excluded.title,
city = excluded.city,
bank_name = excluded.bank_name,
score = excluded.score,
status = excluded.status,
username = excluded.username,
create_dt = excluded.create_dt,
comments = excluded.comments,
content = excluded.content,
bank_answer = excluded.bank_answer,
bank_answer_date = excluded.bank_answer_date,
admin_answer = excluded.admin_answer,
admin_answer_date = excluded.admin_answer_date,
parse_dt = excluded.parse_dt
where
t.status <> excluded.status
or (t.score <> excluded.score or t.comments <> excluded.comments)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment