Commit 1448ba4e authored by unknown's avatar unknown

test of join_free bug


sql/sql_lex.cc:
  possible bug fixed
sql/sql_select.cc:
  fixed join_free bug
parent e2f4a07b
...@@ -195,7 +195,7 @@ joce ...@@ -195,7 +195,7 @@ joce
SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo LIKE '%joce%'); SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo LIKE '%joce%');
Subselect returns more than 1 record Subselect returns more than 1 record
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit; drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
drop table if exists searchconthardwarefr3; drop table if exists searchconthardwarefr3, forumconthardwarefr7;
CREATE TABLE `searchconthardwarefr3` ( CREATE TABLE `searchconthardwarefr3` (
`topic` mediumint(8) unsigned NOT NULL default '0', `topic` mediumint(8) unsigned NOT NULL default '0',
`date` date NOT NULL default '0000-00-00', `date` date NOT NULL default '0000-00-00',
...@@ -241,4 +241,12 @@ topic date pseudo ...@@ -241,4 +241,12 @@ topic date pseudo
43506 2002-10-02 joce 43506 2002-10-02 joce
SELECT * from searchconthardwarefr3 where topic IN (SELECT SUM(topic) FROM searchconthardwarefr3); SELECT * from searchconthardwarefr3 where topic IN (SELECT SUM(topic) FROM searchconthardwarefr3);
topic date pseudo topic date pseudo
drop table searchconthardwarefr3; CREATE TABLE `forumconthardwarefr7` (
`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
`maxnumrep` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`numeropost`),
UNIQUE KEY `maxnumrep` (`maxnumrep`)) TYPE=MyISAM ROW_FORMAT=FIXED;
INSERT INTO forumconthardwarefr7 (numeropost,maxnumrep) VALUES (40143,1),(43506,2);
SELECT SQL_CALC_FOUND_ROWS numeropost,maxnumrep FROM forumconthardwarefr7 WHERE numeropost IN (SELECT topic FROM searchconthardwarefr3 WHERE pseudo='joce' AND date >= '2002-10-06') ORDER BY maxnumrep DESC LIMIT 0,20;
numeropost maxnumrep
drop table searchconthardwarefr3, forumconthardwarefr7;
...@@ -102,7 +102,7 @@ SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo ...@@ -102,7 +102,7 @@ SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit; drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
drop table if exists searchconthardwarefr3; drop table if exists searchconthardwarefr3, forumconthardwarefr7;
CREATE TABLE `searchconthardwarefr3` ( CREATE TABLE `searchconthardwarefr3` (
`topic` mediumint(8) unsigned NOT NULL default '0', `topic` mediumint(8) unsigned NOT NULL default '0',
`date` date NOT NULL default '0000-00-00', `date` date NOT NULL default '0000-00-00',
...@@ -125,4 +125,12 @@ SELECT 1 IN (SELECT 1 FROM searchconthardwarefr3 HAVING a); ...@@ -125,4 +125,12 @@ SELECT 1 IN (SELECT 1 FROM searchconthardwarefr3 HAVING a);
SELECT * from searchconthardwarefr3 where topic IN (SELECT topic FROM searchconthardwarefr3 GROUP BY date); SELECT * from searchconthardwarefr3 where topic IN (SELECT topic FROM searchconthardwarefr3 GROUP BY date);
SELECT * from searchconthardwarefr3 where topic IN (SELECT topic FROM searchconthardwarefr3 GROUP BY date HAVING topic < 4100); SELECT * from searchconthardwarefr3 where topic IN (SELECT topic FROM searchconthardwarefr3 GROUP BY date HAVING topic < 4100);
SELECT * from searchconthardwarefr3 where topic IN (SELECT SUM(topic) FROM searchconthardwarefr3); SELECT * from searchconthardwarefr3 where topic IN (SELECT SUM(topic) FROM searchconthardwarefr3);
drop table searchconthardwarefr3; CREATE TABLE `forumconthardwarefr7` (
\ No newline at end of file `numeropost` mediumint(8) unsigned NOT NULL auto_increment,
`maxnumrep` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`numeropost`),
UNIQUE KEY `maxnumrep` (`maxnumrep`)) TYPE=MyISAM ROW_FORMAT=FIXED;
INSERT INTO forumconthardwarefr7 (numeropost,maxnumrep) VALUES (40143,1),(43506,2);
SELECT SQL_CALC_FOUND_ROWS numeropost,maxnumrep FROM forumconthardwarefr7 WHERE numeropost IN (SELECT topic FROM searchconthardwarefr3 WHERE pseudo='joce' AND date >= '2002-10-06') ORDER BY maxnumrep DESC LIMIT 0,20;
drop table searchconthardwarefr3, forumconthardwarefr7;
\ No newline at end of file
...@@ -927,6 +927,7 @@ void st_select_lex_node::init_query() ...@@ -927,6 +927,7 @@ void st_select_lex_node::init_query()
{ {
next= master= slave= link_next= 0; next= master= slave= link_next= 0;
prev= link_prev= 0; prev= link_prev= 0;
dependent= 0;
} }
void st_select_lex_node::init_select() void st_select_lex_node::init_select()
...@@ -937,7 +938,7 @@ void st_select_lex_node::init_select() ...@@ -937,7 +938,7 @@ void st_select_lex_node::init_select()
select_limit= HA_POS_ERROR; select_limit= HA_POS_ERROR;
offset_limit= 0; offset_limit= 0;
with_sum_func= 0; with_sum_func= 0;
create_refs= dependent= 0; create_refs= 0;
} }
void st_select_lex_unit::init_query() void st_select_lex_unit::init_query()
......
...@@ -2914,10 +2914,13 @@ join_free(JOIN *join) ...@@ -2914,10 +2914,13 @@ join_free(JOIN *join)
if (join->tables > join->const_tables) // Test for not-const tables if (join->tables > join->const_tables) // Test for not-const tables
free_io_cache(join->table[join->const_tables]); free_io_cache(join->table[join->const_tables]);
for (tab=join->join_tab,end=tab+join->tables ; tab != end ; tab++) for (tab=join->join_tab,end=tab+join->tables ; tab != end ; tab++)
{
if (!join->select_lex->dependent)
{ {
delete tab->select; delete tab->select;
delete tab->quick; delete tab->quick;
x_free(tab->cache.buff); x_free(tab->cache.buff);
}
if (tab->table) if (tab->table)
{ {
if (tab->table->key_read) if (tab->table->key_read)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment