Skip to content

Commit 7198fec

Browse files
vincenzopalazzoCopilot
authored andcommitted
db: replace UPDATE FROM syntax for SQLite compat
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. Changelog-Fixed: db: replace UPDATE FROM syntax for SQLite compat Fixes 68f3649 Co-authored-by: Copilot <[email protected]> Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent 675ac14 commit 7198fec

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

wallet/db.c

+4-5
Original file line numberDiff line numberDiff line change
@@ -2043,11 +2043,10 @@ static void migrate_convert_old_channel_keyidx(struct lightningd *ld,
20432043

20442044
stmt = db_prepare_v2(db, SQL("UPDATE addresses"
20452045
" SET addrtype = ?"
2046-
" FROM channels "
2047-
" WHERE addresses.keyidx = channels.shutdown_keyidx_local"
2048-
" AND channels.state != ?"
2049-
" AND channels.state != ?"
2050-
" AND channels.state != ?"));
2046+
" WHERE keyidx IN (SELECT shutdown_keyidx_local FROM channels"
2047+
" WHERE state != ?"
2048+
" AND state != ?"
2049+
" AND state != ?)"));
20512050
db_bind_int(stmt, wallet_addrtype_in_db(ADDR_ALL));
20522051
/* If we might have already seen onchain funds, we need to rescan */
20532052
db_bind_int(stmt, channel_state_in_db(FUNDING_SPEND_SEEN));

0 commit comments

Comments
 (0)