I've seen some CI run fail recently with
called
Result::unwrap()
on anErr
value: DatabaseError(__Unknown, "deadlock detected")'
For example those:
upsert_with_sql_literal_for_target
upsert_with_no_changes_executes_do_nothing
Two may not be a big enough sampling size, but it seems related to upserts.
Going to make a lot of coffee and try to solve this tonight
Ok, after 2 hours battling with my windows VM to install launch link postgresql...
INSERT INTO users (id, name) VALUES(1, 'Sean'), (2, 'Tess')
CREATE UNIQUE INDEX ON users (name) WHERE name != 'Tess'
Those are the two queries creating the deadlock
The easy fix is to run tests with RUST_TEST_THREADS=1
This has been fixed by https://github.com/diesel-rs/diesel/commit/523ffb39f88fb026e69fa51f848ee2de12f16dc4
Most helpful comment
Going to make a lot of coffee and try to solve this tonight