From ba9b4a3bf60c8cdf3829c9eeb904018db91909d1 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Wed, 27 Dec 2017 10:54:12 +0200 Subject: [PATCH] MXS-1527 Do not consider sysvars to be updated in SELECT A statement like select if(@@hostname='box02','prod_mariadb02','n'); does not modify @@hostname. Hence the type mask should be QUERY_TYPE_READ|QUERY_TYPE_SYSVAR_READ and NOT QUERY_TYPE_READ|QUERY_TYPE_GSYSVAR_WRITE. --- query_classifier/qc_sqlite/qc_sqlite.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/query_classifier/qc_sqlite/qc_sqlite.c b/query_classifier/qc_sqlite/qc_sqlite.c index 438fb1489..7ee6de302 100644 --- a/query_classifier/qc_sqlite/qc_sqlite.c +++ b/query_classifier/qc_sqlite/qc_sqlite.c @@ -1023,7 +1023,10 @@ static void update_field_infos(QC_SQLITE_INFO* info, { if (zToken[1] == '@') { - if ((prev_token == TK_EQ) && (pos == QC_TOKEN_LEFT)) + // TODO: This should actually be "... && (info->operation == QUERY_OP_SET)" + // TODO: but there is no QUERY_OP_SET at the moment. + if ((prev_token == TK_EQ) && (pos == QC_TOKEN_LEFT) && + (info->operation != QUERY_OP_SELECT)) { info->type_mask |= QUERY_TYPE_GSYSVAR_WRITE; }