[MXS-2898] warning: The query can't be routed to all backend servers because it includes SELECT and SQL variable modifications which is not supported. Created: 2020-02-25  Updated: 2020-03-13  Resolved: 2020-03-04

Status: Closed
Project: MariaDB MaxScale
Component/s: qc_sqlite
Affects Version/s: 2.4.4
Fix Version/s: 2.4.8

Type: Bug Priority: Major
Reporter: Claudio Nanni Assignee: Johan Wikman
Resolution: Fixed Votes: 0
Labels: None

Sprint: MXS-SPRINT-101

 Description   

SET @my_id = (SELECT LAST_INSERT_ID())

Generates the warning in the subject.

> 2020-02-24 15:04:00 warning: (162) The query can't be routed to all backend servers because it includes SELECT and SQL variable modifications which is not supported. Set use_sql_variables_in=master or split the query to two, where SQL variable modifications are done in the first and the SELECT in the second one.

Looks like the SELECT queryi is not properly classified.



 Comments   
Comment by Johan Wikman [ 2020-03-03 ]

The problem is caused by SET @my_id = (SELECT LAST_INSERT_ID()) being classified as

QUERY_TYPE_READ|QUERY_TYPE_MASTER_READ|QUERY_TYPE_SESSION_WRITE|QUERY_TYPE_USERVAR_WRITE

and not as

QUERY_TYPE_MASTER_READ|QUERY_TYPE_SESSION_WRITE|QUERY_TYPE_USERVAR_WRITE

as SET @my_id = (SELECT @@LAST_INSERT_ID) is.

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