GNOME Bugzilla – Bug 764860
check_vcnc test fails when building against sqlite 3.11
Last modified: 2018-09-21 13:51:11 UTC
Created attachment 325680 [details] Test failure logged in tests/data-models/ When building against sqlite 3.11, the check_vcnc test fails with: ERROR:gda-vprovider-data-model.c:1316:map_sqlite3_info_to_gda_filter: code should not be reached FAIL check_vcnc (exit status: 134) Based on a core dump, this corresponds to a g_assert_not_reached call made from map_sqlite3_info_to_gda_filter. In switch(info->aConstraint[i].op), op corresponds to SQLITE_INDEX_CONSTRAINT_LIKE and this is not implemented. Implementing it fixes the problem and I'll attach a patch. I'd like some advice though. Based on this analysis, is it acceptable to not implement the other two SQLITE_INDEX_CONSTRAINT_REGEXP and SQLITE_INDEX_CONSTRAINT_GLOB constraints? Or does this mean that some set of queries will fail? It looks like we'll be releasing Ubuntu 16.04 in a couple of weeks with this patch since we fail to build against sqlite 3.11 to which we've already updated, so I'd appreciate your advice on whether this is acceptable. Thanks! From 0822e61b4e56131aa9ee08bf0239ec6d2efa92b1 Mon Sep 17 00:00:00 2001 From: Robie Basak <robie.basak@canonical.com> Date: Sun, 10 Apr 2016 19:03:00 +0000 Subject: [PATCH 1/1] Accept SQLITE_INDEX_CONSTRAINT_LIKE from sqlite sqlite 3.10.0 added the SQLITE_INDEX_CONSTRAINT_LIKE, SQLITE_INDEX_CONSTRAINT_GLOB and SQLITE_INDEX_CONSTRAINT_REGEXP constraint operators to the list that xBestIndex can be supplied. See https://www.sqlite.org/vtab.html for details. Compiling against sqlite 3.11 (the current version in Ubuntu Xenial and Debian stretch) causes a build failure because sqlite supplies SQLITE_INDEX_CONSTRAINT_LIKE and libgda's implementation of xBestIndex cannot understand it: ERROR:gda-vprovider-data-model.c:1316:map_sqlite3_info_to_gda_filter: code should not be reached FAIL check_vcnc (exit status: 134) Since libgda already defines (and thus presumably implements) GDA_SQL_OPERATOR_TYPE_LIKE, update the sqlite virtual provider to use it. With this change, libgda5 5.2.4 builds and passes tests again when built against sqlite 3.11. However it may be necessary to implement SQLITE_INDEX_CONSTRAINT_GLOB and SQLITE_INDEX_CONSTRAINT_REGEXP also to cover all possible queries. Though not necessary for Debian or Ubuntu, it may be necessary to make this change conditional on >= 3.10 if it is required that builds against older sqlite versions are still possible. --- libgda/sqlite/virtual/gda-vprovider-data-model.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libgda/sqlite/virtual/gda-vprovider-data-model.c b/libgda/sqlite/virtual/gda-vprovider-data-model.c index 0393eaf..d966ab1 100644 --- a/libgda/sqlite/virtual/gda-vprovider-data-model.c +++ b/libgda/sqlite/virtual/gda-vprovider-data-model.c @@ -1355,6 +1355,9 @@ map_sqlite3_info_to_gda_filter (sqlite3_index_info *info, GdaVconnectionDataMode case SQLITE_INDEX_CONSTRAINT_MATCH: filter->aConstraint[j].op = GDA_SQL_OPERATOR_TYPE_REGEXP; break; + case SQLITE_INDEX_CONSTRAINT_LIKE: + filter->aConstraint[j].op = GDA_SQL_OPERATOR_TYPE_LIKE; + break; default: g_assert_not_reached (); } -- 2.5.0
Created attachment 325681 [details] [review] Proposed patch
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/libgda/issues/88.