I've prepared a test dataset (please find the dump at the end of the message). Check this out:
SELECT
`field1` AS 'Nombre',
`field2`
FROM table1
INNER JOIN table2
ON table1.id=table2.id_tabla
INNER JOIN table3
ON table2.table3_actual=table3.id
WHERE table2.workflow=1
If I run it several times I get a Range check error one out of two times. Also, Windows Task Manager shows that HeidiSQL allocates 100MB of RAM instantly. It gets fixed if I remove the AS 'Nombre' part or rename "Nombre" as "foo".
The query runs fine in other MySQL front ends. Other similar queries in this database have similar memory problems; sometimes HeidiSQL allocates 300MB instantly and it gets released when I perform another query.
Any clue? Should I report it as a bug?
# HeidiSQL Dump
#
# --------------------------------------------------------
# Host: XXXXXXXXXXXXXX
# Database: test
# Server version: 4.1.13
# Server OS: Win32
# Target-Compatibility: MySQL 3.23
# max_allowed_packet: 1047552
# HeidiSQL version: 3.2 Revision: 1129
# --------------------------------------------------------
/*!40100 SET CHARACTER SET latin1*/;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0*/;
DROP TABLE IF EXISTS `table1`;
#
# Table structure for table 'table1'
#
CREATE TABLE `table1` (
`id` int(10) unsigned NOT NULL auto_increment,
`field1` longtext,
`field2` longtext,
PRIMARY KEY (`id`)
) TYPE=MyISAM /*!40100 DEFAULT CHARSET=latin1*/;
#
# Dumping data for table 'table1'
#
# (No data found.)
DROP TABLE IF EXISTS `table2`;
#
# Table structure for table 'table2'
#
CREATE TABLE `table2` (
`id` int(10) unsigned NOT NULL auto_increment,
`table3_actual` int(10) unsigned NOT NULL default '0',
`workflow` int(10) unsigned NOT NULL default '0',
`id_tabla` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `instanciaworkflow_FKIndex1` (`workflow`),
KEY `instanciaworkflow_FKIndex3` (`table3_actual`)
) TYPE=MyISAM /*!40100 DEFAULT CHARSET=latin1*/;
#
# Dumping data for table 'table2'
#
# (No data found.)
DROP TABLE IF EXISTS `table3`;
#
# Table structure for table 'table3'
#
CREATE TABLE `table3` (
`id` int(10) unsigned NOT NULL auto_increment,
`workflow` int(10) unsigned NOT NULL default '0',
`nombre` varchar(255) default NULL,
PRIMARY KEY (`id`),
KEY `table3_FKIndex1` (`workflow`)
) TYPE=MyISAM /*!40100 DEFAULT CHARSET=latin1*/;
#
# Dumping data for table 'table3'
#
LOCK TABLES `table3` WRITE;
/*!40000 ALTER TABLE `table3` DISABLE KEYS*/;
INSERT INTO `table3` (`id`, `workflow`, `nombre`) VALUES
('1','1','inicial');
/*!40000 ALTER TABLE `table3` ENABLE KEYS*/;
UNLOCK TABLES;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS*/;
[/b][/code][i:10abea607a][/i:10abea607a]