'Proxysql query rule starting with comment didn't work

On proxyql 2.2.0

I've the following rule which isn't working (stats_mysql_query_rules counter always on 0). INSERT INTO mysql_query_rules (active, match_digest, destination_hostgroup, apply, multiplex) VALUES (1, '/\* Master \*/', 1, 1, 1);

This rule is in number position on my mysql_query_rules table.

The idea is to catch query like this one and push them to my Master node (AWS RDS Aurora writer endpoint).

/* Master */
select * from my_table;

Regex seems OK but the rule didn't (and query is counted on other rules).



Solution 1:[1]

The documentation isn't explicit about it but it seems that query rules match_digest evaluation is stripping comments (e.g. /* Comments */) within SQL queries. So the pattern used above need to be insert inside the match_pattern field

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 alxsbn