Bug #50666 statement with many and/or combinations causes a StackOverFlowException
Description:
The following query causes the problem:
SELECT ftable.id AS ftable_id, ftable.tid AS ftable_tid, ftable.fid AS ftable_fid, ftable.tablename AS ftable_tablename, ftable.ref AS ftable_ref
FROM ftable INNER JOIN ttable ON ttable.id = ftable.tid WHERE ttable.state = 'TEST' AND ftable.fid = 'TEST' AND (ftable.tablename = 'testa' AND ftable.ref = 981675 OR ftable.tablename = 'testa' AND ftable.ref = 981663 OR ftable.tablename = 'testa' AND ftable.ref = 981668 OR ftable.tablename = 'testa' AND ftable.ref = 981694 OR ftable.tablename = 'testa' AND ftable.ref = 981699 OR ftable.tablename = 'testa' AND ftable.ref = 981687 OR ftable.tablename = 'testa' AND ftable.ref = 981659 OR ftable.tablename = 'testa' AND ftable.ref = 981664 OR ftable.tablename = 'testa' AND ftable.ref = 981690 OR ftable.tablename = 'testa' AND ftable.ref = 981652 OR ftable.tablename = 'testa' AND ftable.ref = 981683 OR ftable.tablename = 'testa' AND ftable.ref = 981676 OR ftable.tablename = 'testa' AND ftable.ref = 981669 OR ftable.tablename = 'testa' AND ftable.ref = 981695 OR ftable.tablename = 'testa' AND ftable.ref = 981672 OR ftable.tablename = 'testa' AND ftable.ref = 981660 OR ftable.tablename = 'testa' AND ftable.ref = 981665 OR ftable.tablename = 'testa' AND ftable.ref = 981691 OR ftable.tablename = 'testa' AND ftable.ref = 981696 OR ftable.tablename = 'testa' AND ftable.ref = 981653 OR ftable.tablename = 'testa' AND ftable.ref = 981684 OR ftable.tablename = 'testa' AND ftable.ref = 981656 OR ftable.tablename = 'testa' AND ftable.ref = 981677 OR ftable.tablename = 'testa' AND ftable.ref = 981670 OR ftable.tablename = 'testa' AND ftable.ref = 981680 OR ftable.tablename = 'testa' AND ftable.ref = 981673 OR ftable.tablename = 'testa' AND ftable.ref = 981661 OR ftable.tablename = 'testa' AND ftable.ref = 981666 OR ftable.tablename = 'testa' AND ftable.ref = 981692 OR ftable.tablename = 'testa' AND ftable.ref = 981697 OR ftable.tablename = 'testa' AND ftable.ref = 981654 OR ftable.tablename = 'testa' AND ftable.ref = 981685 OR ftable.tablename = 'testa' AND ftable.ref = 981657 OR ftable.tablename = 'testa' AND ftable.ref = 981678 OR ftable.tablename = 'testa' AND ftable.ref = 981688 OR ftable.tablename = 'testa' AND ftable.ref = 981650 OR ftable.tablename = 'testa' AND ftable.ref = 981671 OR ftable.tablename = 'testa' AND ftable.ref = 981681 OR ftable.tablename = 'testa' AND ftable.ref = 981674 OR ftable.tablename = 'testa' AND ftable.ref = 981662 OR ftable.tablename = 'testa' AND ftable.ref = 981667 OR ftable.tablename = 'testa' AND ftable.ref = 981693 OR ftable.tablename = 'testa' AND ftable.ref = 981698 OR ftable.tablename = 'testa' AND ftable.ref = 981655 OR ftable.tablename = 'testa' AND ftable.ref = 981686 OR ftable.tablename = 'testa' AND ftable.ref = 981658 OR ftable.tablename = 'testa' AND ftable.ref = 981679 OR ftable.tablename = 'testa' AND ftable.ref = 981689 OR ftable.tablename = 'testa' AND ftable.ref = 981651 OR ftable.tablename = 'testa' AND ftable.ref = 981682) ORDER BY ttable.datetime DESC;
Here's the exception:
2010-01-26 11:51:21,267 ERROR [http-18080-2:com.mysql.infra.com.mysql.merlin.server.SnmpSmtpCriticalNotifier]
java.lang.StackOverflowError
at org.antlr.stringtemplate.StringTemplate.getAttributeRenderer(StringTemplate.java:1033)
at org.antlr.stringtemplate.StringTemplate.getAttributeRenderer(StringTemplate.java:1045)
at org.antlr.stringtemplate.StringTemplate.getAttributeRenderer(StringTemplate.java:1045)
...
How to repeat:
CREATE TABLE `ftable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tid` int(11) DEFAULT NULL,
`fid` varchar(32) NOT NULL,
`tablename` varchar(32) NOT NULL,
`ref` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY (`tid`),
KEY (`fid`)
) ENGINE=MyISAM;
CREATE TABLE `ttable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`fid` varchar(32) NOT NULL,
`state` varchar(32) DEFAULT NULL,
`datetime` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY (`fid`)
) ENGINE=MyISAM;
SELECT ftable.id AS ftable_id, ftable.tid AS ftable_tid, ftable.fid AS ftable_fid, ftable.tablename AS ftable_tablename, ftable.ref AS ftable_ref
FROM ftable INNER JOIN ttable ON ttable.id = ftable.tid WHERE ttable.state = 'TEST' AND ftable.fid = 'TEST' AND (ftable.tablename = 'testa' AND ftable.ref = 981675 OR ftable.tablename = 'testa' AND ftable.ref = 981663 OR ftable.tablename = 'testa' AND ftable.ref = 981668 OR ftable.tablename = 'testa' AND ftable.ref = 981694 OR ftable.tablename = 'testa' AND ftable.ref = 981699 OR ftable.tablename = 'testa' AND ftable.ref = 981687 OR ftable.tablename = 'testa' AND ftable.ref = 981659 OR ftable.tablename = 'testa' AND ftable.ref = 981664 OR ftable.tablename = 'testa' AND ftable.ref = 981690 OR ftable.tablename = 'testa' AND ftable.ref = 981652 OR ftable.tablename = 'testa' AND ftable.ref = 981683 OR ftable.tablename = 'testa' AND ftable.ref = 981676 OR ftable.tablename = 'testa' AND ftable.ref = 981669 OR ftable.tablename = 'testa' AND ftable.ref = 981695 OR ftable.tablename = 'testa' AND ftable.ref = 981672 OR ftable.tablename = 'testa' AND ftable.ref = 981660 OR ftable.tablename = 'testa' AND ftable.ref = 981665 OR ftable.tablename = 'testa' AND ftable.ref = 981691 OR ftable.tablename = 'testa' AND ftable.ref = 981696 OR ftable.tablename = 'testa' AND ftable.ref = 981653 OR ftable.tablename = 'testa' AND ftable.ref = 981684 OR ftable.tablename = 'testa' AND ftable.ref = 981656 OR ftable.tablename = 'testa' AND ftable.ref = 981677 OR ftable.tablename = 'testa' AND ftable.ref = 981670 OR ftable.tablename = 'testa' AND ftable.ref = 981680 OR ftable.tablename = 'testa' AND ftable.ref = 981673 OR ftable.tablename = 'testa' AND ftable.ref = 981661 OR ftable.tablename = 'testa' AND ftable.ref = 981666 OR ftable.tablename = 'testa' AND ftable.ref = 981692 OR ftable.tablename = 'testa' AND ftable.ref = 981697 OR ftable.tablename = 'testa' AND ftable.ref = 981654 OR ftable.tablename = 'testa' AND ftable.ref = 981685 OR ftable.tablename = 'testa' AND ftable.ref = 981657 OR ftable.tablename = 'testa' AND ftable.ref = 981678 OR ftable.tablename = 'testa' AND ftable.ref = 981688 OR ftable.tablename = 'testa' AND ftable.ref = 981650 OR ftable.tablename = 'testa' AND ftable.ref = 981671 OR ftable.tablename = 'testa' AND ftable.ref = 981681 OR ftable.tablename = 'testa' AND ftable.ref = 981674 OR ftable.tablename = 'testa' AND ftable.ref = 981662 OR ftable.tablename = 'testa' AND ftable.ref = 981667 OR ftable.tablename = 'testa' AND ftable.ref = 981693 OR ftable.tablename = 'testa' AND ftable.ref = 981698 OR ftable.tablename = 'testa' AND ftable.ref = 981655 OR ftable.tablename = 'testa' AND ftable.ref = 981686 OR ftable.tablename = 'testa' AND ftable.ref = 981658 OR ftable.tablename = 'testa' AND ftable.ref = 981679 OR ftable.tablename = 'testa' AND ftable.ref = 981689 OR ftable.tablename = 'testa' AND ftable.ref = 981651 OR ftable.tablename = 'testa' AND ftable.ref = 981682) ORDER BY ttable.datetime DESC;
# now try and examine the query in QUAN
Suggested fix:
n/a
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.053 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: The following query causes the problem: SELECT ftable.id AS ftable_id, ftable.tid AS ftable_tid, ftable.fid AS ftable_fid, ftable.tablename AS ftable_tablename, ftable.ref AS ftable_ref FROM ftable INNER JOIN ttable ON ttable.id = ftable.tid WHERE ttable.state = 'TEST' AND ftable.fid = 'TEST' AND (ftable.tablename = 'testa' AND ftable.ref = 981675 OR ftable.tablename = 'testa' AND ftable.ref = 981663 OR ftable.tablename = 'testa' AND ftable.ref = 981668 OR ftable.tablename = 'testa' AND ftable.ref = 981694 OR ftable.tablename = 'testa' AND ftable.ref = 981699 OR ftable.tablename = 'testa' AND ftable.ref = 981687 OR ftable.tablename = 'testa' AND ftable.ref = 981659 OR ftable.tablename = 'testa' AND ftable.ref = 981664 OR ftable.tablename = 'testa' AND ftable.ref = 981690 OR ftable.tablename = 'testa' AND ftable.ref = 981652 OR ftable.tablename = 'testa' AND ftable.ref = 981683 OR ftable.tablename = 'testa' AND ftable.ref = 981676 OR ftable.tablename = 'testa' AND ftable.ref = 981669 OR ftable.tablename = 'testa' AND ftable.ref = 981695 OR ftable.tablename = 'testa' AND ftable.ref = 981672 OR ftable.tablename = 'testa' AND ftable.ref = 981660 OR ftable.tablename = 'testa' AND ftable.ref = 981665 OR ftable.tablename = 'testa' AND ftable.ref = 981691 OR ftable.tablename = 'testa' AND ftable.ref = 981696 OR ftable.tablename = 'testa' AND ftable.ref = 981653 OR ftable.tablename = 'testa' AND ftable.ref = 981684 OR ftable.tablename = 'testa' AND ftable.ref = 981656 OR ftable.tablename = 'testa' AND ftable.ref = 981677 OR ftable.tablename = 'testa' AND ftable.ref = 981670 OR ftable.tablename = 'testa' AND ftable.ref = 981680 OR ftable.tablename = 'testa' AND ftable.ref = 981673 OR ftable.tablename = 'testa' AND ftable.ref = 981661 OR ftable.tablename = 'testa' AND ftable.ref = 981666 OR ftable.tablename = 'testa' AND ftable.ref = 981692 OR ftable.tablename = 'testa' AND ftable.ref = 981697 OR ftable.tablename = 'testa' AND ftable.ref = 981654 OR ftable.tablename = 'testa' AND ftable.ref = 981685 OR ftable.tablename = 'testa' AND ftable.ref = 981657 OR ftable.tablename = 'testa' AND ftable.ref = 981678 OR ftable.tablename = 'testa' AND ftable.ref = 981688 OR ftable.tablename = 'testa' AND ftable.ref = 981650 OR ftable.tablename = 'testa' AND ftable.ref = 981671 OR ftable.tablename = 'testa' AND ftable.ref = 981681 OR ftable.tablename = 'testa' AND ftable.ref = 981674 OR ftable.tablename = 'testa' AND ftable.ref = 981662 OR ftable.tablename = 'testa' AND ftable.ref = 981667 OR ftable.tablename = 'testa' AND ftable.ref = 981693 OR ftable.tablename = 'testa' AND ftable.ref = 981698 OR ftable.tablename = 'testa' AND ftable.ref = 981655 OR ftable.tablename = 'testa' AND ftable.ref = 981686 OR ftable.tablename = 'testa' AND ftable.ref = 981658 OR ftable.tablename = 'testa' AND ftable.ref = 981679 OR ftable.tablename = 'testa' AND ftable.ref = 981689 OR ftable.tablename = 'testa' AND ftable.ref = 981651 OR ftable.tablename = 'testa' AND ftable.ref = 981682) ORDER BY ttable.datetime DESC; Here's the exception: 2010-01-26 11:51:21,267 ERROR [http-18080-2:com.mysql.infra.com.mysql.merlin.server.SnmpSmtpCriticalNotifier] java.lang.StackOverflowError at org.antlr.stringtemplate.StringTemplate.getAttributeRenderer(StringTemplate.java:1033) at org.antlr.stringtemplate.StringTemplate.getAttributeRenderer(StringTemplate.java:1045) at org.antlr.stringtemplate.StringTemplate.getAttributeRenderer(StringTemplate.java:1045) ... How to repeat: CREATE TABLE `ftable` ( `id` int(11) NOT NULL AUTO_INCREMENT, `tid` int(11) DEFAULT NULL, `fid` varchar(32) NOT NULL, `tablename` varchar(32) NOT NULL, `ref` int(11) NOT NULL, PRIMARY KEY (`id`), KEY (`tid`), KEY (`fid`) ) ENGINE=MyISAM; CREATE TABLE `ttable` ( `id` int(11) NOT NULL AUTO_INCREMENT, `fid` varchar(32) NOT NULL, `state` varchar(32) DEFAULT NULL, `datetime` datetime DEFAULT NULL, PRIMARY KEY (`id`), KEY (`fid`) ) ENGINE=MyISAM; SELECT ftable.id AS ftable_id, ftable.tid AS ftable_tid, ftable.fid AS ftable_fid, ftable.tablename AS ftable_tablename, ftable.ref AS ftable_ref FROM ftable INNER JOIN ttable ON ttable.id = ftable.tid WHERE ttable.state = 'TEST' AND ftable.fid = 'TEST' AND (ftable.tablename = 'testa' AND ftable.ref = 981675 OR ftable.tablename = 'testa' AND ftable.ref = 981663 OR ftable.tablename = 'testa' AND ftable.ref = 981668 OR ftable.tablename = 'testa' AND ftable.ref = 981694 OR ftable.tablename = 'testa' AND ftable.ref = 981699 OR ftable.tablename = 'testa' AND ftable.ref = 981687 OR ftable.tablename = 'testa' AND ftable.ref = 981659 OR ftable.tablename = 'testa' AND ftable.ref = 981664 OR ftable.tablename = 'testa' AND ftable.ref = 981690 OR ftable.tablename = 'testa' AND ftable.ref = 981652 OR ftable.tablename = 'testa' AND ftable.ref = 981683 OR ftable.tablename = 'testa' AND ftable.ref = 981676 OR ftable.tablename = 'testa' AND ftable.ref = 981669 OR ftable.tablename = 'testa' AND ftable.ref = 981695 OR ftable.tablename = 'testa' AND ftable.ref = 981672 OR ftable.tablename = 'testa' AND ftable.ref = 981660 OR ftable.tablename = 'testa' AND ftable.ref = 981665 OR ftable.tablename = 'testa' AND ftable.ref = 981691 OR ftable.tablename = 'testa' AND ftable.ref = 981696 OR ftable.tablename = 'testa' AND ftable.ref = 981653 OR ftable.tablename = 'testa' AND ftable.ref = 981684 OR ftable.tablename = 'testa' AND ftable.ref = 981656 OR ftable.tablename = 'testa' AND ftable.ref = 981677 OR ftable.tablename = 'testa' AND ftable.ref = 981670 OR ftable.tablename = 'testa' AND ftable.ref = 981680 OR ftable.tablename = 'testa' AND ftable.ref = 981673 OR ftable.tablename = 'testa' AND ftable.ref = 981661 OR ftable.tablename = 'testa' AND ftable.ref = 981666 OR ftable.tablename = 'testa' AND ftable.ref = 981692 OR ftable.tablename = 'testa' AND ftable.ref = 981697 OR ftable.tablename = 'testa' AND ftable.ref = 981654 OR ftable.tablename = 'testa' AND ftable.ref = 981685 OR ftable.tablename = 'testa' AND ftable.ref = 981657 OR ftable.tablename = 'testa' AND ftable.ref = 981678 OR ftable.tablename = 'testa' AND ftable.ref = 981688 OR ftable.tablename = 'testa' AND ftable.ref = 981650 OR ftable.tablename = 'testa' AND ftable.ref = 981671 OR ftable.tablename = 'testa' AND ftable.ref = 981681 OR ftable.tablename = 'testa' AND ftable.ref = 981674 OR ftable.tablename = 'testa' AND ftable.ref = 981662 OR ftable.tablename = 'testa' AND ftable.ref = 981667 OR ftable.tablename = 'testa' AND ftable.ref = 981693 OR ftable.tablename = 'testa' AND ftable.ref = 981698 OR ftable.tablename = 'testa' AND ftable.ref = 981655 OR ftable.tablename = 'testa' AND ftable.ref = 981686 OR ftable.tablename = 'testa' AND ftable.ref = 981658 OR ftable.tablename = 'testa' AND ftable.ref = 981679 OR ftable.tablename = 'testa' AND ftable.ref = 981689 OR ftable.tablename = 'testa' AND ftable.ref = 981651 OR ftable.tablename = 'testa' AND ftable.ref = 981682) ORDER BY ttable.datetime DESC; # now try and examine the query in QUAN Suggested fix: n/a