Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Won't Do
-
1.2.2
-
None
Description
I ran into the error 1815, 'Internal error: Query cannot be processed using operational mode 1 (vtable mode) when executing this query:
INSERT INTO `rate_curve` (`id`, `type_id`, `currency_id`, `market_date`, `rate_date`, `rate`, `batch_id`) SELECT DISTINCT @i:=@i+1, 1, 1, `date`, `expiry`, ROUND(`risk_free_rate`,6), 247 FROM `tradealert`.`rates` WHERE `date` BETWEEN "2018-01-02" and "2018-03-29" ORDER BY `date`, `expiry`;
I later figured out what is triggering the error. It is this construct: @i:=@i+1 in the SELECT clause. When I replaced it by constant it ran and did not give me any error. Using variables is pretty standard ANSI SQL stuff and I expected this workaround for autoincrement will completely work. The workaround is necessary because of the reason that has something to do with autoincrement numbers "consumption" from the sequence when adding records into the table using mcsimport utility having autoincrement column value set to 0. We ran into the case where just few millions of record blew through the entire INT(11) supply of integer numbers. Because of that we decided to take care of "autoincrementing" the surrogate key for tables ourselves and we used the mechanism outlined in the query above.