Commit aa9bfb44 authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

after merging fix

parent 32df7cac
...@@ -285,46 +285,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -285,46 +285,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL topic 3 NULL 2 Using index 1 PRIMARY t1 index NULL topic 3 NULL 2 Using index
2 SUBSELECT No tables used 2 SUBSELECT No tables used
3 UNION No tables used 3 UNION No tables used
SELECT 1 IN (SELECT 1 FROM t1 HAVING a); drop table t1;
Unknown column 'a' in 'having clause'
SELECT * from t1 where topic IN (SELECT topic FROM t1 GROUP BY date);
topic date pseudo
40143 2002-08-03 joce
43506 2002-10-02 joce
SELECT * from t1 where topic IN (SELECT topic FROM t1 GROUP BY date HAVING topic < 4100);
topic date pseudo
43506 2002-10-02 joce
SELECT * from t1 where topic IN (SELECT SUM(topic) FROM t1);
topic date pseudo
SELECT * from t1 where topic = any (SELECT topic FROM st1 GROUP BY date);
topic date pseudo
40143 2002-08-03 joce
43506 2002-10-02 joce
SELECT * from t1 where topic = any (SELECT topic FROM t1 GROUP BY date HAVING topic < 4100);
topic date pseudo
43506 2002-10-02 joce
SELECT * from t1 where topic = any (SELECT SUM(topic) FROM t1);
topic date pseudo
SELECT * from t1 where topic = all (SELECT topic FROM t1 GROUP BY date);
topic date pseudo
SELECT * from t1 where topic = all (SELECT topic FROM t1 GROUP BY date HAVING topic < 4100);
topic date pseudo
40143 2002-08-03 joce
SELECT * from t1 where topic = all (SELECT SUM(topic) FROM t1);
topic date pseudo
SELECT * from t1 where topic <> any (SELECT SUM(topic) FROM t1);
topic date pseudo
40143 2002-08-03 joce
43506 2002-10-02 joce
CREATE TABLE `t2` (
`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 t1 (numeropost,maxnumrep) VALUES (40143,1),(43506,2);
SELECT SQL_CALC_FOUND_ROWS numeropost,maxnumrep FROM t2 WHERE numeropost IN (SELECT topic FROM t1 WHERE pseudo='joce' AND date >= '2002-10-06') ORDER BY maxnumrep DESC LIMIT 0,20;
numeropost maxnumrep
drop table t1,t2;
CREATE TABLE `t1` ( CREATE TABLE `t1` (
`numeropost` mediumint(8) unsigned NOT NULL auto_increment, `numeropost` mediumint(8) unsigned NOT NULL auto_increment,
`maxnumrep` int(10) unsigned NOT NULL default '0', `maxnumrep` int(10) unsigned NOT NULL default '0',
...@@ -349,8 +310,39 @@ numeropost maxnumrep ...@@ -349,8 +310,39 @@ numeropost maxnumrep
40143 1 40143 1
SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1); SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1);
Unknown column 'a' in 'having clause' Unknown column 'a' in 'having clause'
drop table t1, t2; SELECT 1 IN (SELECT 1 FROM t2 HAVING a);
drop table if exists t1; Unknown column 'a' in 'having clause'
SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY date);
mot topic date pseudo
joce 40143 2002-10-22 joce
joce 43506 2002-10-22 joce
SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY date HAVING topic < 4100);
mot topic date pseudo
joce 43506 2002-10-22 joce
SELECT * from t2 where topic IN (SELECT SUM(topic) FROM t1);
mot topic date pseudo
SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY date);
mot topic date pseudo
joce 40143 2002-10-22 joce
joce 43506 2002-10-22 joce
SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY date HAVING topic < 4100);
mot topic date pseudo
joce 43506 2002-10-22 joce
SELECT * from t2 where topic = any (SELECT SUM(topic) FROM t1);
mot topic date pseudo
SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY date);
mot topic date pseudo
joce 40143 2002-10-22 joce
SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY date HAVING topic < 4100);
mot topic date pseudo
joce 40143 2002-10-22 joce
SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2);
mot topic date pseudo
SELECT * from t2 where topic <> any (SELECT SUM(topic) FROM t2);
mot topic date pseudo
joce 40143 2002-10-22 joce
joce 43506 2002-10-22 joce
drop table t1,t2;
CREATE TABLE `t1` ( CREATE TABLE `t1` (
`numeropost` mediumint(8) unsigned NOT NULL auto_increment, `numeropost` mediumint(8) unsigned NOT NULL auto_increment,
`maxnumrep` int(10) unsigned NOT NULL default '0', `maxnumrep` int(10) unsigned NOT NULL default '0',
......
...@@ -171,10 +171,21 @@ select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1); ...@@ -171,10 +171,21 @@ select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1);
SELECT numeropost,maxnumrep FROM t1 WHERE exists (SELECT 1 FROM t2 WHERE (mot='joce') AND date >= '2002-10-21' AND t1.numeropost = t2.topic) ORDER BY maxnumrep DESC LIMIT 0, 20; SELECT numeropost,maxnumrep FROM t1 WHERE exists (SELECT 1 FROM t2 WHERE (mot='joce') AND date >= '2002-10-21' AND t1.numeropost = t2.topic) ORDER BY maxnumrep DESC LIMIT 0, 20;
-- error 1054 -- error 1054
SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1); SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1);
drop table t1, t2; -- error 1054
SELECT 1 IN (SELECT 1 FROM t2 HAVING a);
SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY date);
SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY date HAVING topic < 4100);
SELECT * from t2 where topic IN (SELECT SUM(topic) FROM t1);
SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY date);
SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY date HAVING topic < 4100);
SELECT * from t2 where topic = any (SELECT SUM(topic) FROM t1);
SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY date);
SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY date HAVING topic < 4100);
SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2);
SELECT * from t2 where topic <> any (SELECT SUM(topic) FROM t2);
drop table t1,t2;
#forumconthardwarefr7 #forumconthardwarefr7
drop table if exists t1;
CREATE TABLE `t1` ( CREATE TABLE `t1` (
`numeropost` mediumint(8) unsigned NOT NULL auto_increment, `numeropost` mediumint(8) unsigned NOT NULL auto_increment,
`maxnumrep` int(10) unsigned NOT NULL default '0', `maxnumrep` int(10) unsigned NOT NULL default '0',
...@@ -215,26 +226,7 @@ INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),( ...@@ -215,26 +226,7 @@ INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(
EXPLAIN SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1'); EXPLAIN SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
EXPLAIN SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'; EXPLAIN SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
EXPLAIN SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'); EXPLAIN SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
SELECT 1 IN (SELECT 1 FROM t1 HAVING a); drop table t1;
SELECT * from t1 where topic IN (SELECT topic FROM t1 GROUP BY date);
SELECT * from t1 where topic IN (SELECT topic FROM t1 GROUP BY date HAVING topic < 4100);
SELECT * from t1 where topic IN (SELECT SUM(topic) FROM t1);
SELECT * from t1 where topic = any (SELECT topic FROM t1 GROUP BY date);
SELECT * from t1 where topic = any (SELECT topic FROM t1 GROUP BY date HAVING topic < 4100);
SELECT * from t1 where topic = any (SELECT SUM(topic) FROM t1);
SELECT * from t1 where topic = all (SELECT topic FROM t1 GROUP BY date);
SELECT * from t1 where topic = all (SELECT topic FROM t1 GROUP BY date HAVING topic < 4100);
SELECT * from t1 where topic = all (SELECT SUM(topic) FROM t1);
SELECT * from t1 where topic <> any (SELECT SUM(topic) FROM t1);
CREATE TABLE `t2` (
`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 t2 (numeropost,maxnumrep) VALUES (40143,1),(43506,2);
SELECT SQL_CALC_FOUND_ROWS numeropost,maxnumrep FROM t2 WHERE numeropost IN (SELECT topic FROM t1 WHERE pseudo='joce' AND date >= '2002-10-06') ORDER BY maxnumrep DESC LIMIT 0,20;
drop table t1,t2;
CREATE TABLE t1 (a int(1)); CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
......
...@@ -2988,6 +2988,7 @@ join_free(JOIN *join) ...@@ -2988,6 +2988,7 @@ join_free(JOIN *join)
else else
{ {
for (tab=join->join_tab,end=tab+join->tables ; tab != end ; tab++) for (tab=join->join_tab,end=tab+join->tables ; tab != end ; tab++)
{
delete tab->select; delete tab->select;
delete tab->quick; delete tab->quick;
x_free(tab->cache.buff); x_free(tab->cache.buff);
......
...@@ -654,7 +654,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -654,7 +654,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
table_to_table_list table_to_table opt_table_list opt_as table_to_table_list table_to_table opt_table_list opt_as
handler_rkey_function handler_read_or_scan handler_rkey_function handler_read_or_scan
single_multi table_wild_list table_wild_one opt_wild single_multi table_wild_list table_wild_one opt_wild
union union_option union union_list union_option
precision opt_on_delete_item subselect_start opt_and precision opt_on_delete_item subselect_start opt_and
subselect_end select_var_list select_var_list_init help opt_len subselect_end select_var_list select_var_list_init help opt_len
END_OF_INPUT END_OF_INPUT
...@@ -1254,7 +1254,7 @@ opt_binary: ...@@ -1254,7 +1254,7 @@ opt_binary:
opt_primary: opt_primary:
/* empty */ /* empty */
| PRIMARY_SYM | PRIMARY_SYM;
references: references:
REFERENCES table_ident REFERENCES table_ident
...@@ -4316,7 +4316,11 @@ rollback: ...@@ -4316,7 +4316,11 @@ rollback:
union: union:
/* empty */ {} /* empty */ {}
|UNION_SYM union_option | union_list
;
union_list:
UNION_SYM union_option
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (lex->exchange) if (lex->exchange)
......
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