From 0c576af6df5af2f1b8df9841fbb566fa52a4e382 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Thu, 18 Apr 2024 14:18:08 +0200 Subject: [PATCH] core: Fix incompatibility introduced by SQLite 3.45.3 For the umpteenth time, SQLite introduced behavioral changes that we need to adapt to. This time, version 3.45.3 "fixed" at https://github.com/sqlite/sqlite/commit/74851f66811854c772a9b2d0a13f1e9e82b69c25 their SQLITE_ALLOW_ROWID_IN_VIEW build-time option which controls the behavior of views having an implicit ROWID column vs not. This broke our view used to proxy data to the content-less FTS5 table, since the SELECT query it translates to used a naked reference to ROWID that is now deemed "ambiguous" by SQLite engine, this results in the following errors: Tracker:ERROR:../tests/core/tracker-ontology-test.c:231:test_query: assertion failed (error == NULL): ambiguous column name: ROWID (tracker-db-interface-error-quark, 0) We are actually referencing data inside the SELECT query, so fix this ambiguity by stating clearly the table/column that we are referring to within the SELECT query clause. This is backwards compatible with older versions of SQLite. Closes: https://gitlab.gnome.org/GNOME/tracker/-/issues/435 --- src/libtracker-sparql/core/tracker-fts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libtracker-sparql/core/tracker-fts.c b/src/libtracker-sparql/core/tracker-fts.c index 1171dc11a8..99600820bd 100644 --- a/src/libtracker-sparql/core/tracker-fts.c +++ b/src/libtracker-sparql/core/tracker-fts.c @@ -112,7 +112,7 @@ tracker_fts_create_table (sqlite3 *db, g_string_append_printf (from, "WHERE COALESCE (%s NULL) IS NOT NULL ", column_names->str); - g_string_append (from, "GROUP BY ROWID"); + g_string_append (from, "GROUP BY \"rdfs:Resource\".ID"); g_string_append (str, from->str); g_string_free (from, TRUE); -- GitLab