[MXS-1043] Reading last insert id from @@identity variable does not work with maxscale Created: 2016-12-01  Updated: 2016-12-02  Resolved: 2016-12-02

Status: Closed
Project: MariaDB MaxScale
Component/s: QueryClassifier
Affects Version/s: 2.0.2
Fix Version/s: 2.0.3, 2.1.0

Type: Bug Priority: Major
Reporter: Stanislav Petr Assignee: Johan Wikman
Resolution: Fixed Votes: 0
Labels: None
Environment:

CentOS 7 64bit



 Description   

When i try to read last insert id from @@identity maxscale always returns 0. (when i try to combine @@identity with last_insert_id in the same query, then @@identity works as expected).

For example:

MySQL [ANI3]> insert into test set data='xxx'; select last_insert_id(), @@identity; select @@identity; select last_insert_id();
Query OK, 1 row affected (0.01 sec)
 
+------------------+------------+
| last_insert_id() | @@identity |
+------------------+------------+
|               79 |         79 |
+------------------+------------+
1 row in set (0.00 sec)
 
+------------+
| @@identity |
+------------+
|          0 |
+------------+
1 row in set (0.00 sec)
 
+------------------+
| last_insert_id() |
+------------------+
|               79 |
+------------------+
1 row in set (0.00 sec)



 Comments   
Comment by Johan Wikman [ 2016-12-02 ]

Neither qc_mysqlembedded nor qc_sqlite recognized @@last_insert_id as the equivalent of last_insert_id(), or @@identity as a synonym of @@last_insert_id.

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