db: replace UPDATE FROM syntax for SQLite compat#8246
Merged
rustyrussell merged 1 commit intoApr 23, 2025
Conversation
b68afd0 to
57e267d
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR rewrites an UPDATE query in wallet/db.c to replace the unsupported UPDATE FROM syntax with a subquery using the IN clause for better SQLite compatibility.
- Changed the UPDATE query in migrate_convert_old_channel_keyidx() to remove the JOIN and use a subquery
- Adjusted conditions to try maintaining identical filtering logic
Introduced the use of UPDATE FROM syntax in SQLite queries, which is not supported in versions prior to 3.33.0. This causes issues on systems with older SQLite versions, as reported in issue ElementsProject#8231. Rewrite the query in migrate_convert_old_channel_keyidx() to use a subquery with IN clause instead of UPDATE FROM, ensuring compatibility with older SQLite versions. Changelog-Fixed: db: replace UPDATE FROM syntax for SQLite compat Fixes 68f3649 Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
067a9e4 to
e6c203b
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR replaces an unsupported SQLite UPDATE FROM syntax with a subquery using the IN clause to ensure compatibility with older SQLite versions.
- Removed the UPDATE FROM clause.
- Introduced a subquery using the IN clause to select the appropriate key indexes.
Comments suppressed due to low confidence (1)
wallet/db.c:2046
- [nitpick] Consider qualifying 'keyidx' with the table name (e.g., addresses.keyidx) to improve clarity and avoid any ambiguity.
" WHERE keyidx IN (SELECT shutdown_keyidx_local FROM channels"
rustyrussell
approved these changes
Apr 23, 2025
Contributor
rustyrussell
left a comment
There was a problem hiding this comment.
Ack e6c203b
Thankyou!!!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduced the use of UPDATE FROM syntax in SQLite queries, which is not supported in versions prior to 3.33.0.
This causes issues on systems with older SQLite versions,
as reported in issue #8231. Rewrite the query in
migrate_convert_old_channel_keyidx() to use a subquery
with IN clause instead of UPDATE FROM, ensuring compatibility with
older SQLite versions.
Fixes 68f3649d6b9fc65ece3f1dc3e2f7e6a053170ea5
Signed-off-by: Vincenzo Palazzo vincenzopalazzodev@gmail.com
Important
25.05 FREEZE MAY 12TH: Non-bugfix PRs not ready by this date will wait for 25.08.
RC1 is scheduled on May 23rd, RC2 on May 26th, ...
The final release is on MAY 29TH.
Checklist
Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked: