diff options
34 files changed, 357 insertions, 872 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index bc24761c7f9..415461d735d 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -53,6 +53,8 @@ jcole@sarvik.tfr.cafe.ee jcole@tetra.spaceapes.com jorge@linux.jorge.mysql.com kaj@work.mysql.com +konstantin@mysql.com +kostja@oak.local lenz@kallisto.mysql.com lenz@mysql.com miguel@hegel.(none) diff --git a/Docs/README.1st b/Docs/README.1st index a6da0680924..980c043224a 100755 --- a/Docs/README.1st +++ b/Docs/README.1st @@ -1,6 +1,6 @@ -This ALPHA build of MySQL 4.1 for the Windows platform does not come with -an installer. A full-featured installer is being developed for -the 4.1 series, and it is scheduled to be released with MySQL 4.1 BETA. +This ALPHA build of MySQL 4.1 for the Windows platform does not come +with an installer. A full-featured installer is being developed for the +4.1 series, and it is scheduled to be released with MySQL 4.1 BETA. ** FRESH INSTALL ** @@ -14,49 +14,63 @@ in the user manual for starting/stopping MySQL: ** UPGRADE INSTALL ** -To install MySQL 4.1 as an upgrade to your current MySQL version, you need +To install MySQL 4.1 as an upgrade to your current version of MySQL, you need to perform the following steps: -* Backup your original install (always a good idea!) -* Unzip this archive to a separate directory from your currently - installed MySQL database (or don't unpack the 'Data' subdirectory - when unzipping this archive, otherwise your databases will be over- - written). +* Back up your original installation (always a good idea!) + +* Unzip the 4.1 archive to a directory that is different than where your + current MySQL installation is located. (Or, if you do unzip this + archive into the same location as your existing installation, do NOT + unpack the 'data' subdirectory. If you unpack the 'data' directory, + your existing databases will be overwritten.) -* Shutdown all mysql server processes/services -* Remove the Win32 Service (if appropriate for your OS): +* Shut down all MySQL server processes/services. + +* Remove the Win32 MySQL service (if appropriate for your OS): c:\mysql\bin\mysqld-nt --remove * Exit 'WinMySQLAdmin' (if it is running). -* If you unzipped this archive into a separate directory, copy all of the - directories and their contents from the location where you unzipped this - archive, excluding the 'data' directory, to the location - where your current MySQL server is installed. -* Start the MySQL server with the '--skip-grant-tables' option (assuming - your MySQL server is installed in 'c:\mysql'): + +* If you unzipped this archive into a directory different than that + of your existing MySQL installation, copy from the archive all its + directories and their contents EXCEPT the 'data' directory into the + existing installation. + +* Start the MySQL server with the '--skip-grant-tables' option. Assuming + your MySQL installation is located at 'c:\mysql', the command looks like + this: c:\mysql\bin\mysqld-opt --skip-grant-tables + + If your installation is located in some other directory, adjust the + pathname in that command (and in the following commands). -* Execute the 'mysql_fix_privilege_tables.sql' script in the 'scripts - directory: +* Execute the 'mysql_fix_privilege_tables.sql' script that is located in + the 'scripts' directory: - c:\mysql\bin\mysql < c:\mysql\scripts\mysql_fix_privilege_tables.sql + c:\mysql\bin\mysql -f mysql < c:\mysql\scripts\mysql_fix_privilege_tables.sql + + This script performs any actions necessary to convert your grant tables + to the current format. You may see some "duplicate column" warnings as + it runs; these can be ignored. -* Stop the server +* Stop the server: c:\mysql\bin\mysqladmin -u root shutdown -* Re-install the Win32 service (if required): +* Re-install the Win32 MySQL service (if required): c:\mysql\bin\mysqld-nt --install -* Re-start the server or service as normal. +* Re-start the server or service using your normal startup procedure. ** Further Questions ** You can find further information about running MySQL on Windows in the -manual that ships in the 'Doc' subdirectory, or at: +manual that ships in the 'Doc' subdirectory, or online at the MySQL AB +web site: http://www.mysql.com/doc/en/Windows.html diff --git a/client/mysqldump.c b/client/mysqldump.c index 4eb6d74cdf1..2c8628d10a8 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -86,9 +86,10 @@ static MYSQL mysql_connection,*sock=0; static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, *current_host=0,*path=0,*fields_terminated=0, *lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0, - *where=0, *default_charset= (char *) "binary", + *where=0, *opt_compatible_mode_str= 0, *err_ptr= 0; +static char *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME; static ulong opt_compatible_mode= 0; static uint opt_mysql_port= 0, err_len= 0; static my_string opt_mysql_unix_port=0; diff --git a/heap/hp_hash.c b/heap/hp_hash.c index 2a946dcd7b9..2843407f3fe 100644 --- a/heap/hp_hash.c +++ b/heap/hp_hash.c @@ -371,8 +371,9 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2) } if (seg->type == HA_KEYTYPE_TEXT) { - if (my_strnncoll(seg->charset,(uchar*) rec1+seg->start,seg->length, - (uchar*) rec2+seg->start,seg->length)) + if (seg->charset->coll->strnncollsp(seg->charset, + (uchar*) rec1+seg->start,seg->length, + (uchar*) rec2+seg->start,seg->length)) return 1; } else @@ -404,8 +405,9 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key) } if (seg->type == HA_KEYTYPE_TEXT) { - if (my_strnncoll(seg->charset,(uchar*) rec+seg->start, seg->length, - (uchar*) key, seg->length)) + if (seg->charset->coll->strnncollsp(seg->charset, + (uchar*) rec+seg->start, seg->length, + (uchar*) key, seg->length)) return 1; } else diff --git a/mysql-test/r/ctype_latin1_de.result b/mysql-test/r/ctype_latin1_de.result index e0cb7008899..7503c16a85e 100644 --- a/mysql-test/r/ctype_latin1_de.result +++ b/mysql-test/r/ctype_latin1_de.result @@ -264,3 +264,22 @@ select * from t1 where word like CAST(0xDF as CHAR); word word2 ß ß drop table t1; +CREATE TABLE t1 ( +s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci +); +INSERT INTO t1 VALUES ('Ü'); +INSERT INTO t1 VALUES ('ue'); +SELECT DISTINCT s1 FROM t1; +s1 +Ü +SELECT s1,COUNT(*) FROM t1 GROUP BY s1; +s1 COUNT(*) +Ü 2 +SELECT COUNT(DISTINCT s1) FROM t1; +COUNT(DISTINCT s1) +1 +SELECT FIELD('ue',s1), FIELD('Ü',s1), s1='ue', s1='Ü' FROM t1; +FIELD('ue',s1) FIELD('Ü',s1) s1='ue' s1='Ü' +1 1 1 1 +1 1 1 1 +DROP TABLE t1; diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result index 23a90be1306..b89a90cc6ba 100644 --- a/mysql-test/r/ctype_recoding.result +++ b/mysql-test/r/ctype_recoding.result @@ -42,3 +42,17 @@ Field Type Null Key Default Extra SET CHARACTER SET koi8r; DROP TABLE ÔÁÂÌÉÃÁ; SET CHARACTER SET default; +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 ÔÅÓÔ; diff --git a/mysql-test/r/fulltext2.result b/mysql-test/r/fulltext2.result index 8086faadba4..a35be210ece 100644 --- a/mysql-test/r/fulltext2.result +++ b/mysql-test/r/fulltext2.result @@ -4,771 +4,6 @@ i int(10) unsigned not null auto_increment primary key, a varchar(255) not null, FULLTEXT KEY (a) ) TYPE=MyISAM; -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); repair table t1 quick; Table Op Msg_type Msg_text test.t1 repair status OK diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 26ef391024e..8fad9d16dc2 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -612,3 +612,9 @@ select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = Case When Count(*) < MAX_REQ Then 1 Else 0 End 1 drop table t1; +create table t1 (a char(10)); +insert into t1 values ('a'),('b'),('c'); +select coercibility(max(a)) from t1; +coercibility(max(a)) +3 +drop table t1; diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 37694ad2f0a..929ab0535d8 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -553,3 +553,8 @@ SUBSTR('abcdefg',-1,-1) select SUBSTR('abcdefg',1,-1) FROM DUAL; SUBSTR('abcdefg',1,-1) +create table t7 (s1 char); +select * from t7 +where concat(s1 collate latin1_general_ci,s1 collate latin1_swedish_ci) = 'AA'; +ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_swedish_ci,EXPLICIT) for operation 'concat' +drop table t7; diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index 3b3e52d8240..68ddb5a377b 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -374,22 +374,23 @@ drop database mysqltest; show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 -create table t1 (a char(1) not null); -insert into t1 values("á"); +create table t1 (a char(1) not null collate koi8r_general_ci); +insert into t1 values(_koi8r"á"); +set CHARACTER SET koi8r; select * from t1; a á set CHARACTER SET cp1251_koi8; select * from t1; a -á +À set CHARACTER SET DEFAULT; show status like "Qcache_queries_in_cache"; Variable_name Value -Qcache_queries_in_cache 1 +Qcache_queries_in_cache 2 show status like "Qcache_hits"; Variable_name Value -Qcache_hits 5 +Qcache_hits 4 drop table t1; create database if not exists mysqltest; create table mysqltest.t1 (i int not null); @@ -415,7 +416,7 @@ Variable_name Value Qcache_queries_in_cache 2 show status like "Qcache_hits"; Variable_name Value -Qcache_hits 7 +Qcache_hits 6 drop database mysqltest; drop table t1; create table t1 (i int not null); @@ -429,7 +430,7 @@ FOUND_ROWS() 4 show status like "Qcache_hits"; Variable_name Value -Qcache_hits 7 +Qcache_hits 6 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 @@ -441,7 +442,7 @@ FOUND_ROWS() 1 show status like "Qcache_hits"; Variable_name Value -Qcache_hits 7 +Qcache_hits 6 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 @@ -454,7 +455,7 @@ FOUND_ROWS() 4 show status like "Qcache_hits"; Variable_name Value -Qcache_hits 8 +Qcache_hits 7 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 @@ -466,7 +467,7 @@ FOUND_ROWS() 1 show status like "Qcache_hits"; Variable_name Value -Qcache_hits 9 +Qcache_hits 8 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 @@ -535,7 +536,7 @@ a 3 show status like "Qcache_hits"; Variable_name Value -Qcache_hits 12 +Qcache_hits 11 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 @@ -552,7 +553,7 @@ a 3 show status like "Qcache_hits"; Variable_name Value -Qcache_hits 13 +Qcache_hits 12 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 @@ -561,6 +562,15 @@ set GLOBAL query_cache_min_res_unit=default; show global variables like "query_cache_min_res_unit"; Variable_name Value query_cache_min_res_unit 4096 +create table t1 (a int not null); +insert into t1 values (1); +select "aaa" from t1; +aaa +aaa +select "AAA" from t1; +AAA +AAA +drop table t1; create table t1 (a int); set GLOBAL query_cache_size=1000; show global variables like "query_cache_size"; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index e941c115b2c..defb88a6ade 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -1317,3 +1317,17 @@ a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 an 2 2 1 2 drop table t1,t2,t3; +create table t1 (s1 int); +create table t2 (s1 int); +insert into t1 values (1); +insert into t2 values (1); +select * from t1 where exists (select s1 from t2 having max(t2.s1)=t1.s1); +s1 +drop table t1,t2; +create table t1 (s1 int); +create table t2 (s1 int); +insert into t1 values (1); +insert into t2 values (1); +update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A); +ERROR 42S02: Unknown table 'x' in field list +DROP TABLE t1, t2; diff --git a/mysql-test/t/ctype_latin1_de.test b/mysql-test/t/ctype_latin1_de.test index 22a4e14158d..00ac128a478 100644 --- a/mysql-test/t/ctype_latin1_de.test +++ b/mysql-test/t/ctype_latin1_de.test @@ -73,3 +73,14 @@ select * from t1 where word like 'AE'; select * from t1 where word like binary 0xDF; select * from t1 where word like CAST(0xDF as CHAR); drop table t1; + +CREATE TABLE t1 ( +s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci +); +INSERT INTO t1 VALUES ('Ü'); +INSERT INTO t1 VALUES ('ue'); +SELECT DISTINCT s1 FROM t1; +SELECT s1,COUNT(*) FROM t1 GROUP BY s1; +SELECT COUNT(DISTINCT s1) FROM t1; +SELECT FIELD('ue',s1), FIELD('Ü',s1), s1='ue', s1='Ü' FROM t1; +DROP TABLE t1; diff --git a/mysql-test/t/ctype_recoding.test b/mysql-test/t/ctype_recoding.test index 68526806166..8fa31b1f17b 100644 --- a/mysql-test/t/ctype_recoding.test +++ b/mysql-test/t/ctype_recoding.test @@ -27,3 +27,14 @@ SHOW FIELDS FROM таблица; SET CHARACTER SET koi8r; DROP TABLE ÔÁÂÌÉÃÁ; SET CHARACTER SET default; + +SET CHARACTER SET koi8r; +CREATE DATABASE ÔÅÓÔ; +USE ÔÅÓÔ; +SHOW TABLES; +SHOW TABLES IN ÔÅÓÔ; +SET CHARACTER SET cp1251; +SHOW TABLES; +SHOW TABLES IN òåñò; +SET CHARACTER SET koi8r; +DROP DATABASE ÔÅÓÔ; diff --git a/mysql-test/t/fulltext2.test b/mysql-test/t/fulltext2.test index 2c0d352a870..b739d60e3b3 100644 --- a/mysql-test/t/fulltext2.test +++ b/mysql-test/t/fulltext2.test @@ -17,6 +17,7 @@ CREATE TABLE t1 ( ) TYPE=MyISAM; # two-level entry, second-level tree with depth 2 +--disable_query_log let $1=260; while ($1) { @@ -39,6 +40,7 @@ while ($1) eval insert t1 (a) values ('aaayyy'); dec $1; } +--enable_query_log # converting to two-level repair table t1 quick; diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index fed19cbe07c..8a43716d854 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -355,3 +355,8 @@ insert into t1 values (1, 3); select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ; select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ; drop table t1; + +create table t1 (a char(10)); +insert into t1 values ('a'),('b'),('c'); +select coercibility(max(a)) from t1; +drop table t1; diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index f158eaa3764..4c996121446 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -305,3 +305,13 @@ select SUBSTR('abcdefg',-1,5) FROM DUAL; select SUBSTR('abcdefg',0,0) FROM DUAL; select SUBSTR('abcdefg',-1,-1) FROM DUAL; select SUBSTR('abcdefg',1,-1) FROM DUAL; + +# +# Test that fix_fields doesn't follow to upper level (to comparison) +# when an error on a lower level (in concat) has accured: +# +create table t7 (s1 char); +--error 1265 +select * from t7 +where concat(s1 collate latin1_general_ci,s1 collate latin1_swedish_ci) = 'AA'; +drop table t7; diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index 929146ba97a..6261260115c 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -260,8 +260,9 @@ show status like "Qcache_queries_in_cache"; # # Charset convertion (cp1251_koi8 always present) # -create table t1 (a char(1) not null); -insert into t1 values("á"); +create table t1 (a char(1) not null collate koi8r_general_ci); +insert into t1 values(_koi8r"á"); +set CHARACTER SET koi8r; select * from t1; set CHARACTER SET cp1251_koi8; select * from t1; @@ -369,6 +370,15 @@ set GLOBAL query_cache_min_res_unit=default; show global variables like "query_cache_min_res_unit"; # +# Case sensitive test +# +create table t1 (a int not null); +insert into t1 values (1); +select "aaa" from t1; +select "AAA" from t1; +drop table t1; + +# # Test of query cache resizing # create table t1 (a int); diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 9ceed286063..6edbbf14b38 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -864,4 +864,26 @@ insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10); insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1); insert into t3 values (3,3), (2,2), (1,1); select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3; -drop table t1,t2,t3;s +drop table t1,t2,t3; + +# +# aggregate functions in HAVING test +# +create table t1 (s1 int); +create table t2 (s1 int); +insert into t1 values (1); +insert into t2 values (1); +select * from t1 where exists (select s1 from t2 having max(t2.s1)=t1.s1); +drop table t1,t2; +# +# update subquery with wrong field (to force name resolving +# in UPDATE name space) +# +create table t1 (s1 int); +create table t2 (s1 int); +insert into t1 values (1); +insert into t2 values (1); +-- error 1109 +update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A); +DROP TABLE t1, t2; + diff --git a/sql/item.cc b/sql/item.cc index c7d0927c970..5604e709ff5 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -48,15 +48,19 @@ Item::Item(): THD *thd= current_thd; next= thd->free_list; // Put in free list thd->free_list= this; - loop_id= 0; /* Item constructor can be called during execution other tnen SQL_COM command => we should check thd->lex.current_select on zero (thd->lex can be uninitialised) */ - if (thd->lex.current_select && - thd->lex.current_select->parsing_place == SELECT_LEX_NODE::SELECT_LIST) - thd->lex.current_select->select_items++; + if (thd->lex.current_select) + { + SELECT_LEX_NODE::enum_parsing_place place= + thd->lex.current_select->parsing_place; + if (place == SELECT_LEX_NODE::SELECT_LIST || + place == SELECT_LEX_NODE::IN_HAVING) + thd->lex.current_select->select_n_having_items++; + } } /* @@ -65,7 +69,6 @@ Item::Item(): tables */ Item::Item(THD *thd, Item &item): - loop_id(0), str_value(item.str_value), name(item.name), max_length(item.max_length), @@ -538,6 +541,11 @@ void Item_param::set_longdata(const char *str, ulong length) int Item_param::save_in_field(Field *field, bool no_conversions) { + THD *thd= current_thd; + + if (thd->command == COM_PREPARE) + return -1; + if (null_value) return (int) set_field_to_null(field); @@ -857,7 +865,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) sl= sl->outer_select()) { table_list= (last= sl)->get_table_list(); - if (sl->insert_select && table_list) + if (sl->resolve_mode == SELECT_LEX::INSERT_MODE && table_list) { // it is primary INSERT st_select_lex => skip first table resolving table_list= table_list->next; @@ -866,7 +874,8 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) table_list, &where, 0)) != not_found_field) break; - if ((refer= find_item_in_list(this, sl->item_list, &counter, + if (sl->resolve_mode == SELECT_LEX::SELECT_MODE && + (refer= find_item_in_list(this, sl->item_list, &counter, REPORT_EXCEPT_NOT_FOUND)) != (Item **) not_found_item) break; @@ -1339,13 +1348,15 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) SELECT_LEX *last=0; for ( ; sl ; sl= sl->outer_select()) { - if ((ref= find_item_in_list(this, (last= sl)->item_list, + last= sl; + if (sl->resolve_mode == SELECT_LEX::SELECT_MODE && + (ref= find_item_in_list(this, sl->item_list, &counter, REPORT_EXCEPT_NOT_FOUND)) != (Item **)not_found_item) break; table_list= sl->get_table_list(); - if (sl->insert_select && table_list) + if (sl->resolve_mode == SELECT_LEX::INSERT_MODE && table_list) { // it is primary INSERT st_select_lex => skip first table resolving table_list= table_list->next; @@ -1431,7 +1442,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) max_length= (*ref)->max_length; maybe_null= (*ref)->maybe_null; decimals= (*ref)->decimals; - set_charset((*ref)->charset()); + collation.set((*ref)->collation); with_sum_func= (*ref)->with_sum_func; fixed= 1; diff --git a/sql/item.h b/sql/item.h index da1c3dd9e51..b29ad7fed22 100644 --- a/sql/item.h +++ b/sql/item.h @@ -85,7 +85,6 @@ public: typedef bool (Item::*Item_processor)(byte *arg); class Item { - uint loop_id; /* Used to find selfrefering loops */ Item(const Item &); /* Prevent use of these */ void operator=(Item &); public: diff --git a/sql/item_func.cc b/sql/item_func.cc index 8a27bf16b37..db9a04dd2b5 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -192,6 +192,8 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) } } fix_length_and_dec(); + if (thd && thd->net.last_errno) // An error inside fix_length_and_dec accured + return 1; fixed= 1; return 0; } @@ -1185,8 +1187,7 @@ longlong Item_func_field::val_int() for (uint i=1 ; i < arg_count ; i++) { String *tmp_value=args[i]->val_str(&tmp); - if (tmp_value && field->length() == tmp_value->length() && - !sortcmp(field,tmp_value,cmp_collation.collation)) + if (tmp_value && !sortcmp(field,tmp_value,cmp_collation.collation)) return (longlong) (i); } } diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 3d2a88d29e5..68655d51521 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -825,6 +825,7 @@ static Item_result set_row(SELECT_LEX *select_lex, Item * item, if (!(row[i]= Item_cache::get_cache(res_type))) return STRING_RESULT; // we should return something row[i]->set_len_n_dec(sel_item->max_length, sel_item->decimals); + row[i]->collation.set(sel_item->collation); } } if (select_lex->item_list.elements > 1) @@ -836,6 +837,7 @@ void subselect_single_select_engine::fix_length_and_dec(Item_cache **row) { DBUG_ASSERT(row || select_lex->item_list.elements==1); res_type= set_row(select_lex, item, row, &maybe_null); + item->collation.set(row[0]->collation); if (cols() != 1) maybe_null= 0; } diff --git a/sql/item_sum.cc b/sql/item_sum.cc index fde39135358..651302ecec5 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -199,7 +199,7 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) decimals=item->decimals; maybe_null=item->maybe_null; unsigned_flag=item->unsigned_flag; - set_charset(item->charset()); + collation.set(item->collation); result_field=0; null_value=1; fix_length_and_dec(); @@ -1023,7 +1023,9 @@ int simple_str_key_cmp(void* arg, byte* key1, byte* key2) Item_sum_count_distinct* item = (Item_sum_count_distinct*)arg; CHARSET_INFO *cs=item->key_charset; uint len=item->key_length; - return my_strnncoll(cs, (const uchar*) key1, len, (const uchar*) key2, len); + return cs->coll->strnncollsp(cs, + (const uchar*) key1, len, + (const uchar*) key2, len); } /* diff --git a/sql/share/charsets/cp1251.xml b/sql/share/charsets/cp1251.xml index 795022cc179..94774cca0f1 100644 --- a/sql/share/charsets/cp1251.xml +++ b/sql/share/charsets/cp1251.xml @@ -34,9 +34,9 @@ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 90 83 82 83 84 85 86 87 88 89 9A 8B 9C 9D 9E 9F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A2 A2 BC A4 B4 A6 A7 B8 A9 BA AB AC AD AE BF @@ -56,9 +56,9 @@ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F 80 81 82 81 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 80 91 92 93 94 95 96 97 98 99 8A 9B 8C 9D 8E 8F A0 A1 A1 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 598ff153cad..54a0ee05db2 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -3221,8 +3221,17 @@ int open_grant_tables(THD *thd, TABLE_LIST *tables) GRANT and REVOKE are applied the slave in/exclusion rules as they are some kind of updates to the mysql.% tables. */ - if (thd->slave_thread && table_rules_on && !tables_ok(0, tables)) - DBUG_RETURN(1); + if (thd->slave_thread && table_rules_on) + { + /* + The tables must be marked "updating" so that tables_ok() takes them into + account in tests. + */ + tables[0].updating=tables[1].updating=tables[2].updating=tables[3].updating=1; + if (!tables_ok(0, tables)) + DBUG_RETURN(1); + tables[0].updating=tables[1].updating=tables[2].updating=tables[3].updating=0; + } #endif if (open_and_lock_tables(thd, tables)) diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index ac6471e794c..767a1a46dcc 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1422,10 +1422,10 @@ ulong Query_cache::init_cache() DUMP(this); - VOID(hash_init(&queries,system_charset_info,def_query_hash_size, 0, 0, + VOID(hash_init(&queries, &my_charset_bin, def_query_hash_size, 0, 0, query_cache_query_get_key, 0, 0)); #ifndef FN_NO_CASE_SENCE - VOID(hash_init(&tables,system_charset_info,def_table_hash_size, 0, 0, + VOID(hash_init(&tables, &my_charset_bin, def_table_hash_size, 0, 0, query_cache_table_get_key, 0, 0)); #else // windows, OS/2 or other case insensitive file names work around diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 92e37f95f0e..436d9412063 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -126,7 +126,8 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, item_list= select_cursor->item_list; select_cursor->with_wild= 0; if (setup_ref_array(thd, &select_cursor->ref_pointer_array, - (item_list.elements + select_cursor->select_items + + (item_list.elements + + select_cursor->select_n_having_items + select_cursor->order_list.elements + select_cursor->group_list.elements)) || setup_fields(thd, select_cursor->ref_pointer_array, first_table, diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 7bdb1a45ad8..2d1d08aa596 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -977,7 +977,8 @@ void st_select_lex::init_query() join= 0; where= 0; olap= UNSPECIFIED_OLAP_TYPE; - insert_select= having_fix_field= 0; + having_fix_field= 0; + resolve_mode= NOMATTER_MODE; cond_count= with_wild= 0; ref_pointer_array= 0; } @@ -1006,7 +1007,7 @@ void st_select_lex::init_select() order_list.next= (byte**) &order_list.first; select_limit= HA_POS_ERROR; offset_limit= 0; - select_items= 0; + select_n_having_items= 0; with_sum_func= 0; parsing_place= SELECT_LEX_NODE::NO_MATTER; } diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 6d47894d737..fb336faa2a6 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -349,7 +349,12 @@ public: // Arrays of pointers to top elements of all_fields list Item **ref_pointer_array; - uint select_items; /* number of items in select_list */ + /* + number of items in select_list and HAVING clause used to get number + bigger then can be number of entries that will be added to all item + list during split_sum_func + */ + uint select_n_having_items; uint cond_count; /* number of arguments of and/or/xor in where/having */ enum_parsing_place parsing_place; /* where we are parsing expression */ bool with_sum_func; /* sum function indicator */ @@ -361,14 +366,27 @@ public: bool braces; /* SELECT ... UNION (SELECT ... ) <- this braces */ /* TRUE when having fix field called in processing of this SELECT */ bool having_fix_field; + /* - TRUE for primary st_select_lex structure of simple INSERT/REPLACE + SELECT for SELECT command st_select_lex. Used to privent scaning + item_list of non-SELECT st_select_lex (no sense find to finding + reference in it (all should be in tables, it is dangerouse due + to order of fix_fields calling for non-SELECTs commands (item list + can be not fix_fieldsd)). This value will be assigned for + primary select (sql_yac.yy) and for any subquery and + UNION SELECT (sql_parse.cc mysql_new_select()) + + + INSERT for primary st_select_lex structure of simple INSERT/REPLACE (used for name resolution, see Item_fiels & Item_ref fix_fields, FALSE for INSERT/REPLACE ... SELECT, because it's st_select_lex->table_list will be preprocessed (first table removed) before passing to handle_select) + + NOMATTER for other */ - bool insert_select; + enum {NOMATTER_MODE, SELECT_MODE, INSERT_MODE} resolve_mode; + void init_query(); void init_select(); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b718fa922c0..f0eba167b90 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -549,6 +549,7 @@ check_connections(THD *thd) char *end, *user, *passwd, *db; char prepared_scramble[SCRAMBLE41_LENGTH+4]; /* Buffer for scramble&hash */ ACL_USER* cached_user=NULL; /* Initialise to NULL for first stage */ + String convdb; DBUG_PRINT("info",("New connection received on %s", vio_description(net->vio))); @@ -724,7 +725,12 @@ check_connections(THD *thd) db=0; using_password= test(passwd[0]); if (thd->client_capabilities & CLIENT_CONNECT_WITH_DB) + { db=strend(passwd)+1; + convdb.copy(db, strlen(db), + thd->variables.character_set_client, system_charset_info); + db= convdb.c_ptr(); + } /* We can get only old hash at this point */ if (using_password && strlen(passwd) != SCRAMBLE_LENGTH) @@ -1125,10 +1131,15 @@ bool dispatch_command(enum enum_server_command command, THD *thd, thd->lex.select_lex.options=0; // We store status here switch (command) { case COM_INIT_DB: - statistic_increment(com_stat[SQLCOM_CHANGE_DB],&LOCK_status); - if (!mysql_change_db(thd,packet)) - mysql_log.write(thd,command,"%s",thd->db); - break; + { + String convname; + statistic_increment(com_stat[SQLCOM_CHANGE_DB],&LOCK_status); + convname.copy(packet, strlen(packet), + thd->variables.character_set_client, system_charset_info); + if (!mysql_change_db(thd,convname.c_ptr())) + mysql_log.write(thd,command,"%s",thd->db); + break; + } #ifndef EMBEDDED_LIBRARY case COM_REGISTER_SLAVE: { @@ -3546,6 +3557,7 @@ mysql_new_select(LEX *lex, bool move_down) unit->link_prev= 0; unit->return_to= lex->current_select; select_lex->include_down(unit); + // TODO: assign resolve_mode for fake subquery after merging with new tree } else { @@ -3571,6 +3583,7 @@ mysql_new_select(LEX *lex, bool move_down) select_lex->master_unit()->global_parameters= select_lex; select_lex->include_global((st_select_lex_node**)&lex->all_selects_list); lex->current_select= select_lex; + select_lex->resolve_mode= SELECT_LEX::SELECT_MODE; return 0; } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 3c5c53422ae..ad0e30d0739 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -295,7 +295,8 @@ JOIN::prepare(Item ***rref_pointer_array, fields_list, &all_fields, wild_num))) || setup_ref_array(thd, rref_pointer_array, (fields_list.elements + - select_lex->select_items + + select_lex-> + select_n_having_items + og_num)) || setup_fields(thd, (*rref_pointer_array), tables_list, fields_list, 1, &all_fields, 1) || diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 0866163b3fd..cf338be16aa 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -159,7 +159,8 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result, item_list= select_cursor->item_list; select_cursor->with_wild= 0; if (setup_ref_array(thd, &select_cursor->ref_pointer_array, - (item_list.elements + select_cursor->select_items + + (item_list.elements + + select_cursor->select_n_having_items + select_cursor->order_list.elements + select_cursor->group_list.elements)) || setup_fields(thd, select_cursor->ref_pointer_array, first_table, diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 73284286761..5af02a7b2ba 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1910,7 +1910,12 @@ opt_ignore_leaves: select: - select_init { Lex->sql_command=SQLCOM_SELECT; }; + select_init + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SELECT; + lex->select_lex.resolve_mode= SELECT_LEX::SELECT_MODE; + }; /* Need select_init2 for subselects. */ select_init: @@ -3401,7 +3406,7 @@ insert: lex->sql_command = SQLCOM_INSERT; /* for subselects */ lex->lock_option= (using_update_log) ? TL_READ_NO_INSERT : TL_READ; - lex->select_lex.insert_select= 1; + lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE; } insert_lock_option opt_ignore insert2 { @@ -3417,7 +3422,7 @@ replace: LEX *lex=Lex; lex->sql_command = SQLCOM_REPLACE; lex->duplicates= DUP_REPLACE; - lex->select_lex.insert_select= 1; + lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE; } replace_lock_option insert2 { @@ -3486,7 +3491,7 @@ insert_values: it is not simple select => table list will be preprocessed before passing to handle_select */ - lex->select_lex.insert_select= 0; + lex->select_lex.resolve_mode= SELECT_LEX::NOMATTER_MODE; lex->current_select->parsing_place= SELECT_LEX_NODE::SELECT_LIST; } select_options select_item_list diff --git a/tests/client_test.c b/tests/client_test.c index 6ee7487ac45..6aeb865aa20 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -7467,24 +7467,26 @@ static void test_sqlmode() static void test_ts() { MYSQL_STMT *stmt; - MYSQL_BIND bind[2]; + MYSQL_BIND bind[6]; MYSQL_TIME ts; + MYSQL_RES *prep_res; char strts[30]; long length; - int rc; + int rc, field_count; + char name; myheader("test_ts"); rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_ts"); myquery(rc); - rc= mysql_query(mysql,"CREATE TABLE test_ts(a TIMESTAMP)"); + rc= mysql_query(mysql,"CREATE TABLE test_ts(a DATE, b TIME, c TIMESTAMP)"); myquery(rc); rc = mysql_commit(mysql); myquery(rc); - stmt = mysql_prepare(mysql,"INSERT INTO test_ts VALUES(?),(?)",40); + stmt = mysql_prepare(mysql,"INSERT INTO test_ts VALUES(?,?,?),(?,?,?)",50); mystmt_init(stmt); ts.year= 2003; @@ -7495,17 +7497,21 @@ static void test_ts() ts.second= 46; length= (long)(strmov(strts,"2003-07-12 21:07:46") - strts); - bind[0].buffer_type= MYSQL_TYPE_STRING; - bind[0].buffer= (char *)strts; - bind[0].buffer_length= sizeof(strts); + bind[0].buffer_type= MYSQL_TYPE_TIMESTAMP; + bind[0].buffer= (char *)&ts; + bind[0].buffer_length= sizeof(ts); bind[0].is_null= 0; - bind[0].length= &length; + bind[0].length= 0; - bind[1].buffer_type= MYSQL_TYPE_TIMESTAMP; - bind[1].buffer= (char *)&ts; - bind[1].buffer_length= sizeof(ts); - bind[1].is_null= 0; - bind[1].length= 0; + bind[2]= bind[1]= bind[0]; + + bind[3].buffer_type= MYSQL_TYPE_STRING; + bind[3].buffer= (char *)strts; + bind[3].buffer_length= sizeof(strts); + bind[3].is_null= 0; + bind[3].length= &length; + + bind[5]= bind[4]= bind[3]; rc = mysql_bind_param(stmt, bind); mystmt(stmt,rc); @@ -7515,27 +7521,49 @@ static void test_ts() mysql_stmt_close(stmt); - verify_col_data("test_ts","a","2003-07-12 21:07:46"); + verify_col_data("test_ts","a","2003-07-12"); + verify_col_data("test_ts","b","21:07:46"); + verify_col_data("test_ts","c","2003-07-12 21:07:46"); - stmt = mysql_prepare(mysql,"SELECT a FROM test_ts WHERE a >= ?",50); + stmt = mysql_prepare(mysql,"SELECT * FROM test_ts",50); mystmt_init(stmt); - rc = mysql_bind_param(stmt, bind); - mystmt(stmt,rc); + prep_res = mysql_prepare_result(stmt); + mytest(prep_res); rc = mysql_execute(stmt); mystmt(stmt,rc); - rc = mysql_fetch(stmt); - mystmt(stmt,rc); + myassert( 2== my_process_stmt_result(stmt)); + field_count= mysql_num_fields(prep_res); - rc = mysql_fetch(stmt); - mystmt(stmt,rc); + mysql_free_result(prep_res); + mysql_stmt_close(stmt); - rc = mysql_fetch(stmt); - myassert(rc == MYSQL_NO_DATA); + for (name= 'a'; field_count--; name++) + { + int row_count= 0; - mysql_stmt_close(stmt); + sprintf(query,"SELECT a,b,c FROM test_ts WHERE %c=?",name); + length= (long)(strmov(query,query)- query); + + fprintf(stdout,"\n %s", query); + stmt = mysql_prepare(mysql, query, length); + mystmt_init(stmt); + + rc = mysql_bind_param(stmt, bind); + mystmt(stmt,rc); + + rc = mysql_execute(stmt); + mystmt(stmt,rc); + + while (mysql_fetch(stmt) == 0) + row_count++; + + fprintf(stdout, "\n returned '%d' rows", row_count); + myassert(row_count == 2); + mysql_stmt_close(stmt); + } } |