Commit 8dba38fe authored by marko@hundin.mysql.fi's avatar marko@hundin.mysql.fi

Merge marko@bk-internal.mysql.com:/home/bk/mysql-4.1

into hundin.mysql.fi:/home/marko/k/mysql-4.1
parents 89996cd7 da92505d
...@@ -940,3 +940,6 @@ ndbcluster-1186/ndb_3_out.log ...@@ -940,3 +940,6 @@ ndbcluster-1186/ndb_3_out.log
ndbcluster-1186/ndbcluster.pid ndbcluster-1186/ndbcluster.pid
ndb/tools/ndb_restore ndb/tools/ndb_restore
ac_available_languages_fragment ac_available_languages_fragment
libmysqld/ha_archive.cc
libmysqld/ha_example.cc
libmysqld/ha_tina.cc
...@@ -825,10 +825,17 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -825,10 +825,17 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
} }
if (argv[1][0]) if (argv[1][0])
{ {
char *pw= argv[1];
#ifdef __WIN__
uint pw_len= strlen(pw);
if (pw_len > 1 && pw[0] == '\'' && pw[pw_len-1] == '\'')
printf("Warning: single quotes were not trimmed from the password by"
" your command\nline client, as you might have expected.\n");
#endif
if (find_type(argv[0], &command_typelib, 2) == ADMIN_OLD_PASSWORD) if (find_type(argv[0], &command_typelib, 2) == ADMIN_OLD_PASSWORD)
make_scrambled_password_323(crypted_pw, argv[1]); make_scrambled_password_323(crypted_pw, pw);
else else
make_scrambled_password(crypted_pw, argv[1]); make_scrambled_password(crypted_pw, pw);
} }
else else
crypted_pw[0]=0; /* No password */ crypted_pw[0]=0; /* No password */
......
...@@ -41,6 +41,13 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef, ...@@ -41,6 +41,13 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
{ {
HP_KEYDEF *keyinfo; HP_KEYDEF *keyinfo;
DBUG_PRINT("info",("Initializing new table")); DBUG_PRINT("info",("Initializing new table"));
/*
We have to store sometimes byte* del_link in records,
so the record length should be at least sizeof(byte*)
*/
set_if_bigger(reclength, sizeof (byte*));
for (i= key_segs= max_length= 0, keyinfo= keydef; i < keys; i++, keyinfo++) for (i= key_segs= max_length= 0, keyinfo= keydef; i < keys; i++, keyinfo++)
{ {
bzero((char*) &keyinfo->block,sizeof(keyinfo->block)); bzero((char*) &keyinfo->block,sizeof(keyinfo->block));
......
...@@ -26,7 +26,7 @@ DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \ ...@@ -26,7 +26,7 @@ DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
-DDATADIR="\"$(MYSQLDATAdir)\"" \ -DDATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" -DSHAREDIR="\"$(MYSQLSHAREdir)\""
INCLUDES= @MT_INCLUDES@ @bdb_includes@ -I$(top_srcdir)/include \ INCLUDES= @MT_INCLUDES@ @bdb_includes@ -I$(top_srcdir)/include \
-I$(top_srcdir)/sql -I$(top_srcdir)/regex \ -I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples -I$(top_srcdir)/regex \
$(openssl_includes) @ZLIB_INCLUDES@ $(openssl_includes) @ZLIB_INCLUDES@
noinst_LIBRARIES = libmysqld_int.a noinst_LIBRARIES = libmysqld_int.a
...@@ -35,6 +35,7 @@ SUBDIRS = . examples ...@@ -35,6 +35,7 @@ SUBDIRS = . examples
libmysqld_sources= libmysqld.c lib_sql.cc emb_qcache.cc libmysqld_sources= libmysqld.c lib_sql.cc emb_qcache.cc
libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \ libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \
my_time.c my_time.c
sqlexamplessources = ha_example.cc ha_archive.cc ha_tina.cc
noinst_HEADERS = embedded_priv.h emb_qcache.h noinst_HEADERS = embedded_priv.h emb_qcache.h
...@@ -59,7 +60,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \ ...@@ -59,7 +60,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
unireg.cc uniques.cc stacktrace.c sql_union.cc hash_filo.cc \ unireg.cc uniques.cc stacktrace.c sql_union.cc hash_filo.cc \
spatial.cc gstream.cc sql_help.cc tztime.cc spatial.cc gstream.cc sql_help.cc tztime.cc
libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources)
libmysqld_a_SOURCES= libmysqld_a_SOURCES=
# automake misses these # automake misses these
...@@ -123,12 +124,16 @@ link_sources: ...@@ -123,12 +124,16 @@ link_sources:
rm -f $(srcdir)/$$f; \ rm -f $(srcdir)/$$f; \
@LN_CP_F@ $(srcdir)/../libmysql/$$f $(srcdir)/$$f; \ @LN_CP_F@ $(srcdir)/../libmysql/$$f $(srcdir)/$$f; \
done; \ done; \
for f in $(sqlexamplessources); do \
rm -f $(srcdir)/$$f; \
@LN_CP_F@ $(srcdir)/../sql/examples/$$f $(srcdir)/$$f; \
done; \
rm -f $(srcdir)/client_settings.h; \ rm -f $(srcdir)/client_settings.h; \
@LN_CP_F@ $(srcdir)/../libmysql/client_settings.h $(srcdir)/client_settings.h; @LN_CP_F@ $(srcdir)/../libmysql/client_settings.h $(srcdir)/client_settings.h;
clean-local: clean-local:
rm -f `echo $(sqlsources) $(libmysqlsources) | sed "s;\.lo;.c;g"` \ rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) | sed "s;\.lo;.c;g"` \
$(top_srcdir)/linked_libmysqld_sources; \ $(top_srcdir)/linked_libmysqld_sources; \
rm -f client_settings.h rm -f client_settings.h
......
...@@ -42,8 +42,9 @@ ...@@ -42,8 +42,9 @@
{ bits-=(bit+1); break; } \ { bits-=(bit+1); break; } \
pos+= *pos pos+= *pos
#define OFFSET_TABLE_SIZE 512
static void read_huff_table(MI_BIT_BUFF *bit_buff,MI_DECODE_TREE *decode_tree, static uint read_huff_table(MI_BIT_BUFF *bit_buff,MI_DECODE_TREE *decode_tree,
uint16 **decode_table,byte **intervall_buff, uint16 **decode_table,byte **intervall_buff,
uint16 *tmp_buff); uint16 *tmp_buff);
static void make_quick_table(uint16 *to_table,uint16 *decode_table, static void make_quick_table(uint16 *to_table,uint16 *decode_table,
...@@ -53,7 +54,7 @@ static void fill_quick_table(uint16 *table,uint bits, uint max_bits, ...@@ -53,7 +54,7 @@ static void fill_quick_table(uint16 *table,uint bits, uint max_bits,
uint value); uint value);
static uint copy_decode_table(uint16 *to_pos,uint offset, static uint copy_decode_table(uint16 *to_pos,uint offset,
uint16 *decode_table); uint16 *decode_table);
static uint find_longest_bitstream(uint16 *table); static uint find_longest_bitstream(uint16 *table, uint16 *end);
static void (*get_unpack_function(MI_COLUMNDEF *rec))(MI_COLUMNDEF *field, static void (*get_unpack_function(MI_COLUMNDEF *rec))(MI_COLUMNDEF *field,
MI_BIT_BUFF *buff, MI_BIT_BUFF *buff,
uchar *to, uchar *to,
...@@ -146,12 +147,12 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) ...@@ -146,12 +147,12 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
{ {
if (!my_errno) if (!my_errno)
my_errno=HA_ERR_END_OF_FILE; my_errno=HA_ERR_END_OF_FILE;
DBUG_RETURN(1); goto err0;
} }
if (memcmp((byte*) header,(byte*) myisam_pack_file_magic,4)) if (memcmp((byte*) header,(byte*) myisam_pack_file_magic,4))
{ {
my_errno=HA_ERR_WRONG_IN_RECORD; my_errno=HA_ERR_WRONG_IN_RECORD;
DBUG_RETURN(1); goto err0;
} }
share->pack.header_length= uint4korr(header+4); share->pack.header_length= uint4korr(header+4);
share->min_pack_length=(uint) uint4korr(header+8); share->min_pack_length=(uint) uint4korr(header+8);
...@@ -173,20 +174,20 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) ...@@ -173,20 +174,20 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
my_malloc((uint) (trees*sizeof(MI_DECODE_TREE)+ my_malloc((uint) (trees*sizeof(MI_DECODE_TREE)+
intervall_length*sizeof(byte)), intervall_length*sizeof(byte)),
MYF(MY_WME)))) MYF(MY_WME))))
DBUG_RETURN(1); goto err0;
intervall_buff=(byte*) (share->decode_trees+trees); intervall_buff=(byte*) (share->decode_trees+trees);
length=(uint) (elements*2+trees*(1 << myisam_quick_table_bits)); length=(uint) (elements*2+trees*(1 << myisam_quick_table_bits));
if (!(share->decode_tables=(uint16*) if (!(share->decode_tables=(uint16*)
my_malloc((length+512)*sizeof(uint16)+ my_malloc((length+OFFSET_TABLE_SIZE)*sizeof(uint16)+
(uint) (share->pack.header_length+7), (uint) (share->pack.header_length+7),
MYF(MY_WME | MY_ZEROFILL)))) MYF(MY_WME | MY_ZEROFILL))))
{ {
my_free((gptr) share->decode_trees,MYF(0)); my_free((gptr) share->decode_trees,MYF(0));
DBUG_RETURN(1); goto err1;
} }
tmp_buff=share->decode_tables+length; tmp_buff=share->decode_tables+length;
disk_cache=(byte*) (tmp_buff+512); disk_cache=(byte*) (tmp_buff+OFFSET_TABLE_SIZE);
if (my_read(file,disk_cache, if (my_read(file,disk_cache,
(uint) (share->pack.header_length-sizeof(header)), (uint) (share->pack.header_length-sizeof(header)),
...@@ -194,7 +195,7 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) ...@@ -194,7 +195,7 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
{ {
my_free((gptr) share->decode_trees,MYF(0)); my_free((gptr) share->decode_trees,MYF(0));
my_free((gptr) share->decode_tables,MYF(0)); my_free((gptr) share->decode_tables,MYF(0));
DBUG_RETURN(1); goto err2;
} }
huff_tree_bits=max_bit(trees ? trees-1 : 0); huff_tree_bits=max_bit(trees ? trees-1 : 0);
...@@ -213,8 +214,9 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) ...@@ -213,8 +214,9 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
skip_to_next_byte(&bit_buff); skip_to_next_byte(&bit_buff);
decode_table=share->decode_tables; decode_table=share->decode_tables;
for (i=0 ; i < trees ; i++) for (i=0 ; i < trees ; i++)
read_huff_table(&bit_buff,share->decode_trees+i,&decode_table, if (read_huff_table(&bit_buff,share->decode_trees+i,&decode_table,
&intervall_buff,tmp_buff); &intervall_buff,tmp_buff))
goto err3;
decode_table=(uint16*) decode_table=(uint16*)
my_realloc((gptr) share->decode_tables, my_realloc((gptr) share->decode_tables,
(uint) ((byte*) decode_table - (byte*) share->decode_tables), (uint) ((byte*) decode_table - (byte*) share->decode_tables),
...@@ -224,8 +226,7 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) ...@@ -224,8 +226,7 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
share->decode_tables=decode_table; share->decode_tables=decode_table;
for (i=0 ; i < trees ; i++) for (i=0 ; i < trees ; i++)
share->decode_trees[i].table=ADD_TO_PTR(share->decode_trees[i].table, share->decode_trees[i].table=ADD_TO_PTR(share->decode_trees[i].table,
diff, diff, uint16*);
uint16*);
} }
/* Fix record-ref-length for keys */ /* Fix record-ref-length for keys */
...@@ -242,19 +243,24 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) ...@@ -242,19 +243,24 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
} }
if (bit_buff.error || bit_buff.pos < bit_buff.end) if (bit_buff.error || bit_buff.pos < bit_buff.end)
{ /* info_length was wrong */ goto err3;
my_errno=HA_ERR_WRONG_IN_RECORD;
my_free((gptr) share->decode_trees,MYF(0));
my_free((gptr) share->decode_tables,MYF(0));
DBUG_RETURN(1);
}
DBUG_RETURN(0); DBUG_RETURN(0);
err3:
my_errno=HA_ERR_WRONG_IN_RECORD;
err2:
my_free((gptr) share->decode_tables,MYF(0));
err1:
my_free((gptr) share->decode_trees,MYF(0));
err0:
DBUG_RETURN(1);
} }
/* Read on huff-code-table from datafile */ /* Read on huff-code-table from datafile */
static void read_huff_table(MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree, static uint read_huff_table(MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree,
uint16 **decode_table, byte **intervall_buff, uint16 **decode_table, byte **intervall_buff,
uint16 *tmp_buff) uint16 *tmp_buff)
{ {
...@@ -297,7 +303,9 @@ static void read_huff_table(MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree, ...@@ -297,7 +303,9 @@ static void read_huff_table(MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree,
decode_tree->intervalls= *intervall_buff; decode_tree->intervalls= *intervall_buff;
if (! intervall_length) if (! intervall_length)
{ {
table_bits=find_longest_bitstream(tmp_buff); table_bits=find_longest_bitstream(tmp_buff, tmp_buff+OFFSET_TABLE_SIZE);
if (table_bits == (uint) ~0)
return 1;
if (table_bits > myisam_quick_table_bits) if (table_bits > myisam_quick_table_bits)
table_bits=myisam_quick_table_bits; table_bits=myisam_quick_table_bits;
next_free_offset= (1 << table_bits); next_free_offset= (1 << table_bits);
...@@ -315,7 +323,7 @@ static void read_huff_table(MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree, ...@@ -315,7 +323,7 @@ static void read_huff_table(MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree,
bit_buff->pos+=intervall_length; bit_buff->pos+=intervall_length;
bit_buff->bits=0; bit_buff->bits=0;
} }
return; return 0;
} }
...@@ -390,15 +398,23 @@ static uint copy_decode_table(uint16 *to_pos, uint offset, ...@@ -390,15 +398,23 @@ static uint copy_decode_table(uint16 *to_pos, uint offset,
} }
static uint find_longest_bitstream(uint16 *table) static uint find_longest_bitstream(uint16 *table, uint16 *end)
{ {
uint length=1,length2; uint length=1,length2;
if (!(*table & IS_CHAR)) if (!(*table & IS_CHAR))
length=find_longest_bitstream(table+ *table)+1; {
uint16 *next= table + *table;
if (next > end || next == table)
return ~0;
length=find_longest_bitstream(next, end)+1;
}
table++; table++;
if (!(*table & IS_CHAR)) if (!(*table & IS_CHAR))
{ {
length2=find_longest_bitstream(table+ *table)+1; uint16 *next= table + *table;
if (next > end || next == table)
return ~0;
length2=find_longest_bitstream(table+ *table, end)+1;
length=max(length,length2); length=max(length,length2);
} }
return length; return length;
......
...@@ -1387,13 +1387,18 @@ run_testcase () ...@@ -1387,13 +1387,18 @@ run_testcase ()
# script soon anyway so it is not worth it spending the time # script soon anyway so it is not worth it spending the time
if [ "x$USE_EMBEDDED_SERVER" = "x1" -a -z "$DO_TEST" ] ; then if [ "x$USE_EMBEDDED_SERVER" = "x1" -a -z "$DO_TEST" ] ; then
for t in \ for t in \
"alter_table" \
"bdb-deadlock" \ "bdb-deadlock" \
"connect" \ "connect" \
"ctype_latin1_de" \
"ctype_ucs" \
"flush_block_commit" \ "flush_block_commit" \
"grant2" \ "grant2" \
"grant_cache" \ "grant_cache" \
"grant" \ "grant" \
"init_connect" \ "init_connect" \
"init_file" \
"innodb" \
"innodb-deadlock" \ "innodb-deadlock" \
"innodb-lock" \ "innodb-lock" \
"mix_innodb_myisam_binlog" \ "mix_innodb_myisam_binlog" \
...@@ -1401,10 +1406,12 @@ run_testcase () ...@@ -1401,10 +1406,12 @@ run_testcase ()
"mysqlbinlog" \ "mysqlbinlog" \
"mysqldump" \ "mysqldump" \
"mysql_protocols" \ "mysql_protocols" \
"packet" \
"ps_1general" \ "ps_1general" \
"rename" \ "rename" \
"show_check" \ "show_check" \
"system_mysql_db_fix" \ "system_mysql_db_fix" \
"timezone2" \
"user_var" \ "user_var" \
"variables" "variables"
do do
......
drop table if exists t1;
SET @test_character_set= 'big5';
SET @test_collation= 'big5_chinese_ci';
SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server;
SET character_set_server= @test_character_set;
SET collation_server= @test_collation;
CREATE DATABASE d1;
USE d1;
CREATE TABLE t1 (c CHAR(10), KEY(c));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c char(10) big5_chinese_ci YES MUL NULL
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
want3results
aaa
aaaa
aaaaa
DROP TABLE t1;
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c1 varchar(15) big5_chinese_ci YES MUL NULL
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
SELECT c1 as want3results from t1 where c1 like 'l%';
want3results
location
loberge
lotre
SELECT c1 as want3results from t1 where c1 like 'lo%';
want3results
location
loberge
lotre
SELECT c1 as want1result from t1 where c1 like 'loc%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'loca%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locat%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locati%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locatio%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'location%';
want1result
location
DROP TABLE t1;
DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
SET CHARACTER SET koi8r;
DROP TABLE IF EXISTS , t1, t2;
SET CHARACTER SET koi8r;
CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp1251) SELECT _koi8r'' AS a;
CREATE TABLE t2 (a CHAR(10) CHARACTER SET utf8);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(10) character set cp1251 default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT a FROM t1;
a
SELECT HEX(a) FROM t1;
HEX(a)
EFF0EEE1E0
INSERT t2 SELECT * FROM t1;
SELECT HEX(a) FROM t2;
HEX(a)
D0BFD180D0BED0B1D0B0
DROP TABLE t1, t2;
CREATE TABLE t1 (description text character set cp1250 NOT NULL);
INSERT INTO t1 (description) VALUES (_latin2'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddde');
SELECT description FROM t1;
description
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddde
DROP TABLE t1;
CREATE TABLE t1 (a TEXT CHARACTER SET cp1251) SELECT _koi8r'' AS a;
CREATE TABLE t2 (a TEXT CHARACTER SET utf8);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` text character set cp1251
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(a) FROM t1;
HEX(a)
EFF0EEE1E0
INSERT t2 SELECT * FROM t1;
SELECT HEX(a) FROM t2;
HEX(a)
D0BFD180D0BED0B1D0B0
DROP TABLE t1, t2;
CREATE TABLE ``
(
CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT " "
) COMMENT " ";
SHOW TABLES;
Tables_in_test
SHOW CREATE TABLE ;
Table Create Table
CREATE TABLE `` (
`` char(32) character set koi8r NOT NULL default '' COMMENT ' '
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT=' '
SHOW FIELDS FROM ;
Field Type Null Key Default Extra
char(32)
SET CHARACTER SET cp1251;
SHOW TABLES;
Tables_in_test
SHOW CREATE TABLE ;
Table Create Table
CREATE TABLE `` (
`` char(32) character set koi8r NOT NULL default '' COMMENT ' '
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT=' '
SHOW FIELDS FROM ;
Field Type Null Key Default Extra
char(32)
SET CHARACTER SET utf8;
SHOW TABLES;
Tables_in_test
таблица
SHOW CREATE TABLE таблица;
Table Create Table
таблица CREATE TABLE `таблица` (
`поле` char(32) character set koi8r NOT NULL default '' COMMENT 'комментарий поля'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='комментарий таблицы'
SHOW FIELDS FROM таблица;
Field Type Null Key Default Extra
поле char(32)
SET CHARACTER SET koi8r;
DROP TABLE ;
SET CHARACTER SET default;
SET NAMES UTF8;
CREATE TABLE t1 (t text) DEFAULT CHARSET UTF8;
INSERT INTO t1 (t) VALUES ('x');
SELECT 1 FROM t1 WHERE CONCAT(_latin1'x') = t;
1
1
DROP TABLE t1;
SET CHARACTER SET koi8r;
CREATE DATABASE ;
USE ;
SHOW TABLES;
Tables_in_тест
SHOW TABLES IN ;
Tables_in_тест
SET CHARACTER SET cp1251;
SHOW TABLES;
Tables_in_тест
SHOW TABLES IN ;
Tables_in_тест
SET CHARACTER SET koi8r;
DROP DATABASE ;
SET NAMES koi8r;
SELECT hex('');
hex('тест')
D4C5D3D4
SET character_set_connection=cp1251;
SELECT hex('');
hex('тест')
F2E5F1F2
USE test;
SET NAMES binary;
CREATE TABLE `тест` (`тест` int);
SHOW CREATE TABLE `тест`;
Table Create Table
тест CREATE TABLE `тест` (
`тест` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SET NAMES utf8;
SHOW CREATE TABLE `тест`;
Table Create Table
тест CREATE TABLE `тест` (
`тест` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE `тест`;
SET NAMES binary;
SET character_set_connection=utf8;
SELECT 'тест' as s;
s
тест
SET NAMES utf8;
SET character_set_connection=binary;
SELECT 'тест' as s;
s
тест
SET NAMES latin1;
CREATE TABLE t1 (`` CHAR(128) DEFAULT '', `1` ENUM('1','2') DEFAULT '2');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`` char(128) default '',
`1` enum('1','2') default '2'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW COLUMNS FROM t1;
Field Type Null Key Default Extra
char(128) YES
1 enum('1','2') YES 2
SET NAMES binary;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`ä` char(128) default 'ä',
`ä1` enum('ä1','ä2') default 'ä2'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW COLUMNS FROM t1;
Field Type Null Key Default Extra
ä char(128) YES ä
ä1 enum('ä1','ä2') YES ä2
DROP TABLE t1;
SET NAMES binary;
CREATE TABLE `good` (a int);
ERROR HY000: Invalid utf8 character string: ''
SET NAMES utf8;
CREATE TABLE `good` (a int);
ERROR HY000: Invalid utf8 character string: '` (a int)'
set names latin1;
create table t1 (a char(10) character set koi8r, b text character set koi8r);
insert into t1 values ('test','test');
insert into t1 values ('','');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'b' at row 1
drop table t1;
set names koi8r;
create table t1 (a char(10) character set cp1251);
insert into t1 values (_koi8r'');
select * from t1 where a=_koi8r'';
a
select * from t1 where a=concat(_koi8r'');
ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (koi8r_general_ci,COERCIBLE) for operation '='
select * from t1 where a=_latin1'';
ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '='
drop table t1;
set names latin1;
set names koi8r;
create table t1 (c1 char(10) character set cp1251);
insert into t1 values ('');
select c1 from t1 where c1 between '' and '';
c1
select ifnull(c1,''), ifnull(null,c1) from t1;
ifnull(c1,'ъ') ifnull(null,c1)
select if(1,c1,''), if(0,c1,'') from t1;
if(1,c1,'Ж') if(0,c1,'Ж')
select coalesce('',c1), coalesce(null,c1) from t1;
coalesce('Ж',c1) coalesce(null,c1)
select least(c1,''), greatest(c1,'') from t1;
least(c1,'Ж') greatest(c1,'Ж')
select locate(c1,''), locate('',c1) from t1;
locate(c1,'ъ') locate('ъ',c1)
1 1
select field(c1,''),field('',c1) from t1;
field(c1,'ъ') field('ъ',c1)
1 1
select concat(c1,''), concat('',c1) from t1;
concat(c1,'Ж') concat('Ж',c1)
select concat_ws(c1,'',''), concat_ws('',c1,'') from t1;
concat_ws(c1,'Ж','ъ') concat_ws('Ж',c1,'ъ')
select replace(c1,'',''), replace('',c1,'') from t1;
replace(c1,'ъ','Ж') replace('ъ',c1,'Ж')
select substring_index(c1,'',2) from t1;
substring_index(c1,'ЖЖъъ',2)
select elt(1,c1,''),elt(1,'',c1) from t1;
elt(1,c1,'Ж') elt(1,'Ж',c1)
select make_set(3,c1,''), make_set(3,'',c1) from t1;
make_set(3,c1,'Ж') make_set(3,'Ж',c1)
, ,
select insert(c1,1,2,''),insert('',1,2,c1) from t1;
insert(c1,1,2,'Ж') insert('Ж',1,2,c1)
select trim(c1 from ''),trim('' from c1) from t1;
trim(c1 from 'ъ') trim('ъ' from c1)
select lpad(c1,3,''), lpad('',3,c1) from t1;
lpad(c1,3,'Ж') lpad('Ж',3,c1)
select rpad(c1,3,''), rpad('',3,c1) from t1;
rpad(c1,3,'Ж') rpad('Ж',3,c1)
This diff is collapsed.
This diff is collapsed.
...@@ -240,3 +240,12 @@ SELECT * FROM t1; ...@@ -240,3 +240,12 @@ SELECT * FROM t1;
pseudo date pseudo date
ZoomZip 1101106546 ZoomZip 1101106546
DROP TABLE t1; DROP TABLE t1;
create table t1(a char(2)) engine=memory;
insert into t1 values (NULL), (NULL);
delete from t1 where a is null;
insert into t1 values ('2'), ('3');
select * from t1;
a
3
2
drop table t1;
This diff is collapsed.
drop table if exists t1;
CREATE TABLE t1 (data LONGBLOB) ENGINE=myisam;
INSERT INTO t1 (data) VALUES (NULL);
UPDATE t1 set data=repeat('a',18*1024*1024);
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
select length(data) from t1;
length(data)
NULL
delete from t1 where left(data,1)='a';
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
truncate table t1;
INSERT INTO t1 (data) VALUES (repeat('a',1*1024*1024));
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
INSERT INTO t1 (data) VALUES (repeat('b',16*1024*1024-1024));
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
delete from t1 where left(data,1)='b';
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
UPDATE t1 set data=repeat('c',17*1024*1024);
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
delete from t1 where left(data,1)='c';
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
INSERT INTO t1 set data=repeat('a',18*1024*1024);
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
select length(data) from t1;
length(data)
NULL
NULL
NULL
alter table t1 modify data blob;
select length(data) from t1;
length(data)
NULL
NULL
NULL
drop table t1;
CREATE TABLE t1 (data BLOB) ENGINE=myisam;
INSERT INTO t1 (data) VALUES (NULL);
UPDATE t1 set data=repeat('a',18*1024*1024);
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
select length(data) from t1;
length(data)
NULL
drop table t1;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -791,6 +791,19 @@ Qcache_queries_in_cache 1 ...@@ -791,6 +791,19 @@ Qcache_queries_in_cache 1
unlock table; unlock table;
drop table t1,t2; drop table t1,t2;
set query_cache_wlock_invalidate=default; set query_cache_wlock_invalidate=default;
CREATE TABLE t1 (id INT PRIMARY KEY);
insert into t1 values (1),(2),(3);
select * from t1;
id
1
2
3
create temporary table t1 (a int not null auto_increment
primary key);
select * from t1;
a
drop table t1;
drop table t1;
SET NAMES koi8r; SET NAMES koi8r;
CREATE TABLE t1 (a char(1) character set koi8r); CREATE TABLE t1 (a char(1) character set koi8r);
INSERT INTO t1 VALUES (_koi8r''),(_koi8r''); INSERT INTO t1 VALUES (_koi8r''),(_koi8r'');
...@@ -901,6 +914,8 @@ set group_concat_max_len=10; ...@@ -901,6 +914,8 @@ set group_concat_max_len=10;
select group_concat(a) FROM t1 group by b; select group_concat(a) FROM t1 group by b;
group_concat(a) group_concat(a)
1234567890 1234567890
Warnings:
Warning 1260 1 line(s) were cut by GROUP_CONCAT()
set group_concat_max_len=1024; set group_concat_max_len=1024;
select group_concat(a) FROM t1 group by b; select group_concat(a) FROM t1 group by b;
group_concat(a) group_concat(a)
......
drop table if exists t1,t2,t3,t4; drop table if exists t1,t2,t3,t4;
drop table if exists t1_1,t1_2,t9_1,t9_2;
CREATE TABLE t1 ( CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
...@@ -2056,6 +2057,10 @@ t2 1 fld3 1 fld3 A NULL NULL NULL BTREE ...@@ -2056,6 +2057,10 @@ t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
drop table t4, t3, t2, t1; drop table t4, t3, t2, t1;
DO 1; DO 1;
DO benchmark(100,1+1),1,1; DO benchmark(100,1+1),1,1;
do default;
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 '' at line 1
do foobar;
ERROR 42S22: Unknown column 'foobar' in 'field list'
CREATE TABLE t1 ( CREATE TABLE t1 (
id mediumint(8) unsigned NOT NULL auto_increment, id mediumint(8) unsigned NOT NULL auto_increment,
pseudo varchar(35) NOT NULL default '', pseudo varchar(35) NOT NULL default '',
...@@ -2348,6 +2353,27 @@ select * from t2,t3 where t2.s = t3.s; ...@@ -2348,6 +2353,27 @@ select * from t2,t3 where t2.s = t3.s;
s s s s
two two two two
drop table t1, t2, t3; drop table t1, t2, t3;
create table t1 (a integer, b integer, index(a), index(b));
create table t2 (c integer, d integer, index(c), index(d));
insert into t1 values (1,2), (2,2), (3,2), (4,2);
insert into t2 values (1,3), (2,3), (3,4), (4,4);
explain select * from t1 left join t2 on a=c where d in (4);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref c,d d 5 const 2 Using where
1 SIMPLE t1 ALL a NULL NULL NULL 3 Using where
select * from t1 left join t2 on a=c where d in (4);
a b c d
3 2 3 4
4 2 4 4
explain select * from t1 left join t2 on a=c where d = 4;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref c,d d 5 const 2 Using where
1 SIMPLE t1 ALL a NULL NULL NULL 3 Using where
select * from t1 left join t2 on a=c where d = 4;
a b c d
3 2 3 4
4 2 4 4
drop table t1, t2;
CREATE TABLE t1 ( CREATE TABLE t1 (
i int(11) NOT NULL default '0', i int(11) NOT NULL default '0',
c char(10) NOT NULL default '', c char(10) NOT NULL default '',
...@@ -2360,7 +2386,4 @@ INSERT INTO t1 VALUES (3,'c'); ...@@ -2360,7 +2386,4 @@ INSERT INTO t1 VALUES (3,'c');
EXPLAIN SELECT i FROM t1 WHERE i=1; EXPLAIN SELECT i FROM t1 WHERE i=1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index 1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
EXPLAIN SELECT i FROM t1 WHERE i=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
DROP TABLE t1; DROP TABLE t1;
...@@ -684,8 +684,8 @@ id txt ...@@ -684,8 +684,8 @@ id txt
3 NULL 3 NULL
1 Chevy 1 Chevy
drop table t1; drop table t1;
CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, PRIMARY KEY (i), KEY (c(1),c(1))); CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, d varchar(1) NOT NULL DEFAULT ' ', PRIMARY KEY (i), KEY (c(1),d));
INSERT t1 VALUES (1,''),(2,''),(3,'asdfh'),(4,''); INSERT t1 (i, c) VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
select max(i) from t1 where c = ''; select max(i) from t1 where c = '';
max(i) max(i)
4 4
......
...@@ -1725,3 +1725,15 @@ a ...@@ -1725,3 +1725,15 @@ a
drop table t1; drop table t1;
create table t1 (a enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin);
insert into t1 values ('Y');
alter table t1 add b set ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
alter table t1 add c enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
select * from t1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 t1 a a 254 3 1 Y 384 0 8
def test t1 t1 b b 254 9 0 Y 2176 0 8
def test t1 t1 c c 254 3 0 Y 384 0 8
a b c
Y NULL NULL
drop table t1;
...@@ -22,14 +22,14 @@ select * from t1; ...@@ -22,14 +22,14 @@ select * from t1;
f1 f2 f1 f2
10 10 10 10
100000 100000 100000 100000
1.23457e+09 1234567890 1.23457e+9 1234567890
1e+10 10000000000 1e+10 10000000000
1e+15 1e+15 1e+15 1e+15
1e+20 1e+20 1e+20 1e+20
3.40282e+38 1e+50 3.40282e+38 1e+50
3.40282e+38 1e+150 3.40282e+38 1e+150
-10 -10 -10 -10
1e-05 1e-05 1e-5 1e-5
1e-10 1e-10 1e-10 1e-10
1e-15 1e-15 1e-15 1e-15
1e-20 1e-20 1e-20 1e-20
...@@ -137,6 +137,8 @@ t1 CREATE TABLE `t1` ( ...@@ -137,6 +137,8 @@ t1 CREATE TABLE `t1` (
drop table t1; drop table t1;
create table t1 (c20 char); create table t1 (c20 char);
insert into t1 values (5000.0); insert into t1 values (5000.0);
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
drop table t1; drop table t1;
create table t1 (f float(54)); create table t1 (f float(54));
ERROR 42000: Incorrect column specifier for column 'f' ERROR 42000: Incorrect column specifier for column 'f'
......
This diff is collapsed.
...@@ -185,3 +185,13 @@ DELETE FROM t1 WHERE date<1101106546; ...@@ -185,3 +185,13 @@ DELETE FROM t1 WHERE date<1101106546;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
#
# Bug #6878: a problem with small length records
#
create table t1(a char(2)) engine=memory;
insert into t1 values (NULL), (NULL);
delete from t1 where a is null;
insert into t1 values ('2'), ('3');
select * from t1;
drop table t1;
...@@ -471,4 +471,3 @@ execute stmt using @var, @var, @var; ...@@ -471,4 +471,3 @@ execute stmt using @var, @var, @var;
set @var=null; set @var=null;
select @var is null, @var is not null, @var; select @var is null, @var is not null, @var;
execute stmt using @var, @var, @var; execute stmt using @var, @var, @var;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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