Commit ceaab960 authored by brian@avenger.(none)'s avatar brian@avenger.(none)

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

into avenger.(none):/export/brian/mysql/mysql-5.0
parents 19ec8072 3ba5e604
......@@ -508,6 +508,7 @@ mysql-test/install_test_db
mysql-test/mysql-test-run
mysql-test/ndb/ndbcluster
mysql-test/r/*.reject
mysql-test/r/index_merge_load.result
mysql-test/r/rpl000001.eval
mysql-test/r/rpl000002.eval
mysql-test/r/rpl000014.eval
......@@ -518,6 +519,7 @@ mysql-test/r/slave-running.eval
mysql-test/r/slave-stopped.eval
mysql-test/share/mysql
mysql-test/std_data/*.pem
mysql-test/t/index_merge.load
mysql-test/var/*
mysql.kdevprj
mysql.proj
......@@ -762,6 +764,7 @@ scripts/mysqldumpslow
scripts/mysqlhotcopy
scripts/safe_mysqld
select_test
server-tools/instance-manager/mysqlmanager
sql-bench/Results-linux/ATIS-mysql_bdb-Linux_2.2.14_my_SMP_i686
sql-bench/bench-count-distinct
sql-bench/bench-init.pl
......@@ -834,6 +837,7 @@ strings/conf_to_src
strings/ctype_autoconf.c
strings/ctype_extra_sources.c
strings/str_test
strings/test_decimal
support-files/MacOSX/Description.plist
support-files/MacOSX/Info.plist
support-files/MacOSX/ReadMe.txt
......@@ -920,3 +924,5 @@ vio/test-ssl
vio/test-sslclient
vio/test-sslserver
vio/viotest-ssl
stamp-h1.in
stamp-h2.in
......@@ -1811,7 +1811,7 @@ sub fix_image
{
my($text) = @_;
my($arg1, $ext);
$text =~ /^([^,]*)$/;
$text =~ /^([^,]*)/;
die "error in image: '$text'" unless defined($1);
$arg1 = $1;
$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 @@
#define ER_NO_DEFAULT_FOR_FIELD 1364
#define ER_DIVISION_BY_ZERO 1365
#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", "",
ER_COLLATION_CHARSET_MISMATCH, "42000", "",
ER_WARN_TOO_FEW_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_TRUNCATED, "01000", "",
ER_WRONG_NAME_FOR_INDEX, "42000", "",
......@@ -202,3 +202,5 @@ ER_SP_VARCOND_AFTER_CURSHNDLR, "42000", "",
ER_SP_CURSOR_AFTER_HANDLER, "42000", "",
ER_SP_CASE_NOT_FOUND, "20000", "",
ER_DIVISION_BY_ZERO, "22012", "",
ER_ILLEGAL_VALUE_FOR_TYPE, "22007", "",
ER_SP_ACCESS_DENIED_ERROR, "42000", "",
......@@ -915,17 +915,6 @@ btr_search_drop_page_hash_index(
{
hash_table_t* table;
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
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
......@@ -951,72 +940,17 @@ btr_search_drop_page_hash_index(
|| (block->buf_fix_count == 0));
#endif /* UNIV_SYNC_DEBUG */
n_fields = block->curr_n_fields;
n_bytes = block->curr_n_bytes;
ut_a(n_fields + n_bytes > 0);
ut_a(block->curr_n_fields + block->curr_n_bytes > 0);
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);
for (i = 0; i < n_cached; i++) {
ha_remove_all_nodes_to_page(table, folds[i], page);
}
ha_remove_all_nodes_to_page(table, page);
block->is_hashed = FALSE;
rw_lock_x_unlock(&btr_search_latch);
mem_free(folds);
}
/************************************************************************
......
......@@ -465,6 +465,7 @@ buf_block_init(
block->in_LRU_list = FALSE;
block->n_pointers = 0;
block->hash_nodes = NULL;
rw_lock_create(&(block->lock));
ut_ad(rw_lock_validate(&(block->lock)));
......
......@@ -789,6 +789,7 @@ buf_LRU_block_free_non_file_page(
|| (block->state == BUF_BLOCK_READY_FOR_USE));
ut_a(block->n_pointers == 0);
ut_a(block->hash_nodes == NULL);
ut_a(!block->in_free_list);
block->state = BUF_BLOCK_NOT_USED;
......
......@@ -65,10 +65,53 @@ ha_create(
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
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
ha_insert_for_fold(
......@@ -84,6 +127,7 @@ ha_insert_for_fold(
{
hash_cell_t* cell;
ha_node_t* node;
buf_block_t* block;
ha_node_t* prev_node;
buf_block_t* prev_block;
ulint hash;
......@@ -92,6 +136,9 @@ ha_insert_for_fold(
#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
#endif /* UNIV_SYNC_DEBUG */
block = buf_block_align(data);
hash = hash_calc_hash(fold, table);
cell = hash_get_nth_cell(table, hash);
......@@ -104,7 +151,15 @@ ha_insert_for_fold(
prev_block = buf_block_align(prev_node->data);
ut_a(prev_block->n_pointers > 0);
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;
......@@ -131,7 +186,9 @@ ha_insert_for_fold(
ha_node_set_data(node, data);
if (table->adaptive) {
buf_block_align(data)->n_pointers++;
block->n_pointers++;
ha_add_buf_block_node(block, node);
}
node->fold = fold;
......@@ -166,9 +223,15 @@ ha_delete_hash_node(
hash_table_t* table, /* in: hash table */
ha_node_t* del_node) /* in: node to be deleted */
{
buf_block_t* block;
if (table->adaptive) {
ut_a(buf_block_align(del_node->data)->n_pointers > 0);
buf_block_align(del_node->data)->n_pointers--;
block = buf_block_align(del_node->data);
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);
......@@ -209,6 +272,8 @@ ha_search_and_update_if_found(
void* data, /* in: 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;
#ifdef UNIV_SYNC_DEBUG
......@@ -220,8 +285,15 @@ ha_search_and_update_if_found(
if (node) {
if (table->adaptive) {
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;
......@@ -236,43 +308,25 @@ void
ha_remove_all_nodes_to_page(
/*========================*/
hash_table_t* table, /* in: hash table */
ulint fold, /* in: fold value */
page_t* page) /* in: buffer page */
{
buf_block_t* block;
ha_node_t* node;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
#endif /* UNIV_SYNC_DEBUG */
node = ha_chain_get_first(table, fold);
block = buf_block_align(page);
while (node) {
if (buf_frame_align(ha_node_get_data(node)) == page) {
node = block->hash_nodes;
while (node) {
/* Remove the hash node */
ha_delete_hash_node(table, node);
/* Start again from the first node in the chain
because the deletion may compact the heap of
nodes and move other nodes! */
node = ha_chain_get_first(table, fold);
} else {
node = ha_chain_get_next(node);
}
node = block->hash_nodes;
}
#ifdef UNIV_DEBUG
/* Check that all nodes really got deleted */
node = ha_chain_get_first(table, fold);
while (node) {
ut_a(buf_frame_align(ha_node_get_data(node)) != page);
node = ha_chain_get_next(node);
}
#endif
ut_a(block->n_pointers == 0);
ut_a(block->hash_nodes == NULL);
}
/*****************************************************************
......@@ -352,6 +406,7 @@ ha_print_info(
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
#include "buf0types.h"
#include "sync0rw.h"
#include "hash0hash.h"
#include "ha0ha.h"
#include "ut0byte.h"
#include "os0proc.h"
......@@ -817,7 +818,7 @@ struct buf_block_struct{
records with the same prefix should be
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
built on this page; note that it does
......@@ -834,6 +835,11 @@ struct buf_block_struct{
ulint curr_side; /* BTR_SEARCH_LEFT_SIDE or
BTR_SEARCH_RIGHT_SIDE in hash
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 */
#ifdef UNIV_SYNC_DEBUG
rw_lock_t debug_latch; /* in the debug version, each thread
......
......@@ -54,7 +54,7 @@ ha_create(
/*****************************************************************
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 inserted. */
is inserted. This function is only used in the adaptive hash index. */
ibool
ha_insert_for_fold(
......@@ -111,7 +111,6 @@ void
ha_remove_all_nodes_to_page(
/*========================*/
hash_table_t* table, /* in: hash table */
ulint fold, /* in: fold value */
page_t* page); /* in: buffer page */
/*****************************************************************
Validates a hash table. */
......@@ -134,9 +133,18 @@ ha_print_info(
typedef struct ha_node_struct ha_node_t;
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 */
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
......
......@@ -166,7 +166,7 @@ hash_get_n_cells(
/***********************************************************************
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
'fold'. */
'fold'. This macro is only used for the adaptive hash index. */
#define HASH_DELETE_AND_COMPACT(TYPE, NAME, TABLE, NODE)\
do {\
......@@ -191,11 +191,23 @@ do {\
/* Copy the top node in place of NODE */\
\
*(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,\
hash_calc_hash(top_node111->fold, TABLE));\
\
/* Look for the pointer to the top node, to update it */\
\
if (cell111->node == top_node111) {\
/* The top node is the first in the chain */\
......
......@@ -1184,6 +1184,8 @@ stop_master ()
mysql_stop ()
{
if [ "$MASTER_RUNNING" = 1 ]
then
$ECHO "Ending Tests"
$ECHO "Shutting-down MySQL daemon"
$ECHO ""
......@@ -1193,7 +1195,7 @@ mysql_stop ()
stop_slave 1
stop_slave 2
$ECHO "Slave shutdown finished"
fi
return 1
}
......@@ -1383,8 +1385,6 @@ run_testcase ()
then
mysql_restart
fi
$ECHO "Resuming Tests"
$ECHO ""
fi
fi
fi
......
......@@ -463,7 +463,7 @@ ALTER TABLE t1 DROP PRIMARY KEY;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`a` int(11) NOT NULL,
`b` int(11) default NULL,
UNIQUE KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
......
......@@ -232,7 +232,7 @@ a b
delete from t1 where a=0;
update t1 set a=NULL where b=6;
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;
SET SQL_MODE='';
insert into t1(a,b)values(NULL,8);
......@@ -274,7 +274,7 @@ a b
delete from t1 where a=0;
update t1 set a=NULL where b=13;
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;
select * from t1 order by b;
a b
......
show tables;
Tables_in_mysql table_type
columns_priv BASE TABLE
db BASE TABLE
func BASE TABLE
help_category BASE TABLE
help_keyword BASE TABLE
help_relation BASE TABLE
help_topic BASE TABLE
host BASE TABLE
proc BASE TABLE
tables_priv BASE TABLE
time_zone BASE TABLE
time_zone_leap_second BASE TABLE
time_zone_name BASE TABLE
time_zone_transition BASE TABLE
time_zone_transition_type BASE TABLE
user BASE TABLE
Tables_in_mysql
columns_priv
db
func
help_category
help_keyword
help_relation
help_topic
host
proc
tables_priv
time_zone
time_zone_leap_second
time_zone_name
time_zone_transition
time_zone_transition_type
user
show tables;
Tables_in_test table_type
Tables_in_test
grant ALL on *.* to test@localhost identified by "gambling";
grant ALL on *.* to test@127.0.0.1 identified by "gambling";
show tables;
Tables_in_mysql table_type
columns_priv BASE TABLE
db BASE TABLE
func BASE TABLE
help_category BASE TABLE
help_keyword BASE TABLE
help_relation BASE TABLE
help_topic BASE TABLE
host BASE TABLE
proc BASE TABLE
tables_priv BASE TABLE
time_zone BASE TABLE
time_zone_leap_second BASE TABLE
time_zone_name BASE TABLE
time_zone_transition BASE TABLE
time_zone_transition_type BASE TABLE
user BASE TABLE
Tables_in_mysql
columns_priv
db
func
help_category
help_keyword
help_relation
help_topic
host
proc
tables_priv
time_zone
time_zone_leap_second
time_zone_name
time_zone_transition
time_zone_transition_type
user
show tables;
Tables_in_test table_type
Tables_in_test
update mysql.user set password=old_password("gambling2") where user=_binary"test";
flush privileges;
set password="";
......@@ -47,24 +47,24 @@ set password='gambling3';
ERROR HY000: Password hash should be a 41-digit hexadecimal number
set password=old_password('gambling3');
show tables;
Tables_in_mysql table_type
columns_priv BASE TABLE
db BASE TABLE
func BASE TABLE
help_category BASE TABLE
help_keyword BASE TABLE
help_relation BASE TABLE
help_topic BASE TABLE
host BASE TABLE
proc BASE TABLE
tables_priv BASE TABLE
time_zone BASE TABLE
time_zone_leap_second BASE TABLE
time_zone_name BASE TABLE
time_zone_transition BASE TABLE
time_zone_transition_type BASE TABLE
user BASE TABLE
Tables_in_mysql
columns_priv
db
func
help_category
help_keyword
help_relation
help_topic
host
proc
tables_priv
time_zone
time_zone_leap_second
time_zone_name
time_zone_transition
time_zone_transition_type
user
show tables;
Tables_in_test table_type
Tables_in_test
delete from mysql.user where user=_binary"test";
flush privileges;
......@@ -11,7 +11,7 @@ create table t1 (b char(0) not null);
create table if not exists t1 (b char(0) not null);
insert into t1 values (""),(null);
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;
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;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`a` int(11) NOT NULL,
`b` int(11) default NULL,
PRIMARY KEY (`a`),
KEY `b` (`b`),
......@@ -203,7 +203,7 @@ CREATE TABLE t1 (a int not null);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0'
`a` int(11) NOT NULL
) ENGINE=HEAP DEFAULT CHARSET=latin1
drop table t1;
SET SESSION storage_engine="gemini";
......@@ -215,7 +215,7 @@ CREATE TABLE t1 (a int not null);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0'
`a` int(11) NOT NULL
) ENGINE=HEAP DEFAULT CHARSET=latin1
SET SESSION storage_engine=default;
drop table t1;
......@@ -291,7 +291,7 @@ create table t3 like t1;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`id` int(11) NOT NULL default '0',
`id` int(11) NOT NULL,
`name` char(20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t3;
......@@ -306,7 +306,7 @@ create temporary table t3 like t2;
show create table t3;
Table Create Table
t3 CREATE TEMPORARY TABLE `t3` (
`id` int(11) NOT NULL default '0'
`id` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t3;
id
......@@ -314,7 +314,7 @@ drop table t3;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`id` int(11) NOT NULL default '0',
`id` int(11) NOT NULL,
`name` char(20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t3;
......@@ -326,14 +326,14 @@ create temporary table t3 like mysqltest.t3;
show create table t3;
Table Create Table
t3 CREATE TEMPORARY TABLE `t3` (
`id` int(11) NOT NULL default '0',
`id` int(11) NOT NULL,
`name` char(20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create table t2 like t3;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0',
`id` int(11) NOT NULL,
`name` char(20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t2;
......@@ -360,7 +360,7 @@ CREATE TABLE t1 (a int not null);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0'
`a` int(11) NOT NULL
) ENGINE=HEAP DEFAULT CHARSET=latin1
drop table t1;
SET SESSION storage_engine="gemini";
......@@ -372,7 +372,7 @@ CREATE TABLE t1 (a int not null);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0'
`a` int(11) NOT NULL
) ENGINE=HEAP DEFAULT CHARSET=latin1
SET SESSION storage_engine=default;
drop table t1;
......
......@@ -484,7 +484,7 @@ ERROR HY000: Unknown collation: 'koi8r'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`latin1_f` char(32) NOT NULL default ''
`latin1_f` char(32) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW FIELDS FROM t1;
Field Type Null Key Default Extra
......
......@@ -224,8 +224,8 @@ create table t1 (word varchar(255) not null, word2 varchar(255) not null, index(
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`word` varchar(255) collate latin1_german2_ci NOT NULL default '',
`word2` 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,
KEY `word` (`word`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci
insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae');
......
......@@ -45,36 +45,36 @@ CREATE TABLE `
CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT " "
) COMMENT " ";
SHOW TABLES;
Tables_in_test table_type
BASE TABLE
Tables_in_test
SHOW CREATE TABLE ;
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=' '
SHOW FIELDS FROM ;
Field Type Null Key Default Extra
char(32)
SET CHARACTER SET cp1251;
SHOW TABLES;
Tables_in_test table_type
BASE TABLE
Tables_in_test
SHOW CREATE TABLE ;
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=' '
SHOW FIELDS FROM ;
Field Type Null Key Default Extra
char(32)
SET CHARACTER SET utf8;
SHOW TABLES;
Tables_in_test table_type
таблица BASE TABLE
Tables_in_test
таблица
SHOW CREATE TABLE таблица;
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='комментарий таблицы'
SHOW FIELDS FROM таблица;
Field Type Null Key Default Extra
......@@ -93,14 +93,14 @@ SET CHARACTER SET koi8r;
CREATE DATABASE ;
USE ;
SHOW TABLES;
Tables_in_ table_type
Tables_in_
SHOW TABLES IN ;
Tables_in_ table_type
Tables_in_
SET CHARACTER SET cp1251;
SHOW TABLES;
Tables_in_ table_type
Tables_in_
SHOW TABLES IN ;
Tables_in_ table_type
Tables_in_
SET CHARACTER SET koi8r;
DROP DATABASE ;
SET NAMES koi8r;
......
......@@ -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
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
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;
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
......
......@@ -52,6 +52,6 @@ ERROR HY000: Can't execute the query because you have a conflicting read lock
unlock tables;
create table t1(n int);
show tables;
Tables_in_test table_type
t1 BASE TABLE
Tables_in_test
t1
drop table t1;
......@@ -476,7 +476,7 @@ CHI Los Angeles
explain
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
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;
max(a3)
NULL
......
......@@ -395,9 +395,9 @@ select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd',2);
SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd',2)
abcdabc
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);
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';
_latin1'B' between _latin1'a' and _latin1'c'
1
......@@ -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
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
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, "#");
lpad(12345, 5, "#")
12345
......
......@@ -77,9 +77,9 @@ select * from t1 where 1 xor 1;
a
explain extended select * from t1 where 1 xor 1;
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:
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;
- a
-1
......
......@@ -8,7 +8,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`fid` int(11) NOT NULL auto_increment,
`g` geometry NOT NULL default '',
`g` geometry NOT NULL,
PRIMARY KEY (`fid`),
SPATIAL KEY `g` (`g`(32))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
......@@ -291,7 +291,7 @@ SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`fid` int(11) NOT NULL auto_increment,
`g` geometry NOT NULL default '',
`g` geometry NOT NULL,
PRIMARY KEY (`fid`),
SPATIAL KEY `g` (`g`(32))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
......
......@@ -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);
SHOW FIELDS FROM gis_point;
Field Type Null Key Default Extra
fid int(11) PRI 0
fid int(11) PRI
g point YES NULL
SHOW FIELDS FROM gis_line;
Field Type Null Key Default Extra
fid int(11) PRI 0
fid int(11) PRI
g linestring YES NULL
SHOW FIELDS FROM gis_polygon;
Field Type Null Key Default Extra
fid int(11) PRI 0
fid int(11) PRI
g polygon YES NULL
SHOW FIELDS FROM gis_multi_point;
Field Type Null Key Default Extra
fid int(11) PRI 0
fid int(11) PRI
g multipoint YES NULL
SHOW FIELDS FROM gis_multi_line;
Field Type Null Key Default Extra
fid int(11) PRI 0
fid int(11) PRI
g multilinestring YES NULL
SHOW FIELDS FROM gis_multi_polygon;
Field Type Null Key Default Extra
fid int(11) PRI 0
fid int(11) PRI
g multipolygon YES NULL
SHOW FIELDS FROM gis_geometrycollection;
Field Type Null Key Default Extra
fid int(11) PRI 0
fid int(11) PRI
g geometrycollection YES NULL
SHOW FIELDS FROM gis_geometry;
Field Type Null Key Default Extra
fid int(11) PRI 0
fid int(11) PRI
g geometry YES NULL
INSERT INTO gis_point VALUES
(101, PointFromText('POINT(10 10)')),
......@@ -430,7 +430,7 @@ mln multilinestring YES NULL
mpg multipolygon YES NULL
gc geometrycollection YES NULL
gm geometry YES NULL
fid int(11) 0
fid int(11)
DROP TABLE t1;
SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))
......
......@@ -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_%`.* to mysqltest_3@localhost with grant option;
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;
Grants for 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
1 SIMPLE t0 ALL i1,i2 NULL NULL NULL 1024 Using where
explain select * from t0 where key2 = 45 or key1 is null;
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;
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
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
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
(key3=10) or (key4 <=> null);
id select_type table type possible_keys key key_len ref rows Extra
......@@ -257,8 +257,8 @@ explain
select * from t0,t1 where (t0.key1=t1.key1) and
(t0.key1=3 or t0.key2=4) and t1.key1<200;
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 t1 ref i1 i1 4 test.t0.key1 1 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
explain
select * from t0,t1 where (t0.key1=t1.key1) and
(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
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL default '0',
`id2` int(11) NOT NULL default '0',
`id` int(11) NOT NULL,
`id2` int(11) NOT NULL,
UNIQUE KEY `id` (`id`,`id2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0',
`id` int(11) NOT NULL,
KEY `t1_id_fk` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
......@@ -1475,7 +1475,7 @@ create index id on t2 (id);
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0',
`id` int(11) NOT NULL,
KEY `id` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
......@@ -1483,7 +1483,7 @@ create index id2 on t2 (id);
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0',
`id` int(11) NOT NULL,
KEY `id` (`id`),
KEY `id2` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
......@@ -1494,7 +1494,7 @@ Got one of the listed errors
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0',
`id` int(11) NOT NULL,
KEY `id` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) 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
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0',
`id2` int(11) NOT NULL default '0',
`id` int(11) NOT NULL,
`id2` int(11) NOT NULL,
KEY `t1_id_fk` (`id`,`id2`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
......@@ -1512,8 +1512,8 @@ create unique index id on t2 (id,id2);
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0',
`id2` int(11) NOT NULL default '0',
`id` int(11) NOT NULL,
`id2` int(11) NOT NULL,
UNIQUE KEY `id` (`id`,`id2`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
) 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
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0',
`id2` int(11) NOT NULL default '0',
`id` int(11) NOT NULL,
`id2` int(11) NOT NULL,
UNIQUE KEY `id` (`id`,`id2`),
KEY `t1_id_fk` (`id2`,`id`),
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
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0',
`id2` int(11) NOT NULL default '0',
`id` int(11) NOT NULL,
`id2` int(11) NOT NULL,
UNIQUE KEY `id` (`id`,`id2`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) 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
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0',
`id2` int(11) NOT NULL default '0',
`id` int(11) NOT NULL,
`id2` int(11) NOT NULL,
UNIQUE KEY `id` (`id`,`id2`),
KEY `t1_id_fk` (`id2`,`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
......@@ -1555,7 +1555,7 @@ show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL auto_increment,
`id2` int(11) NOT NULL default '0',
`id2` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `id` (`id`,`id2`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
......@@ -1566,7 +1566,7 @@ show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL auto_increment,
`id2` int(11) NOT NULL default '0',
`id2` int(11) NOT NULL,
KEY `t1_id_fk` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
......@@ -1575,7 +1575,7 @@ show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`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_test2` (`id`,`id2`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
......@@ -1630,3 +1630,37 @@ show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1
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);
ERROR 23000: Column 'id' cannot be null
insert into t1 values (1), (NULL), (2);
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;
id
1
......@@ -157,19 +157,19 @@ f_float_3_1_u 0.0
set @value= "1e+1111111111a";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1265 Data truncated 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_double' 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 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 1265 Data truncated 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_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_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 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
select * from t1 where number =last_insert_id();
number 4
......@@ -185,20 +185,20 @@ f_float_3_1_u 99.9
set @value= "-1e+1111111111a";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1265 Data truncated 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_double' 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 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_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 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 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
select * from t1 where number =last_insert_id();
number 5
......@@ -212,46 +212,9 @@ f_float_u 0
f_double_15_1_u 0.0
f_float_3_1_u 0.0
set @value= 1e+1111111111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
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
ERROR 22007: Illegal double '1e+1111111111' value found during parsing
set @value= -1e+1111111111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
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
ERROR 22007: Illegal double '1e+1111111111' value found during parsing
set @value= 1e+111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
......@@ -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_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 8
number 6
original_value 1e+111
f_double 1e+111
f_float 3.40282e+38
......@@ -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_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 9
number 7
original_value -1e+111
f_double -1e+111
f_float -3.40282e+38
......@@ -296,7 +259,7 @@ f_float_3_1_u 0.0
set @value= 1;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
select * from t1 where number =last_insert_id();
number 10
number 8
original_value 1
f_double 1
f_float 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_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 11
number 9
original_value -1
f_double -1
f_float -1
......
......@@ -622,8 +622,8 @@ NULL 2 100
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;
Warnings:
Warning 1263 Data truncated; 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 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'No' at row 2
select * from t2;
No Field Count
0 1 100
......
......@@ -65,14 +65,14 @@ test.t2 check error Table 't2' was not locked with LOCK TABLES
test.t1 check status OK
show columns from t1;
Field Type Null Key Default Extra
a int(11) PRI 0
b int(11) MUL 0
c int(11) 0
a int(11) PRI
b int(11) MUL
c int(11)
show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment
a int(11) NULL PRI 0 select,insert,update,references
b int(11) NULL MUL 0 select,insert,update,references
c int(11) NULL 0 select,insert,update,references
a int(11) NULL PRI select,insert,update,references
b int(11) NULL MUL select,insert,update,references
c int(11) NULL select,insert,update,references
show index from t1;
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
......
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 (
grp int(11) default NULL,
a bigint(20) unsigned default NULL,
......@@ -745,3 +745,47 @@ player_id match_1_h * match_id home UUX
7 4 * 1 2 2
3 3 * 1 2 1
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,
UNIQUE (c,i));
INSERT INTO t1 (c) VALUES (NULL),(NULL);
Warnings:
Warning 1263 Data truncated; 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 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 2
SELECT * FROM t1;
c i
1
......
......@@ -26,9 +26,9 @@ RENAME TABLE T1 TO T2;
ALTER TABLE T2 ADD new_col int not null;
ALTER TABLE T2 RENAME T3;
show tables like 't_';
Tables_in_test (t_) table_type
t3 BASE TABLE
t4 BASE TABLE
Tables_in_test (t_)
t3
t4
drop table t3,t4;
create table t1 (a int);
select count(*) from T1;
......@@ -79,4 +79,4 @@ select C.a, c.a from t1 c, t2 C;
ERROR 42000: Not unique table/alias: 'C'
drop table t1, t2;
show tables;
Tables_in_test table_type
Tables_in_test
......@@ -7,7 +7,7 @@ create table TaB (Field int);
create view ViE as select * from TAb;
show create table VIe;
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;
use test;
create table t1Aa (col1 int);
......
......@@ -172,7 +172,7 @@ a b
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` int(11) NOT NULL default '0',
`a` int(11) NOT NULL,
`b` char(20) default NULL,
KEY `a` (`a`)
) 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
show create table t5;
Table Create Table
t5 CREATE TABLE `t5` (
`a` int(11) NOT NULL default '0',
`a` int(11) NOT NULL,
`b` char(20) default NULL,
KEY `a` (`a`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`mysqltest`.`t6`)
......@@ -260,16 +260,16 @@ ENGINE=MERGE UNION=(t1,t2);
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`incr` int(11) NOT NULL default '0',
`othr` int(11) NOT NULL default '0',
`incr` int(11) NOT NULL,
`othr` int(11) NOT NULL,
PRIMARY KEY (`incr`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`)
alter table t3 drop primary key;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`incr` int(11) NOT NULL default '0',
`othr` int(11) NOT NULL default '0'
`incr` int(11) NOT NULL,
`othr` int(11) NOT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`)
drop table t3,t2,t1;
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)
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` int(11) NOT NULL default '0',
`b` int(11) NOT NULL default '0',
`a` int(11) NOT NULL,
`b` int(11) NOT NULL,
KEY `a` (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table t4;
Table Create Table
t4 CREATE TABLE `t4` (
`a` int(11) NOT NULL default '0',
`b` int(11) NOT NULL default '0',
`a` int(11) NOT NULL,
`b` int(11) NOT NULL,
KEY `a` (`a`,`b`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`)
show create table t5;
Table Create Table
t5 CREATE TABLE `t5` (
`a` int(11) NOT NULL default '0',
`a` int(11) NOT NULL,
`b` int(11) NOT NULL auto_increment,
PRIMARY KEY (`a`,`b`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`)
show create table t6;
Table Create Table
t6 CREATE TABLE `t6` (
`a` int(11) NOT NULL default '0',
`a` int(11) NOT NULL,
`b` int(11) NOT NULL auto_increment,
PRIMARY KEY (`a`,`b`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
......@@ -382,8 +382,8 @@ alter table t4 UNION=(t1,t2,t3);
show create table t4;
Table Create Table
t4 CREATE TABLE `t4` (
`a` int(11) NOT NULL default '0',
`b` int(11) NOT NULL default '0',
`a` int(11) NOT NULL,
`b` int(11) NOT NULL,
KEY `a` (`a`,`b`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`,`t3`)
select * from t4 order by a,b;
......@@ -408,8 +408,8 @@ alter table t4 INSERT_METHOD=FIRST;
show create table t4;
Table Create Table
t4 CREATE TABLE `t4` (
`a` int(11) NOT NULL default '0',
`b` int(11) NOT NULL default '0',
`a` int(11) NOT NULL,
`b` int(11) NOT NULL,
KEY `a` (`a`,`b`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`,`t3`)
insert into t4 values (4,1),(4,2);
......
......@@ -27,7 +27,9 @@ CREATE TABLE `t1` (
INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('0987654321098765432109876543210987654321.00000000000000000000');
DROP TABLE t1;
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` (
`a` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
......@@ -354,7 +356,7 @@ UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE 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 */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
......
......@@ -97,39 +97,39 @@ Warnings:
Warning 1265 Data truncated for column 'd' at row 1
UPDATE t1 SET d=NULL;
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);
ERROR 23000: Column 'a' cannot be null
INSERT INTO t1 (a) values (1/null);
ERROR 23000: Column 'a' cannot be null
INSERT INTO t1 (a) values (null),(null);
Warnings:
Warning 1263 Data truncated; 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 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 2
INSERT INTO t1 (b) values (null);
ERROR 23000: Column 'b' cannot be null
INSERT INTO t1 (b) values (1/null);
ERROR 23000: Column 'b' cannot be null
INSERT INTO t1 (b) values (null),(null);
Warnings:
Warning 1263 Data truncated; 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 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 2
INSERT INTO t1 (c) values (null);
ERROR 23000: Column 'c' cannot be null
INSERT INTO t1 (c) values (1/null);
ERROR 23000: Column 'c' cannot be null
INSERT INTO t1 (c) values (null),(null);
Warnings:
Warning 1263 Data truncated; 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 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 2
INSERT INTO t1 (d) values (null);
ERROR 23000: Column 'd' cannot be null
INSERT INTO t1 (d) values (1/null);
ERROR 23000: Column 'd' cannot be null
INSERT INTO t1 (d) values (null),(null);
Warnings:
Warning 1263 Data truncated; 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 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'd' at row 2
select * from t1;
a b c d
0 0000-00-00 00:00:00 0
......
......@@ -342,7 +342,7 @@ index (id2)
);
insert into t1 values(null,null),(1,1);
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;
id id2
NULL 0
......
......@@ -12,5 +12,5 @@ select * from t1 where a is null;
a b
explain select * from t1 where b is null;
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;
......@@ -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
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
3 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
2 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 NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
execute stmt1 ;
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
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
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
2 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 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;
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
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
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
2 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 NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
deallocate prepare stmt1;
drop tables t1,t2;
set @arg00=1;
......
......@@ -252,12 +252,12 @@ mysql
test
prepare stmt4 from ' show tables from test like ''t2%'' ';
execute stmt4;
Tables_in_test (t2%) table_type
t2 BASE TABLE
Tables_in_test (t2%)
t2
prepare stmt4 from ' show columns from t2 from test like ''a%'' ';
execute stmt4;
Field Type Null Key Default Extra
a int(11) PRI 0
a int(11) PRI
create index t2_idx on t2(b);
prepare stmt4 from ' show index from t2 from test ';
execute stmt4;
......@@ -355,7 +355,7 @@ drop user drop_user@localhost;
prepare stmt3 from ' describe t2 ';
execute stmt3;
Field Type Null Key Default Extra
a int(11) PRI 0
a int(11) PRI
b char(10) YES MUL NULL
drop table t2 ;
execute stmt3;
......
......@@ -220,24 +220,22 @@ insert into t1 (x) values (1),(2),(3),(4),(5),(6),(7),(8),(9);
update t1 set y=x;
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
1 SIMPLE t1 ref y y 5 const 1 Using where
1 SIMPLE t2 range x x 5 NULL 4 Using where
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
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
1 SIMPLE t1 ref y y 5 const 1 Using where
1 SIMPLE t2 range x x 5 NULL 4 Using where
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
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
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;
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 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;
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 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;
id select_type table type possible_keys key key_len ref rows Extra
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);
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
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
(t1.key1 <t2.keya + 1) and t2.keya=3;
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 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;
CREATE TABLE t1 (
a int(11) default NULL,
......@@ -415,14 +413,26 @@ count(*)
select count(*) from t2;
count(*)
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;
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 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;
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
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;
id name uid id name uid
1001 A 1 1001 A 1
......@@ -537,34 +547,3 @@ select count(*) from t2 where x = 18446744073709551601;
count(*)
0
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
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t2;
Got one of the listed errors
show tables like "t_";
Tables_in_test (t_) table_type
t1 BASE TABLE
t2 BASE TABLE
t3 BASE TABLE
Tables_in_test (t_)
t1
t2
t3
rename table t3 to t1, t2 to t3, t1 to t2, t4 to t1;
Got one of the listed errors
rename table t3 to t4, t5 to t3, t1 to t2, t4 to t1;
......@@ -45,12 +45,12 @@ CREATE TABLE t3 (a int);
FLUSH TABLES WITH READ LOCK;
RENAME TABLE t1 TO t2, t3 to t4;
show tables;
Tables_in_test table_type
t1 BASE TABLE
t3 BASE TABLE
Tables_in_test
t1
t3
UNLOCK TABLES;
show tables;
Tables_in_test table_type
t2 BASE TABLE
t4 BASE TABLE
Tables_in_test
t2
t4
drop table t2, t4;
......@@ -73,25 +73,25 @@ mysqltest3
test
use mysqltest2;
show tables;
Tables_in_mysqltest2 table_type
t1 BASE TABLE
t3 BASE TABLE
Tables_in_mysqltest2
t1
t3
select * from t1;
n s
1 original foo.t1
use mysqltest3;
show tables;
Tables_in_mysqltest3 table_type
t1 BASE TABLE
Tables_in_mysqltest3
t1
select * from t1;
n s
1 original foo2.t1
use mysqltest;
show tables;
Tables_in_mysqltest table_type
t1 BASE TABLE
t2 BASE TABLE
t3 BASE TABLE
Tables_in_mysqltest
t1
t2
t3
select * from mysqltest.t1;
n s
1 one test
......
......@@ -39,7 +39,7 @@ drop table t1;
set @@session.auto_increment_increment=100, @@session.auto_increment_offset=10;
show variables like "%auto%";
Variable_name Value
auto_incrememt_increment 100
auto_increment_increment 100
auto_increment_offset 10
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
insert into t1 values (NULL),(5),(NULL);
......
......@@ -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
# 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';
Tables_in_test (t1) table_type
Tables_in_test (t1)
drop table t1;
select 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 view if exists v1;
CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' 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
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
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;
id select_type table type possible_keys key key_len ref rows Extra
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;
Nuvarande period
9410
show tables;
Tables_in_test table_type
t1 BASE TABLE
t2 BASE TABLE
t3 BASE TABLE
t4 BASE TABLE
Tables_in_test
t1
t2
t3
t4
show tables from test like "s%";
Tables_in_test (s%) table_type
Tables_in_test (s%)
show tables from test like "t?";
Tables_in_test (t?) table_type
Tables_in_test (t?)
show full columns from t2;
Field Type Collation Null Key Default Extra Privileges Comment
auto int(11) NULL PRI NULL auto_increment select,insert,update,references
......
......@@ -77,13 +77,13 @@ create temporary table t1 (a int not null);
show create table t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) NOT NULL default '0'
`a` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 rename t2;
show create table t2;
Table Create Table
t2 CREATE TEMPORARY TABLE `t2` (
`a` int(11) NOT NULL default '0'
`a` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2;
create table t1 (
......@@ -98,7 +98,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`test_set` set('val1','val2','val3') NOT NULL 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',
`space 2` int(11) default NULL COMMENT 'name with a space'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table'
......@@ -108,7 +108,7 @@ Table Create Table
t1 CREATE TABLE t1 (
test_set set('val1','val2','val3') NOT NULL 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',
`space 2` int(11) default NULL COMMENT 'name with a space'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table'
......@@ -117,7 +117,7 @@ show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment
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
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
space 2 int(11) NULL YES NULL select,insert,update,references name with a space
drop table t1;
......@@ -125,7 +125,7 @@ create table t1 (a int not null, unique aa (a));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`a` int(11) NOT NULL,
UNIQUE KEY `aa` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
......@@ -133,7 +133,7 @@ create table t1 (a int not null, primary key (a));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`a` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
......@@ -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;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`a` int(11) NOT NULL,
`b` char(10) default NULL,
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'
......@@ -158,7 +158,7 @@ alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`a` int(11) NOT NULL,
`b` varchar(10) default NULL,
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'
......@@ -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;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`a` int(11) NOT NULL,
`b` varchar(10) default NULL,
KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
......@@ -216,7 +216,7 @@ index(type_short)
show create table t1;
Table Create Table
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_short` smallint(3) default NULL,
`type_mediumint` mediumint(9) default NULL,
......@@ -227,9 +227,9 @@ t1 CREATE TABLE `t1` (
`type_char` char(2) default NULL,
`type_varchar` varchar(10) default NULL,
`type_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`type_date` date NOT NULL default '0000-00-00',
`type_time` time NOT NULL default '00:00:00',
`type_datetime` datetime NOT NULL default '0000-00-00 00:00:00',
`type_date` date NOT NULL,
`type_time` time NOT NULL,
`type_datetime` datetime NOT NULL,
`type_year` year(4) default NULL,
`type_enum` enum('red','green','blue') default NULL,
`type_set` enum('red','green','blue') default NULL,
......
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)|
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)|
......@@ -138,14 +115,6 @@ foo: loop
set @x=2;
end loop bar|
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()
return 42|
ERROR 42000: RETURN is only allowed in a FUNCTION
......@@ -258,9 +227,6 @@ ERROR 24000: Cursor is not open
drop procedure p|
alter procedure bar3 sql security invoker|
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 if exists t1|
create table t1 (val int, x float)|
......
......@@ -107,13 +107,20 @@ s1
0
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;
select type,db,name from mysql.proc;
type db name
FUNCTION db1_secret db
PROCEDURE db1_secret stamp
PROCEDURE db2 p
PROCEDURE db2 q
drop database db1_secret;
drop database db2;
select type,db,name from mysql.proc;
......
......@@ -877,41 +877,59 @@ drop table t3|
drop procedure cur2|
create procedure chistics()
language sql
modifies sql data
not deterministic
sql security definer
comment 'Characteristics procedure test'
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()|
select * from t1|
id data
chistics 1
delete from t1|
alter procedure chistics sql security invoker name chistics2|
show create procedure chistics2|
alter procedure chistics sql security invoker|
show create procedure chistics|
Procedure sql_mode Create Procedure
chistics2 CREATE PROCEDURE `test`.`chistics2`()
chistics CREATE PROCEDURE `test`.`chistics`()
MODIFIES SQL DATA
SQL SECURITY INVOKER
COMMENT 'Characteristics procedure test'
insert into t1 values ("chistics", 1)
drop procedure chistics2|
drop procedure chistics|
create function chistics() returns int
language sql
deterministic
sql security invoker
comment 'Characteristics procedure test'
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()|
chistics()
42
alter function chistics name chistics2 comment 'Characteristics function test'|
show create function chistics2|
alter function chistics
no sql
comment 'Characteristics function test'|
show create function chistics|
Function sql_mode Create Function
chistics2 CREATE FUNCTION `test`.`chistics2`() RETURNS int
chistics CREATE FUNCTION `test`.`chistics`() RETURNS int
NO SQL
DETERMINISTIC
SQL SECURITY INVOKER
COMMENT 'Characteristics function test'
return 42
drop function chistics2|
drop function chistics|
insert into t1 values ("foo", 1), ("bar", 2), ("zip", 3)|
set @@sql_mode = 'ANSI'|
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
tinyint unsigned 1 0 255 0 0 YES YES YES YES YES NO NULL,0 A very small integer
Table Create Table
t1 CREATE TABLE `t1` (
`id` char(16) NOT NULL default '',
`data` int(11) NOT NULL default '0'
`id` char(16) NOT NULL,
`data` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
Database Create Database
test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */
......@@ -1629,7 +1647,7 @@ Database (foo)
Level Code Message
Field Type Null Key Default Extra
id char(16)
data int(11) 0
data int(11)
Grants for root@localhost
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
......@@ -1659,7 +1677,7 @@ Super Server Admin To use KILL thread, SET GLOBAL, CHANGE MASTER, etc.
Update Tables To update existing rows
Usage Server Admin No privileges - allow connect only
Variable_name Value
Tables_in_test (foo) table_type
Tables_in_test (foo)
Variable_name Value
Level Code Message
call bug4902()|
......@@ -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
Table Create Table
t1 CREATE TABLE `t1` (
`id` char(16) NOT NULL default '',
`data` int(11) NOT NULL default '0'
`id` char(16) NOT NULL,
`data` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
Database Create Database
test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */
......@@ -1679,7 +1697,7 @@ Database (foo)
Level Code Message
Field Type Null Key Default Extra
id char(16)
data int(11) 0
data int(11)
Grants for root@localhost
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
......@@ -1709,7 +1727,7 @@ Super Server Admin To use KILL thread, SET GLOBAL, CHANGE MASTER, etc.
Update Tables To update existing rows
Usage Server Admin No privileges - allow connect only
Variable_name Value
Tables_in_test (foo) table_type
Tables_in_test (foo)
Variable_name Value
Level Code Message
drop procedure bug4902|
......@@ -1825,13 +1843,9 @@ begin
declare v char;
return v;
end|
Warnings:
Warning 1311 Referring to uninitialized variable v
select bug4487()|
bug4487()
NULL
Warnings:
Warning 1311 Referring to uninitialized variable v
drop function bug4487|
drop procedure if exists bug4941|
create procedure bug4941(out x int)
......@@ -1920,6 +1934,39 @@ s1
1
drop procedure bug4905|
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|
create table fac (n int unsigned not null primary key, f bigint unsigned)|
create procedure ifac(n int unsigned)
......@@ -2118,8 +2165,8 @@ insert into test.t1 values (x, y)|
show procedure status like 'bar'|
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
alter procedure bar name bar2 comment "2222222222" sql security definer|
alter procedure bar2 name bar comment "3333333333"|
alter procedure bar comment "2222222222" sql security definer|
alter procedure bar comment "3333333333"|
alter procedure bar|
show create procedure bar|
Procedure sql_mode Create Procedure
......
......@@ -74,7 +74,7 @@ t1 CREATE TABLE `t1` (
set sql_mode="postgresql,oracle,mssql,db2,maxdb";
select @@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;
Table Create Table
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
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 Using index
Warnings:
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);
ERROR 23000: Column 'a' in field list is ambiguous
drop table t1,t2,t3;
......@@ -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
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
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;
CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1);
......@@ -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 t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using where; Using index
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;
create table t1 (a int, b int, index a (a,b));
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
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
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:
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');
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');
......@@ -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 c eq_ref PRIMARY PRIMARY 4 func 1 Using where
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;
create table t1 (a int);
insert into t1 values (1);
......@@ -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
Warnings:
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;
CREATE TABLE t1 (t1_a int);
INSERT INTO t1 VALUES (1);
......
......@@ -37,8 +37,8 @@ show create table t9;
Table Create Table
t9 CREATE TABLE `t9` (
`a` int(11) NOT NULL auto_increment,
`b` char(16) NOT NULL default '',
`c` int(11) NOT NULL default '0',
`b` char(16) NOT NULL,
`c` int(11) NOT NULL,
PRIMARY KEY (`a`)
) 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;
......@@ -58,9 +58,9 @@ show create table mysqltest.t9;
Table Create Table
t9 CREATE TABLE `t9` (
`a` int(11) NOT NULL auto_increment,
`b` char(16) NOT NULL default '',
`c` int(11) NOT NULL default '0',
`d` int(11) NOT NULL default '0',
`b` char(16) NOT NULL,
`c` int(11) NOT NULL,
`d` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='TEST_DIR/var/tmp/' INDEX DIRECTORY='TEST_DIR/var/run/'
drop database mysqltest;
......@@ -68,19 +68,19 @@ create table t1 (a int not null) engine=myisam;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0'
`a` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 add b int;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`a` int(11) NOT NULL,
`b` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`a` int(11) NOT NULL,
`b` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
show tables;
Tables_in_db table_type
columns_priv BASE TABLE
db BASE TABLE
func BASE TABLE
help_category BASE TABLE
help_keyword BASE TABLE
help_relation BASE TABLE
help_topic BASE TABLE
host BASE TABLE
proc BASE TABLE
tables_priv BASE TABLE
time_zone BASE TABLE
time_zone_leap_second BASE TABLE
time_zone_name BASE TABLE
time_zone_transition BASE TABLE
time_zone_transition_type BASE TABLE
user BASE TABLE
Tables_in_db
columns_priv
db
func
help_category
help_keyword
help_relation
help_topic
host
proc
tables_priv
time_zone
time_zone_leap_second
time_zone_name
time_zone_transition
time_zone_transition_type
user
show create table db;
Table Create Table
db CREATE TABLE `db` (
......@@ -134,4 +134,4 @@ columns_priv CREATE TABLE `columns_priv` (
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges'
show tables;
Tables_in_test table_type
Tables_in_test
......@@ -169,3 +169,8 @@ create temporary table t1 (i int);
create trigger trg before insert on t1 for each row set @a:=1;
ERROR HY000: Trigger's 't1' is view or temporary table
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);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` set('','a','b') NOT NULL default ''
`a` set('','a','b') NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a set (' ','a','b ') not null default 'b ');
......
This diff is collapsed.
......@@ -43,7 +43,7 @@ drop table t1;
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 ',';
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 'c' at row 4
Warning 1261 Row 5 doesn't contain data for all columns
......@@ -57,7 +57,7 @@ drop table t1;
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');
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 1265 Data truncated for column 'c' at row 2
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
alter table t1 add d char(2);
update t1 set a=NULL where a=10;
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';
Warnings:
Warning 1265 Data truncated for column 'c' at row 4
......@@ -86,7 +86,7 @@ Warnings:
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 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
insert into t2(b) values('mysqlab');
Warnings:
......
......@@ -21,6 +21,15 @@ select current_user;
grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option;
--error 1044
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;
connection default;
show grants for mysqltest_1@localhost;
......
This diff is collapsed.
......@@ -1155,5 +1155,27 @@ delete from t1;
commit;
show status like "binlog_cache_use";
show status like "binlog_cache_disk_use";
drop table t1;
#
# range optimizer problem
#
create table t1 (x bigint unsigned not null primary key) engine=innodb;
insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
select * from t1;
select count(*) from t1 where x>0;
select count(*) from t1 where x=0;
select count(*) from t1 where x<0;
select count(*) from t1 where x < -16;
select count(*) from t1 where x = -16;
explain select count(*) from t1 where x > -16;
# The following result should be (2). To be fixed when we add 'unsigned flag' to
# Field::store(longlong)
select count(*) from t1 where x > -16;
select * from t1 where x > -16;
select count(*) from t1 where x = 18446744073709551601;
drop table t1;
......@@ -115,13 +115,10 @@ set @value= "-1e+1111111111a";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
--query_vertical select * from t1 where number =last_insert_id()
--error 1367
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()
--error 1367
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;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
......
This diff is collapsed.
......@@ -24,7 +24,7 @@ DROP TABLE t1;
#
CREATE TABLE t1 (a double);
INSERT INTO t1 VALUES (-9e999999);
INSERT INTO t1 VALUES ('-9e999999');
# The following replaces is here because some systems replaces the above
# double with '-inf' and others with MAX_DOUBLE
--replace_result (-1.79769313486232e+308) (RES) (NULL) (RES)
......
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