-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
there is no unique constraint matching given keys for referenced table "access_tokens" #10691
Comments
This is odd; it doesn't seem like it should be necessary to do that: the Is there possibly anything else to the database you've done that could have caused this issue? |
I don't really know the full history, but it seems that there was a migration to postges some versions ago (pre 1.0). v 1.0 was working and had no unique index, and migration to 1.41 has shown this bug. |
Please can you log in to Postgres using |
v1.41 (with create unique index if not exists access_tokens_id on access_tokens (id);)
v1.0 |
Since this fails on startup, and we've not seen other reports of it, we suspect you've somehow found yourself in a very uncommon situation. @richvdh has promised to take a brief look at this, but unless that turns up an obvious problem, we'll probably chalk this up to unexplained weirdness. |
the problem here is that the v1.0.0 schema is missing an index. It should be:
It's extremely unclear to me how your database could possibly be missing that index - it should have been present ever since the very early days of synapse (
synapse_port_db wouldn't explain it.
I can only conclude that at some point in the distant past, there has been some misguided database administration which has caused some indexes to go missing. I recommend comparing your database schema with that of a newly-installed synapse, but beyond that, I don't think there's much we can do to help here. |
Before creating
CREATE TABLE IF NOT EXISTS event_txn_id
create unique index if not exists access_tokens_id on access_tokens (id);
shall be made in order to progress properly.
Description
Aug 25 07:57:17 Matrix matrix-synapse[190116]: Error during initialisation:
Aug 25 07:57:17 Matrix matrix-synapse[190116]: there is no unique constraint matching given keys for referenced table "access_tokens"
Steps to reproduce
Version information
Synapse: 1.40,
on Debian 11,
using matrix repo.
This is a migration from 1.0 version
The text was updated successfully, but these errors were encountered: