From 8a6491e2d606023291054790f6a5e1f608ff646e Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Wed, 22 Feb 2017 15:41:51 +0000 Subject: [PATCH] More comments --- .../dendrite/roomserver/storage/event_types_table.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/github.com/matrix-org/dendrite/roomserver/storage/event_types_table.go b/src/github.com/matrix-org/dendrite/roomserver/storage/event_types_table.go index 1479418a3..4a50d10d6 100644 --- a/src/github.com/matrix-org/dendrite/roomserver/storage/event_types_table.go +++ b/src/github.com/matrix-org/dendrite/roomserver/storage/event_types_table.go @@ -53,6 +53,9 @@ INSERT INTO event_types (event_type_nid, event_type) VALUES // This will result in a conflict on the event_type_unique constraint, in this // case we do nothing. Postgresql won't return a row in that case so we rely on // the caller catching the sql.ErrNoRows error and running a select to get the row. +// We could get postgresql to return the row on a conflict by updating the row +// but it doesn't seem like a good idea to modify the rows just to make postgres +// return it. const insertEventTypeNIDSQL = "" + "INSERT INTO event_types (event_type) VALUES ($1)" + " ON CONFLICT ON CONSTRAINT event_type_unique" +