Commit 0d2cb6c8 authored by joreland@mysql.com's avatar joreland@mysql.com

Merge

parents 5c4da6aa f3890e94
......@@ -55,6 +55,9 @@ case "$cpu_family--$model_name" in
*Pentium*III*CPU*)
cpu_flag="pentium3";
;;
*Pentium*M*pro*)
cpu_flag="pentium-m";
;;
*Athlon*64*)
cpu_flag="athlon64";
cpu_flag_old="athlon";
......
......@@ -308,9 +308,15 @@ C_MODE_END
#ifndef CONFIG_SMP
#define CONFIG_SMP
#endif
#if defined(__ia64__)
#define new my_arg_new
#endif
C_MODE_START
#include <asm/atomic.h>
C_MODE_END
#if defined(__ia64__)
#undef new
#endif
#endif
#include <errno.h> /* Recommended by debian */
/* We need the following to go around a problem with openssl on solaris */
......
......@@ -817,6 +817,9 @@ drop table t1;
select 'c' like '\_' as want0;
want0
0
SELECT SUBSTR('вася',-2);
SUBSTR('вася',-2)
ся
create table t1 (id integer, a varchar(100) character set utf8 collate utf8_unicode_ci);
insert into t1 values (1, 'Test');
select * from t1 where soundex(a) = soundex('Test');
......
......@@ -2476,3 +2476,13 @@ x
NULL
1.0000
drop table t1;
create table t1 (a int(11));
select all all * from t1;
a
select distinct distinct * from t1;
a
select all distinct * from t1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'distinct * from t1' at line 1
select distinct all * from t1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'all * from t1' at line 1
drop table t1;
......@@ -666,6 +666,12 @@ drop table t1;
#
select 'c' like '\_' as want0;
#
# SUBSTR with negative offset didn't work with multi-byte strings
#
SELECT SUBSTR('вася',-2);
#
# Bug #7730 Server crash using soundex on an utf8 table
#
......
......@@ -437,6 +437,7 @@ explain select * from t1 where a='aaa' collate latin1_german1_ci;
drop table t1;
# Test for BUG#9348 "result for WHERE A AND (B OR C) differs from WHERE a AND (C OR B)"
--disable_warnings
CREATE TABLE t1 (
`CLIENT` char(3) character set latin1 collate latin1_bin NOT NULL default '000',
`ARG1` char(3) character set latin1 collate latin1_bin NOT NULL default '',
......@@ -445,6 +446,7 @@ CREATE TABLE t1 (
`FUNCTINT` int(11) NOT NULL default '0',
KEY `VERI_CLNT~2` (`ARG1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--enable_warnings
INSERT INTO t1 VALUES ('000',' 0',' 0','Text 001',0), ('000',' 0',' 1','Text 002',0),
('000',' 1',' 2','Text 003',0), ('000',' 2',' 3','Text 004',0),
......
......@@ -2056,3 +2056,19 @@ create table t1 (s1 int);
insert into t1 values (null),(1);
select distinct avg(s1) as x from t1 group by s1 with rollup;
drop table t1;
#
# Bug#8733 server accepts malformed query (multiply mentioned distinct)
#
create table t1 (a int(11));
select all all * from t1;
select distinct distinct * from t1;
--error 1064
select all distinct * from t1;
--error 1064
select distinct all * from t1;
drop table t1;
#
......@@ -1013,7 +1013,7 @@ String *Item_func_substr::val_str(String *str)
if ((null_value=(args[0]->null_value || args[1]->null_value ||
(arg_count == 3 && args[2]->null_value))))
return 0; /* purecov: inspected */
start= (int32)((start < 0) ? res->length() + start : start -1);
start= (int32)((start < 0) ? res->numchars() + start : start -1);
start=res->charpos(start);
length=res->charpos(length,start);
if (start < 0 || (uint) start+1 > res->length() || length <= 0)
......
......@@ -18,7 +18,6 @@
/* This file defines all string functions */
#ifdef USE_PRAGMA_INTERFACE
#error PRAGMA
#pragma interface /* gcc class implementation */
#endif
......
......@@ -268,6 +268,9 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
#define OPTION_SCHEMA_TABLE (1L << 29)
/* Flag set if setup_tables already done */
#define OPTION_SETUP_TABLES_DONE (1L << 30)
/* Thr following is used to detect a conflict with DISTINCT
in the user query has requested */
#define SELECT_ALL (ULL(1) << 32)
/*
Maximum length of time zone name that we support
......
......@@ -4000,7 +4000,15 @@ select_option:
YYABORT;
Lex->lock_option= TL_READ_HIGH_PRIORITY;
}
| DISTINCT { Select->options|= SELECT_DISTINCT; }
| DISTINCT
{
if (Select->options & SELECT_ALL)
{
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
Select->options|= SELECT_DISTINCT;
}
| SQL_SMALL_RESULT { Select->options|= SELECT_SMALL_RESULT; }
| SQL_BIG_RESULT { Select->options|= SELECT_BIG_RESULT; }
| SQL_BUFFER_RESULT
......@@ -4020,7 +4028,15 @@ select_option:
{
Lex->select_lex.options|= OPTION_TO_QUERY_CACHE;
}
| ALL {}
| ALL
{
if (Select->options & SELECT_DISTINCT)
{
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
Select->options|= SELECT_ALL;
}
;
select_lock_type:
......
......@@ -59,6 +59,7 @@ static byte* get_field_name(Field **buff,uint *length,
3 Wrong data in .frm file
4 Error (see frm_error)
5 Error (see frm_error: charset unavailable)
6 Unknown .frm version
*/
int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
......@@ -135,10 +136,14 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
*fn_ext(share->table_name)='\0'; // Remove extension
*fn_ext(share->path)='\0'; // Remove extension
if (head[0] != (uchar) 254 || head[1] != 1 ||
(head[2] != FRM_VER && head[2] != FRM_VER+1 &&
! (head[2] >= FRM_VER+3 && head[2] <= FRM_VER+4)))
if (head[0] != (uchar) 254 || head[1] != 1)
goto err; /* purecov: inspected */
if (head[2] != FRM_VER && head[2] != FRM_VER+1 &&
! (head[2] >= FRM_VER+3 && head[2] <= FRM_VER+4))
{
error= 6;
goto err; /* purecov: inspected */
}
new_field_pack_flag=head[27];
new_frm_ver= (head[2] - FRM_VER);
field_pack_length= new_frm_ver < 2 ? 11 : 17;
......@@ -1084,6 +1089,12 @@ static void frm_error(int error, TABLE *form, const char *name,
MYF(0), csname, real_name);
break;
}
case 6:
my_printf_error(ER_NOT_FORM_FILE,
"Table '%-.64s' was created with a different version "
"of MySQL and cannot be read",
MYF(0), name);
break;
default: /* Better wrong error than none */
case 4:
my_error(ER_NOT_FORM_FILE, errortype,
......
......@@ -4591,7 +4591,7 @@ uint my_well_formed_len_sjis(CHARSET_INFO *cs __attribute__((unused)),
{
const char *b0= b;
*error= 0;
while (pos && b < e)
while (pos-- && b < e)
{
if ((uchar) b[0] < 128)
{
......
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