Sql error in bookmarks app

While looking at nextcloud log I spotted this:

{"reqId":"YwPiOFxOBXYNm5ud00-VTwAAAAE","level":3,"time":"2022-08-22T20:08:24+00:00","remoteAddr":"192.168.1.35","user":"vitachaos","app":"index","method":"GET","url":"/nextcloud/index.php/apps/bookmarks/bookmark?limit=42&page=0&sortby=added","message":"An exception occurred while     executing a query: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RECURSIVE folder_tree(item_id, parent_folder, type, idx) AS ( SELECT cast(1 as U' at line 1","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36","version":"24.0.2.1","exception":{"Exception":"OC\\DB\\Exceptions\\DbalException","Message":"An exception occurred while executing a qu    ery: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RECURSIVE folder_tree(item_id, parent_folder, type, idx) AS ( SELECT cast(1 as U    ' at line 1","Code":1064,"Trace":[{"file":"/var/www/html/nextcloud/lib/private/DB/ConnectionAdapter.php","line":69,"function":"wrap","class":"OC\\DB\\Exceptions\\DbalException","type":"::"},
{"file":"/var/www/html/nextcloud/apps/bookmarks/lib/Db/BookmarkMapper.php","line":246,"f    unction":"executeQuery","class":"OC\\DB\\ConnectionAdapter","type":"->"},
{"file":"/var/www/html/nextcloud/apps/bookmarks/lib/Db/BookmarkMapper.php","line":239,"function":"findEntitiesWithRawQuery","class":"OCA\\Bookmarks\\Db\\BookmarkMapper","type":"->"},
{"file":"/var/www/html/    nextcloud/apps/bookmarks/lib/Controller/BookmarkController.php","line":379,"function":"findAll","class":"OCA\\Bookmarks\\Db\\BookmarkMapper","type":"->"},
{"file":"/var/www/html/nextcloud/apps/bookmarks/lib/Controller/InternalBookmarkController.php","line":80,"function":"getBook    marks","class":"OCA\\Bookmarks\\Controller\\BookmarkController","type":"->"},
{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"getBookmarks","class":"OCA\\Bookmarks\\Controller\\InternalBookmarkController","type":"->"},
{"file"    :"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class    ":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/html/nextcloud/lib/base.php","line":1023,"function":"match","class":"OC    \\Route\\Router","type":"->"},
{"file":"/var/www/html/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/nextcloud/lib/private/DB/Exceptions/DbalException.php","Line":71,"Previous":{"Exception":"Doctrine\\DBAL\\Exception\\SyntaxErrorException","Message":"An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RECURS    IVE folder_tree(item_id, parent_folder, type, idx) AS ( SELECT cast(1 as U' at line 1","Code":1064,"Trace":[{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1780,"function":"convert","class":"Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter","type":"->"},
{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1719,"function":"handleDriverException","class":"Doctrine\\DBAL\\Connection","type":"->"},
{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1067,    "function":"convertExceptionDuringQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},
{"file":"/var/www/html/nextcloud/lib/private/DB/Connection.php","line":261,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},
{"file":"/var/www/html/nextcloud/lib    /private/DB/ConnectionAdapter.php","line":66,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},
{"file":"/var/www/html/nextcloud/apps/bookmarks/lib/Db/BookmarkMapper.php","line":246,"function":"executeQuery","class":"OC\\DB\\ConnectionAdapter","type":"->"},
{"fi    le":"/var/www/html/nextcloud/apps/bookmarks/lib/Db/BookmarkMapper.php","line":239,"function":"findEntitiesWithRawQuery","class":"OCA\\Bookmarks\\Db\\BookmarkMapper","type":"->"},{"file":"/var/www/html/nextcloud/apps/bookmarks/lib/Controller/BookmarkController.php","line":379,"function":"findAll","class":"OCA\\Bookmarks\\Db\\BookmarkMapper","type":"->"},{"file":"/var/www/html/nextcloud/apps/bookmarks/lib/Controller/InternalBookmarkController.php","line":80,"function":"getBookmarks","class":"OCA\\Bookmarks\\Controller\\BookmarkController","type":"->"},    {"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"getBookmarks","class":"OCA\\Bookmarks\\Controller\\InternalBookmarkController","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line    ":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},
{"file":"/var/www/html/nextcloud/lib/base.php","line":1023,"function":"match","class":"OC\\Route\\Router","type":"->"},
{"file":"/var/www/html/nextcloud/index.php","li    ne":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php","Line":84,"Previous":{"Exception":"Doctrine\\DBAL\\Driver\\PDO\\Exception","Message":"SQLSTATE[42000]: Syntax error o    r access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RECURSIVE folder_tree(item_id, parent_folder, type, idx) AS ( SELECT cast(1 as U' at line 1","Code":1064,"Trace":[{"    file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","line":94,"function":"new","class":"Doctrine\\DBAL\\Driver\\PDO\\Exception","type":"::"},
{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1057,"function":"execu    te","class":"Doctrine\\DBAL\\Driver\\PDO\\Statement","type":"->"},
{"file":"/var/www/html/nextcloud/lib/private/DB/Connection.php","line":261,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},
{"file":"/var/www/html/nextcloud/lib/private/DB/ConnectionAda    pter.php","line":66,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/html/nextcloud/apps/bookmarks/lib/Db/BookmarkMapper.php","line":246,"function":"executeQuery","class":"OC\\DB\\ConnectionAdapter","type":"->"},
{"file":"/var/www/html/nextcl    oud/apps/bookmarks/lib/Db/BookmarkMapper.php","line":239,"function":"findEntitiesWithRawQuery","class":"OCA\\Bookmarks\\Db\\BookmarkMapper","type":"->"},
{"file":"/var/www/html/nextcloud/apps/bookmarks/lib/Controller/BookmarkController.php","line":379,"function":"findAll","class    ":"OCA\\Bookmarks\\Db\\BookmarkMapper","type":"->"},
{"file":"/var/www/html/nextcloud/apps/bookmarks/lib/Controller/InternalBookmarkController.php","line":80,"function":"getBookmarks","class":"OCA\\Bookmarks\\Controller\\BookmarkController","type":"->"},
{"file":"/var/www/html/ne    xtcloud/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"getBookmarks","class":"OCA\\Bookmarks\\Controller\\InternalBookmarkController","type":"->"},
{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"execute    Controller","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},
{"file":"/var/www/html/nextcloud/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Route    /Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/html/nextcloud/lib/base.php","line":1023,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/html/nextcloud/index.php","line":36,"function":"handle    Request","class":"OC","type":"::"}],"File":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php","Line":26,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; che    ck the manual that corresponds to your MariaDB server version for the right syntax to use near 'RECURSIVE folder_tree(item_id, parent_folder, type, idx) AS ( SELECT cast(1 as U' at line 1","Code":"42000","Trace":[{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Drive    r/PDO/Statement.php","line":92,"function":"execute","class":"PDOStatement","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1057,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDO\\Statement","type":"->"},{"file":"/var/www/h    tml/nextcloud/lib/private/DB/Connection.php","line":261,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},
{"file":"/var/www/html/nextcloud/lib/private/DB/ConnectionAdapter.php","line":66,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->    "},
{"file":"/var/www/html/nextcloud/apps/bookmarks/lib/Db/BookmarkMapper.php","line":246,"function":"executeQuery","class":"OC\\DB\\ConnectionAdapter","type":"->"},
{"file":"/var/www/html/nextcloud/apps/bookmarks/lib/Db/BookmarkMapper.php","line":239,"function":"findEntitiesWith    RawQuery","class":"OCA\\Bookmarks\\Db\\BookmarkMapper","type":"->"},{"file":"/var/www/html/nextcloud/apps/bookmarks/lib/Controller/BookmarkController.php","line":379,"function":"findAll","class":"OCA\\Bookmarks\\Db\\BookmarkMapper","type":"->"},{"file":"/var/www/html/nextcloud/    apps/bookmarks/lib/Controller/InternalBookmarkController.php","line":80,"function":"getBookmarks","class":"OCA\\Bookmarks\\Controller\\BookmarkController","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"getBookm    arks","class":"OCA\\Bookmarks\\Controller\\InternalBookmarkController","type":"->"},
{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},
{"file":"/var/www/html/nextcloud/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"    },{"file":"/var/www/html/nextcloud/lib/base.php","line":1023,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/html/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/nextcloud/3rdparty/doctrine    /dbal/src/Driver/PDO/Statement.php","Line":92}}},"CustomMessage":"--"}}

I am using nextcloud version 24.0.2
Bookmarks app versin is 11.0.1

please help.

Hello!

What is your MySQL version?

Server version: 10.1.48-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04

I am still getting this error and need a fix please help.

It appears you need MariaDB 10.2.2