From 4985bf9b6ebacca99c202bc6825b7eeeb7e87e72 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 27 Jul 2017 09:46:34 +0300 Subject: [PATCH] MXS-1328 Mark regexp functions as builtin functions Regexp functions were not listed among the builtin read-only functions and consequently any SELECT using one of those was routed to master. --- query_classifier/qc_sqlite/builtin_functions.c | 10 ++++++++++ query_classifier/test/maxscale.test | 2 ++ 2 files changed, 12 insertions(+) diff --git a/query_classifier/qc_sqlite/builtin_functions.c b/query_classifier/qc_sqlite/builtin_functions.c index 37fde1477..4fe8b950f 100644 --- a/query_classifier/qc_sqlite/builtin_functions.c +++ b/query_classifier/qc_sqlite/builtin_functions.c @@ -360,6 +360,16 @@ static const char* BUILTIN_FUNCTIONS[] = "to_base64", "weight_string", + /* + * Regex functions + * https://mariadb.com/kb/en/mariadb/regular-expressions-functions/ + */ + "regexp", + "regexp_instr", + "regexp_replace", + "regexp_substr", + "rlike", + /* * http://dev.mysql.com/doc/refman/5.7/en/row-subqueries.html */ diff --git a/query_classifier/test/maxscale.test b/query_classifier/test/maxscale.test index 95a3c130e..52a10478c 100644 --- a/query_classifier/test/maxscale.test +++ b/query_classifier/test/maxscale.test @@ -77,3 +77,5 @@ ROLLBACK TO SAVEPOINT id; ROLLBACK WORK TO id; ROLLBACK TO id; RELEASE SAVEPOINT id; + +SELECT her FROM (SELECT @@server_id as her) as t WHERE her REGEXP '.*';