Add ON CONFLICT to derive_transaction_forks

Fixes #1262
pull/1271/head
Luke Imhoff 6 years ago
parent 786f89164b
commit 1579db1aec
  1. 3
      apps/explorer/lib/explorer/chain/import/runner/blocks.ex

@ -133,6 +133,9 @@ defmodule Explorer.Chain.Import.Runner.Blocks do
insert_sql = """ insert_sql = """
INSERT INTO transaction_forks (uncle_hash, index, hash, inserted_at, updated_at) INSERT INTO transaction_forks (uncle_hash, index, hash, inserted_at, updated_at)
#{select_sql} #{select_sql}
ON CONFLICT (uncle_hash, index)
DO UPDATE SET hash = EXCLUDED.hash
WHERE EXCLUDED.hash <> transaction_forks.hash
RETURNING uncle_hash, hash RETURNING uncle_hash, hash
""" """

Loading…
Cancel
Save