1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge sanja.is.com.ua:/home/bell/mysql/bk/work-top3-4.1

into sanja.is.com.ua:/home/bell/mysql/bk/work-simple_in-4.1


mysql-test/r/subselect.result:
  Auto merged
mysql-test/t/subselect.test:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_select.cc:
  Auto merged
This commit is contained in:
unknown
2003-08-05 09:58:00 +03:00
34 changed files with 358 additions and 873 deletions

View File

@ -53,6 +53,8 @@ jcole@sarvik.tfr.cafe.ee
jcole@tetra.spaceapes.com jcole@tetra.spaceapes.com
jorge@linux.jorge.mysql.com jorge@linux.jorge.mysql.com
kaj@work.mysql.com kaj@work.mysql.com
konstantin@mysql.com
kostja@oak.local
lenz@kallisto.mysql.com lenz@kallisto.mysql.com
lenz@mysql.com lenz@mysql.com
miguel@hegel.(none) miguel@hegel.(none)

View File

@ -1,6 +1,6 @@
This ALPHA build of MySQL 4.1 for the Windows platform does not come with This ALPHA build of MySQL 4.1 for the Windows platform does not come
an installer. A full-featured installer is being developed for with an installer. A full-featured installer is being developed for the
the 4.1 series, and it is scheduled to be released with MySQL 4.1 BETA. 4.1 series, and it is scheduled to be released with MySQL 4.1 BETA.
** FRESH INSTALL ** ** FRESH INSTALL **
@ -14,49 +14,63 @@ in the user manual for starting/stopping MySQL:
** UPGRADE INSTALL ** ** 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: to perform the following steps:
* Backup your original install (always a good idea!) * Back up your original installation (always a good idea!)
* Unzip this archive to a separate directory from your currently
installed MySQL database (or don't unpack the 'Data' subdirectory * Unzip the 4.1 archive to a directory that is different than where your
when unzipping this archive, otherwise your databases will be over- current MySQL installation is located. (Or, if you do unzip this
written). 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 * Shut down all MySQL server processes/services.
* Remove the Win32 Service (if appropriate for your OS):
* Remove the Win32 MySQL service (if appropriate for your OS):
c:\mysql\bin\mysqld-nt --remove c:\mysql\bin\mysqld-nt --remove
* Exit 'WinMySQLAdmin' (if it is running). * 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 * If you unzipped this archive into a directory different than that
archive, excluding the 'data' directory, to the location of your existing MySQL installation, copy from the archive all its
where your current MySQL server is installed. directories and their contents EXCEPT the 'data' directory into the
* Start the MySQL server with the '--skip-grant-tables' option (assuming existing installation.
your MySQL server is installed in 'c:\mysql'):
* 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 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 * Execute the 'mysql_fix_privilege_tables.sql' script that is located in
directory: 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 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 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 ** ** Further Questions **
You can find further information about running MySQL on Windows in the 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 http://www.mysql.com/doc/en/Windows.html

View File

@ -86,9 +86,10 @@ static MYSQL mysql_connection,*sock=0;
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
*current_host=0,*path=0,*fields_terminated=0, *current_host=0,*path=0,*fields_terminated=0,
*lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0, *lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0,
*where=0, *default_charset= (char *) "binary", *where=0,
*opt_compatible_mode_str= 0, *opt_compatible_mode_str= 0,
*err_ptr= 0; *err_ptr= 0;
static char *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
static ulong opt_compatible_mode= 0; static ulong opt_compatible_mode= 0;
static uint opt_mysql_port= 0, err_len= 0; static uint opt_mysql_port= 0, err_len= 0;
static my_string opt_mysql_unix_port=0; static my_string opt_mysql_unix_port=0;

View File

@ -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 (seg->type == HA_KEYTYPE_TEXT)
{ {
if (my_strnncoll(seg->charset,(uchar*) rec1+seg->start,seg->length, if (seg->charset->coll->strnncollsp(seg->charset,
(uchar*) rec2+seg->start,seg->length)) (uchar*) rec1+seg->start,seg->length,
(uchar*) rec2+seg->start,seg->length))
return 1; return 1;
} }
else 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 (seg->type == HA_KEYTYPE_TEXT)
{ {
if (my_strnncoll(seg->charset,(uchar*) rec+seg->start, seg->length, if (seg->charset->coll->strnncollsp(seg->charset,
(uchar*) key, seg->length)) (uchar*) rec+seg->start, seg->length,
(uchar*) key, seg->length))
return 1; return 1;
} }
else else

View File

@ -264,3 +264,22 @@ select * from t1 where word like CAST(0xDF as CHAR);
word word2 word word2
<EFBFBD> <09> <EFBFBD> <09>
drop table t1; drop table t1;
CREATE TABLE t1 (
s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci
);
INSERT INTO t1 VALUES ('<27>');
INSERT INTO t1 VALUES ('ue');
SELECT DISTINCT s1 FROM t1;
s1
<EFBFBD>
SELECT s1,COUNT(*) FROM t1 GROUP BY s1;
s1 COUNT(*)
<EFBFBD> 2
SELECT COUNT(DISTINCT s1) FROM t1;
COUNT(DISTINCT s1)
1
SELECT FIELD('ue',s1), FIELD('<27>',s1), s1='ue', s1='<27>' FROM t1;
FIELD('ue',s1) FIELD('<27>',s1) s1='ue' s1='<27>'
1 1 1 1
1 1 1 1
DROP TABLE t1;

View File

@ -42,3 +42,17 @@ Field Type Null Key Default Extra
SET CHARACTER SET koi8r; SET CHARACTER SET koi8r;
DROP TABLE <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; DROP TABLE <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
SET CHARACTER SET default; SET CHARACTER SET default;
SET CHARACTER SET koi8r;
CREATE DATABASE <20><><EFBFBD><EFBFBD>;
USE <20><><EFBFBD><EFBFBD>;
SHOW TABLES;
Tables_in_<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SHOW TABLES IN <20><><EFBFBD><EFBFBD>;
Tables_in_<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SET CHARACTER SET cp1251;
SHOW TABLES;
Tables_in_<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SHOW TABLES IN <20><><EFBFBD><EFBFBD>;
Tables_in_<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SET CHARACTER SET koi8r;
DROP DATABASE <20><><EFBFBD><EFBFBD>;

View File

@ -4,771 +4,6 @@ i int(10) unsigned not null auto_increment primary key,
a varchar(255) not null, a varchar(255) not null,
FULLTEXT KEY (a) FULLTEXT KEY (a)
) TYPE=MyISAM; ) 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; repair table t1 quick;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 repair status OK test.t1 repair status OK

View File

@ -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 Case When Count(*) < MAX_REQ Then 1 Else 0 End
1 1
drop table t1; 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;

View File

@ -553,3 +553,8 @@ SUBSTR('abcdefg',-1,-1)
select SUBSTR('abcdefg',1,-1) FROM DUAL; select SUBSTR('abcdefg',1,-1) FROM DUAL;
SUBSTR('abcdefg',1,-1) 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;

View File

@ -374,22 +374,23 @@ drop database mysqltest;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 0 Qcache_queries_in_cache 0
create table t1 (a char(1) not null); create table t1 (a char(1) not null collate koi8r_general_ci);
insert into t1 values("<22>"); insert into t1 values(_koi8r"<22>");
set CHARACTER SET koi8r;
select * from t1; select * from t1;
a a
<EFBFBD> <EFBFBD>
set CHARACTER SET cp1251_koi8; set CHARACTER SET cp1251_koi8;
select * from t1; select * from t1;
a a
<EFBFBD> <EFBFBD>
set CHARACTER SET DEFAULT; set CHARACTER SET DEFAULT;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 1 Qcache_queries_in_cache 2
show status like "Qcache_hits"; show status like "Qcache_hits";
Variable_name Value Variable_name Value
Qcache_hits 5 Qcache_hits 4
drop table t1; drop table t1;
create database if not exists mysqltest; create database if not exists mysqltest;
create table mysqltest.t1 (i int not null); create table mysqltest.t1 (i int not null);
@ -415,7 +416,7 @@ Variable_name Value
Qcache_queries_in_cache 2 Qcache_queries_in_cache 2
show status like "Qcache_hits"; show status like "Qcache_hits";
Variable_name Value Variable_name Value
Qcache_hits 7 Qcache_hits 6
drop database mysqltest; drop database mysqltest;
drop table t1; drop table t1;
create table t1 (i int not null); create table t1 (i int not null);
@ -429,7 +430,7 @@ FOUND_ROWS()
4 4
show status like "Qcache_hits"; show status like "Qcache_hits";
Variable_name Value Variable_name Value
Qcache_hits 7 Qcache_hits 6
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 1 Qcache_queries_in_cache 1
@ -441,7 +442,7 @@ FOUND_ROWS()
1 1
show status like "Qcache_hits"; show status like "Qcache_hits";
Variable_name Value Variable_name Value
Qcache_hits 7 Qcache_hits 6
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 2 Qcache_queries_in_cache 2
@ -454,7 +455,7 @@ FOUND_ROWS()
4 4
show status like "Qcache_hits"; show status like "Qcache_hits";
Variable_name Value Variable_name Value
Qcache_hits 8 Qcache_hits 7
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 2 Qcache_queries_in_cache 2
@ -466,7 +467,7 @@ FOUND_ROWS()
1 1
show status like "Qcache_hits"; show status like "Qcache_hits";
Variable_name Value Variable_name Value
Qcache_hits 9 Qcache_hits 8
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 2 Qcache_queries_in_cache 2
@ -535,7 +536,7 @@ a
3 3
show status like "Qcache_hits"; show status like "Qcache_hits";
Variable_name Value Variable_name Value
Qcache_hits 12 Qcache_hits 11
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 2 Qcache_queries_in_cache 2
@ -552,7 +553,7 @@ a
3 3
show status like "Qcache_hits"; show status like "Qcache_hits";
Variable_name Value Variable_name Value
Qcache_hits 13 Qcache_hits 12
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 2 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"; show global variables like "query_cache_min_res_unit";
Variable_name Value Variable_name Value
query_cache_min_res_unit 4096 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); create table t1 (a int);
set GLOBAL query_cache_size=1000; set GLOBAL query_cache_size=1000;
show global variables like "query_cache_size"; show global variables like "query_cache_size";

View File

@ -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 2 2
1 2 1 2
drop table t1,t2,t3; 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;

View File

@ -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 binary 0xDF;
select * from t1 where word like CAST(0xDF as CHAR); select * from t1 where word like CAST(0xDF as CHAR);
drop table t1; drop table t1;
CREATE TABLE t1 (
s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci
);
INSERT INTO t1 VALUES ('<27>');
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('<27>',s1), s1='ue', s1='<27>' FROM t1;
DROP TABLE t1;

View File

@ -27,3 +27,14 @@ SHOW FIELDS FROM таблица;
SET CHARACTER SET koi8r; SET CHARACTER SET koi8r;
DROP TABLE <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; DROP TABLE <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
SET CHARACTER SET default; SET CHARACTER SET default;
SET CHARACTER SET koi8r;
CREATE DATABASE <20><><EFBFBD><EFBFBD>;
USE <20><><EFBFBD><EFBFBD>;
SHOW TABLES;
SHOW TABLES IN <20><><EFBFBD><EFBFBD>;
SET CHARACTER SET cp1251;
SHOW TABLES;
SHOW TABLES IN <20><><EFBFBD><EFBFBD>;
SET CHARACTER SET koi8r;
DROP DATABASE <20><><EFBFBD><EFBFBD>;

View File

@ -17,6 +17,7 @@ CREATE TABLE t1 (
) TYPE=MyISAM; ) TYPE=MyISAM;
# two-level entry, second-level tree with depth 2 # two-level entry, second-level tree with depth 2
--disable_query_log
let $1=260; let $1=260;
while ($1) while ($1)
{ {
@ -39,6 +40,7 @@ while ($1)
eval insert t1 (a) values ('aaayyy'); eval insert t1 (a) values ('aaayyy');
dec $1; dec $1;
} }
--enable_query_log
# converting to two-level # converting to two-level
repair table t1 quick; repair table t1 quick;

View File

@ -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 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; 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; 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;

View File

@ -305,3 +305,13 @@ select SUBSTR('abcdefg',-1,5) FROM DUAL;
select SUBSTR('abcdefg',0,0) FROM DUAL; select SUBSTR('abcdefg',0,0) FROM DUAL;
select SUBSTR('abcdefg',-1,-1) FROM DUAL; select SUBSTR('abcdefg',-1,-1) 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;

View File

@ -260,8 +260,9 @@ show status like "Qcache_queries_in_cache";
# #
# Charset convertion (cp1251_koi8 always present) # Charset convertion (cp1251_koi8 always present)
# #
create table t1 (a char(1) not null); create table t1 (a char(1) not null collate koi8r_general_ci);
insert into t1 values("<22>"); insert into t1 values(_koi8r"<22>");
set CHARACTER SET koi8r;
select * from t1; select * from t1;
set CHARACTER SET cp1251_koi8; set CHARACTER SET cp1251_koi8;
select * from t1; select * from t1;
@ -368,6 +369,15 @@ drop table t2;
set GLOBAL query_cache_min_res_unit=default; set GLOBAL query_cache_min_res_unit=default;
show global variables like "query_cache_min_res_unit"; 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 # Test of query cache resizing
# #

View File

@ -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 t2 values (0,0), (1,1), (2,1), (3,1), (4,1);
insert into t3 values (3,3), (2,2), (1,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; 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;

View File

@ -48,15 +48,19 @@ Item::Item():
THD *thd= current_thd; THD *thd= current_thd;
next= thd->free_list; // Put in free list next= thd->free_list; // Put in free list
thd->free_list= this; thd->free_list= this;
loop_id= 0;
/* /*
Item constructor can be called during execution other tnen SQL_COM Item constructor can be called during execution other tnen SQL_COM
command => we should check thd->lex.current_select on zero (thd->lex command => we should check thd->lex.current_select on zero (thd->lex
can be uninitialised) can be uninitialised)
*/ */
if (thd->lex.current_select && if (thd->lex.current_select)
thd->lex.current_select->parsing_place == SELECT_LEX_NODE::SELECT_LIST) {
thd->lex.current_select->select_items++; 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 tables
*/ */
Item::Item(THD *thd, Item &item): Item::Item(THD *thd, Item &item):
loop_id(0),
str_value(item.str_value), str_value(item.str_value),
name(item.name), name(item.name),
max_length(item.max_length), 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) 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) if (null_value)
return (int) set_field_to_null(field); 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()) sl= sl->outer_select())
{ {
table_list= (last= sl)->get_table_list(); 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 // it is primary INSERT st_select_lex => skip first table resolving
table_list= table_list->next; table_list= table_list->next;
@ -866,7 +874,8 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
table_list, &where, table_list, &where,
0)) != not_found_field) 0)) != not_found_field)
break; 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)) != REPORT_EXCEPT_NOT_FOUND)) !=
(Item **) not_found_item) (Item **) not_found_item)
break; break;
@ -1339,13 +1348,15 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
SELECT_LEX *last=0; SELECT_LEX *last=0;
for ( ; sl ; sl= sl->outer_select()) 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, &counter,
REPORT_EXCEPT_NOT_FOUND)) != REPORT_EXCEPT_NOT_FOUND)) !=
(Item **)not_found_item) (Item **)not_found_item)
break; break;
table_list= sl->get_table_list(); 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 // it is primary INSERT st_select_lex => skip first table resolving
table_list= table_list->next; 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; max_length= (*ref)->max_length;
maybe_null= (*ref)->maybe_null; maybe_null= (*ref)->maybe_null;
decimals= (*ref)->decimals; decimals= (*ref)->decimals;
set_charset((*ref)->charset()); collation.set((*ref)->collation);
with_sum_func= (*ref)->with_sum_func; with_sum_func= (*ref)->with_sum_func;
fixed= 1; fixed= 1;

View File

@ -85,7 +85,6 @@ public:
typedef bool (Item::*Item_processor)(byte *arg); typedef bool (Item::*Item_processor)(byte *arg);
class Item { class Item {
uint loop_id; /* Used to find selfrefering loops */
Item(const Item &); /* Prevent use of these */ Item(const Item &); /* Prevent use of these */
void operator=(Item &); void operator=(Item &);
public: public:

View File

@ -192,6 +192,8 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
} }
} }
fix_length_and_dec(); fix_length_and_dec();
if (thd && thd->net.last_errno) // An error inside fix_length_and_dec accured
return 1;
fixed= 1; fixed= 1;
return 0; return 0;
} }
@ -1185,8 +1187,7 @@ longlong Item_func_field::val_int()
for (uint i=1 ; i < arg_count ; i++) for (uint i=1 ; i < arg_count ; i++)
{ {
String *tmp_value=args[i]->val_str(&tmp); String *tmp_value=args[i]->val_str(&tmp);
if (tmp_value && field->length() == tmp_value->length() && if (tmp_value && !sortcmp(field,tmp_value,cmp_collation.collation))
!sortcmp(field,tmp_value,cmp_collation.collation))
return (longlong) (i); return (longlong) (i);
} }
} }

View File

@ -825,6 +825,7 @@ static Item_result set_row(SELECT_LEX *select_lex, Item * item,
if (!(row[i]= Item_cache::get_cache(res_type))) if (!(row[i]= Item_cache::get_cache(res_type)))
return STRING_RESULT; // we should return something return STRING_RESULT; // we should return something
row[i]->set_len_n_dec(sel_item->max_length, sel_item->decimals); 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) 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); DBUG_ASSERT(row || select_lex->item_list.elements==1);
res_type= set_row(select_lex, item, row, &maybe_null); res_type= set_row(select_lex, item, row, &maybe_null);
item->collation.set(row[0]->collation);
if (cols() != 1) if (cols() != 1)
maybe_null= 0; maybe_null= 0;
} }

View File

@ -199,7 +199,7 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
decimals=item->decimals; decimals=item->decimals;
maybe_null=item->maybe_null; maybe_null=item->maybe_null;
unsigned_flag=item->unsigned_flag; unsigned_flag=item->unsigned_flag;
set_charset(item->charset()); collation.set(item->collation);
result_field=0; result_field=0;
null_value=1; null_value=1;
fix_length_and_dec(); 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; Item_sum_count_distinct* item = (Item_sum_count_distinct*)arg;
CHARSET_INFO *cs=item->key_charset; CHARSET_INFO *cs=item->key_charset;
uint len=item->key_length; 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);
} }
/* /*

View File

@ -34,9 +34,9 @@
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 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 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 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 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 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 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 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 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 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 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 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 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 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 A0 A1 A1 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF

View File

@ -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 GRANT and REVOKE are applied the slave in/exclusion rules as they are
some kind of updates to the mysql.% tables. some kind of updates to the mysql.% tables.
*/ */
if (thd->slave_thread && table_rules_on && !tables_ok(0, tables)) if (thd->slave_thread && table_rules_on)
DBUG_RETURN(1); {
/*
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 #endif
if (open_and_lock_tables(thd, tables)) if (open_and_lock_tables(thd, tables))

View File

@ -1422,10 +1422,10 @@ ulong Query_cache::init_cache()
DUMP(this); 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)); query_cache_query_get_key, 0, 0));
#ifndef FN_NO_CASE_SENCE #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)); query_cache_table_get_key, 0, 0));
#else #else
// windows, OS/2 or other case insensitive file names work around // windows, OS/2 or other case insensitive file names work around

View File

@ -126,7 +126,8 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
item_list= select_cursor->item_list; item_list= select_cursor->item_list;
select_cursor->with_wild= 0; select_cursor->with_wild= 0;
if (setup_ref_array(thd, &select_cursor->ref_pointer_array, 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->order_list.elements +
select_cursor->group_list.elements)) || select_cursor->group_list.elements)) ||
setup_fields(thd, select_cursor->ref_pointer_array, first_table, setup_fields(thd, select_cursor->ref_pointer_array, first_table,

View File

@ -977,7 +977,8 @@ void st_select_lex::init_query()
join= 0; join= 0;
where= 0; where= 0;
olap= UNSPECIFIED_OLAP_TYPE; olap= UNSPECIFIED_OLAP_TYPE;
insert_select= having_fix_field= 0; having_fix_field= 0;
resolve_mode= NOMATTER_MODE;
cond_count= with_wild= 0; cond_count= with_wild= 0;
ref_pointer_array= 0; ref_pointer_array= 0;
} }
@ -1006,7 +1007,7 @@ void st_select_lex::init_select()
order_list.next= (byte**) &order_list.first; order_list.next= (byte**) &order_list.first;
select_limit= HA_POS_ERROR; select_limit= HA_POS_ERROR;
offset_limit= 0; offset_limit= 0;
select_items= 0; select_n_having_items= 0;
with_sum_func= 0; with_sum_func= 0;
parsing_place= SELECT_LEX_NODE::NO_MATTER; parsing_place= SELECT_LEX_NODE::NO_MATTER;
} }

View File

@ -349,7 +349,12 @@ public:
// Arrays of pointers to top elements of all_fields list // Arrays of pointers to top elements of all_fields list
Item **ref_pointer_array; 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 */ uint cond_count; /* number of arguments of and/or/xor in where/having */
enum_parsing_place parsing_place; /* where we are parsing expression */ enum_parsing_place parsing_place; /* where we are parsing expression */
bool with_sum_func; /* sum function indicator */ bool with_sum_func; /* sum function indicator */
@ -361,14 +366,27 @@ public:
bool braces; /* SELECT ... UNION (SELECT ... ) <- this braces */ bool braces; /* SELECT ... UNION (SELECT ... ) <- this braces */
/* TRUE when having fix field called in processing of this SELECT */ /* TRUE when having fix field called in processing of this SELECT */
bool having_fix_field; 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, (used for name resolution, see Item_fiels & Item_ref fix_fields,
FALSE for INSERT/REPLACE ... SELECT, because it's FALSE for INSERT/REPLACE ... SELECT, because it's
st_select_lex->table_list will be preprocessed (first table removed) st_select_lex->table_list will be preprocessed (first table removed)
before passing to handle_select) 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_query();
void init_select(); void init_select();

View File

@ -549,6 +549,7 @@ check_connections(THD *thd)
char *end, *user, *passwd, *db; char *end, *user, *passwd, *db;
char prepared_scramble[SCRAMBLE41_LENGTH+4]; /* Buffer for scramble&hash */ char prepared_scramble[SCRAMBLE41_LENGTH+4]; /* Buffer for scramble&hash */
ACL_USER* cached_user=NULL; /* Initialise to NULL for first stage */ ACL_USER* cached_user=NULL; /* Initialise to NULL for first stage */
String convdb;
DBUG_PRINT("info",("New connection received on %s", DBUG_PRINT("info",("New connection received on %s",
vio_description(net->vio))); vio_description(net->vio)));
@ -724,7 +725,12 @@ check_connections(THD *thd)
db=0; db=0;
using_password= test(passwd[0]); using_password= test(passwd[0]);
if (thd->client_capabilities & CLIENT_CONNECT_WITH_DB) if (thd->client_capabilities & CLIENT_CONNECT_WITH_DB)
{
db=strend(passwd)+1; 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 */ /* We can get only old hash at this point */
if (using_password && strlen(passwd) != SCRAMBLE_LENGTH) 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 thd->lex.select_lex.options=0; // We store status here
switch (command) { switch (command) {
case COM_INIT_DB: case COM_INIT_DB:
statistic_increment(com_stat[SQLCOM_CHANGE_DB],&LOCK_status); {
if (!mysql_change_db(thd,packet)) String convname;
mysql_log.write(thd,command,"%s",thd->db); statistic_increment(com_stat[SQLCOM_CHANGE_DB],&LOCK_status);
break; 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 #ifndef EMBEDDED_LIBRARY
case COM_REGISTER_SLAVE: case COM_REGISTER_SLAVE:
{ {
@ -3546,6 +3557,7 @@ mysql_new_select(LEX *lex, bool move_down)
unit->link_prev= 0; unit->link_prev= 0;
unit->return_to= lex->current_select; unit->return_to= lex->current_select;
select_lex->include_down(unit); select_lex->include_down(unit);
// TODO: assign resolve_mode for fake subquery after merging with new tree
} }
else else
{ {
@ -3571,6 +3583,7 @@ mysql_new_select(LEX *lex, bool move_down)
select_lex->master_unit()->global_parameters= select_lex; select_lex->master_unit()->global_parameters= select_lex;
select_lex->include_global((st_select_lex_node**)&lex->all_selects_list); select_lex->include_global((st_select_lex_node**)&lex->all_selects_list);
lex->current_select= select_lex; lex->current_select= select_lex;
select_lex->resolve_mode= SELECT_LEX::SELECT_MODE;
return 0; return 0;
} }

View File

@ -295,7 +295,8 @@ JOIN::prepare(Item ***rref_pointer_array,
fields_list, fields_list,
&all_fields, wild_num))) || &all_fields, wild_num))) ||
setup_ref_array(thd, rref_pointer_array, (fields_list.elements + setup_ref_array(thd, rref_pointer_array, (fields_list.elements +
select_lex->select_items + select_lex->
select_n_having_items +
og_num)) || og_num)) ||
setup_fields(thd, (*rref_pointer_array), tables_list, fields_list, 1, setup_fields(thd, (*rref_pointer_array), tables_list, fields_list, 1,
&all_fields, 1) || &all_fields, 1) ||

View File

@ -159,7 +159,8 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
item_list= select_cursor->item_list; item_list= select_cursor->item_list;
select_cursor->with_wild= 0; select_cursor->with_wild= 0;
if (setup_ref_array(thd, &select_cursor->ref_pointer_array, 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->order_list.elements +
select_cursor->group_list.elements)) || select_cursor->group_list.elements)) ||
setup_fields(thd, select_cursor->ref_pointer_array, first_table, setup_fields(thd, select_cursor->ref_pointer_array, first_table,

View File

@ -1910,7 +1910,12 @@ opt_ignore_leaves:
select: 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. */ /* Need select_init2 for subselects. */
select_init: select_init:
@ -3401,7 +3406,7 @@ insert:
lex->sql_command = SQLCOM_INSERT; lex->sql_command = SQLCOM_INSERT;
/* for subselects */ /* for subselects */
lex->lock_option= (using_update_log) ? TL_READ_NO_INSERT : TL_READ; 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 } insert_lock_option
opt_ignore insert2 opt_ignore insert2
{ {
@ -3417,7 +3422,7 @@ replace:
LEX *lex=Lex; LEX *lex=Lex;
lex->sql_command = SQLCOM_REPLACE; lex->sql_command = SQLCOM_REPLACE;
lex->duplicates= DUP_REPLACE; lex->duplicates= DUP_REPLACE;
lex->select_lex.insert_select= 1; lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE;
} }
replace_lock_option insert2 replace_lock_option insert2
{ {
@ -3486,7 +3491,7 @@ insert_values:
it is not simple select => table list will be it is not simple select => table list will be
preprocessed before passing to handle_select 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; lex->current_select->parsing_place= SELECT_LEX_NODE::SELECT_LIST;
} }
select_options select_item_list select_options select_item_list

View File

@ -7467,24 +7467,26 @@ static void test_sqlmode()
static void test_ts() static void test_ts()
{ {
MYSQL_STMT *stmt; MYSQL_STMT *stmt;
MYSQL_BIND bind[2]; MYSQL_BIND bind[6];
MYSQL_TIME ts; MYSQL_TIME ts;
MYSQL_RES *prep_res;
char strts[30]; char strts[30];
long length; long length;
int rc; int rc, field_count;
char name;
myheader("test_ts"); myheader("test_ts");
rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_ts"); rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_ts");
myquery(rc); 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); myquery(rc);
rc = mysql_commit(mysql); rc = mysql_commit(mysql);
myquery(rc); 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); mystmt_init(stmt);
ts.year= 2003; ts.year= 2003;
@ -7495,17 +7497,21 @@ static void test_ts()
ts.second= 46; ts.second= 46;
length= (long)(strmov(strts,"2003-07-12 21:07:46") - strts); length= (long)(strmov(strts,"2003-07-12 21:07:46") - strts);
bind[0].buffer_type= MYSQL_TYPE_STRING; bind[0].buffer_type= MYSQL_TYPE_TIMESTAMP;
bind[0].buffer= (char *)strts; bind[0].buffer= (char *)&ts;
bind[0].buffer_length= sizeof(strts); bind[0].buffer_length= sizeof(ts);
bind[0].is_null= 0; bind[0].is_null= 0;
bind[0].length= &length; bind[0].length= 0;
bind[1].buffer_type= MYSQL_TYPE_TIMESTAMP; bind[2]= bind[1]= bind[0];
bind[1].buffer= (char *)&ts;
bind[1].buffer_length= sizeof(ts); bind[3].buffer_type= MYSQL_TYPE_STRING;
bind[1].is_null= 0; bind[3].buffer= (char *)strts;
bind[1].length= 0; 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); rc = mysql_bind_param(stmt, bind);
mystmt(stmt,rc); mystmt(stmt,rc);
@ -7515,27 +7521,49 @@ static void test_ts()
mysql_stmt_close(stmt); 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); mystmt_init(stmt);
rc = mysql_bind_param(stmt, bind); prep_res = mysql_prepare_result(stmt);
mystmt(stmt,rc); mytest(prep_res);
rc = mysql_execute(stmt); rc = mysql_execute(stmt);
mystmt(stmt,rc); mystmt(stmt,rc);
rc = mysql_fetch(stmt); myassert( 2== my_process_stmt_result(stmt));
mystmt(stmt,rc); field_count= mysql_num_fields(prep_res);
rc = mysql_fetch(stmt);
mystmt(stmt,rc);
rc = mysql_fetch(stmt);
myassert(rc == MYSQL_NO_DATA);
mysql_free_result(prep_res);
mysql_stmt_close(stmt); mysql_stmt_close(stmt);
for (name= 'a'; field_count--; name++)
{
int row_count= 0;
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);
}
} }