[MXS-1730] Column alias named "engine" without backticks returns an error Created: 2018-03-21  Updated: 2018-03-21  Resolved: 2018-03-21

Status: Closed
Project: MariaDB MaxScale
Component/s: qc_sqlite
Affects Version/s: 2.2.3
Fix Version/s: 2.1.16, 2.2.4

Type: Bug Priority: Major
Reporter: Alexandr Hacicheant Assignee: Johan Wikman
Resolution: Fixed Votes: 0
Labels: None


 Description   

Described query with using alias named engine without using backticks (``) does not work:

select id as engine from users WHERE id = 1;

But this one works:

select id as `engine` from users WHERE id = 1;

Both of this queries successful work in MariaDB 10.2

Add. information:
Query:

mysql> select id as engine from users WHERE id = 1;
ERROR 1141 (HY000): Access denied for user 'docker'@'172.18.0.1': Query could not be parsed completely and will hence be rejected. Please ensure that the SQL syntax is correct.

MaxScale logs:

warning: (3) [dbfwfilter] Query could not be parsed completely and will hence be rejected. Please ensure that the SQL syntax is correct: select id as engine from users WHERE id = 1                        



 Comments   
Comment by markus makela [ 2018-03-21 ]

Can you give the error that MaxScale returns?

Just tested this with 2.2.3 and a docker-compose setup of four 10.2 servers and it works.

Comment by markus makela [ 2018-03-21 ]

OK, so it's about the dbfwfilter. I've added the affected component to it. If possible, please add the firewall rules you used.

Comment by Alexandr Hacicheant [ 2018-03-21 ]

Sure, I've updated the issue.
But, I see that there is an error in dbfwfilter module.
DbFwFilter config is:

[Firewall-Blacklist]
type=filter
module=dbfwfilter
action=block
rules=/etc/maxscale.d/blacklist-rules.txt

Rules file contains:

users %@% match any rules EMAIL_RULE
rule EMAIL_RULE deny columns name email

Comment by Johan Wikman [ 2018-03-21 ]

The problem was in the query classifier. The word ENGINE was treated as a registered keyword and not just as a keyword.

Generated at Thu Feb 08 04:08:59 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.