summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSinisa@sinisa.nasamreza.org <>2002-02-28 22:01:41 +0200
committerSinisa@sinisa.nasamreza.org <>2002-02-28 22:01:41 +0200
commitcdddb6546049b021d8f9dd6d5a1cfede1c4ae6fb (patch)
treeead290526a05fa8ce4157fb5a3448811d0e7a83f
parent99e897e6a65aa2304d720d97e118ee16398cfc5d (diff)
downloadmariadb-git-cdddb6546049b021d8f9dd6d5a1cfede1c4ae6fb.tar.gz
Porting from mysql-4.0.
Read comments there if you are interested ..
-rw-r--r--.bzrignore1
-rw-r--r--libmysql/libmysql.c2
-rw-r--r--mysql-test/r/union.result15
-rw-r--r--mysql-test/t/union.test6
-rw-r--r--sql/sql_yacc.yy8
5 files changed, 27 insertions, 5 deletions
diff --git a/.bzrignore b/.bzrignore
index f40e1f26cd2..f2da28f44f8 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -465,3 +465,4 @@ vio/test-sslserver
vio/viotest-ssl
libmysqld/gstream.cc
libmysqld/spatial.cc
+sql/sql_yacc.yy.orig
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 32aa8e59888..4e4518bbe10 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -737,7 +737,7 @@ static void mysql_read_default_options(struct st_mysql_options *options,
*end=0; /* Remove '=' */
}
/* Change all '_' in variable name to '-' */
- for (end= *option ; (end= strcend(end,'_')) ; )
+ for (end= *option ; (end= strcend(end,'_')) && *end ; )
*end= '-';
switch (find_type(*option+2,&option_types,2)) {
case 1: /* port */
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 6a27df648b5..e842bb3b447 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -86,6 +86,21 @@ explain select a,b from t1 union all select a,b from t2;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 4
t2 ALL NULL NULL NULL NULL 4
+explain select xx from t1 union select 1;
+Unknown column 'xx' in 'field list'
+explain select a,b from t1 union select 1;
+table type possible_keys key key_len ref rows Extra
+t1 ALL NULL NULL NULL NULL 4
+ 0 0 No tables used
+explain select 1 union select a,b from t1 union select 1;
+table type possible_keys key key_len ref rows Extra
+ 0 0 No tables used
+t1 ALL NULL NULL NULL NULL 4
+ 0 0 No tables used
+explain select a,b from t1 union select 1 limit 0;
+table type possible_keys key key_len ref rows Extra
+t1 ALL NULL NULL NULL NULL 4
+ 0 0 Impossible WHERE
select a,b from t1 into outfile 'skr' union select a,b from t2;
Wrong usage of UNION and INTO
select a,b from t1 order by a union select a,b from t2;
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 8d98e6e0389..f782c61d97a 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -24,6 +24,12 @@ select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 g
# Test some error conditions with UNION
explain select a,b from t1 union all select a,b from t2;
+--error 1054
+explain select xx from t1 union select 1;
+explain select a,b from t1 union select 1;
+explain select 1 union select a,b from t1 union select 1;
+explain select a,b from t1 union select 1 limit 0;
+
--error 1221
select a,b from t1 into outfile 'skr' union select a,b from t2;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 857d7a245f0..3c0d476ac83 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1977,7 +1977,7 @@ opt_else:
| ELSE expr { $$= $2; }
when_list:
- { Select->when_list.push_front(new List<Item>) }
+ { Select->when_list.push_front(new List<Item>); }
when_list2
{ $$= Select->when_list.pop(); }
@@ -2080,7 +2080,7 @@ opt_key_definition:
}
key_usage_list:
- key_or_index { Select->interval_list.empty() } '(' key_usage_list2 ')'
+ key_or_index { Select->interval_list.empty(); } '(' key_usage_list2 ')'
{ $$= &Select->interval_list; }
key_usage_list2:
@@ -2686,7 +2686,7 @@ describe:
YYABORT;
}
opt_describe_column
- | describe_command select { Lex->select_lex.options|= SELECT_DESCRIBE };
+ | describe_command select { Lex->select_lex.options|= SELECT_DESCRIBE; }
describe_command:
@@ -3126,7 +3126,7 @@ set:
lex->select->select_limit=lex->thd->default_select_limit;
lex->tx_isolation=lex->thd->tx_isolation;
lex->option_type=0;
- lex->option_list.empty()
+ lex->option_list.empty();
}
option_value_list