Merge bk-internal.mysql.com:/data0/bk/mysql-5.0
into bk-internal.mysql.com:/data0/bk/mysql-5.0-kt client/mysql.cc: Auto merged mysql-test/r/im_life_cycle.result: Auto merged mysql-test/t/im_life_cycle.imtest: Auto merged sql/sql_lex.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_view.cc: Auto merged sql/table.h: Auto merged
This commit is contained in:
commit
6017f911e3
1
BitKeeper/etc/collapsed
Normal file
1
BitKeeper/etc/collapsed
Normal file
@ -0,0 +1 @@
|
||||
44d03f27qNdqJmARzBoP3Is_cN5e0w
|
@ -1221,7 +1221,8 @@ static bool add_line(String &buffer,char *line,char *in_string,
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (!*ml_comment && inchar == '\\')
|
||||
if (!*ml_comment && inchar == '\\' &&
|
||||
!(mysql.server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES))
|
||||
{
|
||||
// Found possbile one character command like \c
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
/* That one is necessary for defines of OPTION_NO_FOREIGN_KEY_CHECKS etc */
|
||||
#include "mysql_priv.h"
|
||||
#include "log_event.h"
|
||||
#include "sql_common.h"
|
||||
|
||||
#define BIN_LOG_HEADER_SIZE 4
|
||||
#define PROBE_HEADER_LEN (EVENT_LEN_OFFSET+4)
|
||||
@ -1077,7 +1078,7 @@ could be out of memory");
|
||||
const char *error_msg;
|
||||
Log_event *ev;
|
||||
|
||||
len = net_safe_read(mysql);
|
||||
len= cli_safe_read(mysql);
|
||||
if (len == packet_error)
|
||||
{
|
||||
fprintf(stderr, "Got error reading packet from server: %s\n",
|
||||
|
@ -620,7 +620,7 @@ static void die(const char *fmt, ...)
|
||||
if (cur_file && cur_file != file_stack)
|
||||
fprintf(stderr, "In included file \"%s\": ",
|
||||
cur_file->file_name);
|
||||
if (start_lineno != 0)
|
||||
if (start_lineno > 0)
|
||||
fprintf(stderr, "At line %u: ", start_lineno);
|
||||
vfprintf(stderr, fmt, args);
|
||||
fprintf(stderr, "\n");
|
||||
|
@ -848,7 +848,6 @@ int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
|
||||
#define stmt_command(mysql, command, arg, length, stmt) \
|
||||
(*(mysql)->methods->advanced_command)(mysql, command, NullS, \
|
||||
0, arg, length, 1, stmt)
|
||||
unsigned long net_safe_read(MYSQL* mysql);
|
||||
|
||||
#ifdef __NETWARE__
|
||||
#pragma pack(pop) /* restore alignment */
|
||||
|
@ -140,7 +140,6 @@ enum enum_server_command
|
||||
|
||||
#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
|
||||
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
|
||||
#define SERVER_STATUS_MORE_RESULTS 4 /* More results on server */
|
||||
#define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */
|
||||
#define SERVER_QUERY_NO_GOOD_INDEX_USED 16
|
||||
#define SERVER_QUERY_NO_INDEX_USED 32
|
||||
|
@ -36,7 +36,7 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
|
||||
const char *header, ulong header_length,
|
||||
const char *arg, ulong arg_length, my_bool skip_check,
|
||||
MYSQL_STMT *stmt);
|
||||
|
||||
unsigned long cli_safe_read(MYSQL *mysql);
|
||||
void set_stmt_errmsg(MYSQL_STMT * stmt, const char *err, int errcode,
|
||||
const char *sqlstate);
|
||||
void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate);
|
||||
|
@ -439,7 +439,7 @@ retry_page_get:
|
||||
if (UNIV_LIKELY_NULL(heap)) {
|
||||
mem_heap_free(heap);
|
||||
}
|
||||
return;
|
||||
goto func_exit;
|
||||
}
|
||||
|
||||
/* Insert to the insert buffer did not succeed:
|
||||
@ -555,6 +555,7 @@ retry_page_get:
|
||||
|| mode != PAGE_CUR_LE);
|
||||
}
|
||||
|
||||
func_exit:
|
||||
if (has_search_latch) {
|
||||
|
||||
rw_lock_s_lock(&btr_search_latch);
|
||||
|
@ -251,9 +251,6 @@ struct fil_system_struct {
|
||||
initialized. */
|
||||
fil_system_t* fil_system = NULL;
|
||||
|
||||
/* The tablespace memory cache hash table size */
|
||||
#define FIL_SYSTEM_HASH_SIZE 50 /* TODO: make bigger! */
|
||||
|
||||
|
||||
/************************************************************************
|
||||
NOTE: you must call fil_mutex_enter_and_prepare_for_io() first!
|
||||
@ -1324,11 +1321,17 @@ fil_init(
|
||||
/*=====*/
|
||||
ulint max_n_open) /* in: max number of open files */
|
||||
{
|
||||
ulint hash_size;
|
||||
|
||||
ut_a(fil_system == NULL);
|
||||
|
||||
/*printf("Initializing the tablespace cache with max %lu open files\n",
|
||||
max_n_open); */
|
||||
fil_system = fil_system_create(FIL_SYSTEM_HASH_SIZE, max_n_open);
|
||||
if (srv_file_per_table) {
|
||||
hash_size = 50000;
|
||||
} else {
|
||||
hash_size = 5000;
|
||||
}
|
||||
|
||||
fil_system = fil_system_create(hash_size, max_n_open);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -950,14 +950,11 @@ ibool
|
||||
ibuf_fixed_addr_page(
|
||||
/*=================*/
|
||||
/* out: TRUE if a fixed address ibuf i/o page */
|
||||
ulint space, /* in: space id */
|
||||
ulint page_no)/* in: page number */
|
||||
{
|
||||
if ((ibuf_bitmap_page(page_no))
|
||||
|| (page_no == IBUF_TREE_ROOT_PAGE_NO)) {
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
return(FALSE);
|
||||
return((space == 0 && page_no == IBUF_TREE_ROOT_PAGE_NO)
|
||||
|| ibuf_bitmap_page(page_no));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -981,7 +978,7 @@ ibuf_page(
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
if (ibuf_fixed_addr_page(page_no)) {
|
||||
if (ibuf_fixed_addr_page(space, page_no)) {
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
@ -1029,7 +1026,7 @@ ibuf_page_low(
|
||||
return(FALSE);
|
||||
}
|
||||
#endif
|
||||
if (ibuf_fixed_addr_page(page_no)) {
|
||||
if (ibuf_fixed_addr_page(space, page_no)) {
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
@ -3052,7 +3049,7 @@ ibuf_merge_or_delete_for_page(
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (ibuf_fixed_addr_page(page_no) || fsp_descr_page(page_no)
|
||||
if (ibuf_fixed_addr_page(space, page_no) || fsp_descr_page(page_no)
|
||||
|| trx_sys_hdr_page(space, page_no)) {
|
||||
return;
|
||||
}
|
||||
@ -3502,21 +3499,9 @@ ibuf_print(
|
||||
data = UT_LIST_GET_FIRST(ibuf->data_list);
|
||||
|
||||
while (data) {
|
||||
fprintf(file,
|
||||
"Ibuf for space %lu: size %lu, free list len %lu, seg size %lu,",
|
||||
(ulong) data->space, (ulong) data->size,
|
||||
(ulong) data->free_list_len,
|
||||
(ulong) data->seg_size);
|
||||
|
||||
if (data->empty) {
|
||||
fputs(" is empty\n", file);
|
||||
} else {
|
||||
fputs(" is not empty\n", file);
|
||||
}
|
||||
fprintf(file,
|
||||
"Ibuf for space %lu: size %lu, free list len %lu, seg size %lu,\n"
|
||||
"%lu inserts, %lu merged recs, %lu merges\n",
|
||||
(ulong) data->space,
|
||||
"Ibuf: size %lu, free list len %lu, seg size %lu,\n"
|
||||
"%lu inserts, %lu merged recs, %lu merges\n",
|
||||
(ulong) data->size,
|
||||
(ulong) data->free_list_len,
|
||||
(ulong) data->seg_size,
|
||||
|
@ -362,7 +362,7 @@ rw_lock_s_unlock_func(
|
||||
|
||||
/* Reset the shared lock by decrementing the reader count */
|
||||
|
||||
ut_ad(lock->reader_count > 0);
|
||||
ut_a(lock->reader_count > 0);
|
||||
lock->reader_count--;
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
|
@ -645,7 +645,7 @@ int cli_read_change_user_result(MYSQL *mysql, char *buff, const char *passwd)
|
||||
NET *net= &mysql->net;
|
||||
ulong pkt_length;
|
||||
|
||||
pkt_length= net_safe_read(mysql);
|
||||
pkt_length= cli_safe_read(mysql);
|
||||
|
||||
if (pkt_length == packet_error)
|
||||
return 1;
|
||||
@ -666,7 +666,7 @@ int cli_read_change_user_result(MYSQL *mysql, char *buff, const char *passwd)
|
||||
return 1;
|
||||
}
|
||||
/* Read what server thinks about out new auth message report */
|
||||
if (net_safe_read(mysql) == packet_error)
|
||||
if (cli_safe_read(mysql) == packet_error)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@ -1887,7 +1887,7 @@ my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
|
||||
DBUG_ENTER("cli_read_prepare_result");
|
||||
|
||||
mysql= mysql->last_used_con;
|
||||
if ((packet_length= net_safe_read(mysql)) == packet_error)
|
||||
if ((packet_length= cli_safe_read(mysql)) == packet_error)
|
||||
DBUG_RETURN(1);
|
||||
mysql->warning_count= 0;
|
||||
|
||||
@ -2505,7 +2505,8 @@ int cli_stmt_execute(MYSQL_STMT *stmt)
|
||||
|
||||
if (stmt->param_count)
|
||||
{
|
||||
NET *net= &stmt->mysql->net;
|
||||
MYSQL *mysql= stmt->mysql;
|
||||
NET *net= &mysql->net;
|
||||
MYSQL_BIND *param, *param_end;
|
||||
char *param_data;
|
||||
ulong length;
|
||||
@ -2517,7 +2518,8 @@ int cli_stmt_execute(MYSQL_STMT *stmt)
|
||||
set_stmt_error(stmt, CR_PARAMS_NOT_BOUND, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (stmt->mysql->status != MYSQL_STATUS_READY)
|
||||
if (mysql->status != MYSQL_STATUS_READY ||
|
||||
mysql->server_status & SERVER_MORE_RESULTS_EXISTS)
|
||||
{
|
||||
set_stmt_error(stmt, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
@ -4532,7 +4534,7 @@ static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row)
|
||||
|
||||
int cli_unbuffered_fetch(MYSQL *mysql, char **row)
|
||||
{
|
||||
if (packet_error == net_safe_read(mysql))
|
||||
if (packet_error == cli_safe_read(mysql))
|
||||
return 1;
|
||||
|
||||
*row= ((mysql->net.read_pos[0] == 254) ? NULL :
|
||||
@ -4641,7 +4643,7 @@ int cli_read_binary_rows(MYSQL_STMT *stmt)
|
||||
|
||||
mysql= mysql->last_used_con;
|
||||
|
||||
while ((pkt_len= net_safe_read(mysql)) != packet_error)
|
||||
while ((pkt_len= cli_safe_read(mysql)) != packet_error)
|
||||
{
|
||||
cp= net->read_pos;
|
||||
if (cp[0] != 254 || pkt_len >= 8)
|
||||
|
@ -89,6 +89,7 @@ install-data-local:
|
||||
$(INSTALL_DATA) $(srcdir)/include/*.inc $(DESTDIR)$(testdir)/include
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(DESTDIR)$(testdir)/std_data
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/*.*001 $(DESTDIR)$(testdir)/std_data
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(DESTDIR)$(testdir)/std_data
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data
|
||||
|
27
mysql-test/include/im_check_env.inc
Normal file
27
mysql-test/include/im_check_env.inc
Normal file
@ -0,0 +1,27 @@
|
||||
# This file is intended to be used in each IM-test. It contains stamements,
|
||||
# that ensure that starting conditions (environment) for the IM-test are as
|
||||
# expected.
|
||||
|
||||
# Wait for mysqld1 (guarded instance) to start.
|
||||
|
||||
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD1_PATH_PID 30 started
|
||||
|
||||
# Check the running instances.
|
||||
|
||||
--connect (mysql1_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK)
|
||||
|
||||
--connection mysql1_con
|
||||
|
||||
SHOW VARIABLES LIKE 'server_id';
|
||||
|
||||
--connection default
|
||||
|
||||
# Let IM detect that mysqld1 is online. This delay should be longer than
|
||||
# monitoring interval.
|
||||
|
||||
--sleep 2
|
||||
|
||||
# Check that IM understands that mysqld1 is online, while mysqld2 is
|
||||
# offline.
|
||||
|
||||
SHOW INSTANCES;
|
@ -2898,12 +2898,16 @@ sub im_stop($) {
|
||||
|
||||
while (1)
|
||||
{
|
||||
# Check that IM-main died.
|
||||
|
||||
if (kill (0, $instance_manager->{'pid'}))
|
||||
{
|
||||
mtr_debug("IM-main is still alive.");
|
||||
last;
|
||||
}
|
||||
|
||||
# Check that IM-angel died.
|
||||
|
||||
if (defined $instance_manager->{'angel_pid'} &&
|
||||
kill (0, $instance_manager->{'angel_pid'}))
|
||||
{
|
||||
@ -2911,21 +2915,39 @@ sub im_stop($) {
|
||||
last;
|
||||
}
|
||||
|
||||
# Check that all guarded mysqld-instances died.
|
||||
|
||||
my $guarded_mysqlds_dead= 1;
|
||||
|
||||
foreach my $pid (@mysqld_pids)
|
||||
{
|
||||
if (kill (0, $pid))
|
||||
{
|
||||
mtr_debug("Guarded mysqld ($pid) is still alive.");
|
||||
$guarded_mysqlds_dead= 0;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
last unless $guarded_mysqlds_dead;
|
||||
|
||||
# Ok, all necessary processes are dead.
|
||||
|
||||
$clean_shutdown= 1;
|
||||
last;
|
||||
}
|
||||
|
||||
# Kill leftovers (the order is important).
|
||||
|
||||
if ($clean_shutdown)
|
||||
{
|
||||
mtr_debug("IM-shutdown was clean -- all processed died.");
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("IM failed to shutdown gracefully. We have to clean the mess...");
|
||||
}
|
||||
|
||||
unless ($clean_shutdown)
|
||||
{
|
||||
|
||||
@ -2946,17 +2968,24 @@ sub im_stop($) {
|
||||
mtr_kill_processes(\@mysqld_pids);
|
||||
|
||||
# Complain in error log so that a warning will be shown.
|
||||
#
|
||||
# TODO: unless BUG#20761 is fixed, we will print the warning
|
||||
# to stdout, so that it can be seen on console and does not
|
||||
# produce pushbuild error.
|
||||
|
||||
my $errlog= "$opt_vardir/log/mysql-test-run.pl.err";
|
||||
|
||||
open (ERRLOG, ">>$errlog") ||
|
||||
mtr_error("Can not open error log ($errlog)");
|
||||
# my $errlog= "$opt_vardir/log/mysql-test-run.pl.err";
|
||||
#
|
||||
# open (ERRLOG, ">>$errlog") ||
|
||||
# mtr_error("Can not open error log ($errlog)");
|
||||
#
|
||||
# my $ts= localtime();
|
||||
# print ERRLOG
|
||||
# "Warning: [$ts] Instance Manager did not shutdown gracefully.\n";
|
||||
#
|
||||
# close ERRLOG;
|
||||
|
||||
my $ts= localtime();
|
||||
print ERRLOG
|
||||
"Warning: [$ts] Instance Manager did not shutdown gracefully.\n";
|
||||
|
||||
close ERRLOG;
|
||||
print "Warning: [$ts] Instance Manager did not shutdown gracefully.\n";
|
||||
}
|
||||
|
||||
# That's all.
|
||||
|
@ -452,7 +452,7 @@ t2 CREATE TABLE `t2` (
|
||||
`ifnull(h,h)` decimal(5,4) default NULL,
|
||||
`ifnull(i,i)` year(4) default NULL,
|
||||
`ifnull(j,j)` date default NULL,
|
||||
`ifnull(k,k)` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`ifnull(k,k)` timestamp NOT NULL default '0000-00-00 00:00:00',
|
||||
`ifnull(l,l)` datetime default NULL,
|
||||
`ifnull(m,m)` varchar(1) default NULL,
|
||||
`ifnull(n,n)` varchar(3) default NULL,
|
||||
|
@ -641,3 +641,16 @@ select charset(group_concat(c1 order by c2)) from t1;
|
||||
charset(group_concat(c1 order by c2))
|
||||
latin1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a INT(10), b LONGTEXT, PRIMARY KEY (a));
|
||||
SET GROUP_CONCAT_MAX_LEN = 20000000;
|
||||
INSERT INTO t1 VALUES (1,REPEAT(CONCAT('A',CAST(CHAR(0) AS BINARY),'B'), 40000));
|
||||
INSERT INTO t1 SELECT a + 1, b FROM t1;
|
||||
SELECT a, CHAR_LENGTH(b) FROM t1;
|
||||
a CHAR_LENGTH(b)
|
||||
1 120000
|
||||
2 120000
|
||||
SELECT CHAR_LENGTH( GROUP_CONCAT(b) ) FROM t1;
|
||||
CHAR_LENGTH( GROUP_CONCAT(b) )
|
||||
240001
|
||||
SET GROUP_CONCAT_MAX_LEN = 1024;
|
||||
DROP TABLE t1;
|
||||
|
@ -988,3 +988,14 @@ SUM(a)
|
||||
6
|
||||
DROP TABLE t1;
|
||||
set div_precision_increment= @sav_dpi;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
CREATE TABLE t2 (a INT PRIMARY KEY, b INT);
|
||||
INSERT INTO t2 VALUES (1,1), (3,3);
|
||||
SELECT SQL_NO_CACHE
|
||||
(SELECT SUM(c.a) FROM t1 ttt, t2 ccc
|
||||
WHERE ttt.a = ccc.b AND ttt.a = t.a GROUP BY ttt.a) AS minid
|
||||
FROM t1 t, t2 c WHERE t.a = c.b;
|
||||
minid
|
||||
NULL
|
||||
DROP TABLE t1,t2;
|
||||
|
@ -1056,6 +1056,34 @@ a c
|
||||
abc abc abc
|
||||
xyz xyz xyz
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (s varchar(10));
|
||||
INSERT INTO t1 VALUES ('yadda'), ('yaddy');
|
||||
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(s) > 'ab';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(`test`.`t1`.`s`) > _latin1'ab')
|
||||
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM('y' FROM s) > 'ab';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(both _latin1'y' from `test`.`t1`.`s`) > _latin1'ab')
|
||||
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(LEADING 'y' FROM s) > 'ab';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(leading _latin1'y' from `test`.`t1`.`s`) > _latin1'ab')
|
||||
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(TRAILING 'y' FROM s) > 'ab';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(trailing _latin1'y' from `test`.`t1`.`s`) > _latin1'ab')
|
||||
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(BOTH 'y' FROM s) > 'ab';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(both _latin1'y' from `test`.`t1`.`s`) > _latin1'ab')
|
||||
DROP TABLE t1;
|
||||
End of 4.1 tests
|
||||
create table t1 (d decimal default null);
|
||||
insert into t1 values (null);
|
||||
|
@ -796,3 +796,28 @@ aaa
|
||||
show warnings;
|
||||
Level Code Message
|
||||
drop table t1, t2;
|
||||
CREATE TABLE t1 (a tinyint(3), b varchar(255), PRIMARY KEY (a));
|
||||
INSERT INTO t1 VALUES (1,'-----'), (6,'Allemagne'), (17,'Autriche'),
|
||||
(25,'Belgique'), (54,'Danemark'), (62,'Espagne'), (68,'France');
|
||||
CREATE TABLE t2 (a tinyint(3), b tinyint(3), PRIMARY KEY (a), KEY b (b));
|
||||
INSERT INTO t2 VALUES (1,1), (2,1), (6,6), (18,17), (15,25), (16,25),
|
||||
(17,25), (10,54), (5,62),(3,68);
|
||||
CREATE VIEW v1 AS select t1.a, concat(t1.b,'') AS b, t1.b as real_b from t1;
|
||||
explain
|
||||
SELECT straight_join sql_no_cache v1.a, v1.b, v1.real_b from t2, v1
|
||||
where t2.b=v1.a GROUP BY t2.b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 index b b 2 NULL 10 Using index
|
||||
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 1 test.t2.b 1
|
||||
SELECT straight_join sql_no_cache v1.a, v1.b, v1.real_b from t2, v1
|
||||
where t2.b=v1.a GROUP BY t2.b;
|
||||
a b real_b
|
||||
1 ----- -----
|
||||
6 Allemagne Allemagne
|
||||
17 Autriche Autriche
|
||||
25 Belgique Belgique
|
||||
54 Danemark Danemark
|
||||
62 Espagne Espagne
|
||||
68 France France
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1,t2;
|
||||
|
@ -2099,3 +2099,46 @@ SOUTH EAST SOUTH EAST
|
||||
SOUTH WEST SOUTH WEST
|
||||
WESTERN WESTERN
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id1 INT, id2 INT);
|
||||
CREATE TABLE t2 (id2 INT, id3 INT, id5 INT);
|
||||
CREATE TABLE t3 (id3 INT, id4 INT);
|
||||
CREATE TABLE t4 (id4 INT);
|
||||
CREATE TABLE t5 (id5 INT, id6 INT);
|
||||
CREATE TABLE t6 (id6 INT);
|
||||
INSERT INTO t1 VALUES(1,1);
|
||||
INSERT INTO t2 VALUES(1,1,1);
|
||||
INSERT INTO t3 VALUES(1,1);
|
||||
INSERT INTO t4 VALUES(1);
|
||||
INSERT INTO t5 VALUES(1,1);
|
||||
INSERT INTO t6 VALUES(1);
|
||||
SELECT * FROM
|
||||
t1
|
||||
NATURAL JOIN
|
||||
(t2 JOIN (t3 NATURAL JOIN t4, t5 NATURAL JOIN t6)
|
||||
ON (t3.id3 = t2.id3 AND t5.id5 = t2.id5));
|
||||
id2 id1 id3 id5 id4 id3 id6 id5
|
||||
1 1 1 1 1 1 1 1
|
||||
SELECT * FROM
|
||||
t1
|
||||
NATURAL JOIN
|
||||
(((t3 NATURAL JOIN t4) join (t5 NATURAL JOIN t6) on t3.id4 = t5.id5) JOIN t2
|
||||
ON (t3.id3 = t2.id3 AND t5.id5 = t2.id5));
|
||||
id2 id1 id4 id3 id6 id5 id3 id5
|
||||
1 1 1 1 1 1 1 1
|
||||
SELECT * FROM t1 NATURAL JOIN ((t3 join (t5 NATURAL JOIN t6)) JOIN t2);
|
||||
id2 id1 id3 id4 id6 id5 id3 id5
|
||||
1 1 1 1 1 1 1 1
|
||||
SELECT * FROM
|
||||
(t2 JOIN (t3 NATURAL JOIN t4, t5 NATURAL JOIN t6)
|
||||
ON (t3.id3 = t2.id3 AND t5.id5 = t2.id5))
|
||||
NATURAL JOIN
|
||||
t1;
|
||||
id2 id3 id5 id4 id3 id6 id5 id1
|
||||
1 1 1 1 1 1 1 1
|
||||
SELECT * FROM
|
||||
(t2 JOIN ((t3 NATURAL JOIN t4) join (t5 NATURAL JOIN t6)))
|
||||
NATURAL JOIN
|
||||
t1;
|
||||
id2 id3 id5 id4 id3 id6 id5 id1
|
||||
1 1 1 1 1 1 1 1
|
||||
DROP TABLE t1,t2,t3,t4,t5,t6;
|
||||
|
@ -1,4 +1,7 @@
|
||||
Success: the process has been started.
|
||||
SHOW VARIABLES LIKE 'server_id';
|
||||
Variable_name Value
|
||||
server_id 1
|
||||
SHOW INSTANCES;
|
||||
instance_name status
|
||||
mysqld1 online
|
||||
|
@ -1,8 +1,7 @@
|
||||
|
||||
--------------------------------------------------------------------
|
||||
-- 1.1.1.
|
||||
--------------------------------------------------------------------
|
||||
Success: the process has been started.
|
||||
SHOW VARIABLES LIKE 'server_id';
|
||||
Variable_name Value
|
||||
server_id 1
|
||||
SHOW INSTANCES;
|
||||
instance_name status
|
||||
mysqld1 online
|
||||
@ -40,10 +39,6 @@ ERROR HY000: Bad instance name. Check that the instance with such a name exists
|
||||
--------------------------------------------------------------------
|
||||
-- 1.1.6.
|
||||
--------------------------------------------------------------------
|
||||
SHOW INSTANCES;
|
||||
instance_name status
|
||||
mysqld1 online
|
||||
mysqld2 offline
|
||||
Killing the process...
|
||||
Sleeping...
|
||||
Success: the process was restarted.
|
||||
|
@ -1,8 +1,11 @@
|
||||
server_id = 1
|
||||
server_id = 2
|
||||
Success: the process has been started.
|
||||
SHOW VARIABLES LIKE 'server_id';
|
||||
Variable_name Value
|
||||
server_id 1
|
||||
SHOW INSTANCES;
|
||||
instance_name status
|
||||
mysqld1 online
|
||||
mysqld2 offline
|
||||
SET mysqld1.server_id = 11;
|
||||
server_id =11
|
||||
server_id = 2
|
||||
|
@ -1,8 +1,11 @@
|
||||
server_id = 1
|
||||
server_id = 2
|
||||
Success: the process has been started.
|
||||
SHOW VARIABLES LIKE 'server_id';
|
||||
Variable_name Value
|
||||
server_id 1
|
||||
SHOW INSTANCES;
|
||||
instance_name status
|
||||
mysqld1 online
|
||||
mysqld2 offline
|
||||
UNSET mysqld1.server_id;
|
||||
server_id = 2
|
||||
SHOW VARIABLES LIKE 'server_id';
|
||||
|
@ -1,4 +1,7 @@
|
||||
Success: the process has been started.
|
||||
SHOW VARIABLES LIKE 'server_id';
|
||||
Variable_name Value
|
||||
server_id 1
|
||||
SHOW INSTANCES;
|
||||
instance_name status
|
||||
mysqld1 online
|
||||
|
@ -1170,3 +1170,73 @@ f1()
|
||||
DROP FUNCTION f1;
|
||||
DROP PROCEDURE p1;
|
||||
DROP USER mysql_bug20230@localhost;
|
||||
SELECT t.table_name, c1.column_name
|
||||
FROM information_schema.tables t
|
||||
INNER JOIN
|
||||
information_schema.columns c1
|
||||
ON t.table_schema = c1.table_schema AND
|
||||
t.table_name = c1.table_name
|
||||
WHERE t.table_schema = 'information_schema' AND
|
||||
c1.ordinal_position =
|
||||
( SELECT COALESCE(MIN(c2.ordinal_position),1)
|
||||
FROM information_schema.columns c2
|
||||
WHERE c2.table_schema = t.table_schema AND
|
||||
c2.table_name = t.table_name AND
|
||||
c2.column_name LIKE '%SCHEMA%'
|
||||
);
|
||||
table_name column_name
|
||||
CHARACTER_SETS CHARACTER_SET_NAME
|
||||
COLLATIONS COLLATION_NAME
|
||||
COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME
|
||||
COLUMNS TABLE_SCHEMA
|
||||
COLUMN_PRIVILEGES TABLE_SCHEMA
|
||||
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
|
||||
ROUTINES ROUTINE_SCHEMA
|
||||
SCHEMATA SCHEMA_NAME
|
||||
SCHEMA_PRIVILEGES TABLE_SCHEMA
|
||||
STATISTICS TABLE_SCHEMA
|
||||
TABLES TABLE_SCHEMA
|
||||
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
|
||||
TABLE_PRIVILEGES TABLE_SCHEMA
|
||||
TRIGGERS TRIGGER_SCHEMA
|
||||
USER_PRIVILEGES GRANTEE
|
||||
VIEWS TABLE_SCHEMA
|
||||
SELECT t.table_name, c1.column_name
|
||||
FROM information_schema.tables t
|
||||
INNER JOIN
|
||||
information_schema.columns c1
|
||||
ON t.table_schema = c1.table_schema AND
|
||||
t.table_name = c1.table_name
|
||||
WHERE t.table_schema = 'information_schema' AND
|
||||
c1.ordinal_position =
|
||||
( SELECT COALESCE(MIN(c2.ordinal_position),1)
|
||||
FROM information_schema.columns c2
|
||||
WHERE c2.table_schema = 'information_schema' AND
|
||||
c2.table_name = t.table_name AND
|
||||
c2.column_name LIKE '%SCHEMA%'
|
||||
);
|
||||
table_name column_name
|
||||
CHARACTER_SETS CHARACTER_SET_NAME
|
||||
COLLATIONS COLLATION_NAME
|
||||
COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME
|
||||
COLUMNS TABLE_SCHEMA
|
||||
COLUMN_PRIVILEGES TABLE_SCHEMA
|
||||
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
|
||||
ROUTINES ROUTINE_SCHEMA
|
||||
SCHEMATA SCHEMA_NAME
|
||||
SCHEMA_PRIVILEGES TABLE_SCHEMA
|
||||
STATISTICS TABLE_SCHEMA
|
||||
TABLES TABLE_SCHEMA
|
||||
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
|
||||
TABLE_PRIVILEGES TABLE_SCHEMA
|
||||
TRIGGERS TRIGGER_SCHEMA
|
||||
USER_PRIVILEGES GRANTEE
|
||||
VIEWS TABLE_SCHEMA
|
||||
SELECT MAX(table_name) FROM information_schema.tables;
|
||||
MAX(table_name)
|
||||
VIEWS
|
||||
SELECT table_name from information_schema.tables
|
||||
WHERE table_name=(SELECT MAX(table_name)
|
||||
FROM information_schema.tables);
|
||||
table_name
|
||||
VIEWS
|
||||
|
@ -1473,8 +1473,8 @@ Error 1146 Table 'test.t4' doesn't exist
|
||||
drop table t1,t2,t3;
|
||||
create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=innodb;
|
||||
insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
|
||||
select name2 from t1 union all select name from t1 union all select id from t1;
|
||||
name2
|
||||
select trim(name2) from t1 union all select trim(name) from t1 union all select trim(id) from t1;
|
||||
trim(name2)
|
||||
fff
|
||||
sss
|
||||
ttt
|
||||
|
@ -2,3 +2,7 @@
|
||||
1
|
||||
ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
|
||||
ERROR at line 1: USE must be followed by a database name
|
||||
\
|
||||
\\
|
||||
';
|
||||
';
|
||||
|
@ -2220,7 +2220,7 @@ RETURN a+b */;;
|
||||
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
|
||||
/*!50003 DROP FUNCTION IF EXISTS `bug9056_func2` */;;
|
||||
/*!50003 SET SESSION SQL_MODE=""*/;;
|
||||
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `bug9056_func2`(f1 char binary) RETURNS char(1)
|
||||
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `bug9056_func2`(f1 char binary) RETURNS char(1) CHARSET latin1
|
||||
begin
|
||||
set f1= concat( 'hello', f1 );
|
||||
return f1;
|
||||
|
@ -516,77 +516,6 @@ SELECT FOUND_ROWS();
|
||||
FOUND_ROWS()
|
||||
2
|
||||
deallocate prepare stmt;
|
||||
create table t1 (a char(3) not null, b char(3) not null,
|
||||
c char(3) not null, primary key (a, b, c));
|
||||
create table t2 like t1;
|
||||
prepare stmt from
|
||||
"select t1.a from (t1 left outer join t2 on t2.a=1 and t1.b=t2.b)
|
||||
where t1.a=1";
|
||||
execute stmt;
|
||||
a
|
||||
execute stmt;
|
||||
a
|
||||
execute stmt;
|
||||
a
|
||||
prepare stmt from
|
||||
"select t1.a, t1.b, t1.c, t2.a, t2.b, t2.c from
|
||||
(t1 left outer join t2 on t2.a=? and t1.b=t2.b)
|
||||
left outer join t2 t3 on t3.a=? where t1.a=?";
|
||||
set @a:=1, @b:=1, @c:=1;
|
||||
execute stmt using @a, @b, @c;
|
||||
a b c a b c
|
||||
execute stmt using @a, @b, @c;
|
||||
a b c a b c
|
||||
execute stmt using @a, @b, @c;
|
||||
a b c a b c
|
||||
deallocate prepare stmt;
|
||||
drop table t1,t2;
|
||||
SET @aux= "SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS A,
|
||||
INFORMATION_SCHEMA.COLUMNS B
|
||||
WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA
|
||||
AND A.TABLE_NAME = B.TABLE_NAME
|
||||
AND A.COLUMN_NAME = B.COLUMN_NAME AND
|
||||
A.TABLE_NAME = 'user'";
|
||||
prepare my_stmt from @aux;
|
||||
execute my_stmt;
|
||||
COUNT(*)
|
||||
37
|
||||
execute my_stmt;
|
||||
COUNT(*)
|
||||
37
|
||||
execute my_stmt;
|
||||
COUNT(*)
|
||||
37
|
||||
deallocate prepare my_stmt;
|
||||
drop procedure if exists p1|
|
||||
drop table if exists t1|
|
||||
create table t1 (id int)|
|
||||
insert into t1 values(1)|
|
||||
create procedure p1(a int, b int)
|
||||
begin
|
||||
declare c int;
|
||||
select max(id)+1 into c from t1;
|
||||
insert into t1 select a+b;
|
||||
insert into t1 select a-b;
|
||||
insert into t1 select a-c;
|
||||
end|
|
||||
set @a= 3, @b= 4|
|
||||
prepare stmt from "call p1(?, ?)"|
|
||||
execute stmt using @a, @b|
|
||||
execute stmt using @a, @b|
|
||||
select * from t1|
|
||||
id
|
||||
1
|
||||
7
|
||||
-1
|
||||
1
|
||||
7
|
||||
-1
|
||||
-5
|
||||
deallocate prepare stmt|
|
||||
drop procedure p1|
|
||||
drop table t1|
|
||||
drop table if exists t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
@ -650,47 +579,6 @@ id
|
||||
3
|
||||
deallocate prepare stmt;
|
||||
drop table t1, t2;
|
||||
create table t1 (a int);
|
||||
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
|
||||
prepare stmt from "select * from t1 limit ?, ?";
|
||||
set @offset=0, @limit=1;
|
||||
execute stmt using @offset, @limit;
|
||||
a
|
||||
1
|
||||
select * from t1 limit 0, 1;
|
||||
a
|
||||
1
|
||||
set @offset=3, @limit=2;
|
||||
execute stmt using @offset, @limit;
|
||||
a
|
||||
4
|
||||
5
|
||||
select * from t1 limit 3, 2;
|
||||
a
|
||||
4
|
||||
5
|
||||
prepare stmt from "select * from t1 limit ?";
|
||||
execute stmt using @limit;
|
||||
a
|
||||
1
|
||||
2
|
||||
prepare stmt from "select * from t1 where a in (select a from t1 limit ?)";
|
||||
ERROR 42000: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
|
||||
prepare stmt from "select * from t1 union all select * from t1 limit ?, ?";
|
||||
set @offset=9;
|
||||
set @limit=2;
|
||||
execute stmt using @offset, @limit;
|
||||
a
|
||||
10
|
||||
1
|
||||
prepare stmt from "(select * from t1 limit ?, ?) union all
|
||||
(select * from t1 limit ?, ?) order by a limit ?";
|
||||
execute stmt using @offset, @limit, @offset, @limit, @limit;
|
||||
a
|
||||
10
|
||||
10
|
||||
drop table t1;
|
||||
deallocate prepare stmt;
|
||||
create table t1 (id int);
|
||||
prepare stmt from "insert into t1 (id) select id from t1 union select id from t1";
|
||||
execute stmt;
|
||||
@ -791,15 +679,6 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
|
||||
select ? from t1;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from t1' at line 1
|
||||
drop table t1;
|
||||
CREATE TABLE b12651_T1(a int) ENGINE=MYISAM;
|
||||
CREATE TABLE b12651_T2(b int) ENGINE=MYISAM;
|
||||
CREATE VIEW b12651_V1 as SELECT b FROM b12651_T2;
|
||||
PREPARE b12651 FROM 'SELECT 1 FROM b12651_T1 WHERE a IN (SELECT b FROM b12651_V1)';
|
||||
EXECUTE b12651;
|
||||
1
|
||||
DROP VIEW b12651_V1;
|
||||
DROP TABLE b12651_T1, b12651_T2;
|
||||
DEALLOCATE PREPARE b12651;
|
||||
prepare stmt from "select @@time_zone";
|
||||
execute stmt;
|
||||
@@time_zone
|
||||
@ -1016,6 +895,147 @@ select @@max_prepared_stmt_count, @@prepared_stmt_count;
|
||||
@@max_prepared_stmt_count @@prepared_stmt_count
|
||||
3 0
|
||||
set global max_prepared_stmt_count= @old_max_prepared_stmt_count;
|
||||
drop table if exists t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
prepare stmt from "delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1";
|
||||
drop temporary table t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
execute stmt;
|
||||
drop temporary table t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
execute stmt;
|
||||
drop temporary table t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
execute stmt;
|
||||
drop temporary table t1;
|
||||
deallocate prepare stmt;
|
||||
End of 4.1 tests
|
||||
create table t1 (a varchar(20));
|
||||
insert into t1 values ('foo');
|
||||
prepare stmt FROM 'SELECT char_length (a) FROM t1';
|
||||
ERROR 42000: FUNCTION test.char_length does not exist
|
||||
drop table t1;
|
||||
create table t1 (a char(3) not null, b char(3) not null,
|
||||
c char(3) not null, primary key (a, b, c));
|
||||
create table t2 like t1;
|
||||
prepare stmt from
|
||||
"select t1.a from (t1 left outer join t2 on t2.a=1 and t1.b=t2.b)
|
||||
where t1.a=1";
|
||||
execute stmt;
|
||||
a
|
||||
execute stmt;
|
||||
a
|
||||
execute stmt;
|
||||
a
|
||||
prepare stmt from
|
||||
"select t1.a, t1.b, t1.c, t2.a, t2.b, t2.c from
|
||||
(t1 left outer join t2 on t2.a=? and t1.b=t2.b)
|
||||
left outer join t2 t3 on t3.a=? where t1.a=?";
|
||||
set @a:=1, @b:=1, @c:=1;
|
||||
execute stmt using @a, @b, @c;
|
||||
a b c a b c
|
||||
execute stmt using @a, @b, @c;
|
||||
a b c a b c
|
||||
execute stmt using @a, @b, @c;
|
||||
a b c a b c
|
||||
deallocate prepare stmt;
|
||||
drop table t1,t2;
|
||||
SET @aux= "SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS A,
|
||||
INFORMATION_SCHEMA.COLUMNS B
|
||||
WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA
|
||||
AND A.TABLE_NAME = B.TABLE_NAME
|
||||
AND A.COLUMN_NAME = B.COLUMN_NAME AND
|
||||
A.TABLE_NAME = 'user'";
|
||||
prepare my_stmt from @aux;
|
||||
execute my_stmt;
|
||||
COUNT(*)
|
||||
37
|
||||
execute my_stmt;
|
||||
COUNT(*)
|
||||
37
|
||||
execute my_stmt;
|
||||
COUNT(*)
|
||||
37
|
||||
deallocate prepare my_stmt;
|
||||
drop procedure if exists p1|
|
||||
drop table if exists t1|
|
||||
create table t1 (id int)|
|
||||
insert into t1 values(1)|
|
||||
create procedure p1(a int, b int)
|
||||
begin
|
||||
declare c int;
|
||||
select max(id)+1 into c from t1;
|
||||
insert into t1 select a+b;
|
||||
insert into t1 select a-b;
|
||||
insert into t1 select a-c;
|
||||
end|
|
||||
set @a= 3, @b= 4|
|
||||
prepare stmt from "call p1(?, ?)"|
|
||||
execute stmt using @a, @b|
|
||||
execute stmt using @a, @b|
|
||||
select * from t1|
|
||||
id
|
||||
1
|
||||
7
|
||||
-1
|
||||
1
|
||||
7
|
||||
-1
|
||||
-5
|
||||
deallocate prepare stmt|
|
||||
drop procedure p1|
|
||||
drop table t1|
|
||||
create table t1 (a int);
|
||||
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
|
||||
prepare stmt from "select * from t1 limit ?, ?";
|
||||
set @offset=0, @limit=1;
|
||||
execute stmt using @offset, @limit;
|
||||
a
|
||||
1
|
||||
select * from t1 limit 0, 1;
|
||||
a
|
||||
1
|
||||
set @offset=3, @limit=2;
|
||||
execute stmt using @offset, @limit;
|
||||
a
|
||||
4
|
||||
5
|
||||
select * from t1 limit 3, 2;
|
||||
a
|
||||
4
|
||||
5
|
||||
prepare stmt from "select * from t1 limit ?";
|
||||
execute stmt using @limit;
|
||||
a
|
||||
1
|
||||
2
|
||||
prepare stmt from "select * from t1 where a in (select a from t1 limit ?)";
|
||||
ERROR 42000: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
|
||||
prepare stmt from "select * from t1 union all select * from t1 limit ?, ?";
|
||||
set @offset=9;
|
||||
set @limit=2;
|
||||
execute stmt using @offset, @limit;
|
||||
a
|
||||
10
|
||||
1
|
||||
prepare stmt from "(select * from t1 limit ?, ?) union all
|
||||
(select * from t1 limit ?, ?) order by a limit ?";
|
||||
execute stmt using @offset, @limit, @offset, @limit, @limit;
|
||||
a
|
||||
10
|
||||
10
|
||||
drop table t1;
|
||||
deallocate prepare stmt;
|
||||
CREATE TABLE b12651_T1(a int) ENGINE=MYISAM;
|
||||
CREATE TABLE b12651_T2(b int) ENGINE=MYISAM;
|
||||
CREATE VIEW b12651_V1 as SELECT b FROM b12651_T2;
|
||||
PREPARE b12651 FROM 'SELECT 1 FROM b12651_T1 WHERE a IN (SELECT b FROM b12651_V1)';
|
||||
EXECUTE b12651;
|
||||
1
|
||||
DROP VIEW b12651_V1;
|
||||
DROP TABLE b12651_T1, b12651_T2;
|
||||
DEALLOCATE PREPARE b12651;
|
||||
create table t1 (id int);
|
||||
prepare ins_call from "insert into t1 (id) values (1)";
|
||||
execute ins_call;
|
||||
|
@ -298,7 +298,7 @@ t9 MyISAM 10 Dynamic 2 216 432 # 2048 0 NULL # # # latin1_swedish_ci NULL
|
||||
prepare stmt4 from ' show status like ''Threads_running'' ';
|
||||
execute stmt4;
|
||||
Variable_name Value
|
||||
Threads_running 1
|
||||
Threads_running #
|
||||
prepare stmt4 from ' show variables like ''sql_mode'' ';
|
||||
execute stmt4;
|
||||
Variable_name Value
|
||||
|
@ -420,4 +420,48 @@ SELECT * FROM t1;
|
||||
col
|
||||
test
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
---> Test for BUG#20438
|
||||
|
||||
---> Preparing environment...
|
||||
---> connection: master
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
|
||||
---> Synchronizing slave with master...
|
||||
|
||||
---> connection: master
|
||||
|
||||
---> Creating procedure...
|
||||
/*!50003 CREATE PROCEDURE p1() SET @a = 1 */;
|
||||
/*!50003 CREATE FUNCTION f1() RETURNS INT RETURN 0 */;
|
||||
|
||||
---> Checking on master...
|
||||
SHOW CREATE PROCEDURE p1;
|
||||
Procedure sql_mode Create Procedure
|
||||
p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
|
||||
SET @a = 1
|
||||
SHOW CREATE FUNCTION f1;
|
||||
Function sql_mode Create Function
|
||||
f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
|
||||
RETURN 0
|
||||
|
||||
---> Synchronizing slave with master...
|
||||
---> connection: master
|
||||
|
||||
---> Checking on slave...
|
||||
SHOW CREATE PROCEDURE p1;
|
||||
Procedure sql_mode Create Procedure
|
||||
p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
|
||||
SET @a = 1
|
||||
SHOW CREATE FUNCTION f1;
|
||||
Function sql_mode Create Function
|
||||
f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
|
||||
RETURN 0
|
||||
|
||||
---> connection: master
|
||||
|
||||
---> Cleaning up...
|
||||
DROP PROCEDURE p1;
|
||||
DROP FUNCTION f1;
|
||||
drop table t1;
|
||||
|
@ -896,3 +896,50 @@ Tables_in_test (t_)
|
||||
SHOW TRIGGERS;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer
|
||||
RESET MASTER;
|
||||
START SLAVE;
|
||||
|
||||
---> Test for BUG#20438
|
||||
|
||||
---> Preparing environment...
|
||||
---> connection: master
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
|
||||
---> Synchronizing slave with master...
|
||||
|
||||
---> connection: master
|
||||
|
||||
---> Creating objects...
|
||||
CREATE TABLE t1(c INT);
|
||||
CREATE TABLE t2(c INT);
|
||||
/*!50003 CREATE TRIGGER t1_bi BEFORE INSERT ON t1
|
||||
FOR EACH ROW
|
||||
INSERT INTO t2 VALUES(NEW.c * 10) */;
|
||||
|
||||
---> Inserting value...
|
||||
INSERT INTO t1 VALUES(1);
|
||||
|
||||
---> Checking on master...
|
||||
SELECT * FROM t1;
|
||||
c
|
||||
1
|
||||
SELECT * FROM t2;
|
||||
c
|
||||
10
|
||||
|
||||
---> Synchronizing slave with master...
|
||||
---> connection: master
|
||||
|
||||
---> Checking on slave...
|
||||
SELECT * FROM t1;
|
||||
c
|
||||
1
|
||||
SELECT * FROM t2;
|
||||
c
|
||||
10
|
||||
|
||||
---> connection: master
|
||||
|
||||
---> Cleaning up...
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
@ -54,3 +54,40 @@ slave-bin.000001 # Query 1 # use `test`; delete from v1 where a=2
|
||||
slave-bin.000001 # Query 1 # use `test`; ALTER ALGORITHM=UNDEFINED DEFINER=root@localhost SQL SECURITY DEFINER VIEW v1 AS select a as b from t1
|
||||
slave-bin.000001 # Query 1 # use `test`; drop view v1
|
||||
slave-bin.000001 # Query 1 # use `test`; drop table t1
|
||||
|
||||
---> Test for BUG#20438
|
||||
|
||||
---> Preparing environment...
|
||||
---> connection: master
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
|
||||
---> Synchronizing slave with master...
|
||||
|
||||
---> connection: master
|
||||
|
||||
---> Creating objects...
|
||||
CREATE TABLE t1(c INT);
|
||||
/*!50003 CREATE VIEW v1 AS SELECT * FROM t1 */;
|
||||
|
||||
---> Inserting value...
|
||||
INSERT INTO t1 VALUES(1);
|
||||
|
||||
---> Checking on master...
|
||||
SELECT * FROM t1;
|
||||
c
|
||||
1
|
||||
|
||||
---> Synchronizing slave with master...
|
||||
---> connection: master
|
||||
|
||||
---> Checking on slave...
|
||||
SELECT * FROM t1;
|
||||
c
|
||||
1
|
||||
|
||||
---> connection: master
|
||||
|
||||
---> Cleaning up...
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
@ -2736,6 +2736,81 @@ SELECT i='1e+01',i=1e+01, i in (1e+01,1e+01), i in ('1e+01','1e+01') FROM t1;
|
||||
i='1e+01' i=1e+01 i in (1e+01,1e+01) i in ('1e+01','1e+01')
|
||||
0 1 1 1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
INSERT INTO t1 VALUES (1,1), (2,1), (4,10);
|
||||
CREATE TABLE t2 (a int PRIMARY KEY, b int, KEY b (b));
|
||||
INSERT INTO t2 VALUES (1,NULL), (2,10);
|
||||
ALTER TABLE t1 ENABLE KEYS;
|
||||
EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 index b b 5 NULL 2 Using index
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
|
||||
SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
|
||||
a b a b
|
||||
1 NULL 1 1
|
||||
1 NULL 2 1
|
||||
1 NULL 4 10
|
||||
2 10 4 10
|
||||
EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 index b b 5 NULL 2 Using index
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
|
||||
SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
|
||||
a b a b
|
||||
1 NULL 1 1
|
||||
1 NULL 2 1
|
||||
1 NULL 4 10
|
||||
2 10 4 10
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
CREATE TABLE t1 (key1 float default NULL, UNIQUE KEY key1 (key1));
|
||||
CREATE TABLE t2 (key2 float default NULL, UNIQUE KEY key2 (key2));
|
||||
INSERT INTO t1 VALUES (0.3762),(0.3845),(0.6158),(0.7941);
|
||||
INSERT INTO t2 VALUES (1.3762),(1.3845),(1.6158),(1.7941);
|
||||
explain select max(key1) from t1 where key1 <= 0.6158;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
explain select max(key2) from t2 where key2 <= 1.6158;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
explain select min(key1) from t1 where key1 >= 0.3762;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
explain select min(key2) from t2 where key2 >= 1.3762;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
explain select max(key1), min(key2) from t1, t2
|
||||
where key1 <= 0.6158 and key2 >= 1.3762;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
explain select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
explain select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
select max(key1) from t1 where key1 <= 0.6158;
|
||||
max(key1)
|
||||
0.61580002307892
|
||||
select max(key2) from t2 where key2 <= 1.6158;
|
||||
max(key2)
|
||||
1.6158000230789
|
||||
select min(key1) from t1 where key1 >= 0.3762;
|
||||
min(key1)
|
||||
0.37619999051094
|
||||
select min(key2) from t2 where key2 >= 1.3762;
|
||||
min(key2)
|
||||
1.3761999607086
|
||||
select max(key1), min(key2) from t1, t2
|
||||
where key1 <= 0.6158 and key2 >= 1.3762;
|
||||
max(key1) min(key2)
|
||||
0.61580002307892 1.3761999607086
|
||||
select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
|
||||
max(key1)
|
||||
0.61580002307892
|
||||
select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
|
||||
min(key1)
|
||||
0.37619999051094
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (
|
||||
K2C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '',
|
||||
K4N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000',
|
||||
|
@ -625,3 +625,7 @@ View Create View
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_cache 1 AS `1`
|
||||
DROP PROCEDURE p1;
|
||||
DROP VIEW v1;
|
||||
SHOW TABLES FROM no_such_database;
|
||||
ERROR 42000: Unknown database 'no_such_database'
|
||||
SHOW COLUMNS FROM no_such_table;
|
||||
ERROR 42S02: Table 'test.no_such_table' doesn't exist
|
||||
|
@ -155,11 +155,11 @@ Pos Instruction
|
||||
0 stmt 9 "drop temporary table if exists sudoku..."
|
||||
1 stmt 1 "create temporary table sudoku_work ( ..."
|
||||
2 stmt 1 "create temporary table sudoku_schedul..."
|
||||
3 stmt 95 "call sudoku_init("
|
||||
3 stmt 95 "call sudoku_init()"
|
||||
4 jump_if_not 7(8) p_naive@0
|
||||
5 stmt 4 "update sudoku_work set cnt = 0 where ..."
|
||||
6 jump 8
|
||||
7 stmt 95 "call sudoku_count("
|
||||
7 stmt 95 "call sudoku_count()"
|
||||
8 stmt 6 "insert into sudoku_schedule (row,col)..."
|
||||
9 set v_scounter@2 0
|
||||
10 set v_i@3 1
|
||||
@ -199,3 +199,10 @@ Pos Instruction
|
||||
44 jump 14
|
||||
45 stmt 9 "drop temporary table sudoku_work, sud..."
|
||||
drop procedure sudoku_solve;
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
CREATE PROCEDURE p1() CREATE INDEX idx ON t1 (c1);
|
||||
SHOW PROCEDURE CODE p1;
|
||||
Pos Instruction
|
||||
0 stmt 2 "CREATE INDEX idx ON t1 (c1)"
|
||||
DROP PROCEDURE p1;
|
||||
End of 5.0 tests.
|
||||
|
@ -1174,3 +1174,16 @@ drop procedure bug15091;
|
||||
drop function if exists bug16896;
|
||||
create aggregate function bug16896() returns int return 1;
|
||||
ERROR 42000: AGGREGATE is not supported for stored functions
|
||||
DROP PROCEDURE IF EXISTS bug14702;
|
||||
CREATE IF NOT EXISTS PROCEDURE bug14702()
|
||||
BEGIN
|
||||
END;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF NOT EXISTS PROCEDURE bug14702()
|
||||
BEGIN
|
||||
END' at line 1
|
||||
CREATE PROCEDURE IF NOT EXISTS bug14702()
|
||||
BEGIN
|
||||
END;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF NOT EXISTS bug14702()
|
||||
BEGIN
|
||||
END' at line 1
|
||||
|
@ -451,3 +451,55 @@ SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
|
||||
Host User Password
|
||||
localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C
|
||||
DROP USER user19857@localhost;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP FUNCTION IF EXISTS f_suid;
|
||||
DROP PROCEDURE IF EXISTS p_suid;
|
||||
DROP FUNCTION IF EXISTS f_evil;
|
||||
DELETE FROM mysql.user WHERE user LIKE 'mysqltest\_%';
|
||||
DELETE FROM mysql.db WHERE user LIKE 'mysqltest\_%';
|
||||
DELETE FROM mysql.tables_priv WHERE user LIKE 'mysqltest\_%';
|
||||
DELETE FROM mysql.columns_priv WHERE user LIKE 'mysqltest\_%';
|
||||
FLUSH PRIVILEGES;
|
||||
CREATE TABLE t1 (i INT);
|
||||
CREATE FUNCTION f_suid(i INT) RETURNS INT SQL SECURITY DEFINER RETURN 0;
|
||||
CREATE PROCEDURE p_suid(IN i INT) SQL SECURITY DEFINER SET @c:= 0;
|
||||
CREATE USER mysqltest_u1@localhost;
|
||||
GRANT EXECUTE ON test.* TO mysqltest_u1@localhost;
|
||||
CREATE DEFINER=mysqltest_u1@localhost FUNCTION f_evil () RETURNS INT
|
||||
SQL SECURITY INVOKER
|
||||
BEGIN
|
||||
SET @a:= CURRENT_USER();
|
||||
SET @b:= (SELECT COUNT(*) FROM t1);
|
||||
RETURN @b;
|
||||
END|
|
||||
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT f_evil();
|
||||
SELECT COUNT(*) FROM t1;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't1'
|
||||
SELECT f_evil();
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't1'
|
||||
SELECT @a, @b;
|
||||
@a @b
|
||||
mysqltest_u1@localhost NULL
|
||||
SELECT f_suid(f_evil());
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't1'
|
||||
SELECT @a, @b;
|
||||
@a @b
|
||||
mysqltest_u1@localhost NULL
|
||||
CALL p_suid(f_evil());
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't1'
|
||||
SELECT @a, @b;
|
||||
@a @b
|
||||
mysqltest_u1@localhost NULL
|
||||
SELECT * FROM v1;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 'v1'
|
||||
SELECT @a, @b;
|
||||
@a @b
|
||||
mysqltest_u1@localhost NULL
|
||||
DROP VIEW v1;
|
||||
DROP FUNCTION f_evil;
|
||||
DROP USER mysqltest_u1@localhost;
|
||||
DROP PROCEDURE p_suid;
|
||||
DROP FUNCTION f_suid;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests.
|
||||
|
@ -5057,6 +5057,190 @@ concat('data was: /', var1, '/')
|
||||
data was: /1/
|
||||
drop table t3|
|
||||
drop procedure bug15217|
|
||||
DROP PROCEDURE IF EXISTS bug21013 |
|
||||
CREATE PROCEDURE bug21013(IN lim INT)
|
||||
BEGIN
|
||||
DECLARE i INT DEFAULT 0;
|
||||
WHILE (i < lim) DO
|
||||
SET @b = LOCATE(_latin1'b', @a, 1);
|
||||
SET i = i + 1;
|
||||
END WHILE;
|
||||
END |
|
||||
SET @a = _latin2"aaaaaaaaaa" |
|
||||
CALL bug21013(10) |
|
||||
DROP PROCEDURE bug21013 |
|
||||
DROP DATABASE IF EXISTS mysqltest1|
|
||||
DROP DATABASE IF EXISTS mysqltest2|
|
||||
CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8|
|
||||
CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8|
|
||||
use mysqltest1|
|
||||
CREATE FUNCTION bug16211_f1() RETURNS CHAR(10)
|
||||
RETURN ""|
|
||||
CREATE FUNCTION bug16211_f2() RETURNS CHAR(10) CHARSET koi8r
|
||||
RETURN ""|
|
||||
CREATE FUNCTION mysqltest2.bug16211_f3() RETURNS CHAR(10)
|
||||
RETURN ""|
|
||||
CREATE FUNCTION mysqltest2.bug16211_f4() RETURNS CHAR(10) CHARSET koi8r
|
||||
RETURN ""|
|
||||
SHOW CREATE FUNCTION bug16211_f1|
|
||||
Function sql_mode Create Function
|
||||
bug16211_f1 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f1`() RETURNS char(10) CHARSET utf8
|
||||
RETURN ""
|
||||
SHOW CREATE FUNCTION bug16211_f2|
|
||||
Function sql_mode Create Function
|
||||
bug16211_f2 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f2`() RETURNS char(10) CHARSET koi8r
|
||||
RETURN ""
|
||||
SHOW CREATE FUNCTION mysqltest2.bug16211_f3|
|
||||
Function sql_mode Create Function
|
||||
bug16211_f3 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f3`() RETURNS char(10) CHARSET utf8
|
||||
RETURN ""
|
||||
SHOW CREATE FUNCTION mysqltest2.bug16211_f4|
|
||||
Function sql_mode Create Function
|
||||
bug16211_f4 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f4`() RETURNS char(10) CHARSET koi8r
|
||||
RETURN ""
|
||||
SELECT dtd_identifier
|
||||
FROM INFORMATION_SCHEMA.ROUTINES
|
||||
WHERE ROUTINE_SCHEMA = "mysqltest1" AND ROUTINE_NAME = "bug16211_f1"|
|
||||
dtd_identifier
|
||||
char(10) CHARSET utf8
|
||||
SELECT dtd_identifier
|
||||
FROM INFORMATION_SCHEMA.ROUTINES
|
||||
WHERE ROUTINE_SCHEMA = "mysqltest1" AND ROUTINE_NAME = "bug16211_f2"|
|
||||
dtd_identifier
|
||||
char(10) CHARSET koi8r
|
||||
SELECT dtd_identifier
|
||||
FROM INFORMATION_SCHEMA.ROUTINES
|
||||
WHERE ROUTINE_SCHEMA = "mysqltest2" AND ROUTINE_NAME = "bug16211_f3"|
|
||||
dtd_identifier
|
||||
char(10) CHARSET utf8
|
||||
SELECT dtd_identifier
|
||||
FROM INFORMATION_SCHEMA.ROUTINES
|
||||
WHERE ROUTINE_SCHEMA = "mysqltest2" AND ROUTINE_NAME = "bug16211_f4"|
|
||||
dtd_identifier
|
||||
char(10) CHARSET koi8r
|
||||
SELECT CHARSET(bug16211_f1())|
|
||||
CHARSET(bug16211_f1())
|
||||
utf8
|
||||
SELECT CHARSET(bug16211_f2())|
|
||||
CHARSET(bug16211_f2())
|
||||
koi8r
|
||||
SELECT CHARSET(mysqltest2.bug16211_f3())|
|
||||
CHARSET(mysqltest2.bug16211_f3())
|
||||
utf8
|
||||
SELECT CHARSET(mysqltest2.bug16211_f4())|
|
||||
CHARSET(mysqltest2.bug16211_f4())
|
||||
koi8r
|
||||
ALTER DATABASE mysqltest1 CHARACTER SET cp1251|
|
||||
ALTER DATABASE mysqltest2 CHARACTER SET cp1251|
|
||||
SHOW CREATE FUNCTION bug16211_f1|
|
||||
Function sql_mode Create Function
|
||||
bug16211_f1 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f1`() RETURNS char(10) CHARSET utf8
|
||||
RETURN ""
|
||||
SHOW CREATE FUNCTION bug16211_f2|
|
||||
Function sql_mode Create Function
|
||||
bug16211_f2 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f2`() RETURNS char(10) CHARSET koi8r
|
||||
RETURN ""
|
||||
SHOW CREATE FUNCTION mysqltest2.bug16211_f3|
|
||||
Function sql_mode Create Function
|
||||
bug16211_f3 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f3`() RETURNS char(10) CHARSET utf8
|
||||
RETURN ""
|
||||
SHOW CREATE FUNCTION mysqltest2.bug16211_f4|
|
||||
Function sql_mode Create Function
|
||||
bug16211_f4 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f4`() RETURNS char(10) CHARSET koi8r
|
||||
RETURN ""
|
||||
SELECT dtd_identifier
|
||||
FROM INFORMATION_SCHEMA.ROUTINES
|
||||
WHERE ROUTINE_SCHEMA = "mysqltest1" AND ROUTINE_NAME = "bug16211_f1"|
|
||||
dtd_identifier
|
||||
char(10) CHARSET utf8
|
||||
SELECT dtd_identifier
|
||||
FROM INFORMATION_SCHEMA.ROUTINES
|
||||
WHERE ROUTINE_SCHEMA = "mysqltest1" AND ROUTINE_NAME = "bug16211_f2"|
|
||||
dtd_identifier
|
||||
char(10) CHARSET koi8r
|
||||
SELECT dtd_identifier
|
||||
FROM INFORMATION_SCHEMA.ROUTINES
|
||||
WHERE ROUTINE_SCHEMA = "mysqltest2" AND ROUTINE_NAME = "bug16211_f3"|
|
||||
dtd_identifier
|
||||
char(10) CHARSET utf8
|
||||
SELECT dtd_identifier
|
||||
FROM INFORMATION_SCHEMA.ROUTINES
|
||||
WHERE ROUTINE_SCHEMA = "mysqltest2" AND ROUTINE_NAME = "bug16211_f4"|
|
||||
dtd_identifier
|
||||
char(10) CHARSET koi8r
|
||||
SELECT CHARSET(bug16211_f1())|
|
||||
CHARSET(bug16211_f1())
|
||||
utf8
|
||||
SELECT CHARSET(bug16211_f2())|
|
||||
CHARSET(bug16211_f2())
|
||||
koi8r
|
||||
SELECT CHARSET(mysqltest2.bug16211_f3())|
|
||||
CHARSET(mysqltest2.bug16211_f3())
|
||||
utf8
|
||||
SELECT CHARSET(mysqltest2.bug16211_f4())|
|
||||
CHARSET(mysqltest2.bug16211_f4())
|
||||
koi8r
|
||||
use test|
|
||||
DROP DATABASE mysqltest1|
|
||||
DROP DATABASE mysqltest2|
|
||||
DROP DATABASE IF EXISTS mysqltest1|
|
||||
CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8|
|
||||
use mysqltest1|
|
||||
CREATE PROCEDURE bug16676_p1(
|
||||
IN p1 CHAR(10),
|
||||
INOUT p2 CHAR(10),
|
||||
OUT p3 CHAR(10))
|
||||
BEGIN
|
||||
SELECT CHARSET(p1), COLLATION(p1);
|
||||
SELECT CHARSET(p2), COLLATION(p2);
|
||||
SELECT CHARSET(p3), COLLATION(p3);
|
||||
END|
|
||||
CREATE PROCEDURE bug16676_p2(
|
||||
IN p1 CHAR(10) CHARSET koi8r,
|
||||
INOUT p2 CHAR(10) CHARSET cp1251,
|
||||
OUT p3 CHAR(10) CHARSET greek)
|
||||
BEGIN
|
||||
SELECT CHARSET(p1), COLLATION(p1);
|
||||
SELECT CHARSET(p2), COLLATION(p2);
|
||||
SELECT CHARSET(p3), COLLATION(p3);
|
||||
END|
|
||||
SET @v2 = 'b'|
|
||||
SET @v3 = 'c'|
|
||||
CALL bug16676_p1('a', @v2, @v3)|
|
||||
CHARSET(p1) COLLATION(p1)
|
||||
utf8 utf8_general_ci
|
||||
CHARSET(p2) COLLATION(p2)
|
||||
utf8 utf8_general_ci
|
||||
CHARSET(p3) COLLATION(p3)
|
||||
utf8 utf8_general_ci
|
||||
CALL bug16676_p2('a', @v2, @v3)|
|
||||
CHARSET(p1) COLLATION(p1)
|
||||
koi8r koi8r_general_ci
|
||||
CHARSET(p2) COLLATION(p2)
|
||||
cp1251 cp1251_general_ci
|
||||
CHARSET(p3) COLLATION(p3)
|
||||
greek greek_general_ci
|
||||
use test|
|
||||
DROP DATABASE mysqltest1|
|
||||
drop procedure if exists bug19862|
|
||||
CREATE TABLE t11 (a INT)|
|
||||
CREATE TABLE t12 (a INT)|
|
||||
CREATE FUNCTION bug19862(x INT) RETURNS INT
|
||||
BEGIN
|
||||
INSERT INTO t11 VALUES (x);
|
||||
RETURN x+1;
|
||||
END|
|
||||
INSERT INTO t12 VALUES (1), (2)|
|
||||
SELECT bug19862(a) FROM t12 ORDER BY 1|
|
||||
bug19862(a)
|
||||
2
|
||||
3
|
||||
SELECT * FROM t11|
|
||||
a
|
||||
1
|
||||
2
|
||||
DROP TABLE t11, t12|
|
||||
DROP FUNCTION bug19862|
|
||||
drop table if exists t3|
|
||||
drop database if exists mysqltest1|
|
||||
create table t3 (a int)|
|
||||
|
@ -2888,6 +2888,33 @@ select 1 from dual where 1 < any (select 2 from dual);
|
||||
select 1 from dual where 1 < all (select 2 from dual where 1!=1);
|
||||
1
|
||||
1
|
||||
create table t1 (s1 char);
|
||||
insert into t1 values (1),(2);
|
||||
select * from t1 where (s1 < any (select s1 from t1));
|
||||
s1
|
||||
1
|
||||
select * from t1 where not (s1 < any (select s1 from t1));
|
||||
s1
|
||||
2
|
||||
select * from t1 where (s1 < ALL (select s1+1 from t1));
|
||||
s1
|
||||
1
|
||||
select * from t1 where not(s1 < ALL (select s1+1 from t1));
|
||||
s1
|
||||
2
|
||||
select * from t1 where (s1+1 = ANY (select s1 from t1));
|
||||
s1
|
||||
1
|
||||
select * from t1 where NOT(s1+1 = ANY (select s1 from t1));
|
||||
s1
|
||||
2
|
||||
select * from t1 where (s1 = ALL (select s1/s1 from t1));
|
||||
s1
|
||||
1
|
||||
select * from t1 where NOT(s1 = ALL (select s1/s1 from t1));
|
||||
s1
|
||||
2
|
||||
drop table t1;
|
||||
create table t1 (df decimal(5,1));
|
||||
insert into t1 values(1.1);
|
||||
insert into t1 values(2.2);
|
||||
|
@ -132,3 +132,15 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
5 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX PRIMARY 34 func 1 Using index; Using where
|
||||
6 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 func 1 Using index; Using where
|
||||
drop table t1, t2, t3, t4;
|
||||
CREATE TABLE t1 (a int(10) , PRIMARY KEY (a)) Engine=InnoDB;
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
CREATE TABLE t2 (a int(10), PRIMARY KEY (a)) Engine=InnoDB;
|
||||
INSERT INTO t2 VALUES (1);
|
||||
CREATE TABLE t3 (a int(10), b int(10), c int(10),
|
||||
PRIMARY KEY (a)) Engine=InnoDB;
|
||||
INSERT INTO t3 VALUES (1,2,1);
|
||||
SELECT t1.* FROM t1 WHERE (SELECT COUNT(*) FROM t3,t2 WHERE t3.c=t2.a
|
||||
and t2.a='1' AND t1.a=t3.b) > 0;
|
||||
a
|
||||
2
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
@ -93,6 +93,18 @@ NULL
|
||||
0R
|
||||
FR
|
||||
DROP TABLE bug19904;
|
||||
CREATE DEFINER=CURRENT_USER() FUNCTION should_not_parse
|
||||
RETURNS STRING SONAME "should_not_parse.so";
|
||||
ERROR HY000: Incorrect usage of SONAME and DEFINER
|
||||
CREATE DEFINER=someone@somewhere FUNCTION should_not_parse
|
||||
RETURNS STRING SONAME "should_not_parse.so";
|
||||
ERROR HY000: Incorrect usage of SONAME and DEFINER
|
||||
create table t1(f1 int);
|
||||
insert into t1 values(1),(2);
|
||||
explain select myfunc_int(f1) from t1 order by 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
|
||||
drop table t1;
|
||||
End of 5.0 tests.
|
||||
DROP FUNCTION metaphon;
|
||||
DROP FUNCTION myfunc_double;
|
||||
|
@ -691,9 +691,9 @@ t1 CREATE TABLE `t1` (
|
||||
`da` datetime default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 SELECT dt from t2 UNION select sc from t2;
|
||||
select * from t1;
|
||||
dt
|
||||
create table t1 SELECT dt from t2 UNION select trim(sc) from t2;
|
||||
select trim(dt) from t1;
|
||||
trim(dt)
|
||||
1972-10-22 11:50:00
|
||||
testc
|
||||
show create table t1;
|
||||
@ -732,7 +732,7 @@ tetetetetest
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`dt` longblob
|
||||
`dt` blob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 SELECT sv from t2 UNION select b from t2;
|
||||
@ -743,7 +743,7 @@ tetetetetest
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`sv` longblob
|
||||
`sv` blob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 SELECT i from t2 UNION select d from t2 UNION select b from t2;
|
||||
@ -755,7 +755,7 @@ tetetetetest
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` longblob
|
||||
`i` blob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 SELECT sv from t2 UNION select tx from t2;
|
||||
@ -766,7 +766,7 @@ teeeeeeeeeeeest
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`sv` longtext
|
||||
`sv` text
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 SELECT b from t2 UNION select tx from t2;
|
||||
@ -777,7 +777,7 @@ teeeeeeeeeeeest
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`b` longblob
|
||||
`b` blob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1,t2;
|
||||
create table t1 select 1 union select -1;
|
||||
@ -1306,6 +1306,21 @@ id
|
||||
5
|
||||
99
|
||||
drop table t1;
|
||||
create table t1(f1 char(1), f2 char(5), f3 binary(1), f4 binary(5), f5 timestamp, f6 varchar(1) character set utf8 collate utf8_general_ci, f7 text);
|
||||
create table t2 as select *, f6 as f8 from t1 union select *, f7 from t1;
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`f1` char(1) default NULL,
|
||||
`f2` char(5) default NULL,
|
||||
`f3` binary(1) default NULL,
|
||||
`f4` binary(5) default NULL,
|
||||
`f5` timestamp NOT NULL default '0000-00-00 00:00:00',
|
||||
`f6` varchar(1) character set utf8 default NULL,
|
||||
`f7` text,
|
||||
`f8` text character set utf8
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1, t2;
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
|
@ -193,7 +193,7 @@ c d
|
||||
2 5
|
||||
3 10
|
||||
drop view v100;
|
||||
ERROR 42S02: Unknown table 'test.v100'
|
||||
ERROR 42S02: Unknown table 'v100'
|
||||
drop view t1;
|
||||
ERROR HY000: 'test.t1' is not VIEW
|
||||
drop table v1;
|
||||
@ -2774,3 +2774,79 @@ Field Type Null Key Default Extra
|
||||
COALESCE(i,j) int(11) YES NULL
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (s varchar(10));
|
||||
INSERT INTO t1 VALUES ('yadda'), ('yady');
|
||||
SELECT TRIM(BOTH 'y' FROM s) FROM t1;
|
||||
TRIM(BOTH 'y' FROM s)
|
||||
adda
|
||||
ad
|
||||
CREATE VIEW v1 AS SELECT TRIM(BOTH 'y' FROM s) FROM t1;
|
||||
SELECT * FROM v1;
|
||||
TRIM(BOTH 'y' FROM s)
|
||||
adda
|
||||
ad
|
||||
DROP VIEW v1;
|
||||
SELECT TRIM(LEADING 'y' FROM s) FROM t1;
|
||||
TRIM(LEADING 'y' FROM s)
|
||||
adda
|
||||
ady
|
||||
CREATE VIEW v1 AS SELECT TRIM(LEADING 'y' FROM s) FROM t1;
|
||||
SELECT * FROM v1;
|
||||
TRIM(LEADING 'y' FROM s)
|
||||
adda
|
||||
ady
|
||||
DROP VIEW v1;
|
||||
SELECT TRIM(TRAILING 'y' FROM s) FROM t1;
|
||||
TRIM(TRAILING 'y' FROM s)
|
||||
yadda
|
||||
yad
|
||||
CREATE VIEW v1 AS SELECT TRIM(TRAILING 'y' FROM s) FROM t1;
|
||||
SELECT * FROM v1;
|
||||
TRIM(TRAILING 'y' FROM s)
|
||||
yadda
|
||||
yad
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (x INT, y INT);
|
||||
CREATE ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View
|
||||
v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `v1` AS select `t1`.`x` AS `x` from `t1`
|
||||
ALTER VIEW v1 AS SELECT x, y FROM t1;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View
|
||||
v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `v1` AS select `t1`.`x` AS `x`,`t1`.`y` AS `y` from `t1`
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (s1 char);
|
||||
INSERT INTO t1 VALUES ('Z');
|
||||
CREATE VIEW v1 AS SELECT s1 collate latin1_german1_ci AS col FROM t1;
|
||||
CREATE VIEW v2 (col) AS SELECT s1 collate latin1_german1_ci FROM t1;
|
||||
INSERT INTO v1 (col) VALUES ('b');
|
||||
INSERT INTO v2 (col) VALUES ('c');
|
||||
SELECT s1 FROM t1;
|
||||
s1
|
||||
Z
|
||||
b
|
||||
c
|
||||
DROP VIEW v1, v2;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id INT);
|
||||
CREATE VIEW v1 AS SELECT id FROM t1;
|
||||
SHOW TABLES;
|
||||
Tables_in_test
|
||||
t1
|
||||
v1
|
||||
DROP VIEW v2,v1;
|
||||
ERROR 42S02: Unknown table 'v2'
|
||||
SHOW TABLES;
|
||||
Tables_in_test
|
||||
t1
|
||||
CREATE VIEW v1 AS SELECT id FROM t1;
|
||||
DROP VIEW t1,v1;
|
||||
ERROR HY000: 'test.t1' is not VIEW
|
||||
SHOW TABLES;
|
||||
Tables_in_test
|
||||
t1
|
||||
DROP TABLE t1;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
|
@ -11,3 +11,4 @@
|
||||
##############################################################################
|
||||
|
||||
ndb_load : Bug#17233
|
||||
lowercase_fs_off : Bug#21419
|
||||
|
@ -433,3 +433,17 @@ create table t1 (c1 varchar(10), c2 int);
|
||||
select charset(group_concat(c1 order by c2)) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #16712: group_concat returns odd string instead of intended result
|
||||
#
|
||||
CREATE TABLE t1 (a INT(10), b LONGTEXT, PRIMARY KEY (a));
|
||||
|
||||
SET GROUP_CONCAT_MAX_LEN = 20000000;
|
||||
|
||||
INSERT INTO t1 VALUES (1,REPEAT(CONCAT('A',CAST(CHAR(0) AS BINARY),'B'), 40000));
|
||||
INSERT INTO t1 SELECT a + 1, b FROM t1;
|
||||
|
||||
SELECT a, CHAR_LENGTH(b) FROM t1;
|
||||
SELECT CHAR_LENGTH( GROUP_CONCAT(b) ) FROM t1;
|
||||
SET GROUP_CONCAT_MAX_LEN = 1024;
|
||||
DROP TABLE t1;
|
||||
|
@ -660,3 +660,18 @@ SELECT SUM(a) FROM t1 GROUP BY b/c;
|
||||
DROP TABLE t1;
|
||||
set div_precision_increment= @sav_dpi;
|
||||
|
||||
#
|
||||
# Bug #20868: Client connection is broken on SQL query error
|
||||
#
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
|
||||
CREATE TABLE t2 (a INT PRIMARY KEY, b INT);
|
||||
INSERT INTO t2 VALUES (1,1), (3,3);
|
||||
|
||||
SELECT SQL_NO_CACHE
|
||||
(SELECT SUM(c.a) FROM t1 ttt, t2 ccc
|
||||
WHERE ttt.a = ccc.b AND ttt.a = t.a GROUP BY ttt.a) AS minid
|
||||
FROM t1 t, t2 c WHERE t.a = c.b;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
@ -706,6 +706,21 @@ SELECT a, CONCAT(a,' ',a) AS c FROM t1
|
||||
INSTR(REVERSE(CONCAT(a,' ',a))," ")) = a;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#17526: WRONG PRINT for TRIM FUNCTION with two arguments
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (s varchar(10));
|
||||
INSERT INTO t1 VALUES ('yadda'), ('yaddy');
|
||||
|
||||
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(s) > 'ab';
|
||||
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM('y' FROM s) > 'ab';
|
||||
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(LEADING 'y' FROM s) > 'ab';
|
||||
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(TRAILING 'y' FROM s) > 'ab';
|
||||
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(BOTH 'y' FROM s) > 'ab';
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
||||
|
@ -632,3 +632,26 @@ group by t1.c1;
|
||||
show warnings;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Bug #20466: a view is mixing data when there's a trigger on the table
|
||||
#
|
||||
CREATE TABLE t1 (a tinyint(3), b varchar(255), PRIMARY KEY (a));
|
||||
|
||||
INSERT INTO t1 VALUES (1,'-----'), (6,'Allemagne'), (17,'Autriche'),
|
||||
(25,'Belgique'), (54,'Danemark'), (62,'Espagne'), (68,'France');
|
||||
|
||||
CREATE TABLE t2 (a tinyint(3), b tinyint(3), PRIMARY KEY (a), KEY b (b));
|
||||
|
||||
INSERT INTO t2 VALUES (1,1), (2,1), (6,6), (18,17), (15,25), (16,25),
|
||||
(17,25), (10,54), (5,62),(3,68);
|
||||
|
||||
CREATE VIEW v1 AS select t1.a, concat(t1.b,'') AS b, t1.b as real_b from t1;
|
||||
|
||||
explain
|
||||
SELECT straight_join sql_no_cache v1.a, v1.b, v1.real_b from t2, v1
|
||||
where t2.b=v1.a GROUP BY t2.b;
|
||||
SELECT straight_join sql_no_cache v1.a, v1.b, v1.real_b from t2, v1
|
||||
where t2.b=v1.a GROUP BY t2.b;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1,t2;
|
||||
|
@ -746,3 +746,51 @@ EXPLAIN SELECT DISTINCT a,a FROM t1 ORDER BY a;
|
||||
SELECT DISTINCT a,a FROM t1 ORDER BY a;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #21007: NATURAL JOIN (any JOIN (2 x NATURAL JOIN)) crashes the server
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (id1 INT, id2 INT);
|
||||
CREATE TABLE t2 (id2 INT, id3 INT, id5 INT);
|
||||
CREATE TABLE t3 (id3 INT, id4 INT);
|
||||
CREATE TABLE t4 (id4 INT);
|
||||
CREATE TABLE t5 (id5 INT, id6 INT);
|
||||
CREATE TABLE t6 (id6 INT);
|
||||
|
||||
INSERT INTO t1 VALUES(1,1);
|
||||
INSERT INTO t2 VALUES(1,1,1);
|
||||
INSERT INTO t3 VALUES(1,1);
|
||||
INSERT INTO t4 VALUES(1);
|
||||
INSERT INTO t5 VALUES(1,1);
|
||||
INSERT INTO t6 VALUES(1);
|
||||
|
||||
-- original bug query
|
||||
SELECT * FROM
|
||||
t1
|
||||
NATURAL JOIN
|
||||
(t2 JOIN (t3 NATURAL JOIN t4, t5 NATURAL JOIN t6)
|
||||
ON (t3.id3 = t2.id3 AND t5.id5 = t2.id5));
|
||||
|
||||
-- inner join swapped
|
||||
SELECT * FROM
|
||||
t1
|
||||
NATURAL JOIN
|
||||
(((t3 NATURAL JOIN t4) join (t5 NATURAL JOIN t6) on t3.id4 = t5.id5) JOIN t2
|
||||
ON (t3.id3 = t2.id3 AND t5.id5 = t2.id5));
|
||||
|
||||
-- one join less, no ON cond
|
||||
SELECT * FROM t1 NATURAL JOIN ((t3 join (t5 NATURAL JOIN t6)) JOIN t2);
|
||||
|
||||
-- wrong error message: 'id2' - ambiguous column
|
||||
SELECT * FROM
|
||||
(t2 JOIN (t3 NATURAL JOIN t4, t5 NATURAL JOIN t6)
|
||||
ON (t3.id3 = t2.id3 AND t5.id5 = t2.id5))
|
||||
NATURAL JOIN
|
||||
t1;
|
||||
SELECT * FROM
|
||||
(t2 JOIN ((t3 NATURAL JOIN t4) join (t5 NATURAL JOIN t6)))
|
||||
NATURAL JOIN
|
||||
t1;
|
||||
|
||||
DROP TABLE t1,t2,t3,t4,t5,t6;
|
||||
|
@ -7,21 +7,7 @@
|
||||
###########################################################################
|
||||
|
||||
--source include/im_check_os.inc
|
||||
|
||||
###########################################################################
|
||||
|
||||
# Wait for mysqld1 (guarded instance) to start.
|
||||
|
||||
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD1_PATH_PID 30 started
|
||||
|
||||
# Let IM detect that mysqld1 is online. This delay should be longer than
|
||||
# monitoring interval.
|
||||
|
||||
--sleep 3
|
||||
|
||||
# Check that start conditions are as expected.
|
||||
|
||||
SHOW INSTANCES;
|
||||
--source include/im_check_env.inc
|
||||
|
||||
###########################################################################
|
||||
|
||||
|
@ -7,33 +7,7 @@
|
||||
###########################################################################
|
||||
|
||||
--source include/im_check_os.inc
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
# 1.1.1. Check that Instance Manager is able:
|
||||
# - to read definitions of two mysqld-instances;
|
||||
# - to start the first instance;
|
||||
# - to understand 'nonguarded' option and keep the second instance down;
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo --------------------------------------------------------------------
|
||||
--echo -- 1.1.1.
|
||||
--echo --------------------------------------------------------------------
|
||||
|
||||
# Wait for mysqld1 (guarded instance) to start.
|
||||
|
||||
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD1_PATH_PID 30 started
|
||||
|
||||
# Let IM detect that mysqld1 is online. This delay should be longer than
|
||||
# monitoring interval.
|
||||
|
||||
--sleep 3
|
||||
|
||||
# Check that start conditions are as expected.
|
||||
|
||||
SHOW INSTANCES;
|
||||
--source include/im_check_env.inc
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
@ -54,9 +28,10 @@ START INSTANCE mysqld2;
|
||||
# FIXME: START INSTANCE should be synchronous.
|
||||
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started
|
||||
|
||||
# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is
|
||||
# synchronous. Even waiting for mysqld to start by looking at its pid file is
|
||||
# not enough, because IM may not detect that mysqld has started.
|
||||
# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
|
||||
# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
|
||||
# its pid file is not enough, because it is unknown when IM detects that
|
||||
# mysqld has started.
|
||||
# SHOW INSTANCES;
|
||||
|
||||
--connect (mysql_con,localhost,root,,mysql,$IM_MYSQLD2_PORT,$IM_MYSQLD2_SOCK)
|
||||
@ -86,9 +61,10 @@ STOP INSTANCE mysqld2;
|
||||
# FIXME: STOP INSTANCE should be synchronous.
|
||||
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped
|
||||
|
||||
# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is
|
||||
# synchronous. Even waiting for mysqld to start by looking at its pid file is
|
||||
# not enough, because IM may not detect that mysqld has started.
|
||||
# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
|
||||
# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
|
||||
# its pid file is not enough, because it is unknown when IM detects that
|
||||
# mysqld has started.
|
||||
# SHOW INSTANCES;
|
||||
|
||||
###########################################################################
|
||||
@ -114,8 +90,8 @@ START INSTANCE mysqld1;
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
# 1.1.5. Check that Instance Manager reports correct errors for 'STOP INSTANCE'
|
||||
# command:
|
||||
# 1.1.5. Check that Instance Manager reports correct errors for
|
||||
# 'STOP INSTANCE' command:
|
||||
# - if the client tries to start unregistered instance;
|
||||
# - if the client tries to start already stopped instance;
|
||||
# - if the client submits invalid arguments;
|
||||
@ -146,12 +122,10 @@ STOP INSTANCE mysqld3;
|
||||
--echo -- 1.1.6.
|
||||
--echo --------------------------------------------------------------------
|
||||
|
||||
SHOW INSTANCES;
|
||||
|
||||
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD1_PATH_PID restarted 30
|
||||
|
||||
# Give some time to IM to detect that mysqld was restarted. It should be longer
|
||||
# than monitoring interval.
|
||||
# Give some time to IM to detect that mysqld was restarted. It should be
|
||||
# longer than monitoring interval.
|
||||
|
||||
--sleep 3
|
||||
|
||||
@ -172,16 +146,18 @@ START INSTANCE mysqld2;
|
||||
# FIXME: START INSTANCE should be synchronous.
|
||||
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started
|
||||
|
||||
# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is
|
||||
# synchronous. Even waiting for mysqld to start by looking at its pid file is
|
||||
# not enough, because IM may not detect that mysqld has started.
|
||||
# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
|
||||
# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
|
||||
# its pid file is not enough, because it is unknown when IM detects that
|
||||
# mysqld has started.
|
||||
# SHOW INSTANCES;
|
||||
|
||||
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed 10
|
||||
|
||||
# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is
|
||||
# synchronous. Even waiting for mysqld to start by looking at its pid file is
|
||||
# not enough, because IM may not detect that mysqld has started.
|
||||
# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
|
||||
# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
|
||||
# its pid file is not enough, because it is unknown when IM detects that
|
||||
# mysqld has started.
|
||||
# SHOW INSTANCES;
|
||||
|
||||
###########################################################################
|
||||
|
@ -39,32 +39,7 @@
|
||||
###########################################################################
|
||||
|
||||
--source include/im_check_os.inc
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
# 0. Check starting conditions.
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
# - check the configuration file;
|
||||
|
||||
--exec grep server_id $MYSQLTEST_VARDIR/im.cnf ;
|
||||
|
||||
# - check the running instances.
|
||||
|
||||
--connect (mysql1_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK)
|
||||
|
||||
--connection mysql1_con
|
||||
|
||||
SHOW VARIABLES LIKE 'server_id';
|
||||
|
||||
--connection default
|
||||
|
||||
# - check the internal cache.
|
||||
# TODO: we should check only server_id option here.
|
||||
|
||||
# SHOW INSTANCE OPTIONS mysqld1;
|
||||
# SHOW INSTANCE OPTIONS mysqld2;
|
||||
--source include/im_check_env.inc
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
|
@ -46,32 +46,7 @@
|
||||
###########################################################################
|
||||
|
||||
--source include/im_check_os.inc
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
# 0. Check starting conditions.
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
# - check the configuration file;
|
||||
|
||||
--exec grep server_id $MYSQLTEST_VARDIR/im.cnf ;
|
||||
|
||||
# - check the running instances.
|
||||
|
||||
--connect (mysql1_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK)
|
||||
|
||||
--connection mysql1_con
|
||||
|
||||
SHOW VARIABLES LIKE 'server_id';
|
||||
|
||||
--connection default
|
||||
|
||||
# - check the internal cache.
|
||||
# TODO: we should check only server_id option here.
|
||||
|
||||
# SHOW INSTANCE OPTIONS mysqld1;
|
||||
# SHOW INSTANCE OPTIONS mysqld2;
|
||||
--source include/im_check_env.inc
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
|
@ -7,36 +7,17 @@
|
||||
###########################################################################
|
||||
|
||||
--source include/im_check_os.inc
|
||||
--source include/im_check_env.inc
|
||||
|
||||
###########################################################################
|
||||
|
||||
#
|
||||
# Check starting conditions. This test case assumes that:
|
||||
# - two mysqld-instances are registered;
|
||||
# - the first instance is online;
|
||||
# - the second instance is offline;
|
||||
# Check 'SHOW INSTANCE OPTIONS' command.
|
||||
#
|
||||
|
||||
# Wait for mysqld1 (guarded instance) to start.
|
||||
|
||||
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD1_PATH_PID 30 started
|
||||
|
||||
# Let IM detect that mysqld1 is online. This delay should be longer than
|
||||
# monitoring interval.
|
||||
|
||||
--sleep 3
|
||||
|
||||
# Check that start conditions are as expected.
|
||||
|
||||
SHOW INSTANCES;
|
||||
|
||||
#
|
||||
# Check 'SHOW INSTANCE OPTIONS' command:
|
||||
# - check that options of both offline and online instances are accessible;
|
||||
# - since configuration of an mysqld-instance contains directories, we should
|
||||
# completely ignore the second column (values) in order to make the test
|
||||
# case produce the same results on different installations;
|
||||
# TODO: ignore values of only directory-specific options.
|
||||
# Since configuration of an mysqld-instance contains directories, we should
|
||||
# completely ignore the second column (values) in order to make the test
|
||||
# case produce the same results on different installations;
|
||||
# TODO: ignore values of only directory-specific options.
|
||||
#
|
||||
|
||||
--replace_column 2 VALUE
|
||||
|
@ -887,4 +887,47 @@ DROP FUNCTION f1;
|
||||
DROP PROCEDURE p1;
|
||||
DROP USER mysql_bug20230@localhost;
|
||||
|
||||
#
|
||||
# Bug#18925: subqueries with MIN/MAX functions on INFORMARTION_SCHEMA
|
||||
#
|
||||
|
||||
SELECT t.table_name, c1.column_name
|
||||
FROM information_schema.tables t
|
||||
INNER JOIN
|
||||
information_schema.columns c1
|
||||
ON t.table_schema = c1.table_schema AND
|
||||
t.table_name = c1.table_name
|
||||
WHERE t.table_schema = 'information_schema' AND
|
||||
c1.ordinal_position =
|
||||
( SELECT COALESCE(MIN(c2.ordinal_position),1)
|
||||
FROM information_schema.columns c2
|
||||
WHERE c2.table_schema = t.table_schema AND
|
||||
c2.table_name = t.table_name AND
|
||||
c2.column_name LIKE '%SCHEMA%'
|
||||
);
|
||||
SELECT t.table_name, c1.column_name
|
||||
FROM information_schema.tables t
|
||||
INNER JOIN
|
||||
information_schema.columns c1
|
||||
ON t.table_schema = c1.table_schema AND
|
||||
t.table_name = c1.table_name
|
||||
WHERE t.table_schema = 'information_schema' AND
|
||||
c1.ordinal_position =
|
||||
( SELECT COALESCE(MIN(c2.ordinal_position),1)
|
||||
FROM information_schema.columns c2
|
||||
WHERE c2.table_schema = 'information_schema' AND
|
||||
c2.table_name = t.table_name AND
|
||||
c2.column_name LIKE '%SCHEMA%'
|
||||
);
|
||||
|
||||
#
|
||||
# Bug#21231: query with a simple non-correlated subquery over
|
||||
# INFORMARTION_SCHEMA.TABLES
|
||||
#
|
||||
|
||||
SELECT MAX(table_name) FROM information_schema.tables;
|
||||
SELECT table_name from information_schema.tables
|
||||
WHERE table_name=(SELECT MAX(table_name)
|
||||
FROM information_schema.tables);
|
||||
|
||||
# End of 5.0 tests.
|
||||
|
@ -1079,7 +1079,7 @@ drop table t1,t2,t3;
|
||||
#
|
||||
create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=innodb;
|
||||
insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
|
||||
select name2 from t1 union all select name from t1 union all select id from t1;
|
||||
select trim(name2) from t1 union all select trim(name) from t1 union all select trim(id) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
|
@ -27,3 +27,14 @@
|
||||
# client comment recognized, but parameter missing => error
|
||||
--exec echo "use" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
|
||||
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
|
||||
|
||||
#
|
||||
# Bug #20103: Escaping with backslash does not work
|
||||
#
|
||||
--exec echo "SET SQL_MODE = 'NO_BACKSLASH_ESCAPES';" > $MYSQLTEST_VARDIR/tmp/bug20103.sql
|
||||
--exec echo "SELECT '\';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql
|
||||
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1
|
||||
|
||||
--exec echo "SET SQL_MODE = '';" > $MYSQLTEST_VARDIR/tmp/bug20103.sql
|
||||
--exec echo "SELECT '\';';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql
|
||||
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1
|
||||
|
@ -490,6 +490,7 @@ execute stmt;
|
||||
deallocate prepare stmt;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
#
|
||||
# Bug#19399 "Stored Procedures 'Lost Connection' when dropping/creating
|
||||
# tables"
|
||||
@ -537,86 +538,6 @@ execute stmt;
|
||||
SELECT FOUND_ROWS();
|
||||
deallocate prepare stmt;
|
||||
|
||||
#
|
||||
# Bug#8115: equality propagation and prepared statements
|
||||
#
|
||||
|
||||
create table t1 (a char(3) not null, b char(3) not null,
|
||||
c char(3) not null, primary key (a, b, c));
|
||||
create table t2 like t1;
|
||||
|
||||
# reduced query
|
||||
prepare stmt from
|
||||
"select t1.a from (t1 left outer join t2 on t2.a=1 and t1.b=t2.b)
|
||||
where t1.a=1";
|
||||
execute stmt;
|
||||
execute stmt;
|
||||
execute stmt;
|
||||
|
||||
# original query
|
||||
prepare stmt from
|
||||
"select t1.a, t1.b, t1.c, t2.a, t2.b, t2.c from
|
||||
(t1 left outer join t2 on t2.a=? and t1.b=t2.b)
|
||||
left outer join t2 t3 on t3.a=? where t1.a=?";
|
||||
|
||||
set @a:=1, @b:=1, @c:=1;
|
||||
|
||||
execute stmt using @a, @b, @c;
|
||||
execute stmt using @a, @b, @c;
|
||||
execute stmt using @a, @b, @c;
|
||||
|
||||
deallocate prepare stmt;
|
||||
|
||||
drop table t1,t2;
|
||||
|
||||
|
||||
#
|
||||
# Bug#9383: INFORMATION_SCHEMA.COLUMNS, JOIN, Crash, prepared statement
|
||||
#
|
||||
|
||||
eval SET @aux= "SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS A,
|
||||
INFORMATION_SCHEMA.COLUMNS B
|
||||
WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA
|
||||
AND A.TABLE_NAME = B.TABLE_NAME
|
||||
AND A.COLUMN_NAME = B.COLUMN_NAME AND
|
||||
A.TABLE_NAME = 'user'";
|
||||
|
||||
let $exec_loop_count= 3;
|
||||
eval prepare my_stmt from @aux;
|
||||
while ($exec_loop_count)
|
||||
{
|
||||
eval execute my_stmt;
|
||||
dec $exec_loop_count;
|
||||
}
|
||||
deallocate prepare my_stmt;
|
||||
|
||||
# Test CALL in prepared mode
|
||||
delimiter |;
|
||||
--disable_warnings
|
||||
drop procedure if exists p1|
|
||||
drop table if exists t1|
|
||||
--enable_warnings
|
||||
create table t1 (id int)|
|
||||
insert into t1 values(1)|
|
||||
create procedure p1(a int, b int)
|
||||
begin
|
||||
declare c int;
|
||||
select max(id)+1 into c from t1;
|
||||
insert into t1 select a+b;
|
||||
insert into t1 select a-b;
|
||||
insert into t1 select a-c;
|
||||
end|
|
||||
set @a= 3, @b= 4|
|
||||
prepare stmt from "call p1(?, ?)"|
|
||||
execute stmt using @a, @b|
|
||||
execute stmt using @a, @b|
|
||||
select * from t1|
|
||||
deallocate prepare stmt|
|
||||
drop procedure p1|
|
||||
drop table t1|
|
||||
delimiter ;|
|
||||
|
||||
#
|
||||
# Bug#9096 "select doesn't return all matched records if prepared statements
|
||||
# is used"
|
||||
@ -691,35 +612,6 @@ select t2.id from t2, t1 where (t1.id=1 and t2.t1_id=t1.id);
|
||||
deallocate prepare stmt;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Bug#7306 LIMIT ?, ? and also WL#1785 " Prepared statements: implement
|
||||
# support for placeholders in LIMIT clause."
|
||||
# Add basic test coverage for the feature.
|
||||
#
|
||||
create table t1 (a int);
|
||||
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
|
||||
prepare stmt from "select * from t1 limit ?, ?";
|
||||
set @offset=0, @limit=1;
|
||||
execute stmt using @offset, @limit;
|
||||
select * from t1 limit 0, 1;
|
||||
set @offset=3, @limit=2;
|
||||
execute stmt using @offset, @limit;
|
||||
select * from t1 limit 3, 2;
|
||||
prepare stmt from "select * from t1 limit ?";
|
||||
execute stmt using @limit;
|
||||
--error 1235
|
||||
prepare stmt from "select * from t1 where a in (select a from t1 limit ?)";
|
||||
prepare stmt from "select * from t1 union all select * from t1 limit ?, ?";
|
||||
set @offset=9;
|
||||
set @limit=2;
|
||||
execute stmt using @offset, @limit;
|
||||
prepare stmt from "(select * from t1 limit ?, ?) union all
|
||||
(select * from t1 limit ?, ?) order by a limit ?";
|
||||
execute stmt using @offset, @limit, @offset, @limit, @limit;
|
||||
|
||||
drop table t1;
|
||||
deallocate prepare stmt;
|
||||
|
||||
#
|
||||
# Bug#11060 "Server crashes on calling stored procedure with INSERT SELECT
|
||||
# UNION SELECT" aka "Server crashes on re-execution of prepared INSERT ...
|
||||
@ -837,22 +729,6 @@ select ??;
|
||||
select ? from t1;
|
||||
--enable_ps_protocol
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#12651
|
||||
# (Crash on a PS including a subquery which is a select from a simple view)
|
||||
#
|
||||
CREATE TABLE b12651_T1(a int) ENGINE=MYISAM;
|
||||
CREATE TABLE b12651_T2(b int) ENGINE=MYISAM;
|
||||
CREATE VIEW b12651_V1 as SELECT b FROM b12651_T2;
|
||||
|
||||
PREPARE b12651 FROM 'SELECT 1 FROM b12651_T1 WHERE a IN (SELECT b FROM b12651_V1)';
|
||||
EXECUTE b12651;
|
||||
|
||||
DROP VIEW b12651_V1;
|
||||
DROP TABLE b12651_T1, b12651_T2;
|
||||
DEALLOCATE PREPARE b12651;
|
||||
|
||||
#
|
||||
# Bug#9359 "Prepared statements take snapshot of system vars at PREPARE
|
||||
# time"
|
||||
@ -1087,7 +963,172 @@ select @@max_prepared_stmt_count, @@prepared_stmt_count;
|
||||
set global max_prepared_stmt_count= @old_max_prepared_stmt_count;
|
||||
--enable_ps_protocol
|
||||
|
||||
# End of 4.1 tests
|
||||
#
|
||||
# Bug#19399 "Stored Procedures 'Lost Connection' when dropping/creating
|
||||
# tables"
|
||||
# Check that multi-delete tables are also cleaned up before re-execution.
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
--enable_warnings
|
||||
# exact delete syntax is essential
|
||||
prepare stmt from "delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1";
|
||||
drop temporary table t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
# the server crashed on the next statement without the fix
|
||||
execute stmt;
|
||||
drop temporary table t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
# the problem was in memory corruption: repeat the test just in case
|
||||
execute stmt;
|
||||
drop temporary table t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
execute stmt;
|
||||
drop temporary table t1;
|
||||
deallocate prepare stmt;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
############################# 5.0 tests start ################################
|
||||
#
|
||||
#
|
||||
# Bug#6102 "Server crash with prepared statement and blank after
|
||||
# function name"
|
||||
# ensure that stored functions are cached when preparing a statement
|
||||
# before we open tables
|
||||
#
|
||||
create table t1 (a varchar(20));
|
||||
insert into t1 values ('foo');
|
||||
--error 1305
|
||||
prepare stmt FROM 'SELECT char_length (a) FROM t1';
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#8115: equality propagation and prepared statements
|
||||
#
|
||||
|
||||
create table t1 (a char(3) not null, b char(3) not null,
|
||||
c char(3) not null, primary key (a, b, c));
|
||||
create table t2 like t1;
|
||||
|
||||
# reduced query
|
||||
prepare stmt from
|
||||
"select t1.a from (t1 left outer join t2 on t2.a=1 and t1.b=t2.b)
|
||||
where t1.a=1";
|
||||
execute stmt;
|
||||
execute stmt;
|
||||
execute stmt;
|
||||
|
||||
# original query
|
||||
prepare stmt from
|
||||
"select t1.a, t1.b, t1.c, t2.a, t2.b, t2.c from
|
||||
(t1 left outer join t2 on t2.a=? and t1.b=t2.b)
|
||||
left outer join t2 t3 on t3.a=? where t1.a=?";
|
||||
|
||||
set @a:=1, @b:=1, @c:=1;
|
||||
|
||||
execute stmt using @a, @b, @c;
|
||||
execute stmt using @a, @b, @c;
|
||||
execute stmt using @a, @b, @c;
|
||||
|
||||
deallocate prepare stmt;
|
||||
|
||||
drop table t1,t2;
|
||||
|
||||
|
||||
#
|
||||
# Bug#9383: INFORMATION_SCHEMA.COLUMNS, JOIN, Crash, prepared statement
|
||||
#
|
||||
|
||||
eval SET @aux= "SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS A,
|
||||
INFORMATION_SCHEMA.COLUMNS B
|
||||
WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA
|
||||
AND A.TABLE_NAME = B.TABLE_NAME
|
||||
AND A.COLUMN_NAME = B.COLUMN_NAME AND
|
||||
A.TABLE_NAME = 'user'";
|
||||
|
||||
let $exec_loop_count= 3;
|
||||
eval prepare my_stmt from @aux;
|
||||
while ($exec_loop_count)
|
||||
{
|
||||
eval execute my_stmt;
|
||||
dec $exec_loop_count;
|
||||
}
|
||||
deallocate prepare my_stmt;
|
||||
|
||||
# Test CALL in prepared mode
|
||||
delimiter |;
|
||||
--disable_warnings
|
||||
drop procedure if exists p1|
|
||||
drop table if exists t1|
|
||||
--enable_warnings
|
||||
create table t1 (id int)|
|
||||
insert into t1 values(1)|
|
||||
create procedure p1(a int, b int)
|
||||
begin
|
||||
declare c int;
|
||||
select max(id)+1 into c from t1;
|
||||
insert into t1 select a+b;
|
||||
insert into t1 select a-b;
|
||||
insert into t1 select a-c;
|
||||
end|
|
||||
set @a= 3, @b= 4|
|
||||
prepare stmt from "call p1(?, ?)"|
|
||||
execute stmt using @a, @b|
|
||||
execute stmt using @a, @b|
|
||||
select * from t1|
|
||||
deallocate prepare stmt|
|
||||
drop procedure p1|
|
||||
drop table t1|
|
||||
delimiter ;|
|
||||
|
||||
|
||||
#
|
||||
# Bug#7306 LIMIT ?, ? and also WL#1785 " Prepared statements: implement
|
||||
# support for placeholders in LIMIT clause."
|
||||
# Add basic test coverage for the feature.
|
||||
#
|
||||
create table t1 (a int);
|
||||
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
|
||||
prepare stmt from "select * from t1 limit ?, ?";
|
||||
set @offset=0, @limit=1;
|
||||
execute stmt using @offset, @limit;
|
||||
select * from t1 limit 0, 1;
|
||||
set @offset=3, @limit=2;
|
||||
execute stmt using @offset, @limit;
|
||||
select * from t1 limit 3, 2;
|
||||
prepare stmt from "select * from t1 limit ?";
|
||||
execute stmt using @limit;
|
||||
--error 1235
|
||||
prepare stmt from "select * from t1 where a in (select a from t1 limit ?)";
|
||||
prepare stmt from "select * from t1 union all select * from t1 limit ?, ?";
|
||||
set @offset=9;
|
||||
set @limit=2;
|
||||
execute stmt using @offset, @limit;
|
||||
prepare stmt from "(select * from t1 limit ?, ?) union all
|
||||
(select * from t1 limit ?, ?) order by a limit ?";
|
||||
execute stmt using @offset, @limit, @offset, @limit, @limit;
|
||||
|
||||
drop table t1;
|
||||
deallocate prepare stmt;
|
||||
|
||||
#
|
||||
# Bug#12651
|
||||
# (Crash on a PS including a subquery which is a select from a simple view)
|
||||
#
|
||||
CREATE TABLE b12651_T1(a int) ENGINE=MYISAM;
|
||||
CREATE TABLE b12651_T2(b int) ENGINE=MYISAM;
|
||||
CREATE VIEW b12651_V1 as SELECT b FROM b12651_T2;
|
||||
|
||||
PREPARE b12651 FROM 'SELECT 1 FROM b12651_T1 WHERE a IN (SELECT b FROM b12651_V1)';
|
||||
EXECUTE b12651;
|
||||
|
||||
DROP VIEW b12651_V1;
|
||||
DROP TABLE b12651_T1, b12651_T2;
|
||||
DEALLOCATE PREPARE b12651;
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Bug #14956: ROW_COUNT() returns incorrect result after EXECUTE of prepared
|
||||
|
@ -316,6 +316,7 @@ prepare stmt4 from ' show table status from test like ''t9%'' ';
|
||||
--replace_column 8 # 12 # 13 # 14 #
|
||||
# Bug#4288
|
||||
execute stmt4;
|
||||
--replace_column 2 #
|
||||
prepare stmt4 from ' show status like ''Threads_running'' ';
|
||||
execute stmt4;
|
||||
prepare stmt4 from ' show variables like ''sql_mode'' ';
|
||||
|
@ -435,6 +435,86 @@ connection master;
|
||||
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
|
||||
#
|
||||
# BUG#20438: CREATE statements for views, stored routines and triggers can be
|
||||
# not replicable.
|
||||
#
|
||||
|
||||
--echo
|
||||
--echo ---> Test for BUG#20438
|
||||
|
||||
# Prepare environment.
|
||||
|
||||
--echo
|
||||
--echo ---> Preparing environment...
|
||||
--echo ---> connection: master
|
||||
--connection master
|
||||
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
--echo ---> Synchronizing slave with master...
|
||||
|
||||
--save_master_pos
|
||||
--connection slave
|
||||
--sync_with_master
|
||||
|
||||
--echo
|
||||
--echo ---> connection: master
|
||||
--connection master
|
||||
|
||||
# Test.
|
||||
|
||||
--echo
|
||||
--echo ---> Creating procedure...
|
||||
|
||||
/*!50003 CREATE PROCEDURE p1() SET @a = 1 */;
|
||||
|
||||
/*!50003 CREATE FUNCTION f1() RETURNS INT RETURN 0 */;
|
||||
|
||||
--echo
|
||||
--echo ---> Checking on master...
|
||||
|
||||
SHOW CREATE PROCEDURE p1;
|
||||
SHOW CREATE FUNCTION f1;
|
||||
|
||||
--echo
|
||||
--echo ---> Synchronizing slave with master...
|
||||
|
||||
--save_master_pos
|
||||
--connection slave
|
||||
--sync_with_master
|
||||
|
||||
--echo ---> connection: master
|
||||
|
||||
--echo
|
||||
--echo ---> Checking on slave...
|
||||
|
||||
SHOW CREATE PROCEDURE p1;
|
||||
SHOW CREATE FUNCTION f1;
|
||||
|
||||
# Cleanup.
|
||||
|
||||
--echo
|
||||
--echo ---> connection: master
|
||||
--connection master
|
||||
|
||||
--echo
|
||||
--echo ---> Cleaning up...
|
||||
|
||||
DROP PROCEDURE p1;
|
||||
DROP FUNCTION f1;
|
||||
|
||||
--save_master_pos
|
||||
--connection slave
|
||||
--sync_with_master
|
||||
--connection master
|
||||
|
||||
|
||||
# cleanup
|
||||
connection master;
|
||||
drop table t1;
|
||||
|
@ -331,6 +331,98 @@ SHOW TRIGGERS;
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
# Restart slave.
|
||||
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
|
||||
#
|
||||
# BUG#20438: CREATE statements for views, stored routines and triggers can be
|
||||
# not replicable.
|
||||
#
|
||||
|
||||
--echo
|
||||
--echo ---> Test for BUG#20438
|
||||
|
||||
# Prepare environment.
|
||||
|
||||
--echo
|
||||
--echo ---> Preparing environment...
|
||||
--echo ---> connection: master
|
||||
--connection master
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
--echo ---> Synchronizing slave with master...
|
||||
|
||||
--save_master_pos
|
||||
--connection slave
|
||||
--sync_with_master
|
||||
|
||||
--echo
|
||||
--echo ---> connection: master
|
||||
--connection master
|
||||
|
||||
# Test.
|
||||
|
||||
--echo
|
||||
--echo ---> Creating objects...
|
||||
|
||||
CREATE TABLE t1(c INT);
|
||||
CREATE TABLE t2(c INT);
|
||||
|
||||
/*!50003 CREATE TRIGGER t1_bi BEFORE INSERT ON t1
|
||||
FOR EACH ROW
|
||||
INSERT INTO t2 VALUES(NEW.c * 10) */;
|
||||
|
||||
--echo
|
||||
--echo ---> Inserting value...
|
||||
|
||||
INSERT INTO t1 VALUES(1);
|
||||
|
||||
--echo
|
||||
--echo ---> Checking on master...
|
||||
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
--echo
|
||||
--echo ---> Synchronizing slave with master...
|
||||
|
||||
--save_master_pos
|
||||
--connection slave
|
||||
--sync_with_master
|
||||
|
||||
--echo ---> connection: master
|
||||
|
||||
--echo
|
||||
--echo ---> Checking on slave...
|
||||
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
# Cleanup.
|
||||
|
||||
--echo
|
||||
--echo ---> connection: master
|
||||
--connection master
|
||||
|
||||
--echo
|
||||
--echo ---> Cleaning up...
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
||||
--save_master_pos
|
||||
--connection slave
|
||||
--sync_with_master
|
||||
--connection master
|
||||
|
||||
|
||||
#
|
||||
# End of tests
|
||||
|
@ -45,3 +45,87 @@ drop table t1;
|
||||
sync_slave_with_master;
|
||||
--replace_column 2 # 5 #
|
||||
show binlog events limit 1,100;
|
||||
|
||||
|
||||
|
||||
#
|
||||
# BUG#20438: CREATE statements for views, stored routines and triggers can be
|
||||
# not replicable.
|
||||
#
|
||||
|
||||
--echo
|
||||
--echo ---> Test for BUG#20438
|
||||
|
||||
# Prepare environment.
|
||||
|
||||
--echo
|
||||
--echo ---> Preparing environment...
|
||||
--echo ---> connection: master
|
||||
--connection master
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
--echo ---> Synchronizing slave with master...
|
||||
|
||||
--save_master_pos
|
||||
--connection slave
|
||||
--sync_with_master
|
||||
|
||||
--echo
|
||||
--echo ---> connection: master
|
||||
--connection master
|
||||
|
||||
# Test.
|
||||
|
||||
--echo
|
||||
--echo ---> Creating objects...
|
||||
|
||||
CREATE TABLE t1(c INT);
|
||||
|
||||
/*!50003 CREATE VIEW v1 AS SELECT * FROM t1 */;
|
||||
|
||||
--echo
|
||||
--echo ---> Inserting value...
|
||||
|
||||
INSERT INTO t1 VALUES(1);
|
||||
|
||||
--echo
|
||||
--echo ---> Checking on master...
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
--echo
|
||||
--echo ---> Synchronizing slave with master...
|
||||
|
||||
--save_master_pos
|
||||
--connection slave
|
||||
--sync_with_master
|
||||
|
||||
--echo ---> connection: master
|
||||
|
||||
--echo
|
||||
--echo ---> Checking on slave...
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
# Cleanup.
|
||||
|
||||
--echo
|
||||
--echo ---> connection: master
|
||||
--connection master
|
||||
|
||||
--echo
|
||||
--echo ---> Cleaning up...
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--save_master_pos
|
||||
--connection slave
|
||||
--sync_with_master
|
||||
--connection master
|
||||
|
||||
|
@ -2304,6 +2304,51 @@ INSERT INTO t1 VALUES (10);
|
||||
SELECT i='1e+01',i=1e+01, i in (1e+01,1e+01), i in ('1e+01','1e+01') FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #21019: First result of SELECT COUNT(*) different than consecutive runs
|
||||
#
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
INSERT INTO t1 VALUES (1,1), (2,1), (4,10);
|
||||
|
||||
CREATE TABLE t2 (a int PRIMARY KEY, b int, KEY b (b));
|
||||
INSERT INTO t2 VALUES (1,NULL), (2,10);
|
||||
ALTER TABLE t1 ENABLE KEYS;
|
||||
|
||||
EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
|
||||
SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
|
||||
EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
|
||||
SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
#
|
||||
# Bug #20954 "avg(keyval) retuns 0.38 but max(keyval) returns an empty set"
|
||||
#
|
||||
--disable_ps_protocol
|
||||
CREATE TABLE t1 (key1 float default NULL, UNIQUE KEY key1 (key1));
|
||||
CREATE TABLE t2 (key2 float default NULL, UNIQUE KEY key2 (key2));
|
||||
INSERT INTO t1 VALUES (0.3762),(0.3845),(0.6158),(0.7941);
|
||||
INSERT INTO t2 VALUES (1.3762),(1.3845),(1.6158),(1.7941);
|
||||
|
||||
explain select max(key1) from t1 where key1 <= 0.6158;
|
||||
explain select max(key2) from t2 where key2 <= 1.6158;
|
||||
explain select min(key1) from t1 where key1 >= 0.3762;
|
||||
explain select min(key2) from t2 where key2 >= 1.3762;
|
||||
explain select max(key1), min(key2) from t1, t2
|
||||
where key1 <= 0.6158 and key2 >= 1.3762;
|
||||
explain select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
|
||||
explain select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
|
||||
|
||||
select max(key1) from t1 where key1 <= 0.6158;
|
||||
select max(key2) from t2 where key2 <= 1.6158;
|
||||
select min(key1) from t1 where key1 >= 0.3762;
|
||||
select min(key2) from t2 where key2 >= 1.3762;
|
||||
select max(key1), min(key2) from t1, t2
|
||||
where key1 <= 0.6158 and key2 >= 1.3762;
|
||||
select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
|
||||
select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
--enable_ps_protocol
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
|
@ -495,4 +495,15 @@ SHOW CREATE VIEW v1;
|
||||
DROP PROCEDURE p1;
|
||||
DROP VIEW v1;
|
||||
|
||||
|
||||
#
|
||||
# Check that SHOW TABLES and SHOW COLUMNS give a error if there is no
|
||||
# referenced database and table respectively.
|
||||
#
|
||||
--error ER_BAD_DB_ERROR
|
||||
SHOW TABLES FROM no_such_database;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
SHOW COLUMNS FROM no_such_table;
|
||||
|
||||
|
||||
# End of 5.0 tests.
|
||||
|
@ -190,3 +190,25 @@ delimiter ;//
|
||||
show procedure code sudoku_solve;
|
||||
|
||||
drop procedure sudoku_solve;
|
||||
|
||||
|
||||
#
|
||||
# Bug#19207: Final parenthesis omitted for CREATE INDEX in Stored
|
||||
# Procedure
|
||||
#
|
||||
# Wrong criteria was used to distinguish the case when there was no
|
||||
# lookahead performed in the parser. Bug affected only statements
|
||||
# ending in one-character token without any optional tail, like CREATE
|
||||
# INDEX and CALL.
|
||||
#
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE PROCEDURE p1() CREATE INDEX idx ON t1 (c1);
|
||||
SHOW PROCEDURE CODE p1;
|
||||
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
@ -1706,6 +1706,28 @@ drop function if exists bug16896;
|
||||
create aggregate function bug16896() returns int return 1;
|
||||
|
||||
|
||||
#
|
||||
# BUG#14702: misleading error message when syntax error in CREATE
|
||||
# PROCEDURE
|
||||
#
|
||||
# Misleading error message was given when IF NOT EXISTS was used in
|
||||
# CREATE PROCEDURE.
|
||||
#
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS bug14702;
|
||||
--enable_warnings
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
CREATE IF NOT EXISTS PROCEDURE bug14702()
|
||||
BEGIN
|
||||
END;
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
CREATE PROCEDURE IF NOT EXISTS bug14702()
|
||||
BEGIN
|
||||
END;
|
||||
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
#
|
||||
|
@ -790,4 +790,80 @@ SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
|
||||
|
||||
DROP USER user19857@localhost;
|
||||
|
||||
# End of 5.0 bugs.
|
||||
--disconnect con1root
|
||||
--connection default
|
||||
|
||||
|
||||
#
|
||||
# BUG#18630: Arguments of suid routine calculated in wrong security
|
||||
# context
|
||||
#
|
||||
# Arguments of suid routines were calculated in definer's security
|
||||
# context instead of caller's context thus creating security hole.
|
||||
#
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP FUNCTION IF EXISTS f_suid;
|
||||
DROP PROCEDURE IF EXISTS p_suid;
|
||||
DROP FUNCTION IF EXISTS f_evil;
|
||||
--enable_warnings
|
||||
DELETE FROM mysql.user WHERE user LIKE 'mysqltest\_%';
|
||||
DELETE FROM mysql.db WHERE user LIKE 'mysqltest\_%';
|
||||
DELETE FROM mysql.tables_priv WHERE user LIKE 'mysqltest\_%';
|
||||
DELETE FROM mysql.columns_priv WHERE user LIKE 'mysqltest\_%';
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
CREATE TABLE t1 (i INT);
|
||||
CREATE FUNCTION f_suid(i INT) RETURNS INT SQL SECURITY DEFINER RETURN 0;
|
||||
CREATE PROCEDURE p_suid(IN i INT) SQL SECURITY DEFINER SET @c:= 0;
|
||||
|
||||
CREATE USER mysqltest_u1@localhost;
|
||||
# Thanks to this grant statement privileges of anonymous users on
|
||||
# 'test' database are not applicable for mysqltest_u1@localhost.
|
||||
GRANT EXECUTE ON test.* TO mysqltest_u1@localhost;
|
||||
|
||||
delimiter |;
|
||||
CREATE DEFINER=mysqltest_u1@localhost FUNCTION f_evil () RETURNS INT
|
||||
SQL SECURITY INVOKER
|
||||
BEGIN
|
||||
SET @a:= CURRENT_USER();
|
||||
SET @b:= (SELECT COUNT(*) FROM t1);
|
||||
RETURN @b;
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT f_evil();
|
||||
|
||||
connect (conn1, localhost, mysqltest_u1,,);
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
SELECT COUNT(*) FROM t1;
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
SELECT f_evil();
|
||||
SELECT @a, @b;
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
SELECT f_suid(f_evil());
|
||||
SELECT @a, @b;
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
CALL p_suid(f_evil());
|
||||
SELECT @a, @b;
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
SELECT * FROM v1;
|
||||
SELECT @a, @b;
|
||||
|
||||
disconnect conn1;
|
||||
connection default;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP FUNCTION f_evil;
|
||||
DROP USER mysqltest_u1@localhost;
|
||||
DROP PROCEDURE p_suid;
|
||||
DROP FUNCTION f_suid;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
@ -5962,7 +5962,208 @@ call bug15217()|
|
||||
drop table t3|
|
||||
drop procedure bug15217|
|
||||
|
||||
|
||||
#
|
||||
# BUG#21013: Performance Degrades when importing data that uses
|
||||
# Trigger and Stored Procedure
|
||||
#
|
||||
# This is a performance and memory leak test. Run with large number
|
||||
# passed to bug21013() procedure.
|
||||
#
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS bug21013 |
|
||||
--enable_warnings
|
||||
|
||||
CREATE PROCEDURE bug21013(IN lim INT)
|
||||
BEGIN
|
||||
DECLARE i INT DEFAULT 0;
|
||||
WHILE (i < lim) DO
|
||||
SET @b = LOCATE(_latin1'b', @a, 1);
|
||||
SET i = i + 1;
|
||||
END WHILE;
|
||||
END |
|
||||
|
||||
SET @a = _latin2"aaaaaaaaaa" |
|
||||
CALL bug21013(10) |
|
||||
|
||||
DROP PROCEDURE bug21013 |
|
||||
|
||||
|
||||
#
|
||||
# BUG#16211: Stored function return type for strings is ignored
|
||||
#
|
||||
|
||||
# Prepare: create database with fixed, pre-defined character set.
|
||||
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS mysqltest1|
|
||||
DROP DATABASE IF EXISTS mysqltest2|
|
||||
--enable_warnings
|
||||
|
||||
CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8|
|
||||
CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8|
|
||||
|
||||
# Test case:
|
||||
|
||||
use mysqltest1|
|
||||
|
||||
# - Create two stored functions -- with and without explicit CHARSET-clause
|
||||
# for return value;
|
||||
|
||||
CREATE FUNCTION bug16211_f1() RETURNS CHAR(10)
|
||||
RETURN ""|
|
||||
|
||||
CREATE FUNCTION bug16211_f2() RETURNS CHAR(10) CHARSET koi8r
|
||||
RETURN ""|
|
||||
|
||||
CREATE FUNCTION mysqltest2.bug16211_f3() RETURNS CHAR(10)
|
||||
RETURN ""|
|
||||
|
||||
CREATE FUNCTION mysqltest2.bug16211_f4() RETURNS CHAR(10) CHARSET koi8r
|
||||
RETURN ""|
|
||||
|
||||
# - Check that CHARSET-clause is specified for the second function;
|
||||
|
||||
SHOW CREATE FUNCTION bug16211_f1|
|
||||
SHOW CREATE FUNCTION bug16211_f2|
|
||||
|
||||
SHOW CREATE FUNCTION mysqltest2.bug16211_f3|
|
||||
SHOW CREATE FUNCTION mysqltest2.bug16211_f4|
|
||||
|
||||
SELECT dtd_identifier
|
||||
FROM INFORMATION_SCHEMA.ROUTINES
|
||||
WHERE ROUTINE_SCHEMA = "mysqltest1" AND ROUTINE_NAME = "bug16211_f1"|
|
||||
|
||||
SELECT dtd_identifier
|
||||
FROM INFORMATION_SCHEMA.ROUTINES
|
||||
WHERE ROUTINE_SCHEMA = "mysqltest1" AND ROUTINE_NAME = "bug16211_f2"|
|
||||
|
||||
SELECT dtd_identifier
|
||||
FROM INFORMATION_SCHEMA.ROUTINES
|
||||
WHERE ROUTINE_SCHEMA = "mysqltest2" AND ROUTINE_NAME = "bug16211_f3"|
|
||||
|
||||
SELECT dtd_identifier
|
||||
FROM INFORMATION_SCHEMA.ROUTINES
|
||||
WHERE ROUTINE_SCHEMA = "mysqltest2" AND ROUTINE_NAME = "bug16211_f4"|
|
||||
|
||||
SELECT CHARSET(bug16211_f1())|
|
||||
SELECT CHARSET(bug16211_f2())|
|
||||
|
||||
SELECT CHARSET(mysqltest2.bug16211_f3())|
|
||||
SELECT CHARSET(mysqltest2.bug16211_f4())|
|
||||
|
||||
# - Alter database character set.
|
||||
|
||||
ALTER DATABASE mysqltest1 CHARACTER SET cp1251|
|
||||
ALTER DATABASE mysqltest2 CHARACTER SET cp1251|
|
||||
|
||||
# - Check that CHARSET-clause has not changed.
|
||||
|
||||
SHOW CREATE FUNCTION bug16211_f1|
|
||||
SHOW CREATE FUNCTION bug16211_f2|
|
||||
|
||||
SHOW CREATE FUNCTION mysqltest2.bug16211_f3|
|
||||
SHOW CREATE FUNCTION mysqltest2.bug16211_f4|
|
||||
|
||||
SELECT dtd_identifier
|
||||
FROM INFORMATION_SCHEMA.ROUTINES
|
||||
WHERE ROUTINE_SCHEMA = "mysqltest1" AND ROUTINE_NAME = "bug16211_f1"|
|
||||
|
||||
SELECT dtd_identifier
|
||||
FROM INFORMATION_SCHEMA.ROUTINES
|
||||
WHERE ROUTINE_SCHEMA = "mysqltest1" AND ROUTINE_NAME = "bug16211_f2"|
|
||||
|
||||
SELECT dtd_identifier
|
||||
FROM INFORMATION_SCHEMA.ROUTINES
|
||||
WHERE ROUTINE_SCHEMA = "mysqltest2" AND ROUTINE_NAME = "bug16211_f3"|
|
||||
|
||||
SELECT dtd_identifier
|
||||
FROM INFORMATION_SCHEMA.ROUTINES
|
||||
WHERE ROUTINE_SCHEMA = "mysqltest2" AND ROUTINE_NAME = "bug16211_f4"|
|
||||
|
||||
SELECT CHARSET(bug16211_f1())|
|
||||
SELECT CHARSET(bug16211_f2())|
|
||||
|
||||
SELECT CHARSET(mysqltest2.bug16211_f3())|
|
||||
SELECT CHARSET(mysqltest2.bug16211_f4())|
|
||||
|
||||
# Cleanup.
|
||||
|
||||
use test|
|
||||
|
||||
DROP DATABASE mysqltest1|
|
||||
DROP DATABASE mysqltest2|
|
||||
|
||||
|
||||
#
|
||||
# BUG#16676: Database CHARSET not used for stored procedures
|
||||
#
|
||||
|
||||
# Prepare: create database with fixed, pre-defined character set.
|
||||
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS mysqltest1|
|
||||
--enable_warnings
|
||||
|
||||
CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8|
|
||||
|
||||
# Test case:
|
||||
|
||||
use mysqltest1|
|
||||
|
||||
# - Create two stored procedures -- with and without explicit CHARSET-clause;
|
||||
|
||||
CREATE PROCEDURE bug16676_p1(
|
||||
IN p1 CHAR(10),
|
||||
INOUT p2 CHAR(10),
|
||||
OUT p3 CHAR(10))
|
||||
BEGIN
|
||||
SELECT CHARSET(p1), COLLATION(p1);
|
||||
SELECT CHARSET(p2), COLLATION(p2);
|
||||
SELECT CHARSET(p3), COLLATION(p3);
|
||||
END|
|
||||
|
||||
CREATE PROCEDURE bug16676_p2(
|
||||
IN p1 CHAR(10) CHARSET koi8r,
|
||||
INOUT p2 CHAR(10) CHARSET cp1251,
|
||||
OUT p3 CHAR(10) CHARSET greek)
|
||||
BEGIN
|
||||
SELECT CHARSET(p1), COLLATION(p1);
|
||||
SELECT CHARSET(p2), COLLATION(p2);
|
||||
SELECT CHARSET(p3), COLLATION(p3);
|
||||
END|
|
||||
|
||||
# - Call procedures.
|
||||
|
||||
SET @v2 = 'b'|
|
||||
SET @v3 = 'c'|
|
||||
|
||||
CALL bug16676_p1('a', @v2, @v3)|
|
||||
CALL bug16676_p2('a', @v2, @v3)|
|
||||
|
||||
# Cleanup.
|
||||
|
||||
use test|
|
||||
|
||||
DROP DATABASE mysqltest1|
|
||||
#
|
||||
# BUG#19862: Sort with filesort by function evaluates function twice
|
||||
#
|
||||
--disable_warnings
|
||||
drop procedure if exists bug19862|
|
||||
--enable_warnings
|
||||
CREATE TABLE t11 (a INT)|
|
||||
CREATE TABLE t12 (a INT)|
|
||||
CREATE FUNCTION bug19862(x INT) RETURNS INT
|
||||
BEGIN
|
||||
INSERT INTO t11 VALUES (x);
|
||||
RETURN x+1;
|
||||
END|
|
||||
INSERT INTO t12 VALUES (1), (2)|
|
||||
SELECT bug19862(a) FROM t12 ORDER BY 1|
|
||||
SELECT * FROM t11|
|
||||
DROP TABLE t11, t12|
|
||||
DROP FUNCTION bug19862|
|
||||
# Bug#21002 "Derived table not selecting from a "real" table fails in JOINs"
|
||||
#
|
||||
# A regression caused by the fix for Bug#18444: for derived tables we should
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1851,6 +1851,24 @@ select 1 from dual where 2 > any (select 1);
|
||||
select 1 from dual where 2 > all (select 1);
|
||||
select 1 from dual where 1 < any (select 2 from dual);
|
||||
select 1 from dual where 1 < all (select 2 from dual where 1!=1);
|
||||
|
||||
# BUG#20975 Wrong query results for subqueries within NOT
|
||||
create table t1 (s1 char);
|
||||
insert into t1 values (1),(2);
|
||||
|
||||
select * from t1 where (s1 < any (select s1 from t1));
|
||||
select * from t1 where not (s1 < any (select s1 from t1));
|
||||
|
||||
select * from t1 where (s1 < ALL (select s1+1 from t1));
|
||||
select * from t1 where not(s1 < ALL (select s1+1 from t1));
|
||||
|
||||
select * from t1 where (s1+1 = ANY (select s1 from t1));
|
||||
select * from t1 where NOT(s1+1 = ANY (select s1 from t1));
|
||||
|
||||
select * from t1 where (s1 = ALL (select s1/s1 from t1));
|
||||
select * from t1 where NOT(s1 = ALL (select s1/s1 from t1));
|
||||
drop table t1;
|
||||
# End of 4.1 tests
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
|
@ -150,3 +150,21 @@ EXPLAIN SELECT t2.*, t4.DOCTYPENAME, t1.CONTENTSIZE,t1.MIMETYPE FROM t2 INNER JO
|
||||
|
||||
drop table t1, t2, t3, t4;
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug #20792: Incorrect results from aggregate subquery
|
||||
#
|
||||
CREATE TABLE t1 (a int(10) , PRIMARY KEY (a)) Engine=InnoDB;
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
|
||||
CREATE TABLE t2 (a int(10), PRIMARY KEY (a)) Engine=InnoDB;
|
||||
INSERT INTO t2 VALUES (1);
|
||||
|
||||
CREATE TABLE t3 (a int(10), b int(10), c int(10),
|
||||
PRIMARY KEY (a)) Engine=InnoDB;
|
||||
INSERT INTO t3 VALUES (1,2,1);
|
||||
|
||||
SELECT t1.* FROM t1 WHERE (SELECT COUNT(*) FROM t3,t2 WHERE t3.c=t2.a
|
||||
and t2.a='1' AND t1.a=t3.b) > 0;
|
||||
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
@ -109,6 +109,24 @@ SELECT myfunc_double(n) AS f FROM bug19904;
|
||||
SELECT metaphon(v) AS f FROM bug19904;
|
||||
DROP TABLE bug19904;
|
||||
|
||||
#
|
||||
# Bug#21269: DEFINER-clause is allowed for UDF-functions
|
||||
#
|
||||
|
||||
--error ER_WRONG_USAGE
|
||||
CREATE DEFINER=CURRENT_USER() FUNCTION should_not_parse
|
||||
RETURNS STRING SONAME "should_not_parse.so";
|
||||
|
||||
--error ER_WRONG_USAGE
|
||||
CREATE DEFINER=someone@somewhere FUNCTION should_not_parse
|
||||
RETURNS STRING SONAME "should_not_parse.so";
|
||||
#
|
||||
# Bug#19862: Sort with filesort by function evaluates function twice
|
||||
#
|
||||
create table t1(f1 int);
|
||||
insert into t1 values(1),(2);
|
||||
explain select myfunc_int(f1) from t1 order by 1;
|
||||
drop table t1;
|
||||
--echo End of 5.0 tests.
|
||||
|
||||
#
|
||||
|
@ -390,8 +390,8 @@ create table t1 SELECT da from t2 UNION select dt from t2;
|
||||
select * from t1;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
create table t1 SELECT dt from t2 UNION select sc from t2;
|
||||
select * from t1;
|
||||
create table t1 SELECT dt from t2 UNION select trim(sc) from t2;
|
||||
select trim(dt) from t1;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
create table t1 SELECT dt from t2 UNION select sv from t2;
|
||||
@ -794,6 +794,14 @@ drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug#12185: Data type aggregation may produce wrong result
|
||||
#
|
||||
create table t1(f1 char(1), f2 char(5), f3 binary(1), f4 binary(5), f5 timestamp, f6 varchar(1) character set utf8 collate utf8_general_ci, f7 text);
|
||||
create table t2 as select *, f6 as f8 from t1 union select *, f7 from t1;
|
||||
show create table t2;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Bug#18175: Union select over 129 tables with a sum function fails.
|
||||
#
|
||||
|
@ -2643,3 +2643,78 @@ DESCRIBE t2;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
#
|
||||
# Bug #17526: views with TRIM functions
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (s varchar(10));
|
||||
INSERT INTO t1 VALUES ('yadda'), ('yady');
|
||||
|
||||
SELECT TRIM(BOTH 'y' FROM s) FROM t1;
|
||||
CREATE VIEW v1 AS SELECT TRIM(BOTH 'y' FROM s) FROM t1;
|
||||
SELECT * FROM v1;
|
||||
DROP VIEW v1;
|
||||
|
||||
SELECT TRIM(LEADING 'y' FROM s) FROM t1;
|
||||
CREATE VIEW v1 AS SELECT TRIM(LEADING 'y' FROM s) FROM t1;
|
||||
SELECT * FROM v1;
|
||||
DROP VIEW v1;
|
||||
|
||||
SELECT TRIM(TRAILING 'y' FROM s) FROM t1;
|
||||
CREATE VIEW v1 AS SELECT TRIM(TRAILING 'y' FROM s) FROM t1;
|
||||
SELECT * FROM v1;
|
||||
DROP VIEW v1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
#Bug #21080: ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM
|
||||
#
|
||||
CREATE TABLE t1 (x INT, y INT);
|
||||
CREATE ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1;
|
||||
SHOW CREATE VIEW v1;
|
||||
|
||||
ALTER VIEW v1 AS SELECT x, y FROM t1;
|
||||
SHOW CREATE VIEW v1;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
# Bug #21086: server crashes when VIEW defined with a SELECT with COLLATE
|
||||
# clause is called
|
||||
#
|
||||
CREATE TABLE t1 (s1 char);
|
||||
INSERT INTO t1 VALUES ('Z');
|
||||
|
||||
CREATE VIEW v1 AS SELECT s1 collate latin1_german1_ci AS col FROM t1;
|
||||
|
||||
CREATE VIEW v2 (col) AS SELECT s1 collate latin1_german1_ci FROM t1;
|
||||
|
||||
# either of these statements will cause crash
|
||||
INSERT INTO v1 (col) VALUES ('b');
|
||||
INSERT INTO v2 (col) VALUES ('c');
|
||||
|
||||
SELECT s1 FROM t1;
|
||||
DROP VIEW v1, v2;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #11551: Asymmetric + undocumented behaviour of DROP VIEW and DROP TABLE
|
||||
#
|
||||
CREATE TABLE t1 (id INT);
|
||||
CREATE VIEW v1 AS SELECT id FROM t1;
|
||||
SHOW TABLES;
|
||||
|
||||
--error 1051
|
||||
DROP VIEW v2,v1;
|
||||
SHOW TABLES;
|
||||
|
||||
CREATE VIEW v1 AS SELECT id FROM t1;
|
||||
--error 1347
|
||||
DROP VIEW t1,v1;
|
||||
SHOW TABLES;
|
||||
|
||||
DROP TABLE t1;
|
||||
--disable_warnings
|
||||
DROP VIEW IF EXISTS v1;
|
||||
--enable_warnings
|
||||
|
@ -335,7 +335,7 @@ File my_sopen(const char *path, int oflag, int shflag, int pmode)
|
||||
* try to open/create the file
|
||||
*/
|
||||
if ((osfh= CreateFile(path, fileaccess, fileshare, &SecurityAttributes,
|
||||
filecreate, fileattrib, NULL)) == (HANDLE)0xffffffff)
|
||||
filecreate, fileattrib, NULL)) == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
/*
|
||||
* OS call to open/create file failed! map the error, release
|
||||
@ -346,7 +346,7 @@ File my_sopen(const char *path, int oflag, int shflag, int pmode)
|
||||
return -1; /* return error to caller */
|
||||
}
|
||||
|
||||
fh= _open_osfhandle((long)osfh, oflag & (_O_APPEND | _O_RDONLY | _O_TEXT));
|
||||
fh= _open_osfhandle((intptr_t)osfh, oflag & (_O_APPEND | _O_RDONLY | _O_TEXT));
|
||||
|
||||
return fh; /* return handle */
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ copy_dir_files()
|
||||
for i in *.c *.cpp *.h *.ih *.i *.ic *.asm *.def *.hpp *.yy *dsp *.dsw \
|
||||
README INSTALL* LICENSE AUTHORS NEWS ChangeLog \
|
||||
*.inc *.test *.result *.pem Moscow_leap des_key_file \
|
||||
*.vcproj *.sln *.dat *.000001 *.require *.opt
|
||||
*.vcproj *.sln *.dat *.000001 *.require *.opt *.cnf
|
||||
do
|
||||
if [ -f $i ]
|
||||
then
|
||||
|
@ -584,7 +584,7 @@ err:
|
||||
*****************************************************************************/
|
||||
|
||||
ulong
|
||||
net_safe_read(MYSQL *mysql)
|
||||
cli_safe_read(MYSQL *mysql)
|
||||
{
|
||||
NET *net= &mysql->net;
|
||||
ulong len=0;
|
||||
@ -627,6 +627,16 @@ net_safe_read(MYSQL *mysql)
|
||||
}
|
||||
else
|
||||
set_mysql_error(mysql, CR_UNKNOWN_ERROR, unknown_sqlstate);
|
||||
/*
|
||||
Cover a protocol design error: error packet does not
|
||||
contain the server status. Therefore, the client has no way
|
||||
to find out whether there are more result sets of
|
||||
a multiple-result-set statement pending. Luckily, in 5.0 an
|
||||
error always aborts execution of a statement, wherever it is
|
||||
a multi-statement or a stored procedure, so it should be
|
||||
safe to unconditionally turn off the flag here.
|
||||
*/
|
||||
mysql->server_status&= ~SERVER_MORE_RESULTS_EXISTS;
|
||||
|
||||
DBUG_PRINT("error",("Got error: %d/%s (%s)",
|
||||
net->last_errno, net->sqlstate, net->last_error));
|
||||
@ -653,7 +663,7 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
|
||||
NET *net= &mysql->net;
|
||||
my_bool result= 1;
|
||||
init_sigpipe_variables
|
||||
DBUG_ENTER("cli_advanced_command");
|
||||
DBUG_ENTER("cli_advanced_command");
|
||||
|
||||
/* Don't give sigpipe errors if the client doesn't want them */
|
||||
set_sigpipe(mysql);
|
||||
@ -663,7 +673,8 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
|
||||
if (mysql_reconnect(mysql))
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (mysql->status != MYSQL_STATUS_READY)
|
||||
if (mysql->status != MYSQL_STATUS_READY ||
|
||||
mysql->server_status & SERVER_MORE_RESULTS_EXISTS)
|
||||
{
|
||||
DBUG_PRINT("error",("state: %d", mysql->status));
|
||||
set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);
|
||||
@ -702,7 +713,7 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
|
||||
}
|
||||
result=0;
|
||||
if (!skip_check)
|
||||
result= ((mysql->packet_length=net_safe_read(mysql)) == packet_error ?
|
||||
result= ((mysql->packet_length=cli_safe_read(mysql)) == packet_error ?
|
||||
1 : 0);
|
||||
end:
|
||||
reset_sigpipe(mysql);
|
||||
@ -754,7 +765,7 @@ static void cli_flush_use_result(MYSQL *mysql)
|
||||
for (;;)
|
||||
{
|
||||
ulong pkt_len;
|
||||
if ((pkt_len=net_safe_read(mysql)) == packet_error)
|
||||
if ((pkt_len=cli_safe_read(mysql)) == packet_error)
|
||||
break;
|
||||
if (pkt_len <= 8 && mysql->net.read_pos[0] == 254)
|
||||
{
|
||||
@ -1276,7 +1287,7 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
|
||||
NET *net = &mysql->net;
|
||||
DBUG_ENTER("cli_read_rows");
|
||||
|
||||
if ((pkt_len= net_safe_read(mysql)) == packet_error)
|
||||
if ((pkt_len= cli_safe_read(mysql)) == packet_error)
|
||||
DBUG_RETURN(0);
|
||||
if (!(result=(MYSQL_DATA*) my_malloc(sizeof(MYSQL_DATA),
|
||||
MYF(MY_WME | MY_ZEROFILL))))
|
||||
@ -1341,7 +1352,7 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
|
||||
}
|
||||
}
|
||||
cur->data[field]=to; /* End of last field */
|
||||
if ((pkt_len=net_safe_read(mysql)) == packet_error)
|
||||
if ((pkt_len=cli_safe_read(mysql)) == packet_error)
|
||||
{
|
||||
free_rows(result);
|
||||
DBUG_RETURN(0);
|
||||
@ -1373,7 +1384,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
|
||||
uchar *pos, *prev_pos, *end_pos;
|
||||
NET *net= &mysql->net;
|
||||
|
||||
if ((pkt_len=net_safe_read(mysql)) == packet_error)
|
||||
if ((pkt_len=cli_safe_read(mysql)) == packet_error)
|
||||
return -1;
|
||||
if (pkt_len <= 8 && net->read_pos[0] == 254)
|
||||
{
|
||||
@ -1650,23 +1661,23 @@ static MYSQL_RES *cli_use_result(MYSQL *mysql);
|
||||
|
||||
static MYSQL_METHODS client_methods=
|
||||
{
|
||||
cli_read_query_result,
|
||||
cli_advanced_command,
|
||||
cli_read_rows,
|
||||
cli_use_result,
|
||||
cli_fetch_lengths,
|
||||
cli_flush_use_result
|
||||
cli_read_query_result, /* read_query_result */
|
||||
cli_advanced_command, /* advanced_command */
|
||||
cli_read_rows, /* read_rows */
|
||||
cli_use_result, /* use_result */
|
||||
cli_fetch_lengths, /* fetch_lengths */
|
||||
cli_flush_use_result /* flush_use_result */
|
||||
#ifndef MYSQL_SERVER
|
||||
,cli_list_fields,
|
||||
cli_read_prepare_result,
|
||||
cli_stmt_execute,
|
||||
cli_read_binary_rows,
|
||||
cli_unbuffered_fetch,
|
||||
NULL,
|
||||
cli_read_statistics,
|
||||
cli_read_query_result,
|
||||
cli_read_change_user_result,
|
||||
cli_read_binary_rows
|
||||
,cli_list_fields, /* list_fields */
|
||||
cli_read_prepare_result, /* read_prepare_result */
|
||||
cli_stmt_execute, /* stmt_execute */
|
||||
cli_read_binary_rows, /* read_binary_rows */
|
||||
cli_unbuffered_fetch, /* unbuffered_fetch */
|
||||
NULL, /* free_embedded_thd */
|
||||
cli_read_statistics, /* read_statistics */
|
||||
cli_read_query_result, /* next_result */
|
||||
cli_read_change_user_result, /* read_change_user_result */
|
||||
cli_read_binary_rows /* read_rows_from_cursor */
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -2029,7 +2040,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
|
||||
Part 1: Connection established, read and parse first packet
|
||||
*/
|
||||
|
||||
if ((pkt_length=net_safe_read(mysql)) == packet_error)
|
||||
if ((pkt_length=cli_safe_read(mysql)) == packet_error)
|
||||
goto error;
|
||||
|
||||
/* Check if version of protocol matches current one */
|
||||
@ -2253,7 +2264,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
|
||||
OK-packet, or re-request scrambled password.
|
||||
*/
|
||||
|
||||
if ((pkt_length=net_safe_read(mysql)) == packet_error)
|
||||
if ((pkt_length=cli_safe_read(mysql)) == packet_error)
|
||||
goto error;
|
||||
|
||||
if (pkt_length == 1 && net->read_pos[0] == 254 &&
|
||||
@ -2270,7 +2281,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
|
||||
goto error;
|
||||
}
|
||||
/* Read what server thinks about out new auth message report */
|
||||
if (net_safe_read(mysql) == packet_error)
|
||||
if (cli_safe_read(mysql) == packet_error)
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -2594,7 +2605,7 @@ static my_bool cli_read_query_result(MYSQL *mysql)
|
||||
*/
|
||||
mysql = mysql->last_used_con;
|
||||
|
||||
if ((length = net_safe_read(mysql)) == packet_error)
|
||||
if ((length = cli_safe_read(mysql)) == packet_error)
|
||||
DBUG_RETURN(1);
|
||||
free_old_query(mysql); /* Free old result */
|
||||
#ifdef MYSQL_CLIENT /* Avoid warn of unused labels*/
|
||||
@ -2629,7 +2640,7 @@ get_info:
|
||||
if (field_count == NULL_LENGTH) /* LOAD DATA LOCAL INFILE */
|
||||
{
|
||||
int error=handle_local_infile(mysql,(char*) pos);
|
||||
if ((length=net_safe_read(mysql)) == packet_error || error)
|
||||
if ((length= cli_safe_read(mysql)) == packet_error || error)
|
||||
DBUG_RETURN(1);
|
||||
goto get_info; /* Get info packet */
|
||||
}
|
||||
|
18
sql/field.cc
18
sql/field.cc
@ -4387,6 +4387,24 @@ Field_timestamp::Field_timestamp(char *ptr_arg, uint32 len_arg,
|
||||
}
|
||||
|
||||
|
||||
Field_timestamp::Field_timestamp(bool maybe_null_arg,
|
||||
const char *field_name_arg,
|
||||
struct st_table *table_arg, CHARSET_INFO *cs)
|
||||
:Field_str((char*) 0, 19, maybe_null_arg ? (uchar*) "": 0, 0,
|
||||
NONE, field_name_arg, table_arg, cs)
|
||||
{
|
||||
/* For 4.0 MYD and 4.0 InnoDB compatibility */
|
||||
flags|= ZEROFILL_FLAG | UNSIGNED_FLAG;
|
||||
if (table && !table->timestamp_field &&
|
||||
unireg_check != NONE)
|
||||
{
|
||||
/* This timestamp has auto-update */
|
||||
table->timestamp_field= this;
|
||||
flags|=TIMESTAMP_FLAG;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Get auto-set type for TIMESTAMP field.
|
||||
|
||||
|
17
sql/field.h
17
sql/field.h
@ -780,6 +780,8 @@ public:
|
||||
enum utype unireg_check_arg, const char *field_name_arg,
|
||||
struct st_table *table_arg,
|
||||
CHARSET_INFO *cs);
|
||||
Field_timestamp(bool maybe_null_arg, const char *field_name_arg,
|
||||
struct st_table *table_arg, CHARSET_INFO *cs);
|
||||
enum_field_types type() const { return FIELD_TYPE_TIMESTAMP;}
|
||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
|
||||
enum Item_result cmp_type () const { return INT_RESULT; }
|
||||
@ -1128,6 +1130,21 @@ public:
|
||||
{
|
||||
flags|= BLOB_FLAG;
|
||||
}
|
||||
Field_blob(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg,
|
||||
struct st_table *table_arg, CHARSET_INFO *cs, bool set_packlength)
|
||||
:Field_longstr((char*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0, 0,
|
||||
NONE, field_name_arg, table_arg, cs)
|
||||
{
|
||||
flags|= BLOB_FLAG;
|
||||
packlength= 4;
|
||||
if (set_packlength)
|
||||
{
|
||||
uint32 char_length= len_arg/cs->mbmaxlen;
|
||||
packlength= char_length <= 255 ? 1 :
|
||||
char_length <= 65535 ? 2 :
|
||||
char_length <= 16777215 ? 3 : 4;
|
||||
}
|
||||
}
|
||||
enum_field_types type() const { return FIELD_TYPE_BLOB;}
|
||||
enum ha_base_keytype key_type() const
|
||||
{ return binary() ? HA_KEYTYPE_VARBINARY2 : HA_KEYTYPE_VARTEXT2; }
|
||||
|
@ -5943,14 +5943,6 @@ ha_innobase::start_stmt(
|
||||
|
||||
innobase_release_stat_resources(trx);
|
||||
|
||||
if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
|
||||
&& trx->global_read_view) {
|
||||
/* At low transaction isolation levels we let
|
||||
each consistent read set its own snapshot */
|
||||
|
||||
read_view_close_for_mysql(trx);
|
||||
}
|
||||
|
||||
prebuilt->sql_stat_start = TRUE;
|
||||
prebuilt->hint_need_to_fetch_extra_cols = 0;
|
||||
prebuilt->read_just_key = 0;
|
||||
@ -6684,17 +6676,17 @@ ha_innobase::store_lock(
|
||||
&& !thd->tablespace_op
|
||||
&& thd->lex->sql_command != SQLCOM_TRUNCATE
|
||||
&& thd->lex->sql_command != SQLCOM_OPTIMIZE
|
||||
|
||||
#ifdef __WIN__
|
||||
/*
|
||||
for alter table on win32 for succesfull operation
|
||||
completion it is used TL_WRITE(=10) lock instead of
|
||||
TL_WRITE_ALLOW_READ(=6), however here in innodb handler
|
||||
TL_WRITE is lifted to TL_WRITE_ALLOW_WRITE, which causes
|
||||
race condition when several clients do alter table
|
||||
simultaneously (bug #17264). This fix avoids the problem.
|
||||
*/
|
||||
&& thd->lex->sql_command != SQLCOM_ALTER_TABLE
|
||||
/* For alter table on win32 for succesful operation
|
||||
completion it is used TL_WRITE(=10) lock instead of
|
||||
TL_WRITE_ALLOW_READ(=6), however here in innodb handler
|
||||
TL_WRITE is lifted to TL_WRITE_ALLOW_WRITE, which causes
|
||||
race condition when several clients do alter table
|
||||
simultaneously (bug #17264). This fix avoids the problem. */
|
||||
&& thd->lex->sql_command != SQLCOM_ALTER_TABLE
|
||||
#endif
|
||||
|
||||
&& thd->lex->sql_command != SQLCOM_CREATE_TABLE) {
|
||||
|
||||
lock_type = TL_WRITE_ALLOW_WRITE;
|
||||
|
18
sql/item.cc
18
sql/item.cc
@ -1424,7 +1424,8 @@ bool agg_item_charsets(DTCollation &coll, const char *fname,
|
||||
In case we're in statement prepare, create conversion item
|
||||
in its memory: it will be reused on each execute.
|
||||
*/
|
||||
arena= thd->activate_stmt_arena_if_needed(&backup);
|
||||
arena= thd->is_stmt_prepare() ? thd->activate_stmt_arena_if_needed(&backup)
|
||||
: NULL;
|
||||
|
||||
for (i= 0, arg= args; i < nargs; i++, arg+= item_sep)
|
||||
{
|
||||
@ -1459,7 +1460,7 @@ bool agg_item_charsets(DTCollation &coll, const char *fname,
|
||||
been created in prepare. In this case register the change for
|
||||
rollback.
|
||||
*/
|
||||
if (arena && arena->is_conventional())
|
||||
if (arena)
|
||||
*arg= conv;
|
||||
else
|
||||
thd->change_item_tree(arg, conv);
|
||||
@ -3903,7 +3904,9 @@ Field *Item::make_string_field(TABLE *table)
|
||||
if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB)
|
||||
return new Field_blob(max_length, maybe_null, name, table,
|
||||
collation.collation);
|
||||
if (max_length > 0)
|
||||
/* Item_type_holder holds the exact type, do not change it */
|
||||
if (max_length > 0 &&
|
||||
(type() != Item::TYPE_HOLDER || field_type() != MYSQL_TYPE_STRING))
|
||||
return new Field_varstring(max_length, maybe_null, name, table,
|
||||
collation.collation);
|
||||
return new Field_string(max_length, maybe_null, name, table,
|
||||
@ -3967,6 +3970,7 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table)
|
||||
case MYSQL_TYPE_TIME:
|
||||
return new Field_time(maybe_null, name, table, &my_charset_bin);
|
||||
case MYSQL_TYPE_TIMESTAMP:
|
||||
return new Field_timestamp(maybe_null, name, table, &my_charset_bin);
|
||||
case MYSQL_TYPE_DATETIME:
|
||||
return new Field_datetime(maybe_null, name, table, &my_charset_bin);
|
||||
case MYSQL_TYPE_YEAR:
|
||||
@ -3990,7 +3994,11 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table)
|
||||
case MYSQL_TYPE_LONG_BLOB:
|
||||
case MYSQL_TYPE_BLOB:
|
||||
case MYSQL_TYPE_GEOMETRY:
|
||||
return new Field_blob(max_length, maybe_null, name, table,
|
||||
if (this->type() == Item::TYPE_HOLDER)
|
||||
return new Field_blob(max_length, maybe_null, name, table,
|
||||
collation.collation, 1);
|
||||
else
|
||||
return new Field_blob(max_length, maybe_null, name, table,
|
||||
collation.collation);
|
||||
break; // Blob handled outside of case
|
||||
}
|
||||
@ -6151,7 +6159,7 @@ uint32 Item_type_holder::display_length(Item *item)
|
||||
case MYSQL_TYPE_DOUBLE:
|
||||
return 53;
|
||||
case MYSQL_TYPE_NULL:
|
||||
return 4;
|
||||
return 0;
|
||||
case MYSQL_TYPE_LONGLONG:
|
||||
return 20;
|
||||
case MYSQL_TYPE_INT24:
|
||||
|
@ -752,6 +752,7 @@ public:
|
||||
virtual bool find_item_in_field_list_processor(byte *arg) { return 0; }
|
||||
virtual bool change_context_processor(byte *context) { return 0; }
|
||||
virtual bool reset_query_id_processor(byte *query_id) { return 0; }
|
||||
virtual bool is_expensive_processor(byte *arg) { return 0; }
|
||||
|
||||
virtual Item *equal_fields_propagator(byte * arg) { return this; }
|
||||
virtual Item *set_no_const_sub(byte *arg) { return this; }
|
||||
|
@ -3656,6 +3656,28 @@ Item *Item_cond_or::neg_transformer(THD *thd) /* NOT(a OR b OR ...) -> */
|
||||
}
|
||||
|
||||
|
||||
Item *Item_func_nop_all::neg_transformer(THD *thd)
|
||||
{
|
||||
/* "NOT (e $cmp$ ANY (SELECT ...)) -> e $rev_cmp$" ALL (SELECT ...) */
|
||||
Item_func_not_all *new_item= new Item_func_not_all(args[0]);
|
||||
Item_allany_subselect *allany= (Item_allany_subselect*)args[0];
|
||||
allany->func= allany->func_creator(FALSE);
|
||||
allany->all= !allany->all;
|
||||
allany->upper_item= new_item;
|
||||
return new_item;
|
||||
}
|
||||
|
||||
Item *Item_func_not_all::neg_transformer(THD *thd)
|
||||
{
|
||||
/* "NOT (e $cmp$ ALL (SELECT ...)) -> e $rev_cmp$" ANY (SELECT ...) */
|
||||
Item_func_nop_all *new_item= new Item_func_nop_all(args[0]);
|
||||
Item_allany_subselect *allany= (Item_allany_subselect*)args[0];
|
||||
allany->all= !allany->all;
|
||||
allany->func= allany->func_creator(TRUE);
|
||||
allany->upper_item= new_item;
|
||||
return new_item;
|
||||
}
|
||||
|
||||
Item *Item_func_eq::negated_item() /* a = b -> a != b */
|
||||
{
|
||||
return new Item_func_ne(args[0], args[1]);
|
||||
|
@ -311,6 +311,7 @@ public:
|
||||
void set_sum_test(Item_sum_hybrid *item) { test_sum_item= item; };
|
||||
void set_sub_test(Item_maxmin_subselect *item) { test_sub_item= item; };
|
||||
bool empty_underlying_subquery();
|
||||
Item *neg_transformer(THD *thd);
|
||||
};
|
||||
|
||||
|
||||
@ -321,6 +322,7 @@ public:
|
||||
Item_func_nop_all(Item *a) :Item_func_not_all(a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "<nop>"; }
|
||||
Item *neg_transformer(THD *thd);
|
||||
};
|
||||
|
||||
|
||||
|
@ -398,6 +398,13 @@ Field *Item_func::tmp_table_field(TABLE *t_arg)
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
bool Item_func::is_expensive_processor(byte *arg)
|
||||
{
|
||||
return is_expensive();
|
||||
}
|
||||
|
||||
|
||||
my_decimal *Item_func::val_decimal(my_decimal *decimal_value)
|
||||
{
|
||||
DBUG_ASSERT(fixed);
|
||||
@ -4830,7 +4837,9 @@ Item_func_sp::execute_impl(THD *thd, Field *return_value_fld)
|
||||
{
|
||||
bool err_status= TRUE;
|
||||
Sub_statement_state statement_state;
|
||||
Security_context *save_security_ctx= thd->security_ctx, *save_ctx_func;
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
Security_context *save_security_ctx= thd->security_ctx;
|
||||
#endif
|
||||
|
||||
DBUG_ENTER("Item_func_sp::execute_impl");
|
||||
|
||||
@ -4841,7 +4850,7 @@ Item_func_sp::execute_impl(THD *thd, Field *return_value_fld)
|
||||
thd->security_ctx= context->security_ctx;
|
||||
}
|
||||
#endif
|
||||
if (find_and_check_access(thd, EXECUTE_ACL, &save_ctx_func))
|
||||
if (find_and_check_access(thd))
|
||||
goto error;
|
||||
|
||||
/*
|
||||
@ -4853,13 +4862,11 @@ Item_func_sp::execute_impl(THD *thd, Field *return_value_fld)
|
||||
err_status= m_sp->execute_function(thd, args, arg_count, return_value_fld);
|
||||
thd->restore_sub_statement_state(&statement_state);
|
||||
|
||||
error:
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
sp_restore_security_context(thd, save_ctx_func);
|
||||
error:
|
||||
thd->security_ctx= save_security_ctx;
|
||||
#else
|
||||
error:
|
||||
#endif
|
||||
|
||||
DBUG_RETURN(err_status);
|
||||
}
|
||||
|
||||
@ -4976,70 +4983,38 @@ Item_func_sp::tmp_table_field(TABLE *t_arg)
|
||||
SYNOPSIS
|
||||
find_and_check_access()
|
||||
thd thread handler
|
||||
want_access requested access
|
||||
save backup of security context
|
||||
|
||||
RETURN
|
||||
FALSE Access granted
|
||||
TRUE Requested access can't be granted or function doesn't exists
|
||||
In this case security context is not changed and *save = 0
|
||||
|
||||
NOTES
|
||||
Checks if requested access to function can be granted to user.
|
||||
If function isn't found yet, it searches function first.
|
||||
If function can't be found or user don't have requested access
|
||||
error is raised.
|
||||
If security context sp_ctx is provided and access can be granted then
|
||||
switch back to previous context isn't performed.
|
||||
In case of access error or if context is not provided then
|
||||
find_and_check_access() switches back to previous security context.
|
||||
*/
|
||||
|
||||
bool
|
||||
Item_func_sp::find_and_check_access(THD *thd, ulong want_access,
|
||||
Security_context **save)
|
||||
Item_func_sp::find_and_check_access(THD *thd)
|
||||
{
|
||||
bool res= TRUE;
|
||||
|
||||
*save= 0; // Safety if error
|
||||
if (! m_sp && ! (m_sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, m_name,
|
||||
&thd->sp_func_cache, TRUE)))
|
||||
{
|
||||
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str);
|
||||
goto error;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
if (check_routine_access(thd, want_access,
|
||||
if (check_routine_access(thd, EXECUTE_ACL,
|
||||
m_sp->m_db.str, m_sp->m_name.str, 0, FALSE))
|
||||
goto error;
|
||||
|
||||
sp_change_security_context(thd, m_sp, save);
|
||||
/*
|
||||
If we changed context to run as another user, we need to check the
|
||||
access right for the new context again as someone may have deleted
|
||||
this person the right to use the procedure
|
||||
|
||||
TODO:
|
||||
Cache if the definer has the right to use the object on the first
|
||||
usage and only reset the cache if someone does a GRANT statement
|
||||
that 'may' affect this.
|
||||
*/
|
||||
if (*save &&
|
||||
check_routine_access(thd, want_access,
|
||||
m_sp->m_db.str, m_sp->m_name.str, 0, FALSE))
|
||||
{
|
||||
sp_restore_security_context(thd, *save);
|
||||
*save= 0; // Safety
|
||||
goto error;
|
||||
}
|
||||
return TRUE;
|
||||
#endif
|
||||
res= FALSE; // no error
|
||||
|
||||
error:
|
||||
return res;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Item_func_sp::fix_fields(THD *thd, Item **ref)
|
||||
{
|
||||
@ -5050,19 +5025,23 @@ Item_func_sp::fix_fields(THD *thd, Item **ref)
|
||||
{
|
||||
/*
|
||||
Here we check privileges of the stored routine only during view
|
||||
creation, in order to validate the view. A runtime check is perfomed
|
||||
in Item_func_sp::execute(), and this method is not called during
|
||||
context analysis. We do not need to restore the security context
|
||||
changed in find_and_check_access because all view structures created
|
||||
in CREATE VIEW are not used for execution. Notice, that during view
|
||||
creation we do not infer into stored routine bodies and do not check
|
||||
privileges of its statements, which would probably be a good idea
|
||||
especially if the view has SQL SECURITY DEFINER and the used stored
|
||||
procedure has SQL SECURITY DEFINER
|
||||
creation, in order to validate the view. A runtime check is
|
||||
perfomed in Item_func_sp::execute(), and this method is not
|
||||
called during context analysis. Notice, that during view
|
||||
creation we do not infer into stored routine bodies and do not
|
||||
check privileges of its statements, which would probably be a
|
||||
good idea especially if the view has SQL SECURITY DEFINER and
|
||||
the used stored procedure has SQL SECURITY DEFINER.
|
||||
*/
|
||||
Security_context *save_ctx;
|
||||
if (!(res= find_and_check_access(thd, EXECUTE_ACL, &save_ctx)))
|
||||
sp_restore_security_context(thd, save_ctx);
|
||||
res= find_and_check_access(thd);
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
Security_context *save_secutiry_ctx;
|
||||
if (!res && !(res= set_routine_security_ctx(thd, m_sp, false,
|
||||
&save_secutiry_ctx)))
|
||||
{
|
||||
sp_restore_security_context(thd, save_secutiry_ctx);
|
||||
}
|
||||
#endif /* ! NO_EMBEDDED_ACCESS_CHECKS */
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
NOT_FUNC, NOT_ALL_FUNC,
|
||||
NOW_FUNC, TRIG_COND_FUNC,
|
||||
GUSERVAR_FUNC, COLLATE_FUNC,
|
||||
EXTRACT_FUNC, CHAR_TYPECAST_FUNC, FUNC_SP };
|
||||
EXTRACT_FUNC, CHAR_TYPECAST_FUNC, FUNC_SP, UDF_FUNC };
|
||||
enum optimize_type { OPTIMIZE_NONE,OPTIMIZE_KEY,OPTIMIZE_OP, OPTIMIZE_NULL,
|
||||
OPTIMIZE_EQUAL };
|
||||
enum Type type() const { return FUNC_ITEM; }
|
||||
@ -189,6 +189,8 @@ public:
|
||||
Item *transform(Item_transformer transformer, byte *arg);
|
||||
void traverse_cond(Cond_traverser traverser,
|
||||
void * arg, traverse_order order);
|
||||
bool is_expensive_processor(byte *arg);
|
||||
virtual bool is_expensive() { return 0; }
|
||||
};
|
||||
|
||||
|
||||
@ -933,6 +935,7 @@ public:
|
||||
Item_udf_func(udf_func *udf_arg, List<Item> &list)
|
||||
:Item_func(list), udf(udf_arg) {}
|
||||
const char *func_name() const { return udf.name(); }
|
||||
enum Functype functype() const { return UDF_FUNC; }
|
||||
bool fix_fields(THD *thd, Item **ref)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 0);
|
||||
@ -945,6 +948,7 @@ public:
|
||||
void cleanup();
|
||||
Item_result result_type () const { return udf.result_type(); }
|
||||
table_map not_null_tables() const { return 0; }
|
||||
bool is_expensive() { return 1; }
|
||||
};
|
||||
|
||||
|
||||
@ -1468,11 +1472,11 @@ public:
|
||||
{ context= (Name_resolution_context *)cntx; return FALSE; }
|
||||
|
||||
void fix_length_and_dec();
|
||||
bool find_and_check_access(THD * thd, ulong want_access,
|
||||
Security_context **backup);
|
||||
bool find_and_check_access(THD * thd);
|
||||
virtual enum Functype functype() const { return FUNC_SP; }
|
||||
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
bool is_expensive() { return 1; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -1503,6 +1503,23 @@ void Item_func_trim::fix_length_and_dec()
|
||||
}
|
||||
}
|
||||
|
||||
void Item_func_trim::print(String *str)
|
||||
{
|
||||
if (arg_count == 1)
|
||||
{
|
||||
Item_func::print(str);
|
||||
return;
|
||||
}
|
||||
str->append(Item_func_trim::func_name());
|
||||
str->append('(');
|
||||
str->append(mode_name());
|
||||
str->append(' ');
|
||||
args[1]->print(str);
|
||||
str->append(STRING_WITH_LEN(" from "));
|
||||
args[0]->print(str);
|
||||
str->append(')');
|
||||
}
|
||||
|
||||
|
||||
/* Item_func_password */
|
||||
|
||||
|
@ -233,6 +233,8 @@ public:
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "trim"; }
|
||||
void print(String *str);
|
||||
virtual const char *mode_name() const { return "both"; }
|
||||
};
|
||||
|
||||
|
||||
@ -243,6 +245,7 @@ public:
|
||||
Item_func_ltrim(Item *a) :Item_func_trim(a) {}
|
||||
String *val_str(String *);
|
||||
const char *func_name() const { return "ltrim"; }
|
||||
const char *mode_name() const { return "leading"; }
|
||||
};
|
||||
|
||||
|
||||
@ -253,6 +256,7 @@ public:
|
||||
Item_func_rtrim(Item *a) :Item_func_trim(a) {}
|
||||
String *val_str(String *);
|
||||
const char *func_name() const { return "rtrim"; }
|
||||
const char *mode_name() const { return "trailing"; }
|
||||
};
|
||||
|
||||
|
||||
@ -724,7 +728,7 @@ public:
|
||||
void fix_length_and_dec();
|
||||
bool eq(const Item *item, bool binary_cmp) const;
|
||||
const char *func_name() const { return "collate"; }
|
||||
enum Functype func_type() const { return COLLATE_FUNC; }
|
||||
enum Functype functype() const { return COLLATE_FUNC; }
|
||||
void print(String *str);
|
||||
Item_field *filed_for_view_update()
|
||||
{
|
||||
|
@ -572,14 +572,14 @@ Item_in_subselect::Item_in_subselect(Item * left_exp,
|
||||
}
|
||||
|
||||
Item_allany_subselect::Item_allany_subselect(Item * left_exp,
|
||||
Comp_creator *fn,
|
||||
chooser_compare_func_creator fc,
|
||||
st_select_lex *select_lex,
|
||||
bool all_arg)
|
||||
:Item_in_subselect(), all(all_arg)
|
||||
:Item_in_subselect(), func_creator(fc), all(all_arg)
|
||||
{
|
||||
DBUG_ENTER("Item_in_subselect::Item_in_subselect");
|
||||
left_expr= left_exp;
|
||||
func= fn;
|
||||
func= func_creator(all_arg);
|
||||
init(select_lex, new select_exists_subselect(this));
|
||||
max_columns= 1;
|
||||
abort_on_null= 0;
|
||||
|
@ -269,14 +269,13 @@ public:
|
||||
/* ALL/ANY/SOME subselect */
|
||||
class Item_allany_subselect :public Item_in_subselect
|
||||
{
|
||||
protected:
|
||||
Comp_creator *func;
|
||||
|
||||
public:
|
||||
chooser_compare_func_creator func_creator;
|
||||
Comp_creator *func;
|
||||
bool all;
|
||||
|
||||
Item_allany_subselect(Item * left_expr, Comp_creator *f,
|
||||
st_select_lex *select_lex, bool all);
|
||||
Item_allany_subselect(Item * left_expr, chooser_compare_func_creator fc,
|
||||
st_select_lex *select_lex, bool all);
|
||||
|
||||
// only ALL subquery has upper not
|
||||
subs_type substype() { return all?ALL_SUBS:ANY_SUBS; }
|
||||
|
@ -377,7 +377,13 @@ Field *Item_sum::create_tmp_field(bool group, TABLE *table,
|
||||
case INT_RESULT:
|
||||
return new Field_longlong(max_length,maybe_null,name,table,unsigned_flag);
|
||||
case STRING_RESULT:
|
||||
if (max_length/collation.collation->mbmaxlen > 255 && convert_blob_length)
|
||||
/*
|
||||
Make sure that the blob fits into a Field_varstring which has
|
||||
2-byte lenght.
|
||||
*/
|
||||
if (max_length/collation.collation->mbmaxlen > 255 &&
|
||||
max_length/collation.collation->mbmaxlen < UINT_MAX16 &&
|
||||
convert_blob_length)
|
||||
return new Field_varstring(convert_blob_length, maybe_null,
|
||||
name, table,
|
||||
collation.collation);
|
||||
|
@ -520,9 +520,11 @@ enum enum_var_type
|
||||
OPT_DEFAULT= 0, OPT_SESSION, OPT_GLOBAL
|
||||
};
|
||||
class sys_var;
|
||||
class Comp_creator;
|
||||
typedef Comp_creator* (*chooser_compare_func_creator)(bool invert);
|
||||
#include "item.h"
|
||||
extern my_decimal decimal_zero;
|
||||
typedef Comp_creator* (*chooser_compare_func_creator)(bool invert);
|
||||
|
||||
/* sql_parse.cc */
|
||||
void free_items(Item *item);
|
||||
void cleanup_items(Item *item);
|
||||
@ -865,8 +867,6 @@ bool mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create);
|
||||
void mysqld_list_processes(THD *thd,const char *user,bool verbose);
|
||||
int mysqld_show_status(THD *thd);
|
||||
int mysqld_show_variables(THD *thd,const char *wild);
|
||||
int mysql_find_files(THD *thd,List<char> *files, const char *db,
|
||||
const char *path, const char *wild, bool dir);
|
||||
bool mysqld_show_storage_engines(THD *thd);
|
||||
bool mysqld_show_privileges(THD *thd);
|
||||
bool mysqld_show_column_types(THD *thd);
|
||||
@ -1138,7 +1138,10 @@ uint check_word(TYPELIB *lib, const char *val, const char *end,
|
||||
bool is_keyword(const char *name, uint len);
|
||||
|
||||
#define MY_DB_OPT_FILE "db.opt"
|
||||
bool check_db_dir_existence(const char *db_name);
|
||||
bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create);
|
||||
bool load_db_opt_by_name(THD *thd, const char *db_name,
|
||||
HA_CREATE_INFO *db_create_info);
|
||||
bool my_dbopt_init(void);
|
||||
void my_dbopt_cleanup(void);
|
||||
void my_dbopt_free(void);
|
||||
|
@ -322,7 +322,7 @@ static char eof_buff[1]= { (char) 254 }; /* Marker for end of fields */
|
||||
254 Marker (1 byte)
|
||||
warning_count Stored in 2 bytes; New in 4.1 protocol
|
||||
status_flag Stored in 2 bytes;
|
||||
For flags like SERVER_STATUS_MORE_RESULTS
|
||||
For flags like SERVER_MORE_RESULTS_EXISTS
|
||||
|
||||
Note that the warning count will not be sent if 'no_flush' is set as
|
||||
we don't want to report the warning count until all data is sent to the
|
||||
|
@ -3051,7 +3051,7 @@ static ulong read_event(MYSQL* mysql, MASTER_INFO *mi, bool* suppress_warnings)
|
||||
return packet_error;
|
||||
#endif
|
||||
|
||||
len = net_safe_read(mysql);
|
||||
len = cli_safe_read(mysql);
|
||||
if (len == packet_error || (long) len < 1)
|
||||
{
|
||||
if (mysql_errno(mysql) == ER_NET_READ_INTERRUPTED)
|
||||
|
17
sql/sp.cc
17
sql/sp.cc
@ -495,6 +495,13 @@ sp_returns_type(THD *thd, String &result, sp_head *sp)
|
||||
table.s = &table.share_not_to_be_used;
|
||||
field= sp->create_result_field(0, 0, &table);
|
||||
field->sql_type(result);
|
||||
|
||||
if (field->has_charset())
|
||||
{
|
||||
result.append(STRING_WITH_LEN(" CHARSET "));
|
||||
result.append(field->charset()->csname);
|
||||
}
|
||||
|
||||
delete field;
|
||||
}
|
||||
|
||||
@ -626,7 +633,10 @@ db_create_routine(THD *thd, int type, sp_head *sp)
|
||||
log_query.append(STRING_WITH_LEN("CREATE "));
|
||||
append_definer(thd, &log_query, &thd->lex->definer->user,
|
||||
&thd->lex->definer->host);
|
||||
log_query.append(thd->lex->stmt_definition_begin);
|
||||
log_query.append(thd->lex->stmt_definition_begin,
|
||||
(char *)sp->m_body_begin -
|
||||
thd->lex->stmt_definition_begin +
|
||||
sp->m_body.length);
|
||||
|
||||
/* Such a statement can always go directly to binlog, no trans cache */
|
||||
Query_log_event qinfo(thd, log_query.c_ptr(), log_query.length(), 0,
|
||||
@ -974,6 +984,11 @@ sp_find_routine(THD *thd, int type, sp_name *name, sp_cache **cp,
|
||||
sp_head *new_sp;
|
||||
const char *returns= "";
|
||||
char definer[USER_HOST_BUFF_SIZE];
|
||||
|
||||
/*
|
||||
String buffer for RETURNS data type must have system charset;
|
||||
64 -- size of "returns" column of mysql.proc.
|
||||
*/
|
||||
String retstr(64);
|
||||
|
||||
DBUG_PRINT("info", ("found: 0x%lx", (ulong)sp));
|
||||
|
248
sql/sp_head.cc
248
sql/sp_head.cc
@ -470,7 +470,7 @@ sp_head::init(LEX *lex)
|
||||
lex->trg_table_fields.empty();
|
||||
my_init_dynamic_array(&m_instr, sizeof(sp_instr *), 16, 8);
|
||||
m_param_begin= m_param_end= m_body_begin= 0;
|
||||
m_qname.str= m_db.str= m_name.str= m_params.str=
|
||||
m_qname.str= m_db.str= m_name.str= m_params.str=
|
||||
m_body.str= m_defstr.str= 0;
|
||||
m_qname.length= m_db.length= m_name.length= m_params.length=
|
||||
m_body.length= m_defstr.length= 0;
|
||||
@ -478,29 +478,42 @@ sp_head::init(LEX *lex)
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
sp_head::init_strings(THD *thd, LEX *lex, sp_name *name)
|
||||
sp_head::init_sp_name(THD *thd, sp_name *spname)
|
||||
{
|
||||
DBUG_ENTER("sp_head::init_sp_name");
|
||||
|
||||
/* Must be initialized in the parser. */
|
||||
|
||||
DBUG_ASSERT(spname && spname->m_db.str && spname->m_db.length);
|
||||
|
||||
/* We have to copy strings to get them into the right memroot. */
|
||||
|
||||
m_db.length= spname->m_db.length;
|
||||
m_db.str= strmake_root(thd->mem_root, spname->m_db.str, spname->m_db.length);
|
||||
|
||||
m_name.length= spname->m_name.length;
|
||||
m_name.str= strmake_root(thd->mem_root, spname->m_name.str,
|
||||
spname->m_name.length);
|
||||
|
||||
if (spname->m_qname.length == 0)
|
||||
spname->init_qname(thd);
|
||||
|
||||
m_qname.length= spname->m_qname.length;
|
||||
m_qname.str= strmake_root(thd->mem_root, spname->m_qname.str,
|
||||
m_qname.length);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
sp_head::init_strings(THD *thd, LEX *lex)
|
||||
{
|
||||
DBUG_ENTER("sp_head::init_strings");
|
||||
uchar *endp; /* Used to trim the end */
|
||||
/* During parsing, we must use thd->mem_root */
|
||||
MEM_ROOT *root= thd->mem_root;
|
||||
|
||||
DBUG_ASSERT(name);
|
||||
/* Must be initialized in the parser */
|
||||
DBUG_ASSERT(name->m_db.str && name->m_db.length);
|
||||
|
||||
/* We have to copy strings to get them into the right memroot */
|
||||
m_db.length= name->m_db.length;
|
||||
m_db.str= strmake_root(root, name->m_db.str, name->m_db.length);
|
||||
m_name.length= name->m_name.length;
|
||||
m_name.str= strmake_root(root, name->m_name.str, name->m_name.length);
|
||||
|
||||
if (name->m_qname.length == 0)
|
||||
name->init_qname(thd);
|
||||
m_qname.length= name->m_qname.length;
|
||||
m_qname.str= strmake_root(root, name->m_qname.str, m_qname.length);
|
||||
|
||||
if (m_param_begin && m_param_end)
|
||||
{
|
||||
m_params.length= m_param_end - m_param_begin;
|
||||
@ -514,10 +527,7 @@ sp_head::init_strings(THD *thd, LEX *lex, sp_name *name)
|
||||
Trim "garbage" at the end. This is sometimes needed with the
|
||||
"/ * ! VERSION... * /" wrapper in dump files.
|
||||
*/
|
||||
while (m_body_begin < endp &&
|
||||
(endp[-1] <= ' ' || endp[-1] == '*' ||
|
||||
endp[-1] == '/' || endp[-1] == ';'))
|
||||
endp-= 1;
|
||||
endp= skip_rear_comments(m_body_begin, endp);
|
||||
|
||||
m_body.length= endp - m_body_begin;
|
||||
m_body.str= strmake_root(root, (char *)m_body_begin, m_body.length);
|
||||
@ -1097,6 +1107,7 @@ sp_head::execute(THD *thd)
|
||||
|
||||
thd->restore_active_arena(&execute_arena, &backup_arena);
|
||||
|
||||
thd->spcont->pop_all_cursors(); // To avoid memory leaks after an error
|
||||
|
||||
/* Restore all saved */
|
||||
old_packet.swap(thd->packet);
|
||||
@ -1158,6 +1169,161 @@ sp_head::execute(THD *thd)
|
||||
m_first_instance->m_first_free_instance->m_recursion_level ==
|
||||
m_recursion_level + 1));
|
||||
m_first_instance->m_first_free_instance= this;
|
||||
|
||||
DBUG_RETURN(err_status);
|
||||
}
|
||||
|
||||
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
/*
|
||||
set_routine_security_ctx() changes routine security context, and
|
||||
checks if there is an EXECUTE privilege in new context. If there is
|
||||
no EXECUTE privilege, it changes the context back and returns a
|
||||
error.
|
||||
|
||||
SYNOPSIS
|
||||
set_routine_security_ctx()
|
||||
thd thread handle
|
||||
sp stored routine to change the context for
|
||||
is_proc TRUE is procedure, FALSE if function
|
||||
save_ctx pointer to an old security context
|
||||
|
||||
RETURN
|
||||
TRUE if there was a error, and the context wasn't changed.
|
||||
FALSE if the context was changed.
|
||||
*/
|
||||
|
||||
bool
|
||||
set_routine_security_ctx(THD *thd, sp_head *sp, bool is_proc,
|
||||
Security_context **save_ctx)
|
||||
{
|
||||
*save_ctx= 0;
|
||||
if (sp_change_security_context(thd, sp, save_ctx))
|
||||
return TRUE;
|
||||
|
||||
/*
|
||||
If we changed context to run as another user, we need to check the
|
||||
access right for the new context again as someone may have revoked
|
||||
the right to use the procedure from this user.
|
||||
|
||||
TODO:
|
||||
Cache if the definer has the right to use the object on the
|
||||
first usage and only reset the cache if someone does a GRANT
|
||||
statement that 'may' affect this.
|
||||
*/
|
||||
if (*save_ctx &&
|
||||
check_routine_access(thd, EXECUTE_ACL,
|
||||
sp->m_db.str, sp->m_name.str, is_proc, FALSE))
|
||||
{
|
||||
sp_restore_security_context(thd, *save_ctx);
|
||||
*save_ctx= 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#endif // ! NO_EMBEDDED_ACCESS_CHECKS
|
||||
|
||||
|
||||
/*
|
||||
Execute a trigger:
|
||||
- changes security context for triggers
|
||||
- switch to new memroot
|
||||
- call sp_head::execute
|
||||
- restore old memroot
|
||||
- restores security context
|
||||
|
||||
SYNOPSIS
|
||||
sp_head::execute_trigger()
|
||||
thd Thread handle
|
||||
db database name
|
||||
table table name
|
||||
grant_info GRANT_INFO structure to be filled with
|
||||
information about definer's privileges
|
||||
on subject table
|
||||
|
||||
RETURN
|
||||
FALSE on success
|
||||
TRUE on error
|
||||
*/
|
||||
|
||||
bool
|
||||
sp_head::execute_trigger(THD *thd, const char *db, const char *table,
|
||||
GRANT_INFO *grant_info)
|
||||
{
|
||||
sp_rcontext *octx = thd->spcont;
|
||||
sp_rcontext *nctx = NULL;
|
||||
bool err_status= FALSE;
|
||||
MEM_ROOT call_mem_root;
|
||||
Query_arena call_arena(&call_mem_root, Query_arena::INITIALIZED_FOR_SP);
|
||||
Query_arena backup_arena;
|
||||
|
||||
DBUG_ENTER("sp_head::execute_trigger");
|
||||
DBUG_PRINT("info", ("trigger %s", m_name.str));
|
||||
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
Security_context *save_ctx;
|
||||
if (sp_change_security_context(thd, this, &save_ctx))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
/*
|
||||
NOTE: TRIGGER_ACL should be used here.
|
||||
*/
|
||||
if (check_global_access(thd, SUPER_ACL))
|
||||
{
|
||||
sp_restore_security_context(thd, save_ctx);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
Fetch information about table-level privileges to GRANT_INFO
|
||||
structure for subject table. Check of privileges that will use it
|
||||
and information about column-level privileges will happen in
|
||||
Item_trigger_field::fix_fields().
|
||||
*/
|
||||
fill_effective_table_privileges(thd, grant_info, db, table);
|
||||
#endif // NO_EMBEDDED_ACCESS_CHECKS
|
||||
|
||||
/*
|
||||
Prepare arena and memroot for objects which lifetime is whole
|
||||
duration of trigger call (sp_rcontext, it's tables and items,
|
||||
sp_cursor and Item_cache holders for case expressions). We can't
|
||||
use caller's arena/memroot for those objects because in this case
|
||||
some fixed amount of memory will be consumed for each trigger
|
||||
invocation and so statements which involve lot of them will hog
|
||||
memory.
|
||||
|
||||
TODO: we should create sp_rcontext once per command and reuse it
|
||||
on subsequent executions of a trigger.
|
||||
*/
|
||||
init_sql_alloc(&call_mem_root, MEM_ROOT_BLOCK_SIZE, 0);
|
||||
thd->set_n_backup_active_arena(&call_arena, &backup_arena);
|
||||
|
||||
if (!(nctx= new sp_rcontext(m_pcont, 0, octx)) ||
|
||||
nctx->init(thd))
|
||||
{
|
||||
err_status= TRUE;
|
||||
goto err_with_cleanup;
|
||||
}
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
nctx->sp= this;
|
||||
#endif
|
||||
|
||||
thd->spcont= nctx;
|
||||
|
||||
err_status= execute(thd);
|
||||
|
||||
err_with_cleanup:
|
||||
thd->restore_active_arena(&call_arena, &backup_arena);
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
sp_restore_security_context(thd, save_ctx);
|
||||
#endif // NO_EMBEDDED_ACCESS_CHECKS
|
||||
delete nctx;
|
||||
call_arena.free_items();
|
||||
free_root(&call_mem_root, MYF(0));
|
||||
thd->spcont= octx;
|
||||
|
||||
DBUG_RETURN(err_status);
|
||||
}
|
||||
|
||||
@ -1165,8 +1331,12 @@ sp_head::execute(THD *thd)
|
||||
/*
|
||||
Execute a function:
|
||||
- evaluate parameters
|
||||
- changes security context for SUID routines
|
||||
- switch to new memroot
|
||||
- call sp_head::execute
|
||||
- restore old memroot
|
||||
- evaluate the return value
|
||||
- restores security context
|
||||
|
||||
SYNOPSIS
|
||||
sp_head::execute_function()
|
||||
@ -1293,6 +1463,15 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
|
||||
}
|
||||
thd->spcont= nctx;
|
||||
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
Security_context *save_security_ctx;
|
||||
if (set_routine_security_ctx(thd, this, FALSE, &save_security_ctx))
|
||||
{
|
||||
err_status= TRUE;
|
||||
goto err_with_cleanup;
|
||||
}
|
||||
#endif
|
||||
|
||||
binlog_save_options= thd->options;
|
||||
if (need_binlog_call)
|
||||
{
|
||||
@ -1333,7 +1512,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
|
||||
reset_dynamic(&thd->user_var_events);
|
||||
}
|
||||
|
||||
if (m_type == TYPE_ENUM_FUNCTION && !err_status)
|
||||
if (!err_status)
|
||||
{
|
||||
/* We need result only in function but not in trigger */
|
||||
|
||||
@ -1344,8 +1523,9 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
nctx->pop_all_cursors(); // To avoid memory leaks after an error
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
sp_restore_security_context(thd, save_security_ctx);
|
||||
#endif
|
||||
|
||||
err_with_cleanup:
|
||||
delete nctx;
|
||||
@ -1368,8 +1548,10 @@ err_with_cleanup:
|
||||
|
||||
The function does the following steps:
|
||||
- Set all parameters
|
||||
- changes security context for SUID routines
|
||||
- call sp_head::execute
|
||||
- copy back values of INOUT and OUT parameters
|
||||
- restores security context
|
||||
|
||||
RETURN
|
||||
FALSE on success
|
||||
@ -1490,6 +1672,12 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
|
||||
|
||||
thd->spcont= nctx;
|
||||
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
Security_context *save_security_ctx= 0;
|
||||
if (!err_status)
|
||||
err_status= set_routine_security_ctx(thd, this, TRUE, &save_security_ctx);
|
||||
#endif
|
||||
|
||||
if (!err_status)
|
||||
err_status= execute(thd);
|
||||
|
||||
@ -1534,10 +1722,14 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
if (save_security_ctx)
|
||||
sp_restore_security_context(thd, save_security_ctx);
|
||||
#endif
|
||||
|
||||
if (!save_spcont)
|
||||
delete octx;
|
||||
|
||||
nctx->pop_all_cursors(); // To avoid memory leaks after an error
|
||||
delete nctx;
|
||||
thd->spcont= save_spcont;
|
||||
|
||||
@ -1674,14 +1866,18 @@ sp_head::fill_field_definition(THD *thd, LEX *lex,
|
||||
enum enum_field_types field_type,
|
||||
create_field *field_def)
|
||||
{
|
||||
HA_CREATE_INFO sp_db_info;
|
||||
LEX_STRING cmt = { 0, 0 };
|
||||
uint unused1= 0;
|
||||
int unused2= 0;
|
||||
|
||||
load_db_opt_by_name(thd, m_db.str, &sp_db_info);
|
||||
|
||||
if (field_def->init(thd, (char*) "", field_type, lex->length, lex->dec,
|
||||
lex->type, (Item*) 0, (Item*) 0, &cmt, 0,
|
||||
&lex->interval_list,
|
||||
(lex->charset ? lex->charset : default_charset_info),
|
||||
(lex->charset ? lex->charset :
|
||||
sp_db_info.default_table_charset),
|
||||
lex->uint_geom_type))
|
||||
return TRUE;
|
||||
|
||||
|
@ -193,9 +193,13 @@ public:
|
||||
void
|
||||
init(LEX *lex);
|
||||
|
||||
/* Copy sp name from parser. */
|
||||
void
|
||||
init_sp_name(THD *thd, sp_name *spname);
|
||||
|
||||
// Initialize strings after parsing header
|
||||
void
|
||||
init_strings(THD *thd, LEX *lex, sp_name *name);
|
||||
init_strings(THD *thd, LEX *lex);
|
||||
|
||||
int
|
||||
create(THD *thd);
|
||||
@ -206,6 +210,10 @@ public:
|
||||
void
|
||||
destroy();
|
||||
|
||||
bool
|
||||
execute_trigger(THD *thd, const char *db, const char *table,
|
||||
GRANT_INFO *grant_onfo);
|
||||
|
||||
bool
|
||||
execute_function(THD *thd, Item **args, uint argcount, Field *return_fld);
|
||||
|
||||
@ -1149,6 +1157,10 @@ sp_change_security_context(THD *thd, sp_head *sp,
|
||||
Security_context **backup);
|
||||
void
|
||||
sp_restore_security_context(THD *thd, Security_context *backup);
|
||||
|
||||
bool
|
||||
set_routine_security_ctx(THD *thd, sp_head *sp, bool is_proc,
|
||||
Security_context **save_ctx);
|
||||
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
|
||||
|
||||
TABLE_LIST *
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user