-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix ambiguous column name that would prevent use of MSC2716 History Import when using Postgres as a database. #12843
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix ambiguous column name that would prevent use of MSC2716 History Import when using Postgres as a database. | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1057,7 +1057,7 @@ def _get_connected_batch_event_backfill_results_txn( | |
INNER JOIN batch_events AS c | ||
ON i.next_batch_id = c.batch_id | ||
/* Get the depth of the batch start event from the events table */ | ||
INNER JOIN events AS e USING (event_id) | ||
INNER JOIN events AS e ON c.event_id = e.event_id | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We want to return connected batch events and the info about the batch event ( Thanks for fixing this up! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we configure SQLite to yell about ambiguous columns as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't found a way. I've opened a thread on their forum about this (since I didn't find anyone mentioning this behaviour anywhere, so I may as well be the one to do so). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Cross link please? 🙏 ) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's intentional behaviour and there are test cases ensuring it picks the first one: https://www.sqlite.org/forum/forumpost/941664fc450a4f56 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For reference, backfilling from the insertion or batch event will work. But we already have the insertion event so there isn't a need to backfill it again. And the mistake here would only make it hint to backfill from the batch event earlier anyway. They are both in the historical chain (diagram) |
||
/* Find an insertion event which matches the given event_id */ | ||
WHERE i.event_id = ? | ||
LIMIT ? | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rephrase this as what the end user would see, rather than what is happening internally? I.e. something like "Fix bug where servers using SQLite3 would fail to backfill in MSC2716 rooms" or something.
The changelog is aimed at server admins rather than developers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the problem is that I have never used this feature and don't really understand how this would look to a server admin :-).
Would that be more suitable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, potentially? @MadLittleMods may have a better idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't fail to import for me with my local Postgres Synapse setup.
Looking at this spot of code, I am guessing it will fail to backfill from another server when it sees an insertion event if you have
experimental_features.msc2716_enabled
enabled.This seems more accurate:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, my message was purely going off the name of the test. What you've written makes sense.