Error with MariaDB 10.1.41 (Debian 9.10): list of wikis not shown

I just updated my Debian server on which XWiki is running to 9.10, and afterwards the list of wikis in the Wiki Index is empty. Instead an error message is shown in the log like:

2019-09-07 22:31:21,375 [] WARN  o.h.u.JDBCExceptionReporter    - SQL Error: 1054, SQLState: 42S22 
2019-09-07 22:31:21,375 [] ERROR o.h.u.JDBCExceptionReporter    - Unknown column 'dbstringli2_.XWL_ID' in 'where clause' 

This worked before with MariaDB 10.1.38. The XWiki version is 10.11.9, but I guess the problem does not depend on the XWiki version.

I will investigate further and let you know if I find out more, but for now I can only advise against updating your Debian servers to 9.10 (likely 10.1 has the same issue, but I have not tried this).

After some debugging I am quite sure it is a bug in the version of MariaDB.

A workaround to prevent this error is to paste the following code into the velocity macro the page WikiManager.WikisLiveTableResultsMacros:

#macro(gridresultwithfilter_buildJSON $className $collist $filterfrom $filterwhere $filterParams $map)
  #gridresultwithfilter_buildQuery($className $collist $filterfrom $filterwhere $filterParams)
  #set($discard = $map.put('reqNo', $mathtool.toInteger($request.reqNo)))

This helps because it overwrites a macro from the livetable that also tries to fetch tags for the results (I did not check why), and the error comes out of the tag plugin:

Caused by: com.xpn.xwiki.XWikiException: Error number 0 in 3: Failed to get tag count for query [select elements(prop.list) from XWikiDocument as doc, BaseObject as tagobject, DBStringListProperty as prop, BaseObject as obj , LargeStringProperty prop_dtable  where and tagobject.className='XWiki.TagClass' and and'tags' and doc.translation=0 and and obj.className = ? and doc.fullName <> ?  and and = ?  and IN ('XWikiServerXwiki','XWikiServerTestwiki','XWikiServerMargarettingtye')], with parameters [[XWiki.XWikiServerClass, XWiki.XWikiServerClassTemplate, description]]
at com.xpn.xwiki.plugin.tag.TagQueryUtils.getTagCountForQuery(
at com.xpn.xwiki.plugin.tag.TagPlugin.getTagCountForQuery(
at com.xpn.xwiki.plugin.tag.TagPluginApi.getTagCountForQuery(
at sun.reflect.GeneratedMethodAccessor625.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(
... 206 more

Of course this is not a fix, and the problem should reappear in other livetables. (The document index seems to work just fine, however.)

One can reproduce the issue with a minimal SQL for the XWiki DB like:

SELECT xwikilistitems.XWL_NAME
  cross join xwikiobjects
  cross join xwikilargestrings

which makes no sense whatever but also shows the error message Unknown column 'xwikilists.XWL_ID' in 'where clause'

Another reason why I think it is a MariaDB bug is that the following query:

SELECT  FROM  a, b cross join c cross join d;

with some dummy tables containing just an id column also triggers an error with mariaDB 10.1.41, but not with 10.1.38

Edit: I send a bug report to the MariaDB issue tracker and downgraded my MariaDB server with:

# apt-get  install mariadb-server-10.1=10.1.37-0+deb9u1 mariadb-server-core-10.1=10.1.37-0+deb9u1
# apt-mark hold mariadb-server-10.1 mariadb-server-core-10.1 mariadb-server

I guess I will keep it that way instead of trying to work around the problem on the XWiki side, and I hope the issue will be fixed soon.

Edit 2: the MariaDB developers responded that my bug report was a duplicate and that the issue has been fixed in 10.1.42 (and all other affected versions). For the Debian distribution we probably have to wait until the next security update (at least for Debian9 aka stretch).

Another possibility: looks like they provide various custom repositories which are probably more up to date than the standard Debian ones. See