Commit 2bc842a4 authored by unknown's avatar unknown

Merge bk://mysql.bkbits.net/mysql-5.0

into avenger.(none):/export/brian/mysql/mysql-5.0


BitKeeper/etc/logging_ok:
  auto-union
configure.in:
  Auto merged
parents e32fe8ff 09e05035
...@@ -508,6 +508,7 @@ mysql-test/install_test_db ...@@ -508,6 +508,7 @@ mysql-test/install_test_db
mysql-test/mysql-test-run mysql-test/mysql-test-run
mysql-test/ndb/ndbcluster mysql-test/ndb/ndbcluster
mysql-test/r/*.reject mysql-test/r/*.reject
mysql-test/r/index_merge_load.result
mysql-test/r/rpl000001.eval mysql-test/r/rpl000001.eval
mysql-test/r/rpl000002.eval mysql-test/r/rpl000002.eval
mysql-test/r/rpl000014.eval mysql-test/r/rpl000014.eval
...@@ -518,6 +519,7 @@ mysql-test/r/slave-running.eval ...@@ -518,6 +519,7 @@ mysql-test/r/slave-running.eval
mysql-test/r/slave-stopped.eval mysql-test/r/slave-stopped.eval
mysql-test/share/mysql mysql-test/share/mysql
mysql-test/std_data/*.pem mysql-test/std_data/*.pem
mysql-test/t/index_merge.load
mysql-test/var/* mysql-test/var/*
mysql.kdevprj mysql.kdevprj
mysql.proj mysql.proj
...@@ -762,6 +764,7 @@ scripts/mysqldumpslow ...@@ -762,6 +764,7 @@ scripts/mysqldumpslow
scripts/mysqlhotcopy scripts/mysqlhotcopy
scripts/safe_mysqld scripts/safe_mysqld
select_test select_test
server-tools/instance-manager/mysqlmanager
sql-bench/Results-linux/ATIS-mysql_bdb-Linux_2.2.14_my_SMP_i686 sql-bench/Results-linux/ATIS-mysql_bdb-Linux_2.2.14_my_SMP_i686
sql-bench/bench-count-distinct sql-bench/bench-count-distinct
sql-bench/bench-init.pl sql-bench/bench-init.pl
...@@ -834,6 +837,7 @@ strings/conf_to_src ...@@ -834,6 +837,7 @@ strings/conf_to_src
strings/ctype_autoconf.c strings/ctype_autoconf.c
strings/ctype_extra_sources.c strings/ctype_extra_sources.c
strings/str_test strings/str_test
strings/test_decimal
support-files/MacOSX/Description.plist support-files/MacOSX/Description.plist
support-files/MacOSX/Info.plist support-files/MacOSX/Info.plist
support-files/MacOSX/ReadMe.txt support-files/MacOSX/ReadMe.txt
...@@ -920,3 +924,5 @@ vio/test-ssl ...@@ -920,3 +924,5 @@ vio/test-ssl
vio/test-sslclient vio/test-sslclient
vio/test-sslserver vio/test-sslserver
vio/viotest-ssl vio/viotest-ssl
stamp-h1.in
stamp-h2.in
...@@ -1811,7 +1811,7 @@ sub fix_image ...@@ -1811,7 +1811,7 @@ sub fix_image
{ {
my($text) = @_; my($text) = @_;
my($arg1, $ext); my($arg1, $ext);
$text =~ /^([^,]*)$/; $text =~ /^([^,]*)/;
die "error in image: '$text'" unless defined($1); die "error in image: '$text'" unless defined($1);
$arg1 = $1; $arg1 = $1;
$arg1 =~ s/@@/@/g; $arg1 =~ s/@@/@/g;
......
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _decimal_h
#define _decimal_h
#include <my_global.h>
typedef enum {TRUNCATE=0, HALF_EVEN, HALF_UP} decimal_round_mode;
typedef int32 decimal_digit;
typedef struct st_decimal {
int intg, frac, len;
my_bool sign;
decimal_digit *buf;
} decimal;
int decimal2string(decimal *from, char *to, int *to_len);
int string2decimal(char *from, decimal *to, char **end);
int string2decimal_fixed(char *from, decimal *to, char **end);
int decimal2ulonglong(decimal *from, ulonglong *to);
int ulonglong2decimal(ulonglong from, decimal *to);
int decimal2longlong(decimal *from, longlong *to);
int longlong2decimal(longlong from, decimal *to);
int decimal2double(decimal *from, double *to);
int double2decimal(double from, decimal *to);
int decimal2bin(decimal *from, char *to, int precision, int scale);
int bin2decimal(char *from, decimal *to, int precision, int scale);
int decimal_size(int precision, int scale);
int decimal_bin_size(int precision, int scale);
int decimal_result_size(decimal *from1, decimal *from2, char op, int param);
int decimal_add(decimal *from1, decimal *from2, decimal *to);
int decimal_sub(decimal *from1, decimal *from2, decimal *to);
int decimal_cmp(decimal *from1, decimal *from2);
int decimal_mul(decimal *from1, decimal *from2, decimal *to);
int decimal_div(decimal *from1, decimal *from2, decimal *to, int scale_incr);
int decimal_mod(decimal *from1, decimal *from2, decimal *to);
int decimal_round(decimal *from, decimal *to, int new_scale, decimal_round_mode mode);
/*
the following works only on special "zero" decimal, not on any
decimal that happen to evaluate to zero
*/
#define decimal_is_zero(dec) ((dec)->intg1==1 && (dec)->frac1==0 && (dec)->buf[0]==0)
/* set a decimal to zero */
#define decimal_make_zero(dec) do { \
(dec)->buf[0]=0; \
(dec)->intg=1; \
(dec)->frac=0; \
(dec)->sign=0; \
} while(0)
/*
returns the length of the buffer to hold string representation
of the decimal
*/
#define decimal_string_size(dec) ((dec)->intg + (dec)->frac + ((dec)->frac > 0) + 1)
/* negate a decimal */
#define decimal_neg(dec) do { (dec)->sign^=1; } while(0)
/*
conventions:
decimal_smth() == 0 -- everything's ok
decimal_smth() <= 1 -- result is usable, but precision loss is possible
decimal_smth() <= 2 -- result can be unusable, most significant digits
could've been lost
decimal_smth() > 2 -- no result was generated
*/
#define E_DEC_OK 0
#define E_DEC_TRUNCATED 1
#define E_DEC_OVERFLOW 2
#define E_DEC_DIV_ZERO 3
#define E_DEC_BAD_NUM 4
#define E_DEC_OOM 5
#endif
...@@ -383,4 +383,8 @@ ...@@ -383,4 +383,8 @@
#define ER_NO_DEFAULT_FOR_FIELD 1364 #define ER_NO_DEFAULT_FOR_FIELD 1364
#define ER_DIVISION_BY_ZERO 1365 #define ER_DIVISION_BY_ZERO 1365
#define ER_TRUNCATED_WRONG_VALUE_FOR_FIELD 1366 #define ER_TRUNCATED_WRONG_VALUE_FOR_FIELD 1366
#define ER_ERROR_MESSAGES 367 #define ER_ILLEGAL_VALUE_FOR_TYPE 1367
#define ER_VIEW_NONUPD_CHECK 1368
#define ER_VIEW_CHECK_FAILED 1369
#define ER_SP_ACCESS_DENIED_ERROR 1370
#define ER_ERROR_MESSAGES 371
...@@ -156,7 +156,7 @@ ER_SPATIAL_CANT_HAVE_NULL, "42000", "", ...@@ -156,7 +156,7 @@ ER_SPATIAL_CANT_HAVE_NULL, "42000", "",
ER_COLLATION_CHARSET_MISMATCH, "42000", "", ER_COLLATION_CHARSET_MISMATCH, "42000", "",
ER_WARN_TOO_FEW_RECORDS, "01000", "", ER_WARN_TOO_FEW_RECORDS, "01000", "",
ER_WARN_TOO_MANY_RECORDS, "01000", "", ER_WARN_TOO_MANY_RECORDS, "01000", "",
ER_WARN_NULL_TO_NOTNULL, "01000", "", ER_WARN_NULL_TO_NOTNULL, "22004", "",
ER_WARN_DATA_OUT_OF_RANGE, "22003", "", ER_WARN_DATA_OUT_OF_RANGE, "22003", "",
ER_WARN_DATA_TRUNCATED, "01000", "", ER_WARN_DATA_TRUNCATED, "01000", "",
ER_WRONG_NAME_FOR_INDEX, "42000", "", ER_WRONG_NAME_FOR_INDEX, "42000", "",
...@@ -202,3 +202,5 @@ ER_SP_VARCOND_AFTER_CURSHNDLR, "42000", "", ...@@ -202,3 +202,5 @@ ER_SP_VARCOND_AFTER_CURSHNDLR, "42000", "",
ER_SP_CURSOR_AFTER_HANDLER, "42000", "", ER_SP_CURSOR_AFTER_HANDLER, "42000", "",
ER_SP_CASE_NOT_FOUND, "20000", "", ER_SP_CASE_NOT_FOUND, "20000", "",
ER_DIVISION_BY_ZERO, "22012", "", ER_DIVISION_BY_ZERO, "22012", "",
ER_ILLEGAL_VALUE_FOR_TYPE, "22007", "",
ER_SP_ACCESS_DENIED_ERROR, "42000", "",
...@@ -435,8 +435,8 @@ btr_search_update_hash_ref( ...@@ -435,8 +435,8 @@ btr_search_update_hash_ref(
ha_insert_for_fold(btr_search_sys->hash_index, fold, rec); ha_insert_for_fold(btr_search_sys->hash_index, fold, rec);
} }
} }
/************************************************************************* /*************************************************************************
Updates the search info. */ Updates the search info. */
...@@ -915,17 +915,6 @@ btr_search_drop_page_hash_index( ...@@ -915,17 +915,6 @@ btr_search_drop_page_hash_index(
{ {
hash_table_t* table; hash_table_t* table;
buf_block_t* block; buf_block_t* block;
ulint n_fields;
ulint n_bytes;
rec_t* rec;
rec_t* sup;
ulint fold;
ulint prev_fold;
dulint tree_id;
ulint n_cached;
ulint n_recs;
ulint* folds;
ulint i;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED)); ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
...@@ -951,72 +940,17 @@ btr_search_drop_page_hash_index( ...@@ -951,72 +940,17 @@ btr_search_drop_page_hash_index(
|| (block->buf_fix_count == 0)); || (block->buf_fix_count == 0));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
n_fields = block->curr_n_fields; ut_a(block->curr_n_fields + block->curr_n_bytes > 0);
n_bytes = block->curr_n_bytes;
ut_a(n_fields + n_bytes > 0);
rw_lock_s_unlock(&btr_search_latch); rw_lock_s_unlock(&btr_search_latch);
n_recs = page_get_n_recs(page);
/* Calculate and cache fold values into an array for fast deletion
from the hash index */
folds = mem_alloc(n_recs * sizeof(ulint));
n_cached = 0;
sup = page_get_supremum_rec(page);
rec = page_get_infimum_rec(page);
rec = page_rec_get_next(rec);
if (rec != sup) {
ut_a(n_fields <= rec_get_n_fields(rec));
if (n_bytes > 0) {
ut_a(n_fields < rec_get_n_fields(rec));
}
}
tree_id = btr_page_get_index_id(page);
prev_fold = 0;
while (rec != sup) {
/* FIXME: in a mixed tree, not all records may have enough
ordering fields: */
fold = rec_fold(rec, n_fields, n_bytes, tree_id);
if (fold == prev_fold && prev_fold != 0) {
goto next_rec;
}
/* Remove all hash nodes pointing to this page from the
hash chain */
folds[n_cached] = fold;
n_cached++;
next_rec:
rec = page_rec_get_next(rec);
prev_fold = fold;
}
rw_lock_x_lock(&btr_search_latch); rw_lock_x_lock(&btr_search_latch);
for (i = 0; i < n_cached; i++) { ha_remove_all_nodes_to_page(table, page);
ha_remove_all_nodes_to_page(table, folds[i], page);
}
block->is_hashed = FALSE; block->is_hashed = FALSE;
rw_lock_x_unlock(&btr_search_latch); rw_lock_x_unlock(&btr_search_latch);
mem_free(folds);
} }
/************************************************************************ /************************************************************************
......
...@@ -465,6 +465,7 @@ buf_block_init( ...@@ -465,6 +465,7 @@ buf_block_init(
block->in_LRU_list = FALSE; block->in_LRU_list = FALSE;
block->n_pointers = 0; block->n_pointers = 0;
block->hash_nodes = NULL;
rw_lock_create(&(block->lock)); rw_lock_create(&(block->lock));
ut_ad(rw_lock_validate(&(block->lock))); ut_ad(rw_lock_validate(&(block->lock)));
......
...@@ -789,6 +789,7 @@ buf_LRU_block_free_non_file_page( ...@@ -789,6 +789,7 @@ buf_LRU_block_free_non_file_page(
|| (block->state == BUF_BLOCK_READY_FOR_USE)); || (block->state == BUF_BLOCK_READY_FOR_USE));
ut_a(block->n_pointers == 0); ut_a(block->n_pointers == 0);
ut_a(block->hash_nodes == NULL);
ut_a(!block->in_free_list); ut_a(!block->in_free_list);
block->state = BUF_BLOCK_NOT_USED; block->state = BUF_BLOCK_NOT_USED;
......
...@@ -65,10 +65,53 @@ ha_create( ...@@ -65,10 +65,53 @@ ha_create(
return(table); return(table);
} }
/*****************************************************************
Removes an adaptive hash index node from the doubly linked list of hash nodes
for the buffer block. */
UNIV_INLINE
void
ha_remove_buf_block_node(
/*=====================*/
buf_block_t* block, /* in: buffer block */
ha_node_t* node) /* in: an adaptive hash index node */
{
if (node == block->hash_nodes) {
block->hash_nodes = node->next_for_block;
}
if (node->prev_for_block != NULL) {
(node->prev_for_block)->next_for_block = node->next_for_block;
}
if (node->next_for_block != NULL) {
(node->next_for_block)->prev_for_block = node->prev_for_block;
}
}
/*****************************************************************
Adds an adaptive hash index node to the start of the doubly linked list of
hash nodes for the buffer block. */
UNIV_INLINE
void
ha_add_buf_block_node(
/*==================*/
buf_block_t* block, /* in: buffer block */
ha_node_t* node) /* in: an adaptive hash index node */
{
node->next_for_block = block->hash_nodes;
node->prev_for_block = NULL;
block->hash_nodes = node;
if (node->next_for_block != NULL) {
(node->next_for_block)->prev_for_block = node;
}
}
/***************************************************************** /*****************************************************************
Inserts an entry into a hash table. If an entry with the same fold number Inserts an entry into a hash table. If an entry with the same fold number
is found, its node is updated to point to the new data, and no new node is found, its node is updated to point to the new data, and no new node
is inserted. */ is inserted. This function is only used in the adaptive hash index. */
ibool ibool
ha_insert_for_fold( ha_insert_for_fold(
...@@ -84,6 +127,7 @@ ha_insert_for_fold( ...@@ -84,6 +127,7 @@ ha_insert_for_fold(
{ {
hash_cell_t* cell; hash_cell_t* cell;
ha_node_t* node; ha_node_t* node;
buf_block_t* block;
ha_node_t* prev_node; ha_node_t* prev_node;
buf_block_t* prev_block; buf_block_t* prev_block;
ulint hash; ulint hash;
...@@ -92,6 +136,9 @@ ha_insert_for_fold( ...@@ -92,6 +136,9 @@ ha_insert_for_fold(
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold))); ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
block = buf_block_align(data);
hash = hash_calc_hash(fold, table); hash = hash_calc_hash(fold, table);
cell = hash_get_nth_cell(table, hash); cell = hash_get_nth_cell(table, hash);
...@@ -104,7 +151,15 @@ ha_insert_for_fold( ...@@ -104,7 +151,15 @@ ha_insert_for_fold(
prev_block = buf_block_align(prev_node->data); prev_block = buf_block_align(prev_node->data);
ut_a(prev_block->n_pointers > 0); ut_a(prev_block->n_pointers > 0);
prev_block->n_pointers--; prev_block->n_pointers--;
buf_block_align(data)->n_pointers++;
block->n_pointers++;
if (prev_block != block) {
ha_remove_buf_block_node(prev_block,
prev_node);
ha_add_buf_block_node(block,
prev_node);
}
} }
prev_node->data = data; prev_node->data = data;
...@@ -131,7 +186,9 @@ ha_insert_for_fold( ...@@ -131,7 +186,9 @@ ha_insert_for_fold(
ha_node_set_data(node, data); ha_node_set_data(node, data);
if (table->adaptive) { if (table->adaptive) {
buf_block_align(data)->n_pointers++; block->n_pointers++;
ha_add_buf_block_node(block, node);
} }
node->fold = fold; node->fold = fold;
...@@ -166,9 +223,15 @@ ha_delete_hash_node( ...@@ -166,9 +223,15 @@ ha_delete_hash_node(
hash_table_t* table, /* in: hash table */ hash_table_t* table, /* in: hash table */
ha_node_t* del_node) /* in: node to be deleted */ ha_node_t* del_node) /* in: node to be deleted */
{ {
buf_block_t* block;
if (table->adaptive) { if (table->adaptive) {
ut_a(buf_block_align(del_node->data)->n_pointers > 0); block = buf_block_align(del_node->data);
buf_block_align(del_node->data)->n_pointers--;
ut_a(block->n_pointers > 0);
block->n_pointers--;
ha_remove_buf_block_node(block, del_node);
} }
HASH_DELETE_AND_COMPACT(ha_node_t, next, table, del_node); HASH_DELETE_AND_COMPACT(ha_node_t, next, table, del_node);
...@@ -209,6 +272,8 @@ ha_search_and_update_if_found( ...@@ -209,6 +272,8 @@ ha_search_and_update_if_found(
void* data, /* in: pointer to the data */ void* data, /* in: pointer to the data */
void* new_data)/* in: new pointer to the data */ void* new_data)/* in: new pointer to the data */
{ {
buf_block_t* old_block;
buf_block_t* block;
ha_node_t* node; ha_node_t* node;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
...@@ -220,8 +285,15 @@ ha_search_and_update_if_found( ...@@ -220,8 +285,15 @@ ha_search_and_update_if_found(
if (node) { if (node) {
if (table->adaptive) { if (table->adaptive) {
ut_a(buf_block_align(node->data)->n_pointers > 0); ut_a(buf_block_align(node->data)->n_pointers > 0);
buf_block_align(node->data)->n_pointers--;
buf_block_align(new_data)->n_pointers++; old_block = buf_block_align(node->data);
ut_a(old_block->n_pointers > 0);
old_block->n_pointers--;
ha_remove_buf_block_node(old_block, node);
block = buf_block_align(new_data);
block->n_pointers++;
ha_add_buf_block_node(block, node);
} }
node->data = new_data; node->data = new_data;
...@@ -236,43 +308,25 @@ void ...@@ -236,43 +308,25 @@ void
ha_remove_all_nodes_to_page( ha_remove_all_nodes_to_page(
/*========================*/ /*========================*/
hash_table_t* table, /* in: hash table */ hash_table_t* table, /* in: hash table */
ulint fold, /* in: fold value */
page_t* page) /* in: buffer page */ page_t* page) /* in: buffer page */
{ {
buf_block_t* block;
ha_node_t* node; ha_node_t* node;
#ifdef UNIV_SYNC_DEBUG block = buf_block_align(page);
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
#endif /* UNIV_SYNC_DEBUG */
node = ha_chain_get_first(table, fold);
while (node) {
if (buf_frame_align(ha_node_get_data(node)) == page) {
/* Remove the hash node */ node = block->hash_nodes;
ha_delete_hash_node(table, node); while (node) {
/* Remove the hash node */
/* Start again from the first node in the chain ha_delete_hash_node(table, node);
because the deletion may compact the heap of
nodes and move other nodes! */
node = ha_chain_get_first(table, fold); node = block->hash_nodes;
} else {
node = ha_chain_get_next(node);
}
} }
#ifdef UNIV_DEBUG
/* Check that all nodes really got deleted */
node = ha_chain_get_first(table, fold); ut_a(block->n_pointers == 0);
ut_a(block->hash_nodes == NULL);
while (node) {
ut_a(buf_frame_align(ha_node_get_data(node)) != page);
node = ha_chain_get_next(node);
}
#endif
} }
/***************************************************************** /*****************************************************************
...@@ -352,6 +406,7 @@ ha_print_info( ...@@ -352,6 +406,7 @@ ha_print_info(
n_bufs++; n_bufs++;
} }
fprintf(file, ", node heap has %lu buffer(s)\n", (ulong) n_bufs); fprintf(file, ", node heap has %lu buffer(s)\n",
(ulong) n_bufs);
} }
} }
...@@ -29,6 +29,7 @@ Created 11/5/1995 Heikki Tuuri ...@@ -29,6 +29,7 @@ Created 11/5/1995 Heikki Tuuri
#include "buf0types.h" #include "buf0types.h"
#include "sync0rw.h" #include "sync0rw.h"
#include "hash0hash.h" #include "hash0hash.h"
#include "ha0ha.h"
#include "ut0byte.h" #include "ut0byte.h"
#include "os0proc.h" #include "os0proc.h"
...@@ -817,7 +818,7 @@ struct buf_block_struct{ ...@@ -817,7 +818,7 @@ struct buf_block_struct{
records with the same prefix should be records with the same prefix should be
indexed in the hash index */ indexed in the hash index */
/* The following 4 fields are protected by btr_search_latch: */ /* The following 6 fields are protected by btr_search_latch: */
ibool is_hashed; /* TRUE if hash index has already been ibool is_hashed; /* TRUE if hash index has already been
built on this page; note that it does built on this page; note that it does
...@@ -834,6 +835,11 @@ struct buf_block_struct{ ...@@ -834,6 +835,11 @@ struct buf_block_struct{
ulint curr_side; /* BTR_SEARCH_LEFT_SIDE or ulint curr_side; /* BTR_SEARCH_LEFT_SIDE or
BTR_SEARCH_RIGHT_SIDE in hash BTR_SEARCH_RIGHT_SIDE in hash
indexing */ indexing */
ha_node_t* hash_nodes; /* a doubly linked list of hash nodes
for this buffer block; this points to
the first node in the list if any;
note that we do not use UT_LST_ macros
to manipulate this list */
/* 6. Debug fields */ /* 6. Debug fields */
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
rw_lock_t debug_latch; /* in the debug version, each thread rw_lock_t debug_latch; /* in the debug version, each thread
......
...@@ -54,7 +54,7 @@ ha_create( ...@@ -54,7 +54,7 @@ ha_create(
/***************************************************************** /*****************************************************************
Inserts an entry into a hash table. If an entry with the same fold number Inserts an entry into a hash table. If an entry with the same fold number
is found, its node is updated to point to the new data, and no new node is found, its node is updated to point to the new data, and no new node
is inserted. */ is inserted. This function is only used in the adaptive hash index. */
ibool ibool
ha_insert_for_fold( ha_insert_for_fold(
...@@ -111,7 +111,6 @@ void ...@@ -111,7 +111,6 @@ void
ha_remove_all_nodes_to_page( ha_remove_all_nodes_to_page(
/*========================*/ /*========================*/
hash_table_t* table, /* in: hash table */ hash_table_t* table, /* in: hash table */
ulint fold, /* in: fold value */
page_t* page); /* in: buffer page */ page_t* page); /* in: buffer page */
/***************************************************************** /*****************************************************************
Validates a hash table. */ Validates a hash table. */
...@@ -134,9 +133,18 @@ ha_print_info( ...@@ -134,9 +133,18 @@ ha_print_info(
typedef struct ha_node_struct ha_node_t; typedef struct ha_node_struct ha_node_t;
struct ha_node_struct { struct ha_node_struct {
ha_node_t* next; /* next chain node or NULL if none */ ha_node_t* next; /* next chain node; NULL if none */
void* data; /* pointer to the data */ void* data; /* pointer to the data */
ulint fold; /* fold value for the data */ ulint fold; /* fold value for the data */
ha_node_t* next_for_block;/* in an adaptive hash index
(btr0sea.c), a doubly linked list of hash
nodes for the buffer block; these nodes
contain pointers to index records on the
page; in the last node this field is NULL;
note that we do not use UT_LST_ macros
to manipulate this list */
ha_node_t* prev_for_block;/* pointer to the previous node; in the
first node NULL */
}; };
#ifndef UNIV_NONINL #ifndef UNIV_NONINL
......
...@@ -166,7 +166,7 @@ hash_get_n_cells( ...@@ -166,7 +166,7 @@ hash_get_n_cells(
/*********************************************************************** /***********************************************************************
Deletes a struct which is stored in the heap of the hash table, and compacts Deletes a struct which is stored in the heap of the hash table, and compacts
the heap. The fold value must be stored in the struct NODE in a field named the heap. The fold value must be stored in the struct NODE in a field named
'fold'. */ 'fold'. This macro is only used for the adaptive hash index. */
#define HASH_DELETE_AND_COMPACT(TYPE, NAME, TABLE, NODE)\ #define HASH_DELETE_AND_COMPACT(TYPE, NAME, TABLE, NODE)\
do {\ do {\
...@@ -191,11 +191,23 @@ do {\ ...@@ -191,11 +191,23 @@ do {\
/* Copy the top node in place of NODE */\ /* Copy the top node in place of NODE */\
\ \
*(NODE) = *top_node111;\ *(NODE) = *top_node111;\
\
/* Update the adaptive hash list of the buffer block that\
corresponds to the top node */\
if (top_node111->next_for_block != NULL) {\
(top_node111->next_for_block)->prev_for_block = NODE;\
}\
\
if (top_node111->prev_for_block != NULL) {\
(top_node111->prev_for_block)->next_for_block = NODE;\
} else {\
buf_block_align(top_node111->data)->hash_nodes = NODE;\
}\
\
/* Look for the hash pointer to the top node, to update it */\
\ \
cell111 = hash_get_nth_cell(TABLE,\ cell111 = hash_get_nth_cell(TABLE,\
hash_calc_hash(top_node111->fold, TABLE));\ hash_calc_hash(top_node111->fold, TABLE));\
\
/* Look for the pointer to the top node, to update it */\
\ \
if (cell111->node == top_node111) {\ if (cell111->node == top_node111) {\
/* The top node is the first in the chain */\ /* The top node is the first in the chain */\
......
...@@ -1184,17 +1184,19 @@ stop_master () ...@@ -1184,17 +1184,19 @@ stop_master ()
mysql_stop () mysql_stop ()
{ {
$ECHO "Ending Tests" if [ "$MASTER_RUNNING" = 1 ]
$ECHO "Shutting-down MySQL daemon" then
$ECHO "" $ECHO "Ending Tests"
stop_master $ECHO "Shutting-down MySQL daemon"
$ECHO "Master shutdown finished" $ECHO ""
stop_slave stop_master
stop_slave 1 $ECHO "Master shutdown finished"
stop_slave 2 stop_slave
$ECHO "Slave shutdown finished" stop_slave 1
stop_slave 2
return 1 $ECHO "Slave shutdown finished"
fi
return 1
} }
mysql_restart () mysql_restart ()
...@@ -1383,8 +1385,6 @@ run_testcase () ...@@ -1383,8 +1385,6 @@ run_testcase ()
then then
mysql_restart mysql_restart
fi fi
$ECHO "Resuming Tests"
$ECHO ""
fi fi
fi fi
fi fi
......
...@@ -463,7 +463,7 @@ ALTER TABLE t1 DROP PRIMARY KEY; ...@@ -463,7 +463,7 @@ ALTER TABLE t1 DROP PRIMARY KEY;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` int(11) default NULL, `b` int(11) default NULL,
UNIQUE KEY `b` (`b`) UNIQUE KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
......
...@@ -232,7 +232,7 @@ a b ...@@ -232,7 +232,7 @@ a b
delete from t1 where a=0; delete from t1 where a=0;
update t1 set a=NULL where b=6; update t1 set a=NULL where b=6;
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 4 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 4
update t1 set a=300 where b=7; update t1 set a=300 where b=7;
SET SQL_MODE=''; SET SQL_MODE='';
insert into t1(a,b)values(NULL,8); insert into t1(a,b)values(NULL,8);
...@@ -274,7 +274,7 @@ a b ...@@ -274,7 +274,7 @@ a b
delete from t1 where a=0; delete from t1 where a=0;
update t1 set a=NULL where b=13; update t1 set a=NULL where b=13;
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 9 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 9
update t1 set a=500 where b=14; update t1 set a=500 where b=14;
select * from t1 order by b; select * from t1 order by b;
a b a b
......
show tables; show tables;
Tables_in_mysql table_type Tables_in_mysql
columns_priv BASE TABLE columns_priv
db BASE TABLE db
func BASE TABLE func
help_category BASE TABLE help_category
help_keyword BASE TABLE help_keyword
help_relation BASE TABLE help_relation
help_topic BASE TABLE help_topic
host BASE TABLE host
proc BASE TABLE proc
tables_priv BASE TABLE tables_priv
time_zone BASE TABLE time_zone
time_zone_leap_second BASE TABLE time_zone_leap_second
time_zone_name BASE TABLE time_zone_name
time_zone_transition BASE TABLE time_zone_transition
time_zone_transition_type BASE TABLE time_zone_transition_type
user BASE TABLE user
show tables; show tables;
Tables_in_test table_type Tables_in_test
grant ALL on *.* to test@localhost identified by "gambling"; grant ALL on *.* to test@localhost identified by "gambling";
grant ALL on *.* to test@127.0.0.1 identified by "gambling"; grant ALL on *.* to test@127.0.0.1 identified by "gambling";
show tables; show tables;
Tables_in_mysql table_type Tables_in_mysql
columns_priv BASE TABLE columns_priv
db BASE TABLE db
func BASE TABLE func
help_category BASE TABLE help_category
help_keyword BASE TABLE help_keyword
help_relation BASE TABLE help_relation
help_topic BASE TABLE help_topic
host BASE TABLE host
proc BASE TABLE proc
tables_priv BASE TABLE tables_priv
time_zone BASE TABLE time_zone
time_zone_leap_second BASE TABLE time_zone_leap_second
time_zone_name BASE TABLE time_zone_name
time_zone_transition BASE TABLE time_zone_transition
time_zone_transition_type BASE TABLE time_zone_transition_type
user BASE TABLE user
show tables; show tables;
Tables_in_test table_type Tables_in_test
update mysql.user set password=old_password("gambling2") where user=_binary"test"; update mysql.user set password=old_password("gambling2") where user=_binary"test";
flush privileges; flush privileges;
set password=""; set password="";
...@@ -47,24 +47,24 @@ set password='gambling3'; ...@@ -47,24 +47,24 @@ set password='gambling3';
ERROR HY000: Password hash should be a 41-digit hexadecimal number ERROR HY000: Password hash should be a 41-digit hexadecimal number
set password=old_password('gambling3'); set password=old_password('gambling3');
show tables; show tables;
Tables_in_mysql table_type Tables_in_mysql
columns_priv BASE TABLE columns_priv
db BASE TABLE db
func BASE TABLE func
help_category BASE TABLE help_category
help_keyword BASE TABLE help_keyword
help_relation BASE TABLE help_relation
help_topic BASE TABLE help_topic
host BASE TABLE host
proc BASE TABLE proc
tables_priv BASE TABLE tables_priv
time_zone BASE TABLE time_zone
time_zone_leap_second BASE TABLE time_zone_leap_second
time_zone_name BASE TABLE time_zone_name
time_zone_transition BASE TABLE time_zone_transition
time_zone_transition_type BASE TABLE time_zone_transition_type
user BASE TABLE user
show tables; show tables;
Tables_in_test table_type Tables_in_test
delete from mysql.user where user=_binary"test"; delete from mysql.user where user=_binary"test";
flush privileges; flush privileges;
...@@ -11,7 +11,7 @@ create table t1 (b char(0) not null); ...@@ -11,7 +11,7 @@ create table t1 (b char(0) not null);
create table if not exists t1 (b char(0) not null); create table if not exists t1 (b char(0) not null);
insert into t1 values (""),(null); insert into t1 values (""),(null);
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'b' at row 2 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 2
select * from t1; select * from t1;
b b
...@@ -152,7 +152,7 @@ create table t1 (a int not null, b int, primary key(a), key (b), key (b), key (b ...@@ -152,7 +152,7 @@ create table t1 (a int not null, b int, primary key(a), key (b), key (b), key (b
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` int(11) default NULL, `b` int(11) default NULL,
PRIMARY KEY (`a`), PRIMARY KEY (`a`),
KEY `b` (`b`), KEY `b` (`b`),
...@@ -203,7 +203,7 @@ CREATE TABLE t1 (a int not null); ...@@ -203,7 +203,7 @@ CREATE TABLE t1 (a int not null);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0' `a` int(11) NOT NULL
) ENGINE=HEAP DEFAULT CHARSET=latin1 ) ENGINE=HEAP DEFAULT CHARSET=latin1
drop table t1; drop table t1;
SET SESSION storage_engine="gemini"; SET SESSION storage_engine="gemini";
...@@ -215,7 +215,7 @@ CREATE TABLE t1 (a int not null); ...@@ -215,7 +215,7 @@ CREATE TABLE t1 (a int not null);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0' `a` int(11) NOT NULL
) ENGINE=HEAP DEFAULT CHARSET=latin1 ) ENGINE=HEAP DEFAULT CHARSET=latin1
SET SESSION storage_engine=default; SET SESSION storage_engine=default;
drop table t1; drop table t1;
...@@ -291,7 +291,7 @@ create table t3 like t1; ...@@ -291,7 +291,7 @@ create table t3 like t1;
show create table t3; show create table t3;
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
`name` char(20) default NULL `name` char(20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t3; select * from t3;
...@@ -306,7 +306,7 @@ create temporary table t3 like t2; ...@@ -306,7 +306,7 @@ create temporary table t3 like t2;
show create table t3; show create table t3;
Table Create Table Table Create Table
t3 CREATE TEMPORARY TABLE `t3` ( t3 CREATE TEMPORARY TABLE `t3` (
`id` int(11) NOT NULL default '0' `id` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t3; select * from t3;
id id
...@@ -314,7 +314,7 @@ drop table t3; ...@@ -314,7 +314,7 @@ drop table t3;
show create table t3; show create table t3;
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
`name` char(20) default NULL `name` char(20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t3; select * from t3;
...@@ -326,14 +326,14 @@ create temporary table t3 like mysqltest.t3; ...@@ -326,14 +326,14 @@ create temporary table t3 like mysqltest.t3;
show create table t3; show create table t3;
Table Create Table Table Create Table
t3 CREATE TEMPORARY TABLE `t3` ( t3 CREATE TEMPORARY TABLE `t3` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
`name` char(20) default NULL `name` char(20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
create table t2 like t3; create table t2 like t3;
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
`name` char(20) default NULL `name` char(20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t2; select * from t2;
...@@ -360,7 +360,7 @@ CREATE TABLE t1 (a int not null); ...@@ -360,7 +360,7 @@ CREATE TABLE t1 (a int not null);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0' `a` int(11) NOT NULL
) ENGINE=HEAP DEFAULT CHARSET=latin1 ) ENGINE=HEAP DEFAULT CHARSET=latin1
drop table t1; drop table t1;
SET SESSION storage_engine="gemini"; SET SESSION storage_engine="gemini";
...@@ -372,7 +372,7 @@ CREATE TABLE t1 (a int not null); ...@@ -372,7 +372,7 @@ CREATE TABLE t1 (a int not null);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0' `a` int(11) NOT NULL
) ENGINE=HEAP DEFAULT CHARSET=latin1 ) ENGINE=HEAP DEFAULT CHARSET=latin1
SET SESSION storage_engine=default; SET SESSION storage_engine=default;
drop table t1; drop table t1;
......
...@@ -484,7 +484,7 @@ ERROR HY000: Unknown collation: 'koi8r' ...@@ -484,7 +484,7 @@ ERROR HY000: Unknown collation: 'koi8r'
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`latin1_f` char(32) NOT NULL default '' `latin1_f` char(32) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW FIELDS FROM t1; SHOW FIELDS FROM t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
......
...@@ -224,8 +224,8 @@ create table t1 (word varchar(255) not null, word2 varchar(255) not null, index( ...@@ -224,8 +224,8 @@ create table t1 (word varchar(255) not null, word2 varchar(255) not null, index(
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`word` varchar(255) collate latin1_german2_ci NOT NULL default '', `word` varchar(255) collate latin1_german2_ci NOT NULL,
`word2` varchar(255) collate latin1_german2_ci NOT NULL default '', `word2` varchar(255) collate latin1_german2_ci NOT NULL,
KEY `word` (`word`) KEY `word` (`word`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci
insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae'); insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae');
......
...@@ -45,36 +45,36 @@ CREATE TABLE ` ...@@ -45,36 +45,36 @@ CREATE TABLE `
CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT " " CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT " "
) COMMENT " "; ) COMMENT " ";
SHOW TABLES; SHOW TABLES;
Tables_in_test table_type Tables_in_test
BASE TABLE
SHOW CREATE TABLE ; SHOW CREATE TABLE ;
Table Create Table Table Create Table
CREATE TABLE `` ( CREATE TABLE `` (
`` char(32) character set koi8r NOT NULL default '' COMMENT ' ' `` char(32) character set koi8r NOT NULL COMMENT ' '
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT=' ' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT=' '
SHOW FIELDS FROM ; SHOW FIELDS FROM ;
Field Type Null Key Default Extra Field Type Null Key Default Extra
char(32) char(32)
SET CHARACTER SET cp1251; SET CHARACTER SET cp1251;
SHOW TABLES; SHOW TABLES;
Tables_in_test table_type Tables_in_test
BASE TABLE
SHOW CREATE TABLE ; SHOW CREATE TABLE ;
Table Create Table Table Create Table
CREATE TABLE `` ( CREATE TABLE `` (
`` char(32) character set koi8r NOT NULL default '' COMMENT ' ' `` char(32) character set koi8r NOT NULL COMMENT ' '
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT=' ' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT=' '
SHOW FIELDS FROM ; SHOW FIELDS FROM ;
Field Type Null Key Default Extra Field Type Null Key Default Extra
char(32) char(32)
SET CHARACTER SET utf8; SET CHARACTER SET utf8;
SHOW TABLES; SHOW TABLES;
Tables_in_test table_type Tables_in_test
таблица BASE TABLE таблица
SHOW CREATE TABLE таблица; SHOW CREATE TABLE таблица;
Table Create Table Table Create Table
таблица CREATE TABLE `таблица` ( таблица CREATE TABLE `таблица` (
`поле` char(32) character set koi8r NOT NULL default '' COMMENT 'комментарий поля' `поле` char(32) character set koi8r NOT NULL COMMENT 'комментарий поля'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='комментарий таблицы' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='комментарий таблицы'
SHOW FIELDS FROM таблица; SHOW FIELDS FROM таблица;
Field Type Null Key Default Extra Field Type Null Key Default Extra
...@@ -93,14 +93,14 @@ SET CHARACTER SET koi8r; ...@@ -93,14 +93,14 @@ SET CHARACTER SET koi8r;
CREATE DATABASE ; CREATE DATABASE ;
USE ; USE ;
SHOW TABLES; SHOW TABLES;
Tables_in_ table_type Tables_in_
SHOW TABLES IN ; SHOW TABLES IN ;
Tables_in_ table_type Tables_in_
SET CHARACTER SET cp1251; SET CHARACTER SET cp1251;
SHOW TABLES; SHOW TABLES;
Tables_in_ table_type Tables_in_
SHOW TABLES IN ; SHOW TABLES IN ;
Tables_in_ table_type Tables_in_
SET CHARACTER SET koi8r; SET CHARACTER SET koi8r;
DROP DATABASE ; DROP DATABASE ;
SET NAMES koi8r; SET NAMES koi8r;
......
...@@ -212,7 +212,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -212,7 +212,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index 1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index
explain SELECT distinct a from t3 order by a desc limit 2; explain SELECT distinct a from t3 order by a desc limit 2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 index NULL a 5 NULL 204 Using index 1 SIMPLE t3 index NULL a 5 NULL 10 Using index
explain SELECT distinct a,b from t3 order by a+1; explain SELECT distinct a,b from t3 order by a+1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 204 Using temporary; Using filesort 1 SIMPLE t3 ALL NULL NULL NULL NULL 204 Using temporary; Using filesort
......
...@@ -52,6 +52,6 @@ ERROR HY000: Can't execute the query because you have a conflicting read lock ...@@ -52,6 +52,6 @@ ERROR HY000: Can't execute the query because you have a conflicting read lock
unlock tables; unlock tables;
create table t1(n int); create table t1(n int);
show tables; show tables;
Tables_in_test table_type Tables_in_test
t1 BASE TABLE t1
drop table t1; drop table t1;
...@@ -476,7 +476,7 @@ CHI Los Angeles ...@@ -476,7 +476,7 @@ CHI Los Angeles
explain explain
select max(a3) from t1 where a2 is null and a2 = 2; select max(a3) from t1 where a2 is null and a2 = 2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
select max(a3) from t1 where a2 is null and a2 = 2; select max(a3) from t1 where a2 is null and a2 = 2;
max(a3) max(a3)
NULL NULL
......
...@@ -395,9 +395,9 @@ select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd',2); ...@@ -395,9 +395,9 @@ select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd',2);
SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd',2) SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd',2)
abcdabc abcdabc
select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin2'd',2); select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin2'd',2);
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'substr_index' ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'substring_index'
select SUBSTRING_INDEX(_latin1'abcdabcdabcd' COLLATE latin1_general_ci,_latin1'd' COLLATE latin1_bin,2); select SUBSTRING_INDEX(_latin1'abcdabcdabcd' COLLATE latin1_general_ci,_latin1'd' COLLATE latin1_bin,2);
ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'substr_index' ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'substring_index'
select _latin1'B' between _latin1'a' and _latin1'c'; select _latin1'B' between _latin1'a' and _latin1'c';
_latin1'B' between _latin1'a' and _latin1'c' _latin1'B' between _latin1'a' and _latin1'c'
1 1
...@@ -638,7 +638,7 @@ explain extended select md5('hello'), sha('abc'), sha1('abc'), soundex(''), 'moo ...@@ -638,7 +638,7 @@ explain extended select md5('hello'), sha('abc'), sha1('abc'), soundex(''), 'moo
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings: Warnings:
Note 1003 select md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,cast(_latin1'HE' as char charset binary) AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate latin1_bin),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substr_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")` Note 1003 select md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,cast(_latin1'HE' as char charset binary) AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate latin1_bin),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substring_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")`
SELECT lpad(12345, 5, "#"); SELECT lpad(12345, 5, "#");
lpad(12345, 5, "#") lpad(12345, 5, "#")
12345 12345
......
...@@ -77,9 +77,9 @@ select * from t1 where 1 xor 1; ...@@ -77,9 +77,9 @@ select * from t1 where 1 xor 1;
a a
explain extended select * from t1 where 1 xor 1; explain extended select * from t1 where 1 xor 1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
Warnings: Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (1 xor 1) Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1`
select - a from t1; select - a from t1;
- a - a
-1 -1
......
...@@ -8,7 +8,7 @@ SHOW CREATE TABLE t1; ...@@ -8,7 +8,7 @@ SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`fid` int(11) NOT NULL auto_increment, `fid` int(11) NOT NULL auto_increment,
`g` geometry NOT NULL default '', `g` geometry NOT NULL,
PRIMARY KEY (`fid`), PRIMARY KEY (`fid`),
SPATIAL KEY `g` (`g`(32)) SPATIAL KEY `g` (`g`(32))
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
...@@ -291,7 +291,7 @@ SHOW CREATE TABLE t2; ...@@ -291,7 +291,7 @@ SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`fid` int(11) NOT NULL auto_increment, `fid` int(11) NOT NULL auto_increment,
`g` geometry NOT NULL default '', `g` geometry NOT NULL,
PRIMARY KEY (`fid`), PRIMARY KEY (`fid`),
SPATIAL KEY `g` (`g`(32)) SPATIAL KEY `g` (`g`(32))
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
......
...@@ -9,35 +9,35 @@ CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMET ...@@ -9,35 +9,35 @@ CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMET
CREATE TABLE gis_geometry (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY); CREATE TABLE gis_geometry (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY);
SHOW FIELDS FROM gis_point; SHOW FIELDS FROM gis_point;
Field Type Null Key Default Extra Field Type Null Key Default Extra
fid int(11) PRI 0 fid int(11) PRI
g point YES NULL g point YES NULL
SHOW FIELDS FROM gis_line; SHOW FIELDS FROM gis_line;
Field Type Null Key Default Extra Field Type Null Key Default Extra
fid int(11) PRI 0 fid int(11) PRI
g linestring YES NULL g linestring YES NULL
SHOW FIELDS FROM gis_polygon; SHOW FIELDS FROM gis_polygon;
Field Type Null Key Default Extra Field Type Null Key Default Extra
fid int(11) PRI 0 fid int(11) PRI
g polygon YES NULL g polygon YES NULL
SHOW FIELDS FROM gis_multi_point; SHOW FIELDS FROM gis_multi_point;
Field Type Null Key Default Extra Field Type Null Key Default Extra
fid int(11) PRI 0 fid int(11) PRI
g multipoint YES NULL g multipoint YES NULL
SHOW FIELDS FROM gis_multi_line; SHOW FIELDS FROM gis_multi_line;
Field Type Null Key Default Extra Field Type Null Key Default Extra
fid int(11) PRI 0 fid int(11) PRI
g multilinestring YES NULL g multilinestring YES NULL
SHOW FIELDS FROM gis_multi_polygon; SHOW FIELDS FROM gis_multi_polygon;
Field Type Null Key Default Extra Field Type Null Key Default Extra
fid int(11) PRI 0 fid int(11) PRI
g multipolygon YES NULL g multipolygon YES NULL
SHOW FIELDS FROM gis_geometrycollection; SHOW FIELDS FROM gis_geometrycollection;
Field Type Null Key Default Extra Field Type Null Key Default Extra
fid int(11) PRI 0 fid int(11) PRI
g geometrycollection YES NULL g geometrycollection YES NULL
SHOW FIELDS FROM gis_geometry; SHOW FIELDS FROM gis_geometry;
Field Type Null Key Default Extra Field Type Null Key Default Extra
fid int(11) PRI 0 fid int(11) PRI
g geometry YES NULL g geometry YES NULL
INSERT INTO gis_point VALUES INSERT INTO gis_point VALUES
(101, PointFromText('POINT(10 10)')), (101, PointFromText('POINT(10 10)')),
...@@ -430,7 +430,7 @@ mln multilinestring YES NULL ...@@ -430,7 +430,7 @@ mln multilinestring YES NULL
mpg multipolygon YES NULL mpg multipolygon YES NULL
gc geometrycollection YES NULL gc geometrycollection YES NULL
gm geometry YES NULL gm geometry YES NULL
fid int(11) 0 fid int(11)
DROP TABLE t1; DROP TABLE t1;
SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)')))); SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)')))) AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))
......
...@@ -12,6 +12,14 @@ mysqltest_1@localhost ...@@ -12,6 +12,14 @@ mysqltest_1@localhost
grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option; grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option;
grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option; grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'my_%' ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'my_%'
set @@sql_mode='NO_AUTO_CREATE_USER';
select @@sql_mode;
@@sql_mode
NO_AUTO_CREATE_USER
grant select on `my\_1`.* to mysqltest_4@localhost with grant option;
ERROR 42000: 'mysqltest_1'@'localhost' is not allowed to create new users
grant select on `my\_1`.* to mysqltest_4@localhost identified by 'mypass'
with grant option;
show grants for mysqltest_1@localhost; show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
......
This diff is collapsed.
...@@ -76,13 +76,13 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -76,13 +76,13 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL i1,i2 NULL NULL NULL 1024 Using where 1 SIMPLE t0 ALL i1,i2 NULL NULL NULL 1024 Using where
explain select * from t0 where key2 = 45 or key1 is null; explain select * from t0 where key2 = 45 or key1 is null;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 range i1,i2 i2 4 NULL 1 Using where 1 SIMPLE t0 ref i2 i2 4 const 1
explain select * from t0 where key2=10 or key3=3 or key4 <=> null; explain select * from t0 where key2=10 or key3=3 or key4 <=> null;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 index_merge i2,i3,i4 i2,i3 4,4 NULL 2 Using union(i2,i3); Using where 1 SIMPLE t0 index_merge i2,i3,i4 i2,i3 4,4 NULL 2 Using union(i2,i3); Using where
explain select * from t0 where key2=10 or key3=3 or key4 is null; explain select * from t0 where key2=10 or key3=3 or key4 is null;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 index_merge i2,i3,i4 i2,i3 4,4 NULL 2 Using union(i2,i3); Using where 1 SIMPLE t0 index_merge i2,i3 i2,i3 4,4 NULL 2 Using union(i2,i3); Using where
explain select key1 from t0 where (key1 <=> null) or (key2 < 5) or explain select key1 from t0 where (key1 <=> null) or (key2 < 5) or
(key3=10) or (key4 <=> null); (key3=10) or (key4 <=> null);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
...@@ -257,8 +257,8 @@ explain ...@@ -257,8 +257,8 @@ explain
select * from t0,t1 where (t0.key1=t1.key1) and select * from t0,t1 where (t0.key1=t1.key1) and
(t0.key1=3 or t0.key2=4) and t1.key1<200; (t0.key1=3 or t0.key2=4) and t1.key1<200;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where 1 SIMPLE t0 range i1,i2 i1 4 NULL 179 Using where
1 SIMPLE t1 ref i1 i1 4 test.t0.key1 1 Using where 1 SIMPLE t1 ref i1 i1 4 test.t0.key1 1
explain explain
select * from t0,t1 where (t0.key1=t1.key1) and select * from t0,t1 where (t0.key1=t1.key1) and
(t0.key1=3 or t0.key2<4) and t1.key1=2; (t0.key1=3 or t0.key2<4) and t1.key1=2;
......
...@@ -1460,14 +1460,14 @@ create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) ref ...@@ -1460,14 +1460,14 @@ create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) ref
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
`id2` int(11) NOT NULL default '0', `id2` int(11) NOT NULL,
UNIQUE KEY `id` (`id`,`id2`) UNIQUE KEY `id` (`id`,`id2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
KEY `t1_id_fk` (`id`), KEY `t1_id_fk` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
...@@ -1475,7 +1475,7 @@ create index id on t2 (id); ...@@ -1475,7 +1475,7 @@ create index id on t2 (id);
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
KEY `id` (`id`), KEY `id` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
...@@ -1483,7 +1483,7 @@ create index id2 on t2 (id); ...@@ -1483,7 +1483,7 @@ create index id2 on t2 (id);
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
KEY `id` (`id`), KEY `id` (`id`),
KEY `id2` (`id`), KEY `id2` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
...@@ -1494,7 +1494,7 @@ Got one of the listed errors ...@@ -1494,7 +1494,7 @@ Got one of the listed errors
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
KEY `id` (`id`), KEY `id` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
...@@ -1503,8 +1503,8 @@ create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk ...@@ -1503,8 +1503,8 @@ create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
`id2` int(11) NOT NULL default '0', `id2` int(11) NOT NULL,
KEY `t1_id_fk` (`id`,`id2`), KEY `t1_id_fk` (`id`,`id2`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
...@@ -1512,8 +1512,8 @@ create unique index id on t2 (id,id2); ...@@ -1512,8 +1512,8 @@ create unique index id on t2 (id,id2);
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
`id2` int(11) NOT NULL default '0', `id2` int(11) NOT NULL,
UNIQUE KEY `id` (`id`,`id2`), UNIQUE KEY `id` (`id`,`id2`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
...@@ -1522,8 +1522,8 @@ create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),cons ...@@ -1522,8 +1522,8 @@ create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),cons
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
`id2` int(11) NOT NULL default '0', `id2` int(11) NOT NULL,
UNIQUE KEY `id` (`id`,`id2`), UNIQUE KEY `id` (`id`,`id2`),
KEY `t1_id_fk` (`id2`,`id`), KEY `t1_id_fk` (`id2`,`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
...@@ -1533,8 +1533,8 @@ create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), con ...@@ -1533,8 +1533,8 @@ create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), con
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
`id2` int(11) NOT NULL default '0', `id2` int(11) NOT NULL,
UNIQUE KEY `id` (`id`,`id2`), UNIQUE KEY `id` (`id`,`id2`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
...@@ -1543,8 +1543,8 @@ create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),cons ...@@ -1543,8 +1543,8 @@ create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),cons
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
`id2` int(11) NOT NULL default '0', `id2` int(11) NOT NULL,
UNIQUE KEY `id` (`id`,`id2`), UNIQUE KEY `id` (`id`,`id2`),
KEY `t1_id_fk` (`id2`,`id`), KEY `t1_id_fk` (`id2`,`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
...@@ -1555,7 +1555,7 @@ show create table t2; ...@@ -1555,7 +1555,7 @@ show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL auto_increment, `id` int(11) NOT NULL auto_increment,
`id2` int(11) NOT NULL default '0', `id2` int(11) NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `id` (`id`,`id2`), KEY `id` (`id`,`id2`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
...@@ -1566,7 +1566,7 @@ show create table t2; ...@@ -1566,7 +1566,7 @@ show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL auto_increment, `id` int(11) NOT NULL auto_increment,
`id2` int(11) NOT NULL default '0', `id2` int(11) NOT NULL,
KEY `t1_id_fk` (`id`), KEY `t1_id_fk` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
...@@ -1575,7 +1575,7 @@ show create table t2; ...@@ -1575,7 +1575,7 @@ show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL auto_increment, `id` int(11) NOT NULL auto_increment,
`id2` int(11) NOT NULL default '0', `id2` int(11) NOT NULL,
KEY `id_test` (`id`), KEY `id_test` (`id`),
KEY `id_test2` (`id`,`id2`), KEY `id_test2` (`id`,`id2`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
...@@ -1630,3 +1630,37 @@ show status like "binlog_cache_disk_use"; ...@@ -1630,3 +1630,37 @@ show status like "binlog_cache_disk_use";
Variable_name Value Variable_name Value
Binlog_cache_disk_use 1 Binlog_cache_disk_use 1
drop table t1; drop table t1;
create table t1 (x bigint unsigned not null primary key) engine=innodb;
insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
select * from t1;
x
18446744073709551600
18446744073709551601
select count(*) from t1 where x>0;
count(*)
2
select count(*) from t1 where x=0;
count(*)
0
select count(*) from t1 where x<0;
count(*)
0
select count(*) from t1 where x < -16;
count(*)
0
select count(*) from t1 where x = -16;
count(*)
0
explain select count(*) from t1 where x > -16;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL 1 Using where; Using index
select count(*) from t1 where x > -16;
count(*)
1
select * from t1 where x > -16;
x
18446744073709551601
select count(*) from t1 where x = 18446744073709551601;
count(*)
1
drop table t1;
...@@ -63,7 +63,7 @@ insert into t1 values(NULL); ...@@ -63,7 +63,7 @@ insert into t1 values(NULL);
ERROR 23000: Column 'id' cannot be null ERROR 23000: Column 'id' cannot be null
insert into t1 values (1), (NULL), (2); insert into t1 values (1), (NULL), (2);
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'id' at row 2 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'id' at row 2
select * from t1; select * from t1;
id id
1 1
...@@ -157,19 +157,19 @@ f_float_3_1_u 0.0 ...@@ -157,19 +157,19 @@ f_float_3_1_u 0.0
set @value= "1e+1111111111a"; set @value= "1e+1111111111a";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings: Warnings:
Warning 1265 Data truncated for column 'f_double' at row 1 Warning 1264 Out of range value adjusted for column 'f_double' at row 1
Warning 1265 Data truncated for column 'f_float' at row 1 Warning 1264 Out of range value adjusted for column 'f_float' at row 1
Warning 1264 Out of range value adjusted for column 'f_float' at row 1 Warning 1264 Out of range value adjusted for column 'f_float' at row 1
Warning 1265 Data truncated for column 'f_double_7_2' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1
Warning 1265 Data truncated for column 'f_float_4_3' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1 Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1
Warning 1265 Data truncated for column 'f_double_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1
Warning 1265 Data truncated for column 'f_float_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
Warning 1265 Data truncated for column 'f_float_3_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id(); select * from t1 where number =last_insert_id();
number 4 number 4
...@@ -185,20 +185,20 @@ f_float_3_1_u 99.9 ...@@ -185,20 +185,20 @@ f_float_3_1_u 99.9
set @value= "-1e+1111111111a"; set @value= "-1e+1111111111a";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings: Warnings:
Warning 1265 Data truncated for column 'f_double' at row 1 Warning 1264 Out of range value adjusted for column 'f_double' at row 1
Warning 1265 Data truncated for column 'f_float' at row 1 Warning 1264 Out of range value adjusted for column 'f_float' at row 1
Warning 1264 Out of range value adjusted for column 'f_float' at row 1 Warning 1264 Out of range value adjusted for column 'f_float' at row 1
Warning 1265 Data truncated for column 'f_double_7_2' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1
Warning 1265 Data truncated for column 'f_float_4_3' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1 Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1
Warning 1265 Data truncated for column 'f_double_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_u' at row 1
Warning 1265 Data truncated for column 'f_float_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
Warning 1265 Data truncated for column 'f_float_3_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id(); select * from t1 where number =last_insert_id();
number 5 number 5
...@@ -212,46 +212,9 @@ f_float_u 0 ...@@ -212,46 +212,9 @@ f_float_u 0
f_double_15_1_u 0.0 f_double_15_1_u 0.0
f_float_3_1_u 0.0 f_float_3_1_u 0.0
set @value= 1e+1111111111; set @value= 1e+1111111111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); ERROR 22007: Illegal double '1e+1111111111' value found during parsing
Warnings:
Warning 1264 Out of range value adjusted for column 'f_float' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 6
original_value 1.7976931348623e+308
f_double 1.79769313486232e+308
f_float 3.40282e+38
f_double_7_2 99999.99
f_float_4_3 9.999
f_double_u 1.79769313486232e+308
f_float_u 3.40282e+38
f_double_15_1_u 99999999999999.9
f_float_3_1_u 99.9
set @value= -1e+1111111111; set @value= -1e+1111111111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); ERROR 22007: Illegal double '1e+1111111111' value found during parsing
Warnings:
Warning 1264 Out of range value adjusted for column 'f_float' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 7
original_value -1.7976931348623e+308
f_double -1.79769313486232e+308
f_float -3.40282e+38
f_double_7_2 -99999.99
f_float_4_3 -9.999
f_double_u 0
f_float_u 0
f_double_15_1_u 0.0
f_float_3_1_u 0.0
set @value= 1e+111; set @value= 1e+111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings: Warnings:
...@@ -262,7 +225,7 @@ Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1 ...@@ -262,7 +225,7 @@ Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id(); select * from t1 where number =last_insert_id();
number 8 number 6
original_value 1e+111 original_value 1e+111
f_double 1e+111 f_double 1e+111
f_float 3.40282e+38 f_float 3.40282e+38
...@@ -283,7 +246,7 @@ Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1 ...@@ -283,7 +246,7 @@ Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id(); select * from t1 where number =last_insert_id();
number 9 number 7
original_value -1e+111 original_value -1e+111
f_double -1e+111 f_double -1e+111
f_float -3.40282e+38 f_float -3.40282e+38
...@@ -296,7 +259,7 @@ f_float_3_1_u 0.0 ...@@ -296,7 +259,7 @@ f_float_3_1_u 0.0
set @value= 1; set @value= 1;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
select * from t1 where number =last_insert_id(); select * from t1 where number =last_insert_id();
number 10 number 8
original_value 1 original_value 1
f_double 1 f_double 1
f_float 1 f_float 1
...@@ -314,7 +277,7 @@ Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1 ...@@ -314,7 +277,7 @@ Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id(); select * from t1 where number =last_insert_id();
number 11 number 9
original_value -1 original_value -1
f_double -1 f_double -1
f_float -1 f_float -1
......
...@@ -622,8 +622,8 @@ NULL 2 100 ...@@ -622,8 +622,8 @@ NULL 2 100
create table t2(No int not null, Field int not null, Count int not null); create table t2(No int not null, Field int not null, Count int not null);
insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2; insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2;
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'No' at row 1 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'No' at row 1
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'No' at row 2 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'No' at row 2
select * from t2; select * from t2;
No Field Count No Field Count
0 1 100 0 1 100
......
...@@ -65,14 +65,14 @@ test.t2 check error Table 't2' was not locked with LOCK TABLES ...@@ -65,14 +65,14 @@ test.t2 check error Table 't2' was not locked with LOCK TABLES
test.t1 check status OK test.t1 check status OK
show columns from t1; show columns from t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
a int(11) PRI 0 a int(11) PRI
b int(11) MUL 0 b int(11) MUL
c int(11) 0 c int(11)
show full columns from t1; show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
a int(11) NULL PRI 0 select,insert,update,references a int(11) NULL PRI select,insert,update,references
b int(11) NULL MUL 0 select,insert,update,references b int(11) NULL MUL select,insert,update,references
c int(11) NULL 0 select,insert,update,references c int(11) NULL select,insert,update,references
show index from t1; show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 a A 4 NULL NULL BTREE t1 0 PRIMARY 1 a A 4 NULL NULL BTREE
......
This diff is collapsed.
drop table if exists t1,t2,t3,t4,t5; drop table if exists t0,t1,t2,t3,t4,t5;
CREATE TABLE t1 ( CREATE TABLE t1 (
grp int(11) default NULL, grp int(11) default NULL,
a bigint(20) unsigned default NULL, a bigint(20) unsigned default NULL,
...@@ -745,3 +745,47 @@ player_id match_1_h * match_id home UUX ...@@ -745,3 +745,47 @@ player_id match_1_h * match_id home UUX
7 4 * 1 2 2 7 4 * 1 2 2
3 3 * 1 2 1 3 3 * 1 2 1
drop table t1, t2; drop table t1, t2;
CREATE TABLE t0 (a0 int PRIMARY KEY);
CREATE TABLE t1 (a1 int PRIMARY KEY);
CREATE TABLE t2 (a2 int);
CREATE TABLE t3 (a3 int);
INSERT INTO t0 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1), (2);
INSERT INTO t3 VALUES (1), (2);
SELECT * FROM t1 LEFT JOIN t2 ON a1=0;
a1 a2
1 NULL
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON a1=0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
SELECT * FROM t1 LEFT JOIN (t2,t3) ON a1=0;
a1 a2 a3
1 NULL NULL
EXPLAIN SELECT * FROM t1 LEFT JOIN (t2,t3) ON a1=0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
1 SIMPLE t3 ALL NULL NULL NULL NULL 2
SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=0 WHERE a0=a1;
a0 a1 a2 a3
1 1 NULL NULL
EXPLAIN SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=0 WHERE a0=a1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 system PRIMARY NULL NULL NULL 1
1 SIMPLE t1 system PRIMARY NULL NULL NULL 1
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
1 SIMPLE t3 ALL NULL NULL NULL NULL 2
INSERT INTO t0 VALUES (0);
INSERT INTO t1 VALUES (0);
SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=5 WHERE a0=a1 AND a0=1;
a0 a1 a2 a3
1 1 NULL NULL
EXPLAIN SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=5 WHERE a0=a1 AND a0=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 const PRIMARY PRIMARY 4 const 1 Using index
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
1 SIMPLE t3 ALL NULL NULL NULL NULL 2
DROP TABLE t0,t1,t2,t3;
...@@ -159,8 +159,8 @@ CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT, ...@@ -159,8 +159,8 @@ CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT,
UNIQUE (c,i)); UNIQUE (c,i));
INSERT INTO t1 (c) VALUES (NULL),(NULL); INSERT INTO t1 (c) VALUES (NULL),(NULL);
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'c' at row 1 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'c' at row 2 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 2
SELECT * FROM t1; SELECT * FROM t1;
c i c i
1 1
......
...@@ -26,9 +26,9 @@ RENAME TABLE T1 TO T2; ...@@ -26,9 +26,9 @@ RENAME TABLE T1 TO T2;
ALTER TABLE T2 ADD new_col int not null; ALTER TABLE T2 ADD new_col int not null;
ALTER TABLE T2 RENAME T3; ALTER TABLE T2 RENAME T3;
show tables like 't_'; show tables like 't_';
Tables_in_test (t_) table_type Tables_in_test (t_)
t3 BASE TABLE t3
t4 BASE TABLE t4
drop table t3,t4; drop table t3,t4;
create table t1 (a int); create table t1 (a int);
select count(*) from T1; select count(*) from T1;
...@@ -79,4 +79,4 @@ select C.a, c.a from t1 c, t2 C; ...@@ -79,4 +79,4 @@ select C.a, c.a from t1 c, t2 C;
ERROR 42000: Not unique table/alias: 'C' ERROR 42000: Not unique table/alias: 'C'
drop table t1, t2; drop table t1, t2;
show tables; show tables;
Tables_in_test table_type Tables_in_test
...@@ -7,7 +7,7 @@ create table TaB (Field int); ...@@ -7,7 +7,7 @@ create table TaB (Field int);
create view ViE as select * from TAb; create view ViE as select * from TAb;
show create table VIe; show create table VIe;
View Create View View Create View
vie CREATE VIEW `mysqltest`.`vie` AS select `mysqltest`.`tab`.`Field` AS `Field` from `mysqltest`.`tab` vie CREATE ALGORITHM=UNDEFINED VIEW `mysqltest`.`vie` AS select `mysqltest`.`tab`.`Field` AS `Field` from `mysqltest`.`tab`
drop database MySQLTest; drop database MySQLTest;
use test; use test;
create table t1Aa (col1 int); create table t1Aa (col1 int);
......
...@@ -172,7 +172,7 @@ a b ...@@ -172,7 +172,7 @@ a b
show create table t3; show create table t3;
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` char(20) default NULL, `b` char(20) default NULL,
KEY `a` (`a`) KEY `a` (`a`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`)
...@@ -187,7 +187,7 @@ create table t5 (a int not null, b char(20), key(a)) engine=MERGE UNION=(test.t1 ...@@ -187,7 +187,7 @@ create table t5 (a int not null, b char(20), key(a)) engine=MERGE UNION=(test.t1
show create table t5; show create table t5;
Table Create Table Table Create Table
t5 CREATE TABLE `t5` ( t5 CREATE TABLE `t5` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` char(20) default NULL, `b` char(20) default NULL,
KEY `a` (`a`) KEY `a` (`a`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`mysqltest`.`t6`) ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`mysqltest`.`t6`)
...@@ -260,16 +260,16 @@ ENGINE=MERGE UNION=(t1,t2); ...@@ -260,16 +260,16 @@ ENGINE=MERGE UNION=(t1,t2);
show create table t3; show create table t3;
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`incr` int(11) NOT NULL default '0', `incr` int(11) NOT NULL,
`othr` int(11) NOT NULL default '0', `othr` int(11) NOT NULL,
PRIMARY KEY (`incr`) PRIMARY KEY (`incr`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`)
alter table t3 drop primary key; alter table t3 drop primary key;
show create table t3; show create table t3;
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`incr` int(11) NOT NULL default '0', `incr` int(11) NOT NULL,
`othr` int(11) NOT NULL default '0' `othr` int(11) NOT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`)
drop table t3,t2,t1; drop table t3,t2,t1;
create table t1 (a int not null, key(a)) engine=merge; create table t1 (a int not null, key(a)) engine=merge;
...@@ -296,28 +296,28 @@ create table t6 (a int not null, b int not null auto_increment, primary key(a,b) ...@@ -296,28 +296,28 @@ create table t6 (a int not null, b int not null auto_increment, primary key(a,b)
show create table t3; show create table t3;
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` int(11) NOT NULL default '0', `b` int(11) NOT NULL,
KEY `a` (`a`,`b`) KEY `a` (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table t4; show create table t4;
Table Create Table Table Create Table
t4 CREATE TABLE `t4` ( t4 CREATE TABLE `t4` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` int(11) NOT NULL default '0', `b` int(11) NOT NULL,
KEY `a` (`a`,`b`) KEY `a` (`a`,`b`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`)
show create table t5; show create table t5;
Table Create Table Table Create Table
t5 CREATE TABLE `t5` ( t5 CREATE TABLE `t5` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` int(11) NOT NULL auto_increment, `b` int(11) NOT NULL auto_increment,
PRIMARY KEY (`a`,`b`) PRIMARY KEY (`a`,`b`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`) ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`)
show create table t6; show create table t6;
Table Create Table Table Create Table
t6 CREATE TABLE `t6` ( t6 CREATE TABLE `t6` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` int(11) NOT NULL auto_increment, `b` int(11) NOT NULL auto_increment,
PRIMARY KEY (`a`,`b`) PRIMARY KEY (`a`,`b`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`) ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
...@@ -382,8 +382,8 @@ alter table t4 UNION=(t1,t2,t3); ...@@ -382,8 +382,8 @@ alter table t4 UNION=(t1,t2,t3);
show create table t4; show create table t4;
Table Create Table Table Create Table
t4 CREATE TABLE `t4` ( t4 CREATE TABLE `t4` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` int(11) NOT NULL default '0', `b` int(11) NOT NULL,
KEY `a` (`a`,`b`) KEY `a` (`a`,`b`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`,`t3`) ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`,`t3`)
select * from t4 order by a,b; select * from t4 order by a,b;
...@@ -408,8 +408,8 @@ alter table t4 INSERT_METHOD=FIRST; ...@@ -408,8 +408,8 @@ alter table t4 INSERT_METHOD=FIRST;
show create table t4; show create table t4;
Table Create Table Table Create Table
t4 CREATE TABLE `t4` ( t4 CREATE TABLE `t4` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` int(11) NOT NULL default '0', `b` int(11) NOT NULL,
KEY `a` (`a`,`b`) KEY `a` (`a`,`b`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`,`t3`) ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`,`t3`)
insert into t4 values (4,1),(4,2); insert into t4 values (4,1),(4,2);
......
...@@ -27,7 +27,9 @@ CREATE TABLE `t1` ( ...@@ -27,7 +27,9 @@ CREATE TABLE `t1` (
INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('0987654321098765432109876543210987654321.00000000000000000000'); INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('0987654321098765432109876543210987654321.00000000000000000000');
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a double); CREATE TABLE t1 (a double);
INSERT INTO t1 VALUES (-9e999999); INSERT INTO t1 VALUES ('-9e999999');
Warnings:
Warning 1264 Out of range value adjusted for column 'a' at row 1
CREATE TABLE `t1` ( CREATE TABLE `t1` (
`a` double default NULL `a` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
...@@ -354,7 +356,7 @@ UNLOCK TABLES; ...@@ -354,7 +356,7 @@ UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */; /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `v1`; DROP TABLE IF EXISTS `v1`;
DROP VIEW IF EXISTS `v1`; DROP VIEW IF EXISTS `v1`;
CREATE VIEW `test`.`v1` AS select `test`.`t1`.`a` AS `a` from `test`.`t1`; CREATE ALGORITHM=UNDEFINED VIEW `test`.`v1` AS select `test`.`t1`.`a` AS `a` from `test`.`t1`;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
......
...@@ -97,39 +97,39 @@ Warnings: ...@@ -97,39 +97,39 @@ Warnings:
Warning 1265 Data truncated for column 'd' at row 1 Warning 1265 Data truncated for column 'd' at row 1
UPDATE t1 SET d=NULL; UPDATE t1 SET d=NULL;
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'd' at row 1 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'd' at row 1
INSERT INTO t1 (a) values (null); INSERT INTO t1 (a) values (null);
ERROR 23000: Column 'a' cannot be null ERROR 23000: Column 'a' cannot be null
INSERT INTO t1 (a) values (1/null); INSERT INTO t1 (a) values (1/null);
ERROR 23000: Column 'a' cannot be null ERROR 23000: Column 'a' cannot be null
INSERT INTO t1 (a) values (null),(null); INSERT INTO t1 (a) values (null),(null);
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 2 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 2
INSERT INTO t1 (b) values (null); INSERT INTO t1 (b) values (null);
ERROR 23000: Column 'b' cannot be null ERROR 23000: Column 'b' cannot be null
INSERT INTO t1 (b) values (1/null); INSERT INTO t1 (b) values (1/null);
ERROR 23000: Column 'b' cannot be null ERROR 23000: Column 'b' cannot be null
INSERT INTO t1 (b) values (null),(null); INSERT INTO t1 (b) values (null),(null);
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'b' at row 1 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 1
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'b' at row 2 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 2
INSERT INTO t1 (c) values (null); INSERT INTO t1 (c) values (null);
ERROR 23000: Column 'c' cannot be null ERROR 23000: Column 'c' cannot be null
INSERT INTO t1 (c) values (1/null); INSERT INTO t1 (c) values (1/null);
ERROR 23000: Column 'c' cannot be null ERROR 23000: Column 'c' cannot be null
INSERT INTO t1 (c) values (null),(null); INSERT INTO t1 (c) values (null),(null);
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'c' at row 1 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'c' at row 2 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 2
INSERT INTO t1 (d) values (null); INSERT INTO t1 (d) values (null);
ERROR 23000: Column 'd' cannot be null ERROR 23000: Column 'd' cannot be null
INSERT INTO t1 (d) values (1/null); INSERT INTO t1 (d) values (1/null);
ERROR 23000: Column 'd' cannot be null ERROR 23000: Column 'd' cannot be null
INSERT INTO t1 (d) values (null),(null); INSERT INTO t1 (d) values (null),(null);
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'd' at row 1 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'd' at row 1
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'd' at row 2 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'd' at row 2
select * from t1; select * from t1;
a b c d a b c d
0 0000-00-00 00:00:00 0 0 0000-00-00 00:00:00 0
......
...@@ -342,7 +342,7 @@ index (id2) ...@@ -342,7 +342,7 @@ index (id2)
); );
insert into t1 values(null,null),(1,1); insert into t1 values(null,null),(1,1);
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'id2' at row 1 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'id2' at row 1
select * from t1; select * from t1;
id id2 id id2
NULL 0 NULL 0
......
...@@ -12,5 +12,5 @@ select * from t1 where a is null; ...@@ -12,5 +12,5 @@ select * from t1 where a is null;
a b a b
explain select * from t1 where b is null; explain select * from t1 where b is null;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
drop table t1; drop table t1;
...@@ -159,24 +159,24 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -159,24 +159,24 @@ id select_type table type possible_keys key key_len ref rows Extra
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table 6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found 5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found 4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
3 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found 3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
execute stmt1 ; execute stmt1 ;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table 6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found 5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found 4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
3 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found 3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25; explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table 6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found 5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found 4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
3 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found 3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
deallocate prepare stmt1; deallocate prepare stmt1;
drop tables t1,t2; drop tables t1,t2;
set @arg00=1; set @arg00=1;
......
...@@ -252,12 +252,12 @@ mysql ...@@ -252,12 +252,12 @@ mysql
test test
prepare stmt4 from ' show tables from test like ''t2%'' '; prepare stmt4 from ' show tables from test like ''t2%'' ';
execute stmt4; execute stmt4;
Tables_in_test (t2%) table_type Tables_in_test (t2%)
t2 BASE TABLE t2
prepare stmt4 from ' show columns from t2 from test like ''a%'' '; prepare stmt4 from ' show columns from t2 from test like ''a%'' ';
execute stmt4; execute stmt4;
Field Type Null Key Default Extra Field Type Null Key Default Extra
a int(11) PRI 0 a int(11) PRI
create index t2_idx on t2(b); create index t2_idx on t2(b);
prepare stmt4 from ' show index from t2 from test '; prepare stmt4 from ' show index from t2 from test ';
execute stmt4; execute stmt4;
...@@ -355,7 +355,7 @@ drop user drop_user@localhost; ...@@ -355,7 +355,7 @@ drop user drop_user@localhost;
prepare stmt3 from ' describe t2 '; prepare stmt3 from ' describe t2 ';
execute stmt3; execute stmt3;
Field Type Null Key Default Extra Field Type Null Key Default Extra
a int(11) PRI 0 a int(11) PRI
b char(10) YES MUL NULL b char(10) YES MUL NULL
drop table t2 ; drop table t2 ;
execute stmt3; execute stmt3;
......
...@@ -220,24 +220,22 @@ insert into t1 (x) values (1),(2),(3),(4),(5),(6),(7),(8),(9); ...@@ -220,24 +220,22 @@ insert into t1 (x) values (1),(2),(3),(4),(5),(6),(7),(8),(9);
update t1 set y=x; update t1 set y=x;
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 7 and t1.y+0; explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 7 and t1.y+0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref y y 5 const 1 Using where 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
1 SIMPLE t2 range x x 5 NULL 4 Using where
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 7 and t2.x <= t1.y+0; explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 7 and t2.x <= t1.y+0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref y y 5 const 1 Using where 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
1 SIMPLE t2 range x x 5 NULL 4 Using where
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1; explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref y y 5 const 1 Using where 1 SIMPLE t1 ref y y 5 const 1 Using where
1 SIMPLE t2 ALL x NULL NULL NULL 9 Range checked for each record (index map: 0x1) 1 SIMPLE t2 range x x 5 NULL 3 Using where
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1; explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref y y 5 const 1 Using where 1 SIMPLE t1 ref y y 5 const 1 Using where
1 SIMPLE t2 ALL x NULL NULL NULL 9 Range checked for each record (index map: 0x1) 1 SIMPLE t2 range x x 5 NULL 3 Using where
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y; explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref y y 5 const 1 Using where 1 SIMPLE t1 ref y y 5 const 1 Using where
1 SIMPLE t2 ALL x NULL NULL NULL 9 Using where 1 SIMPLE t2 range x x 5 NULL 2 Using where
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y; explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref y y 5 const 1 Using where 1 SIMPLE t1 ref y y 5 const 1 Using where
...@@ -256,12 +254,12 @@ INSERT INTO t2 VALUES (0),(0),(1),(1),(2),(2); ...@@ -256,12 +254,12 @@ INSERT INTO t2 VALUES (0),(0),(1),(1),(2),(2);
explain select * from t1, t2 where (t1.key1 <t2.keya + 1) and t2.keya=3; explain select * from t1, t2 where (t1.key1 <t2.keya + 1) and t2.keya=3;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref j1 j1 4 const 1 Using index 1 SIMPLE t2 ref j1 j1 4 const 1 Using index
1 SIMPLE t1 ALL i1 NULL NULL NULL 4 Range checked for each record (index map: 0x1) 1 SIMPLE t1 index i1 i1 4 NULL 4 Using where; Using index
explain select * from t1 force index(i1), t2 force index(j1) where explain select * from t1 force index(i1), t2 force index(j1) where
(t1.key1 <t2.keya + 1) and t2.keya=3; (t1.key1 <t2.keya + 1) and t2.keya=3;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref j1 j1 4 const 1 Using index 1 SIMPLE t2 ref j1 j1 4 const 1 Using index
1 SIMPLE t1 ALL i1 NULL NULL NULL 4 Range checked for each record (index map: 0x1) 1 SIMPLE t1 index i1 i1 4 NULL 4 Using where; Using index
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE TABLE t1 ( CREATE TABLE t1 (
a int(11) default NULL, a int(11) default NULL,
...@@ -415,14 +413,26 @@ count(*) ...@@ -415,14 +413,26 @@ count(*)
select count(*) from t2; select count(*) from t2;
count(*) count(*)
1026 1026
analyze table t1,t2;
Table Op Msg_type Msg_text
test.t1 analyze status OK
test.t2 analyze status Table is already up to date
explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uid_index uid_index 4 NULL 128 Using where 1 SIMPLE t1 range uid_index uid_index 4 NULL 128 Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38 1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38
explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uid_index uid_index 4 NULL 128 Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38
explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0; explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uid_index uid_index 4 NULL 129 Using where 1 SIMPLE t1 range uid_index uid_index 4 NULL 129 Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38 1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38
explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uid_index uid_index 4 NULL 129 Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38
select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
id name uid id name uid id name uid id name uid
1001 A 1 1001 A 1 1001 A 1 1001 A 1
...@@ -537,34 +547,3 @@ select count(*) from t2 where x = 18446744073709551601; ...@@ -537,34 +547,3 @@ select count(*) from t2 where x = 18446744073709551601;
count(*) count(*)
0 0
drop table t1; drop table t1;
create table t1 (x bigint unsigned not null primary key) engine=innodb;
insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
select * from t1;
x
18446744073709551600
18446744073709551601
select count(*) from t1 where x>0;
count(*)
2
select count(*) from t1 where x=0;
count(*)
0
select count(*) from t1 where x<0;
count(*)
0
select count(*) from t1 where x < -16;
count(*)
0
select count(*) from t1 where x = -16;
count(*)
0
explain select count(*) from t1 where x > -16;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL 1 Using where; Using index
select count(*) from t1 where x > -16;
count(*)
1
select count(*) from t1 where x = 18446744073709551601;
count(*)
1
drop table t1;
...@@ -20,10 +20,10 @@ Got one of the listed errors ...@@ -20,10 +20,10 @@ Got one of the listed errors
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t2; rename table t3 to t4, t2 to t3, t1 to t2, t4 to t2;
Got one of the listed errors Got one of the listed errors
show tables like "t_"; show tables like "t_";
Tables_in_test (t_) table_type Tables_in_test (t_)
t1 BASE TABLE t1
t2 BASE TABLE t2
t3 BASE TABLE t3
rename table t3 to t1, t2 to t3, t1 to t2, t4 to t1; rename table t3 to t1, t2 to t3, t1 to t2, t4 to t1;
Got one of the listed errors Got one of the listed errors
rename table t3 to t4, t5 to t3, t1 to t2, t4 to t1; rename table t3 to t4, t5 to t3, t1 to t2, t4 to t1;
...@@ -45,12 +45,12 @@ CREATE TABLE t3 (a int); ...@@ -45,12 +45,12 @@ CREATE TABLE t3 (a int);
FLUSH TABLES WITH READ LOCK; FLUSH TABLES WITH READ LOCK;
RENAME TABLE t1 TO t2, t3 to t4; RENAME TABLE t1 TO t2, t3 to t4;
show tables; show tables;
Tables_in_test table_type Tables_in_test
t1 BASE TABLE t1
t3 BASE TABLE t3
UNLOCK TABLES; UNLOCK TABLES;
show tables; show tables;
Tables_in_test table_type Tables_in_test
t2 BASE TABLE t2
t4 BASE TABLE t4
drop table t2, t4; drop table t2, t4;
...@@ -73,25 +73,25 @@ mysqltest3 ...@@ -73,25 +73,25 @@ mysqltest3
test test
use mysqltest2; use mysqltest2;
show tables; show tables;
Tables_in_mysqltest2 table_type Tables_in_mysqltest2
t1 BASE TABLE t1
t3 BASE TABLE t3
select * from t1; select * from t1;
n s n s
1 original foo.t1 1 original foo.t1
use mysqltest3; use mysqltest3;
show tables; show tables;
Tables_in_mysqltest3 table_type Tables_in_mysqltest3
t1 BASE TABLE t1
select * from t1; select * from t1;
n s n s
1 original foo2.t1 1 original foo2.t1
use mysqltest; use mysqltest;
show tables; show tables;
Tables_in_mysqltest table_type Tables_in_mysqltest
t1 BASE TABLE t1
t2 BASE TABLE t2
t3 BASE TABLE t3
select * from mysqltest.t1; select * from mysqltest.t1;
n s n s
1 one test 1 one test
......
...@@ -39,7 +39,7 @@ drop table t1; ...@@ -39,7 +39,7 @@ drop table t1;
set @@session.auto_increment_increment=100, @@session.auto_increment_offset=10; set @@session.auto_increment_increment=100, @@session.auto_increment_offset=10;
show variables like "%auto%"; show variables like "%auto%";
Variable_name Value Variable_name Value
auto_incrememt_increment 100 auto_increment_increment 100
auto_increment_offset 10 auto_increment_offset 10
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
insert into t1 values (NULL),(5),(NULL); insert into t1 values (NULL),(5),(NULL);
......
...@@ -11,7 +11,7 @@ show slave status; ...@@ -11,7 +11,7 @@ show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 273 # # master-bin.000001 Yes Yes test.t3,test.t1,test.t2 0 0 273 # None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 273 # # master-bin.000001 Yes Yes test.t3,test.t1,test.t2 0 0 273 # None 0 No #
show tables like 't1'; show tables like 't1';
Tables_in_test (t1) table_type Tables_in_test (t1)
drop table t1; drop table t1;
select get_lock('crash_lock%20C', 10); select get_lock('crash_lock%20C', 10);
get_lock('crash_lock%20C', 10) get_lock('crash_lock%20C', 10)
......
create schema foo;
show create schema foo;
Database Create Database
foo CREATE DATABASE `foo` /*!40100 DEFAULT CHARACTER SET latin1 */
show schemas;
Database
foo
mysql
test
drop schema foo;
drop table if exists t1,t2,t3,t4; drop table if exists t1,t2,t3,t4;
drop view if exists v1;
CREATE TABLE t1 ( CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
...@@ -1374,7 +1375,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -1374,7 +1375,7 @@ id select_type table type possible_keys key key_len ref rows Extra
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0; explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where 1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null; explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 1 SIMPLE t4 ALL NULL NULL NULL NULL 12
...@@ -2021,15 +2022,15 @@ select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1; ...@@ -2021,15 +2022,15 @@ select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1;
Nuvarande period Nuvarande period
9410 9410
show tables; show tables;
Tables_in_test table_type Tables_in_test
t1 BASE TABLE t1
t2 BASE TABLE t2
t3 BASE TABLE t3
t4 BASE TABLE t4
show tables from test like "s%"; show tables from test like "s%";
Tables_in_test (s%) table_type Tables_in_test (s%)
show tables from test like "t?"; show tables from test like "t?";
Tables_in_test (t?) table_type Tables_in_test (t?)
show full columns from t2; show full columns from t2;
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
auto int(11) NULL PRI NULL auto_increment select,insert,update,references auto int(11) NULL PRI NULL auto_increment select,insert,update,references
......
...@@ -77,13 +77,13 @@ create temporary table t1 (a int not null); ...@@ -77,13 +77,13 @@ create temporary table t1 (a int not null);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TEMPORARY TABLE `t1` ( t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) NOT NULL default '0' `a` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 rename t2; alter table t1 rename t2;
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TEMPORARY TABLE `t2` ( t2 CREATE TEMPORARY TABLE `t2` (
`a` int(11) NOT NULL default '0' `a` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2; drop table t2;
create table t1 ( create table t1 (
...@@ -98,7 +98,7 @@ Table Create Table ...@@ -98,7 +98,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`test_set` set('val1','val2','val3') NOT NULL default '', `test_set` set('val1','val2','val3') NOT NULL default '',
`name` char(20) default 'O''Brien' COMMENT 'O''Brien as default', `name` char(20) default 'O''Brien' COMMENT 'O''Brien as default',
`c` int(11) NOT NULL default '0' COMMENT 'int column', `c` int(11) NOT NULL COMMENT 'int column',
`c-b` int(11) default NULL COMMENT 'name with a minus', `c-b` int(11) default NULL COMMENT 'name with a minus',
`space 2` int(11) default NULL COMMENT 'name with a space' `space 2` int(11) default NULL COMMENT 'name with a space'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table'
...@@ -108,7 +108,7 @@ Table Create Table ...@@ -108,7 +108,7 @@ Table Create Table
t1 CREATE TABLE t1 ( t1 CREATE TABLE t1 (
test_set set('val1','val2','val3') NOT NULL default '', test_set set('val1','val2','val3') NOT NULL default '',
`name` char(20) default 'O''Brien' COMMENT 'O''Brien as default', `name` char(20) default 'O''Brien' COMMENT 'O''Brien as default',
c int(11) NOT NULL default '0' COMMENT 'int column', c int(11) NOT NULL COMMENT 'int column',
`c-b` int(11) default NULL COMMENT 'name with a minus', `c-b` int(11) default NULL COMMENT 'name with a minus',
`space 2` int(11) default NULL COMMENT 'name with a space' `space 2` int(11) default NULL COMMENT 'name with a space'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table'
...@@ -117,7 +117,7 @@ show full columns from t1; ...@@ -117,7 +117,7 @@ show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
test_set set('val1','val2','val3') latin1_swedish_ci select,insert,update,references test_set set('val1','val2','val3') latin1_swedish_ci select,insert,update,references
name char(20) latin1_swedish_ci YES O'Brien select,insert,update,references O'Brien as default name char(20) latin1_swedish_ci YES O'Brien select,insert,update,references O'Brien as default
c int(11) NULL 0 select,insert,update,references int column c int(11) NULL select,insert,update,references int column
c-b int(11) NULL YES NULL select,insert,update,references name with a minus c-b int(11) NULL YES NULL select,insert,update,references name with a minus
space 2 int(11) NULL YES NULL select,insert,update,references name with a space space 2 int(11) NULL YES NULL select,insert,update,references name with a space
drop table t1; drop table t1;
...@@ -125,7 +125,7 @@ create table t1 (a int not null, unique aa (a)); ...@@ -125,7 +125,7 @@ create table t1 (a int not null, unique aa (a));
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
UNIQUE KEY `aa` (`a`) UNIQUE KEY `aa` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
...@@ -133,7 +133,7 @@ create table t1 (a int not null, primary key (a)); ...@@ -133,7 +133,7 @@ create table t1 (a int not null, primary key (a));
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
...@@ -150,7 +150,7 @@ create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CH ...@@ -150,7 +150,7 @@ create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CH
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` char(10) default NULL, `b` char(10) default NULL,
KEY `b` (`b`) KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test'
...@@ -158,7 +158,7 @@ alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0; ...@@ -158,7 +158,7 @@ alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` varchar(10) default NULL, `b` varchar(10) default NULL,
KEY `b` (`b`) KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=200 AVG_ROW_LENGTH=10 PACK_KEYS=0 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC COMMENT='test' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=200 AVG_ROW_LENGTH=10 PACK_KEYS=0 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC COMMENT='test'
...@@ -166,7 +166,7 @@ ALTER TABLE t1 AVG_ROW_LENGTH=0 CHECKSUM=0 COMMENT="" MIN_ROWS=0 MAX_ROWS=0 PACK ...@@ -166,7 +166,7 @@ ALTER TABLE t1 AVG_ROW_LENGTH=0 CHECKSUM=0 COMMENT="" MIN_ROWS=0 MAX_ROWS=0 PACK
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` varchar(10) default NULL, `b` varchar(10) default NULL,
KEY `b` (`b`) KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
...@@ -216,7 +216,7 @@ index(type_short) ...@@ -216,7 +216,7 @@ index(type_short)
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`type_bool` tinyint(1) NOT NULL default '0', `type_bool` tinyint(1) NOT NULL,
`type_tiny` tinyint(4) NOT NULL auto_increment, `type_tiny` tinyint(4) NOT NULL auto_increment,
`type_short` smallint(3) default NULL, `type_short` smallint(3) default NULL,
`type_mediumint` mediumint(9) default NULL, `type_mediumint` mediumint(9) default NULL,
...@@ -227,9 +227,9 @@ t1 CREATE TABLE `t1` ( ...@@ -227,9 +227,9 @@ t1 CREATE TABLE `t1` (
`type_char` char(2) default NULL, `type_char` char(2) default NULL,
`type_varchar` varchar(10) default NULL, `type_varchar` varchar(10) default NULL,
`type_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `type_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`type_date` date NOT NULL default '0000-00-00', `type_date` date NOT NULL,
`type_time` time NOT NULL default '00:00:00', `type_time` time NOT NULL,
`type_datetime` datetime NOT NULL default '0000-00-00 00:00:00', `type_datetime` datetime NOT NULL,
`type_year` year(4) default NULL, `type_year` year(4) default NULL,
`type_enum` enum('red','green','blue') default NULL, `type_enum` enum('red','green','blue') default NULL,
`type_set` enum('red','green','blue') default NULL, `type_set` enum('red','green','blue') default NULL,
......
delete from mysql.proc; delete from mysql.proc;
create function .f1() returns int return 1;
create procedure .p1() select 1, database();
create procedure p1() select 2, database();
alter procedure .p1 sql security invoker;
select .f1();
.f1()
1
call .p1();
1 database()
1 test
call p1();
2 database()
2 test
select f1();
ERROR 42000: FUNCTION test.f1 does not exist
select db,name,type,security_type from mysql.proc;
db name type security_type
f1 FUNCTION DEFINER
p1 PROCEDURE INVOKER
test p1 PROCEDURE DEFINER
drop function .f1;
drop procedure .p1;
drop procedure p1;
create procedure syntaxerror(t int)| create procedure syntaxerror(t int)|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
create procedure syntaxerror(t int)| create procedure syntaxerror(t int)|
...@@ -138,14 +115,6 @@ foo: loop ...@@ -138,14 +115,6 @@ foo: loop
set @x=2; set @x=2;
end loop bar| end loop bar|
ERROR 42000: End-label bar without match ERROR 42000: End-label bar without match
create procedure foo(out x int)
begin
declare y int;
set x = y;
end|
Warnings:
Warning 1311 Referring to uninitialized variable y
drop procedure foo|
create procedure foo() create procedure foo()
return 42| return 42|
ERROR 42000: RETURN is only allowed in a FUNCTION ERROR 42000: RETURN is only allowed in a FUNCTION
...@@ -258,9 +227,6 @@ ERROR 24000: Cursor is not open ...@@ -258,9 +227,6 @@ ERROR 24000: Cursor is not open
drop procedure p| drop procedure p|
alter procedure bar3 sql security invoker| alter procedure bar3 sql security invoker|
ERROR 42000: PROCEDURE test.bar3 does not exist ERROR 42000: PROCEDURE test.bar3 does not exist
alter procedure bar3 name
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|
ERROR 42000: Identifier name 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' is too long
drop table t1| drop table t1|
drop table if exists t1| drop table if exists t1|
create table t1 (val int, x float)| create table t1 (val int, x float)|
......
...@@ -107,13 +107,20 @@ s1 ...@@ -107,13 +107,20 @@ s1
0 0
2 2
2 2
alter procedure p modifies sql data;
drop procedure p;
alter procedure q modifies sql data;
ERROR 42000: Access denied; you are not the procedure/function definer of 'db2.q'
drop procedure q;
ERROR 42000: Access denied; you are not the procedure/function definer of 'db2.q'
use db2;
alter procedure q modifies sql data;
drop procedure q;
use test; use test;
select type,db,name from mysql.proc; select type,db,name from mysql.proc;
type db name type db name
FUNCTION db1_secret db FUNCTION db1_secret db
PROCEDURE db1_secret stamp PROCEDURE db1_secret stamp
PROCEDURE db2 p
PROCEDURE db2 q
drop database db1_secret; drop database db1_secret;
drop database db2; drop database db2;
select type,db,name from mysql.proc; select type,db,name from mysql.proc;
......
...@@ -877,41 +877,59 @@ drop table t3| ...@@ -877,41 +877,59 @@ drop table t3|
drop procedure cur2| drop procedure cur2|
create procedure chistics() create procedure chistics()
language sql language sql
modifies sql data
not deterministic not deterministic
sql security definer sql security definer
comment 'Characteristics procedure test' comment 'Characteristics procedure test'
insert into t1 values ("chistics", 1)| insert into t1 values ("chistics", 1)|
show create procedure chistics|
Procedure sql_mode Create Procedure
chistics CREATE PROCEDURE `test`.`chistics`()
MODIFIES SQL DATA
COMMENT 'Characteristics procedure test'
insert into t1 values ("chistics", 1)
call chistics()| call chistics()|
select * from t1| select * from t1|
id data id data
chistics 1 chistics 1
delete from t1| delete from t1|
alter procedure chistics sql security invoker name chistics2| alter procedure chistics sql security invoker|
show create procedure chistics2| show create procedure chistics|
Procedure sql_mode Create Procedure Procedure sql_mode Create Procedure
chistics2 CREATE PROCEDURE `test`.`chistics2`() chistics CREATE PROCEDURE `test`.`chistics`()
MODIFIES SQL DATA
SQL SECURITY INVOKER SQL SECURITY INVOKER
COMMENT 'Characteristics procedure test' COMMENT 'Characteristics procedure test'
insert into t1 values ("chistics", 1) insert into t1 values ("chistics", 1)
drop procedure chistics2| drop procedure chistics|
create function chistics() returns int create function chistics() returns int
language sql language sql
deterministic deterministic
sql security invoker sql security invoker
comment 'Characteristics procedure test' comment 'Characteristics procedure test'
return 42| return 42|
show create function chistics|
Function sql_mode Create Function
chistics CREATE FUNCTION `test`.`chistics`() RETURNS int
DETERMINISTIC
SQL SECURITY INVOKER
COMMENT 'Characteristics procedure test'
return 42
select chistics()| select chistics()|
chistics() chistics()
42 42
alter function chistics name chistics2 comment 'Characteristics function test'| alter function chistics
show create function chistics2| no sql
comment 'Characteristics function test'|
show create function chistics|
Function sql_mode Create Function Function sql_mode Create Function
chistics2 CREATE FUNCTION `test`.`chistics2`() RETURNS int chistics CREATE FUNCTION `test`.`chistics`() RETURNS int
NO SQL
DETERMINISTIC DETERMINISTIC
SQL SECURITY INVOKER SQL SECURITY INVOKER
COMMENT 'Characteristics function test' COMMENT 'Characteristics function test'
return 42 return 42
drop function chistics2| drop function chistics|
insert into t1 values ("foo", 1), ("bar", 2), ("zip", 3)| insert into t1 values ("foo", 1), ("bar", 2), ("zip", 3)|
set @@sql_mode = 'ANSI'| set @@sql_mode = 'ANSI'|
create procedure modes(out c1 int, out c2 int) create procedure modes(out c1 int, out c2 int)
...@@ -1620,8 +1638,8 @@ tinyint 1 -128 127 0 0 YES YES NO YES YES NO NULL,0 A very small integer ...@@ -1620,8 +1638,8 @@ tinyint 1 -128 127 0 0 YES YES NO YES YES NO NULL,0 A very small integer
tinyint unsigned 1 0 255 0 0 YES YES YES YES YES NO NULL,0 A very small integer tinyint unsigned 1 0 255 0 0 YES YES YES YES YES NO NULL,0 A very small integer
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`id` char(16) NOT NULL default '', `id` char(16) NOT NULL,
`data` int(11) NOT NULL default '0' `data` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
Database Create Database Database Create Database
test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */
...@@ -1629,7 +1647,7 @@ Database (foo) ...@@ -1629,7 +1647,7 @@ Database (foo)
Level Code Message Level Code Message
Field Type Null Key Default Extra Field Type Null Key Default Extra
id char(16) id char(16)
data int(11) 0 data int(11)
Grants for root@localhost Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
...@@ -1659,7 +1677,7 @@ Super Server Admin To use KILL thread, SET GLOBAL, CHANGE MASTER, etc. ...@@ -1659,7 +1677,7 @@ Super Server Admin To use KILL thread, SET GLOBAL, CHANGE MASTER, etc.
Update Tables To update existing rows Update Tables To update existing rows
Usage Server Admin No privileges - allow connect only Usage Server Admin No privileges - allow connect only
Variable_name Value Variable_name Value
Tables_in_test (foo) table_type Tables_in_test (foo)
Variable_name Value Variable_name Value
Level Code Message Level Code Message
call bug4902()| call bug4902()|
...@@ -1670,8 +1688,8 @@ tinyint 1 -128 127 0 0 YES YES NO YES YES NO NULL,0 A very small integer ...@@ -1670,8 +1688,8 @@ tinyint 1 -128 127 0 0 YES YES NO YES YES NO NULL,0 A very small integer
tinyint unsigned 1 0 255 0 0 YES YES YES YES YES NO NULL,0 A very small integer tinyint unsigned 1 0 255 0 0 YES YES YES YES YES NO NULL,0 A very small integer
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`id` char(16) NOT NULL default '', `id` char(16) NOT NULL,
`data` int(11) NOT NULL default '0' `data` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
Database Create Database Database Create Database
test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */
...@@ -1679,7 +1697,7 @@ Database (foo) ...@@ -1679,7 +1697,7 @@ Database (foo)
Level Code Message Level Code Message
Field Type Null Key Default Extra Field Type Null Key Default Extra
id char(16) id char(16)
data int(11) 0 data int(11)
Grants for root@localhost Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
...@@ -1709,7 +1727,7 @@ Super Server Admin To use KILL thread, SET GLOBAL, CHANGE MASTER, etc. ...@@ -1709,7 +1727,7 @@ Super Server Admin To use KILL thread, SET GLOBAL, CHANGE MASTER, etc.
Update Tables To update existing rows Update Tables To update existing rows
Usage Server Admin No privileges - allow connect only Usage Server Admin No privileges - allow connect only
Variable_name Value Variable_name Value
Tables_in_test (foo) table_type Tables_in_test (foo)
Variable_name Value Variable_name Value
Level Code Message Level Code Message
drop procedure bug4902| drop procedure bug4902|
...@@ -1825,13 +1843,9 @@ begin ...@@ -1825,13 +1843,9 @@ begin
declare v char; declare v char;
return v; return v;
end| end|
Warnings:
Warning 1311 Referring to uninitialized variable v
select bug4487()| select bug4487()|
bug4487() bug4487()
NULL NULL
Warnings:
Warning 1311 Referring to uninitialized variable v
drop function bug4487| drop function bug4487|
drop procedure if exists bug4941| drop procedure if exists bug4941|
create procedure bug4941(out x int) create procedure bug4941(out x int)
...@@ -1920,6 +1934,39 @@ s1 ...@@ -1920,6 +1934,39 @@ s1
1 1
drop procedure bug4905| drop procedure bug4905|
drop table t3| drop table t3|
drop function if exists bug6022|
create function bug6022(x int) returns int
begin
if x < 0 then
return 0;
else
return bug6022(x-1);
end if;
end|
select bug6022(5)|
bug6022(5)
0
drop function bug6022|
drop procedure if exists bug6029|
create procedure bug6029()
begin
declare exit handler for 1136 select '1136';
declare exit handler for sqlstate '23000' select 'sqlstate 23000';
declare continue handler for sqlexception select 'sqlexception';
insert into t3 values (1);
insert into t3 values (1,2);
end|
create table t3 (s1 int, primary key (s1))|
insert into t3 values (1)|
call bug6029()|
sqlstate 23000
sqlstate 23000
delete from t3|
call bug6029()|
1136
1136
drop procedure bug6029|
drop table t3|
drop table if exists fac| drop table if exists fac|
create table fac (n int unsigned not null primary key, f bigint unsigned)| create table fac (n int unsigned not null primary key, f bigint unsigned)|
create procedure ifac(n int unsigned) create procedure ifac(n int unsigned)
...@@ -2118,8 +2165,8 @@ insert into test.t1 values (x, y)| ...@@ -2118,8 +2165,8 @@ insert into test.t1 values (x, y)|
show procedure status like 'bar'| show procedure status like 'bar'|
Db Name Type Definer Modified Created Security_type Comment Db Name Type Definer Modified Created Security_type Comment
test bar PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER 111111111111 test bar PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER 111111111111
alter procedure bar name bar2 comment "2222222222" sql security definer| alter procedure bar comment "2222222222" sql security definer|
alter procedure bar2 name bar comment "3333333333"| alter procedure bar comment "3333333333"|
alter procedure bar| alter procedure bar|
show create procedure bar| show create procedure bar|
Procedure sql_mode Create Procedure Procedure sql_mode Create Procedure
......
...@@ -74,7 +74,7 @@ t1 CREATE TABLE `t1` ( ...@@ -74,7 +74,7 @@ t1 CREATE TABLE `t1` (
set sql_mode="postgresql,oracle,mssql,db2,maxdb"; set sql_mode="postgresql,oracle,mssql,db2,maxdb";
select @@sql_mode; select @@sql_mode;
@@sql_mode @@sql_mode
PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,POSTGRESQL,ORACLE,MSSQL,DB2,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,POSTGRESQL,ORACLE,MSSQL,DB2,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE "t1" ( t1 CREATE TABLE "t1" (
......
This diff is collapsed.
...@@ -331,7 +331,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -331,7 +331,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 Using index 2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 Using index
Warnings: Warnings:
Note 1276 Field or reference 'clinic_uq' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'clinic_uq' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where exists(select 1 AS `Not_used` from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`)) Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where exists(select 1 AS `Not_used` from `test`.`t7` where (`test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`))
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b); select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column 'a' in field list is ambiguous ERROR 23000: Column 'a' in field list is ambiguous
drop table t1,t2,t3; drop table t1,t2,t3;
...@@ -545,7 +545,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -545,7 +545,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 Using index 1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 Using index
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings: Warnings:
Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = _latin1'1') and (`test`.`t1`.`numreponse` = 3)) Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numreponse` = (select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = _latin1'1'))) and (`test`.`t1`.`numeropost` = _latin1'1'))
drop table t1; drop table t1;
CREATE TABLE t1 (a int(1)); CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
...@@ -1313,7 +1313,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -1313,7 +1313,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 func 1 Using where 2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 func 1 Using where
2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using where; Using index 2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using where; Using index
Warnings: Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))) Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
drop table t1, t2, t3; drop table t1, t2, t3;
create table t1 (a int, b int, index a (a,b)); create table t1 (a int, b int, index a (a,b));
create table t2 (a int, index a (a)); create table t2 (a int, index a (a));
...@@ -1675,10 +1675,10 @@ Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `tes ...@@ -1675,10 +1675,10 @@ Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `tes
explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null); explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY tt ALL NULL NULL NULL NULL 12 Using where 1 PRIMARY tt ALL NULL NULL NULL NULL 12 Using where
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 7 Using where; Using index 2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 Using where; Using index
Warnings: Warnings:
Note 1276 Field or reference 'tt.id' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'tt.id' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where not(exists(select `test`.`t1`.`id` AS `id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and ((`test`.`t1`.`id` = `test`.`tt`.`id`) or isnull(`test`.`t1`.`id`))) having (`test`.`t1`.`id` is not null))) Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where not(exists(select `test`.`t1`.`id` AS `id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`tt`.`id` = `test`.`t1`.`id`)) having (`test`.`t1`.`id` is not null)))
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001'); insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
create table t2 (id int not null, text varchar(20) not null default '', primary key (id)); create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10'); insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
...@@ -1704,7 +1704,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -1704,7 +1704,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2
1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 Using where 1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 Using where
Warnings: Warnings:
Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(((`test`.`a`.`id` = `test`.`b`.`id`) or isnull(`test`.`b`.`id`))) join `test`.`t1` `c` where (if(isnull(`test`.`b`.`id`),1000,`test`.`b`.`id`) = `test`.`c`.`id`) Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(((`test`.`b`.`id` = `test`.`a`.`id`) or isnull(`test`.`b`.`id`))) join `test`.`t1` `c` where (if(isnull(`test`.`b`.`id`),1000,`test`.`b`.`id`) = `test`.`c`.`id`)
drop table t1,t2; drop table t1,t2;
create table t1 (a int); create table t1 (a int);
insert into t1 values (1); insert into t1 values (1);
...@@ -1832,7 +1832,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -1832,7 +1832,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
Warnings: Warnings:
Note 1276 Field or reference 'up.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'up.a' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where exists(select 1 AS `Not_used` from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`)) Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where exists(select 1 AS `Not_used` from `test`.`t1` where (`test`.`up`.`a` = `test`.`t1`.`a`))
drop table t1; drop table t1;
CREATE TABLE t1 (t1_a int); CREATE TABLE t1 (t1_a int);
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
......
...@@ -37,8 +37,8 @@ show create table t9; ...@@ -37,8 +37,8 @@ show create table t9;
Table Create Table Table Create Table
t9 CREATE TABLE `t9` ( t9 CREATE TABLE `t9` (
`a` int(11) NOT NULL auto_increment, `a` int(11) NOT NULL auto_increment,
`b` char(16) NOT NULL default '', `b` char(16) NOT NULL,
`c` int(11) NOT NULL default '0', `c` int(11) NOT NULL,
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='TEST_DIR/var/tmp/' INDEX DIRECTORY='TEST_DIR/var/run/' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='TEST_DIR/var/tmp/' INDEX DIRECTORY='TEST_DIR/var/run/'
alter table t9 rename t8, add column d int not null; alter table t9 rename t8, add column d int not null;
...@@ -58,9 +58,9 @@ show create table mysqltest.t9; ...@@ -58,9 +58,9 @@ show create table mysqltest.t9;
Table Create Table Table Create Table
t9 CREATE TABLE `t9` ( t9 CREATE TABLE `t9` (
`a` int(11) NOT NULL auto_increment, `a` int(11) NOT NULL auto_increment,
`b` char(16) NOT NULL default '', `b` char(16) NOT NULL,
`c` int(11) NOT NULL default '0', `c` int(11) NOT NULL,
`d` int(11) NOT NULL default '0', `d` int(11) NOT NULL,
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='TEST_DIR/var/tmp/' INDEX DIRECTORY='TEST_DIR/var/run/' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='TEST_DIR/var/tmp/' INDEX DIRECTORY='TEST_DIR/var/run/'
drop database mysqltest; drop database mysqltest;
...@@ -68,19 +68,19 @@ create table t1 (a int not null) engine=myisam; ...@@ -68,19 +68,19 @@ create table t1 (a int not null) engine=myisam;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0' `a` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 add b int; alter table t1 add b int;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` int(11) default NULL `b` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` int(11) default NULL `b` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
show tables; show tables;
Tables_in_db table_type Tables_in_db
columns_priv BASE TABLE columns_priv
db BASE TABLE db
func BASE TABLE func
help_category BASE TABLE help_category
help_keyword BASE TABLE help_keyword
help_relation BASE TABLE help_relation
help_topic BASE TABLE help_topic
host BASE TABLE host
proc BASE TABLE proc
tables_priv BASE TABLE tables_priv
time_zone BASE TABLE time_zone
time_zone_leap_second BASE TABLE time_zone_leap_second
time_zone_name BASE TABLE time_zone_name
time_zone_transition BASE TABLE time_zone_transition
time_zone_transition_type BASE TABLE time_zone_transition_type
user BASE TABLE user
show create table db; show create table db;
Table Create Table Table Create Table
db CREATE TABLE `db` ( db CREATE TABLE `db` (
...@@ -134,4 +134,4 @@ columns_priv CREATE TABLE `columns_priv` ( ...@@ -134,4 +134,4 @@ columns_priv CREATE TABLE `columns_priv` (
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges'
show tables; show tables;
Tables_in_test table_type Tables_in_test
...@@ -169,3 +169,8 @@ create temporary table t1 (i int); ...@@ -169,3 +169,8 @@ create temporary table t1 (i int);
create trigger trg before insert on t1 for each row set @a:=1; create trigger trg before insert on t1 for each row set @a:=1;
ERROR HY000: Trigger's 't1' is view or temporary table ERROR HY000: Trigger's 't1' is view or temporary table
drop table t1; drop table t1;
create table t1 (x1col char);
create trigger tx1 before insert on t1 for each row set new.x1col = 'x';
insert into t1 values ('y');
drop trigger t1.tx1;
drop table t1;
...@@ -3,7 +3,7 @@ create table t1 (a set (' ','a','b') not null); ...@@ -3,7 +3,7 @@ create table t1 (a set (' ','a','b') not null);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` set('','a','b') NOT NULL default '' `a` set('','a','b') NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 (a set (' ','a','b ') not null default 'b '); create table t1 (a set (' ','a','b ') not null default 'b ');
......
This diff is collapsed.
...@@ -43,7 +43,7 @@ drop table t1; ...@@ -43,7 +43,7 @@ drop table t1;
create table t1(a tinyint, b int not null, c date, d char(5)); create table t1(a tinyint, b int not null, c date, d char(5));
load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ','; load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ',';
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'b' at row 2 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 2
Warning 1265 Data truncated for column 'd' at row 3 Warning 1265 Data truncated for column 'd' at row 3
Warning 1265 Data truncated for column 'c' at row 4 Warning 1265 Data truncated for column 'c' at row 4
Warning 1261 Row 5 doesn't contain data for all columns Warning 1261 Row 5 doesn't contain data for all columns
...@@ -57,7 +57,7 @@ drop table t1; ...@@ -57,7 +57,7 @@ drop table t1;
create table t1(a tinyint NOT NULL, b tinyint unsigned, c char(5)); create table t1(a tinyint NOT NULL, b tinyint unsigned, c char(5));
insert into t1 values(NULL,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test'); insert into t1 values(NULL,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test');
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1
Warning 1264 Out of range value adjusted for column 'b' at row 2 Warning 1264 Out of range value adjusted for column 'b' at row 2
Warning 1265 Data truncated for column 'c' at row 2 Warning 1265 Data truncated for column 'c' at row 2
Warning 1264 Out of range value adjusted for column 'a' at row 3 Warning 1264 Out of range value adjusted for column 'a' at row 3
...@@ -70,7 +70,7 @@ Warning 1265 Data truncated for column 'c' at row 2 ...@@ -70,7 +70,7 @@ Warning 1265 Data truncated for column 'c' at row 2
alter table t1 add d char(2); alter table t1 add d char(2);
update t1 set a=NULL where a=10; update t1 set a=NULL where a=10;
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 2 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 2
update t1 set c='mysql ab' where c='test'; update t1 set c='mysql ab' where c='test';
Warnings: Warnings:
Warning 1265 Data truncated for column 'c' at row 4 Warning 1265 Data truncated for column 'c' at row 4
...@@ -86,7 +86,7 @@ Warnings: ...@@ -86,7 +86,7 @@ Warnings:
Warning 1265 Data truncated for column 'b' at row 1 Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'b' at row 2 Warning 1265 Data truncated for column 'b' at row 2
Warning 1265 Data truncated for column 'b' at row 3 Warning 1265 Data truncated for column 'b' at row 3
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 4 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 4
Warning 1265 Data truncated for column 'b' at row 4 Warning 1265 Data truncated for column 'b' at row 4
insert into t2(b) values('mysqlab'); insert into t2(b) values('mysqlab');
Warnings: Warnings:
......
...@@ -21,6 +21,15 @@ select current_user; ...@@ -21,6 +21,15 @@ select current_user;
grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option; grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option;
--error 1044 --error 1044
grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option; grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option;
#
# NO_AUTO_CREATE_USER mode
#
set @@sql_mode='NO_AUTO_CREATE_USER';
select @@sql_mode;
--error 1211
grant select on `my\_1`.* to mysqltest_4@localhost with grant option;
grant select on `my\_1`.* to mysqltest_4@localhost identified by 'mypass'
with grant option;
disconnect user1; disconnect user1;
connection default; connection default;
show grants for mysqltest_1@localhost; show grants for mysqltest_1@localhost;
......
This diff is collapsed.
This diff is collapsed.
...@@ -115,13 +115,10 @@ set @value= "-1e+1111111111a"; ...@@ -115,13 +115,10 @@ set @value= "-1e+1111111111a";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
--query_vertical select * from t1 where number =last_insert_id() --query_vertical select * from t1 where number =last_insert_id()
--error 1367
set @value= 1e+1111111111; set @value= 1e+1111111111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); --error 1367
--query_vertical select * from t1 where number =last_insert_id()
set @value= -1e+1111111111; set @value= -1e+1111111111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
--query_vertical select * from t1 where number =last_insert_id()
set @value= 1e+111; set @value= 1e+111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment