Uploaded image for project: 'MariaDB MaxScale'
  1. MariaDB MaxScale
  2. MXS-1043

Reading last insert id from @@identity variable does not work with maxscale

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.0.3, 2.1.0
    • Component/s: QueryClassifier
    • 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)
      

        Attachments

          Activity

            People

            • Assignee:
              johan.wikman Johan Wikman
              Reporter:
              glux Stanislav Petr
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: