From 59cd0529a2beaf1aebfe380105baf372949ee3c8 Mon Sep 17 00:00:00 2001 From: Anant Prakash Date: Sat, 26 May 2018 16:22:54 +0530 Subject: [PATCH] Raise error on insert conflict in roomserver_transactions --- .../dendrite/roomserver/storage/transactions_table.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/roomserver/storage/transactions_table.go b/src/github.com/matrix-org/dendrite/roomserver/storage/transactions_table.go index 9faaae654..e9c904cc8 100644 --- a/src/github.com/matrix-org/dendrite/roomserver/storage/transactions_table.go +++ b/src/github.com/matrix-org/dendrite/roomserver/storage/transactions_table.go @@ -32,14 +32,12 @@ CREATE TABLE IF NOT EXISTS roomserver_transactions ( event_id TEXT NOT NULL, -- A transaction ID is unique for a user and device -- This automatically creates an index. - CONSTRAINT roomserver_transaction_unique PRIMARY KEY (transaction_id, device_id, user_id) + PRIMARY KEY (transaction_id, device_id, user_id) ); ` const insertTransactionSQL = "" + "INSERT INTO roomserver_transactions (transaction_id, device_id, user_id, event_id)" + - " VALUES ($1, $2, $3, $4)" + - " ON CONFLICT ON CONSTRAINT roomserver_transaction_unique" + - " DO NOTHING" + " VALUES ($1, $2, $3, $4)" const selectTransactionEventIDSQL = "" + "SELECT event_id FROM roomserver_transactions" +