-
-
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 all 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 bug where servers using a Postgres database would fail to backfill from an insertion event when MSC2716 is enabled (`experimental_features.msc2716_enabled`). |
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. 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.
c.event_id
(wherebatch_events AS c
) makes sense 👍We want to return connected batch events and the info about the batch event (
depth
,stream_ordering
).Thanks for fixing this up!