INSERT INTO record (did, collection, rkey, rev, cid, live, data)
 VALUES ($1, $2, $3, $4, $5, $6, $7)
 ON CONFLICT
  ON CONSTRAINT record_pkey
  DO UPDATE
    SET (rev, cid, live, data) = (EXCLUDED.rev, EXCLUDED.cid, EXCLUDED.live, EXCLUDED.data)
    WHERE EXCLUDED.rev > record.rev
