Commit ac11cba7 authored by matthias@three.local.lan's avatar matthias@three.local.lan

Merge mleich@bk-internal.mysql.com:/home/bk/mysql-4.1

into three.local.lan:/home/matthias/Arbeit/mysql-4.1/src
parents 2d90fe51 5b0e3b13
...@@ -10,7 +10,7 @@ use Sys::Hostname; ...@@ -10,7 +10,7 @@ use Sys::Hostname;
$opt_distribution=$opt_user=$opt_config_env=$opt_config_extra_env=""; $opt_distribution=$opt_user=$opt_config_env=$opt_config_extra_env="";
$opt_dbd_options=$opt_perl_options=$opt_config_options=$opt_make_options=$opt_suffix=""; $opt_dbd_options=$opt_perl_options=$opt_config_options=$opt_make_options=$opt_suffix="";
$opt_tmp=$opt_version_suffix=""; $opt_tmp=$opt_version_suffix="";
$opt_bundled_zlib=$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_one_error=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_archive=$opt_with_cluster=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=$opt_without_embedded=$opt_readline=0; $opt_bundled_zlib=$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_one_error=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_archive=$opt_with_cluster=$opt_with_csv=$opt_with_example=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=$opt_without_embedded=$opt_readline=0;
$opt_embedded_test=$opt_ps_test=$opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=$opt_clearlogs=0; $opt_embedded_test=$opt_ps_test=$opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=$opt_clearlogs=0;
GetOptions( GetOptions(
...@@ -57,6 +57,8 @@ GetOptions( ...@@ -57,6 +57,8 @@ GetOptions(
"version-suffix=s", "version-suffix=s",
"with-archive", "with-archive",
"with-cluster", "with-cluster",
"with-csv",
"with-example",
"with-debug", "with-debug",
"with-low-memory", "with-low-memory",
"with-other-libc=s", "with-other-libc=s",
...@@ -279,6 +281,8 @@ if ($opt_stage <= 1) ...@@ -279,6 +281,8 @@ if ($opt_stage <= 1)
$opt_embedded_test= 0 if ($opt_without_embedded); $opt_embedded_test= 0 if ($opt_without_embedded);
$opt_config_options.= " --with-archive-storage-engine" if ($opt_with_archive); $opt_config_options.= " --with-archive-storage-engine" if ($opt_with_archive);
$opt_config_options.= " --with-ndbcluster" if ($opt_with_cluster); $opt_config_options.= " --with-ndbcluster" if ($opt_with_cluster);
$opt_config_options.= " --with-csv-storage-engine" if ($opt_with_csv);
$opt_config_options.= " --with-example-storage-engine" if ($opt_with_example);
# Only enable InnoDB when requested (required to be able to # Only enable InnoDB when requested (required to be able to
# build the "Classic" packages that do not include InnoDB) # build the "Classic" packages that do not include InnoDB)
...@@ -637,11 +641,17 @@ If user is empty then no mail is sent. ...@@ -637,11 +641,17 @@ If user is empty then no mail is sent.
Set name suffix (e.g. 'com' or '-max') for a distribution Set name suffix (e.g. 'com' or '-max') for a distribution
--with archive --with archive
Enable the Archive storage Engine Enable the Archive storage engine
--with cluster --with cluster
Compile and test with NDB Cluster enabled Compile and test with NDB Cluster enabled
--with-csv
Enable the CSV storage engine
--with-example
Enable the Example storage engine
--with-debug --with-debug
Build binaries with debug information (implies "--no-strip") Build binaries with debug information (implies "--no-strip")
......
...@@ -21,6 +21,7 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/regex \ ...@@ -21,6 +21,7 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/regex \
$(openssl_includes) $(openssl_includes)
LIBS = @CLIENT_LIBS@ LIBS = @CLIENT_LIBS@
DEPLIB= ../libmysql/libmysqlclient.la DEPLIB= ../libmysql/libmysqlclient.la
REGEXLIB= ../regex/libregex.a
LDADD = @CLIENT_EXTRA_LDFLAGS@ $(DEPLIB) LDADD = @CLIENT_EXTRA_LDFLAGS@ $(DEPLIB)
bin_PROGRAMS = mysql mysqladmin mysqlcheck mysqlshow \ bin_PROGRAMS = mysql mysqladmin mysqlcheck mysqlshow \
mysqldump mysqlimport mysqltest mysqlbinlog mysqlmanagerc mysqlmanager-pwgen mysqldump mysqlimport mysqltest mysqlbinlog mysqlmanagerc mysqlmanager-pwgen
...@@ -37,8 +38,8 @@ mysqlshow_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB) ...@@ -37,8 +38,8 @@ mysqlshow_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
mysqldump_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB) mysqldump_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
mysqlimport_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB) mysqlimport_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
mysqltest_SOURCES= mysqltest.c ../mysys/my_getsystime.c mysqltest_SOURCES= mysqltest.c ../mysys/my_getsystime.c
mysqltest_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB) mysqltest_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(REGEXLIB) $(DEPLIB)
mysqltest_LDADD = $(LDADD) $(top_builddir)/regex/libregex.a mysqltest_LDADD = $(REGEXLIB) $(LDADD)
mysqlbinlog_SOURCES = mysqlbinlog.cc ../mysys/mf_tempdir.c mysqlbinlog_SOURCES = mysqlbinlog.cc ../mysys/mf_tempdir.c
mysqlbinlog_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB) mysqlbinlog_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
mysqlmanagerc_SOURCES = mysqlmanagerc.c mysqlmanagerc_SOURCES = mysqlmanagerc.c
......
...@@ -1825,8 +1825,6 @@ static void dumpTable(uint numFields, char *table) ...@@ -1825,8 +1825,6 @@ static void dumpTable(uint numFields, char *table)
err: err:
if (query != query_buf) if (query != query_buf)
my_free(query, MYF(MY_ALLOW_ZERO_PTR)); my_free(query, MYF(MY_ALLOW_ZERO_PTR));
if (order_by)
my_free(order_by, MYF(0));
safe_exit(error); safe_exit(error);
return; return;
} /* dumpTable */ } /* dumpTable */
...@@ -1978,6 +1976,8 @@ static int dump_all_tables_in_db(char *database) ...@@ -1978,6 +1976,8 @@ static int dump_all_tables_in_db(char *database)
numrows = getTableStructure(table, database); numrows = getTableStructure(table, database);
if (!dFlag && numrows > 0) if (!dFlag && numrows > 0)
dumpTable(numrows,table); dumpTable(numrows,table);
my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
order_by= 0;
} }
if (opt_xml) if (opt_xml)
{ {
...@@ -2027,6 +2027,8 @@ static int dump_selected_tables(char *db, char **table_names, int tables) ...@@ -2027,6 +2027,8 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
numrows = getTableStructure(*table_names, db); numrows = getTableStructure(*table_names, db);
if (!dFlag && numrows > 0) if (!dFlag && numrows > 0)
dumpTable(numrows, *table_names); dumpTable(numrows, *table_names);
my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
order_by= 0;
} }
if (opt_xml) if (opt_xml)
{ {
......
...@@ -291,6 +291,7 @@ enum ha_base_keytype { ...@@ -291,6 +291,7 @@ enum ha_base_keytype {
#define HA_ERR_NO_SUCH_TABLE 155 /* The table does not exist in engine */ #define HA_ERR_NO_SUCH_TABLE 155 /* The table does not exist in engine */
#define HA_ERR_TABLE_EXIST 156 /* The table existed in storage engine */ #define HA_ERR_TABLE_EXIST 156 /* The table existed in storage engine */
#define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */ #define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */
#define HA_ERR_NULL_IN_SPATIAL 158 /* NULLs are not supported in spatial index */
/* Other constants */ /* Other constants */
......
...@@ -2364,6 +2364,8 @@ dict_scan_id( ...@@ -2364,6 +2364,8 @@ dict_scan_id(
ulint len = 0; ulint len = 0;
const char* s; const char* s;
char* d; char* d;
ulint id_len;
byte* b;
*id = NULL; *id = NULL;
...@@ -2425,6 +2427,28 @@ dict_scan_id( ...@@ -2425,6 +2427,28 @@ dict_scan_id(
*id = s; *id = s;
} }
if (heap && !quote) {
/* EMS MySQL Manager sometimes adds characters 0xA0 (in
latin1, a 'non-breakable space') to the end of a table name.
But isspace(0xA0) is not true, which confuses our foreign key
parser. After the UTF-8 conversion in ha_innodb.cc, bytes 0xC2
and 0xA0 are at the end of the string.
TODO: we should lex the string using thd->charset_info, and
my_isspace(). Only after that, convert id names to UTF-8. */
b = (byte*)(*id);
id_len = strlen(b);
if (id_len >= 3 && b[id_len - 1] == 0xA0
&& b[id_len - 2] == 0xC2) {
/* Strip the 2 last bytes */
b[id_len - 2] = '\0';
}
}
return(ptr); return(ptr);
} }
...@@ -2479,7 +2503,7 @@ dict_scan_col( ...@@ -2479,7 +2503,7 @@ dict_scan_col(
} }
/************************************************************************* /*************************************************************************
Scans the referenced table name from an SQL string. */ Scans a table name from an SQL string. */
static static
const char* const char*
dict_scan_table_name( dict_scan_table_name(
...@@ -2490,7 +2514,7 @@ dict_scan_table_name( ...@@ -2490,7 +2514,7 @@ dict_scan_table_name(
const char* name, /* in: foreign key table name */ const char* name, /* in: foreign key table name */
ibool* success,/* out: TRUE if ok name found */ ibool* success,/* out: TRUE if ok name found */
mem_heap_t* heap, /* in: heap where to allocate the id */ mem_heap_t* heap, /* in: heap where to allocate the id */
const char** ref_name)/* out,own: the referenced table name; const char** ref_name)/* out,own: the table name;
NULL if no name was scannable */ NULL if no name was scannable */
{ {
const char* database_name = NULL; const char* database_name = NULL;
......
...@@ -1490,7 +1490,6 @@ srv_printf_innodb_monitor( ...@@ -1490,7 +1490,6 @@ srv_printf_innodb_monitor(
srv_last_monitor_time = time(NULL); srv_last_monitor_time = time(NULL);
rewind(file);
fputs("\n=====================================\n", file); fputs("\n=====================================\n", file);
ut_print_timestamp(file); ut_print_timestamp(file);
......
...@@ -3663,8 +3663,8 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, ...@@ -3663,8 +3663,8 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
case MYSQL_TYPE_INT24: /* mediumint is sent as 4 bytes int */ case MYSQL_TYPE_INT24: /* mediumint is sent as 4 bytes int */
case MYSQL_TYPE_LONG: case MYSQL_TYPE_LONG:
{ {
long value= sint4korr(*row); int32 value= sint4korr(*row);
longlong data= field_is_unsigned ? (longlong) (unsigned long) value : longlong data= field_is_unsigned ? (longlong) (uint32) value :
(longlong) value; (longlong) value;
fetch_long_with_conversion(param, field, data); fetch_long_with_conversion(param, field, data);
*row+= 4; *row+= 4;
......
...@@ -159,7 +159,8 @@ int mi_write(MI_INFO *info, byte *record) ...@@ -159,7 +159,8 @@ int mi_write(MI_INFO *info, byte *record)
err: err:
save_errno=my_errno; save_errno=my_errno;
if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_RECORD_FILE_FULL) if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_RECORD_FILE_FULL ||
my_errno == HA_ERR_NULL_IN_SPATIAL)
{ {
if (info->bulk_insert) if (info->bulk_insert)
{ {
......
...@@ -710,7 +710,8 @@ err1: ...@@ -710,7 +710,8 @@ err1:
int rtree_insert(MI_INFO *info, uint keynr, uchar *key, uint key_length) int rtree_insert(MI_INFO *info, uint keynr, uchar *key, uint key_length)
{ {
return (rtree_insert_level(info, keynr, key, key_length, -1) == -1) ? -1 : 0; return (!key_length ||
(rtree_insert_level(info, keynr, key, key_length, -1) == -1)) ? -1 : 0;
} }
......
...@@ -50,6 +50,11 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key, ...@@ -50,6 +50,11 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
dlen = _mi_calc_blob_length(keyseg->bit_start, pos); dlen = _mi_calc_blob_length(keyseg->bit_start, pos);
memcpy_fixed(&dptr, pos + keyseg->bit_start, sizeof(char*)); memcpy_fixed(&dptr, pos + keyseg->bit_start, sizeof(char*));
if (!dptr)
{
my_errno= HA_ERR_NULL_IN_SPATIAL;
return 0;
}
sp_mbr_from_wkb(dptr + 4, dlen - 4, SPDIMS, mbr); /* SRID */ sp_mbr_from_wkb(dptr + 4, dlen - 4, SPDIMS, mbr); /* SRID */
for (i = 0, keyseg = keyinfo->seg; keyseg->type; keyseg++, i++) for (i = 0, keyseg = keyinfo->seg; keyseg->type; keyseg++, i++)
......
...@@ -25,6 +25,7 @@ USE d1; ...@@ -25,6 +25,7 @@ USE d1;
CREATE TABLE t1 (c CHAR(10), KEY(c)); CREATE TABLE t1 (c CHAR(10), KEY(c));
--enable_warnings --enable_warnings
# check the column was created with the expected charset/collation # check the column was created with the expected charset/collation
--replace_result select,insert,update,references ""
SHOW FULL COLUMNS FROM t1; SHOW FULL COLUMNS FROM t1;
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa'); INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%'; SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
...@@ -37,6 +38,7 @@ DROP TABLE t1; ...@@ -37,6 +38,7 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2))); CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
--enable_warnings --enable_warnings
# check the column was created with the expected charset/collation # check the column was created with the expected charset/collation
--replace_result select,insert,update,references ""
SHOW FULL COLUMNS FROM t1; SHOW FULL COLUMNS FROM t1;
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab'); INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
SELECT c1 as want3results from t1 where c1 like 'l%'; SELECT c1 as want3results from t1 where c1 like 'l%';
......
...@@ -490,6 +490,7 @@ if [ x$SOURCE_DIST = x1 ] ; then ...@@ -490,6 +490,7 @@ if [ x$SOURCE_DIST = x1 ] ; then
echo "Fatal error: Cannot find embedded server 'mysqltest'" 1>&2 echo "Fatal error: Cannot find embedded server 'mysqltest'" 1>&2
exit 1 exit 1
fi fi
TESTS_BINDIR="$BASEDIR/libmysqld/examples"
else else
MYSQLD="$VALGRIND $BASEDIR/sql/mysqld" MYSQLD="$VALGRIND $BASEDIR/sql/mysqld"
if [ -f "$BASEDIR/client/.libs/lt-mysqltest" ] ; then if [ -f "$BASEDIR/client/.libs/lt-mysqltest" ] ; then
...@@ -499,6 +500,7 @@ if [ x$SOURCE_DIST = x1 ] ; then ...@@ -499,6 +500,7 @@ if [ x$SOURCE_DIST = x1 ] ; then
else else
MYSQL_TEST="$BASEDIR/client/mysqltest" MYSQL_TEST="$BASEDIR/client/mysqltest"
fi fi
TESTS_BINDIR="$BASEDIR/tests"
fi fi
if [ -f "$BASEDIR/client/.libs/mysqldump" ] ; then if [ -f "$BASEDIR/client/.libs/mysqldump" ] ; then
MYSQL_DUMP="$BASEDIR/client/.libs/mysqldump" MYSQL_DUMP="$BASEDIR/client/.libs/mysqldump"
...@@ -515,7 +517,6 @@ if [ x$SOURCE_DIST = x1 ] ; then ...@@ -515,7 +517,6 @@ if [ x$SOURCE_DIST = x1 ] ; then
fi fi
CLIENT_BINDIR="$BASEDIR/client" CLIENT_BINDIR="$BASEDIR/client"
TESTS_BINDIR="$BASEDIR/tests"
MYSQLADMIN="$CLIENT_BINDIR/mysqladmin" MYSQLADMIN="$CLIENT_BINDIR/mysqladmin"
WAIT_PID="$BASEDIR/extra/mysql_waitpid" WAIT_PID="$BASEDIR/extra/mysql_waitpid"
MYSQL_MANAGER_CLIENT="$CLIENT_BINDIR/mysqlmanagerc" MYSQL_MANAGER_CLIENT="$CLIENT_BINDIR/mysqlmanagerc"
......
...@@ -10,7 +10,7 @@ USE d1; ...@@ -10,7 +10,7 @@ USE d1;
CREATE TABLE t1 (c CHAR(10), KEY(c)); CREATE TABLE t1 (c CHAR(10), KEY(c));
SHOW FULL COLUMNS FROM t1; SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
c char(10) big5_chinese_ci YES MUL NULL select,insert,update,references c char(10) big5_chinese_ci YES MUL NULL
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa'); INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%'; SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
want3results want3results
...@@ -21,7 +21,7 @@ DROP TABLE t1; ...@@ -21,7 +21,7 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2))); CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
SHOW FULL COLUMNS FROM t1; SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
c1 varchar(15) big5_chinese_ci YES MUL NULL select,insert,update,references c1 varchar(15) big5_chinese_ci YES MUL NULL
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab'); INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
SELECT c1 as want3results from t1 where c1 like 'l%'; SELECT c1 as want3results from t1 where c1 like 'l%';
want3results want3results
......
drop table if exists t1;
SET @test_character_set= 'big5';
SET @test_collation= 'big5_chinese_ci';
SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server;
SET character_set_server= @test_character_set;
SET collation_server= @test_collation;
CREATE DATABASE d1;
USE d1;
CREATE TABLE t1 (c CHAR(10), KEY(c));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c char(10) big5_chinese_ci YES MUL NULL
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
want3results
aaa
aaaa
aaaaa
DROP TABLE t1;
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c1 varchar(15) big5_chinese_ci YES MUL NULL
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
SELECT c1 as want3results from t1 where c1 like 'l%';
want3results
location
loberge
lotre
SELECT c1 as want3results from t1 where c1 like 'lo%';
want3results
location
loberge
lotre
SELECT c1 as want1result from t1 where c1 like 'loc%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'loca%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locat%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locati%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locatio%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'location%';
want1result
location
DROP TABLE t1;
DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
...@@ -2329,7 +2329,7 @@ USE d1; ...@@ -2329,7 +2329,7 @@ USE d1;
CREATE TABLE t1 (c CHAR(10), KEY(c)); CREATE TABLE t1 (c CHAR(10), KEY(c));
SHOW FULL COLUMNS FROM t1; SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
c char(10) utf8_swedish_ci YES MUL NULL select,insert,update,references c char(10) utf8_swedish_ci YES MUL NULL
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa'); INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%'; SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
want3results want3results
...@@ -2340,7 +2340,7 @@ DROP TABLE t1; ...@@ -2340,7 +2340,7 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2))); CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
SHOW FULL COLUMNS FROM t1; SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
c1 varchar(15) utf8_swedish_ci YES MUL NULL select,insert,update,references c1 varchar(15) utf8_swedish_ci YES MUL NULL
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab'); INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
SELECT c1 as want3results from t1 where c1 like 'l%'; SELECT c1 as want3results from t1 where c1 like 'l%';
want3results want3results
...@@ -2375,3 +2375,14 @@ DROP DATABASE d1; ...@@ -2375,3 +2375,14 @@ DROP DATABASE d1;
USE test; USE test;
SET character_set_server= @safe_character_set_server; SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server; SET collation_server= @safe_collation_server;
create table t1 (a varchar(1)) character set utf8 collate utf8_estonian_ci;
insert into t1 values ('A'),('B'),('C'),('a'),('b'),('c');
select a, a regexp '[a]' from t1 order by binary a;
a a regexp '[a]'
A 1
B 0
C 0
a 1
b 0
c 0
drop table t1;
This diff is collapsed.
This diff is collapsed.
...@@ -685,3 +685,9 @@ drop table t1; ...@@ -685,3 +685,9 @@ drop table t1;
select left(1234, 3) + 0; select left(1234, 3) + 0;
left(1234, 3) + 0 left(1234, 3) + 0
123 123
create table t1 (a int not null primary key, b varchar(40), c datetime);
insert into t1 (a,b,c) values (1,'Tom','2004-12-10 12:13:14'),(2,'ball games','2004-12-10 12:13:14'), (3,'Basil','2004-12-10 12:13:14'), (4,'Dean','2004-12-10 12:13:14'),(5,'Ellis','2004-12-10 12:13:14'), (6,'Serg','2004-12-10 12:13:14'), (7,'Sergei','2004-12-10 12:13:14'),(8,'Georg','2004-12-10 12:13:14'),(9,'Salle','2004-12-10 12:13:14'),(10,'Sinisa','2004-12-10 12:13:14');
select count(*) as total, left(c,10) as reg from t1 group by reg order by reg desc limit 0,12;
total reg
10 2004-12-10
drop table t1;
...@@ -798,3 +798,9 @@ INSERT INTO t1 (name, kind, line) VALUES ...@@ -798,3 +798,9 @@ INSERT INTO t1 (name, kind, line) VALUES
ALTER TABLE t1 ENABLE KEYS; ALTER TABLE t1 ENABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES ("austria", "pp", GeomFromText('LINESTRING(14.9906 48.9887,14.9946 48.9904,14.9947 48.9916)')); INSERT INTO t1 (name, kind, line) VALUES ("austria", "pp", GeomFromText('LINESTRING(14.9906 48.9887,14.9946 48.9904,14.9947 48.9916)'));
drop table t1; drop table t1;
CREATE TABLE t1 (st varchar(100));
INSERT INTO t1 VALUES ("Fake string");
CREATE TABLE t2 (geom GEOMETRY NOT NULL, SPATIAL KEY gk(geom));
INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
ERROR HY000: Unknown error
drop table t1, t2;
...@@ -464,3 +464,14 @@ ERROR HY000: You can't specify target table 't1' for update in FROM clause ...@@ -464,3 +464,14 @@ ERROR HY000: You can't specify target table 't1' for update in FROM clause
delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1; delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1;
ERROR HY000: You can't specify target table 't1' for update in FROM clause ERROR HY000: You can't specify target table 't1' for update in FROM clause
drop table t1,t2; drop table t1,t2;
create table t1 (
aclid bigint not null primary key,
status tinyint(1) not null
) engine = innodb;
create table t2 (
refid bigint not null primary key,
aclid bigint, index idx_acl(aclid)
) engine = innodb;
insert into t2 values(1,null);
delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1';
drop table t1, t2;
drop table if exists t1; drop table if exists t1, t2;
create table t1 (ts timestamp); create table t1 (ts timestamp);
set time_zone='+00:00'; set time_zone='+00:00';
select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp()); select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp());
...@@ -256,18 +256,50 @@ delete from mysql.db where user like 'mysqltest\_%'; ...@@ -256,18 +256,50 @@ delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%'; delete from mysql.tables_priv where user like 'mysqltest\_%';
delete from mysql.columns_priv where user like 'mysqltest\_%'; delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges; flush privileges;
grant usage on mysqltest.* to mysqltest_1@localhost; create table t1 (a int, b datetime);
create table t2 (c int, d datetime);
grant all privileges on test.* to mysqltest_1@localhost;
show grants for current_user(); show grants for current_user();
Grants for mysqltest_1@localhost Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT ALL PRIVILEGES ON `test`.* TO 'mysqltest_1'@'localhost'
set time_zone= '+00:00'; set time_zone= '+00:00';
set time_zone= 'Europe/Moscow'; set time_zone= 'Europe/Moscow';
select convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC'); select convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC');
convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC') convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
2004-10-21 15:00:00 2004-10-21 15:00:00
select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
convert_tz(b, 'Europe/Moscow', 'UTC')
update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
where t1.a = t2.c and t2.d = (select max(d) from t2);
select * from mysql.time_zone_name; select * from mysql.time_zone_name;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql' ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql'
select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name; select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql' ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql'
delete from mysql.db where user like 'mysqltest\_%';
flush privileges;
grant all privileges on test.t1 to mysqltest_1@localhost;
grant all privileges on test.t2 to mysqltest_1@localhost;
show grants for current_user();
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT ALL PRIVILEGES ON `test`.`t2` TO 'mysqltest_1'@'localhost'
GRANT ALL PRIVILEGES ON `test`.`t1` TO 'mysqltest_1'@'localhost'
set time_zone= '+00:00';
set time_zone= 'Europe/Moscow';
select convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC');
convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC')
2004-12-01 09:00:00
select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
convert_tz(b, 'Europe/Moscow', 'UTC')
update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC')
where t1.a = t2.c and t2.d = (select max(d) from t2);
select * from mysql.time_zone_name;
ERROR 42000: select command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
ERROR 42000: select command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
delete from mysql.user where user like 'mysqltest\_%'; delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
flush privileges; flush privileges;
drop table t1, t2;
...@@ -444,3 +444,11 @@ DROP TABLE t1; ...@@ -444,3 +444,11 @@ DROP TABLE t1;
SET @test_character_set= 'utf8'; SET @test_character_set= 'utf8';
SET @test_collation= 'utf8_swedish_ci'; SET @test_collation= 'utf8_swedish_ci';
-- source include/ctype_common.inc -- source include/ctype_common.inc
#
# Bug 7111 server crashes when regexp is used
#
create table t1 (a varchar(1)) character set utf8 collate utf8_estonian_ci;
insert into t1 values ('A'),('B'),('C'),('a'),('b'),('c');
select a, a regexp '[a]' from t1 order by binary a;
drop table t1;
This diff is collapsed.
...@@ -421,3 +421,11 @@ drop table t1; ...@@ -421,3 +421,11 @@ drop table t1;
# #
select left(1234, 3) + 0; select left(1234, 3) + 0;
#
# Bug #7101: bug with LEFT() when used as a field in GROUP BY aggregation
#
create table t1 (a int not null primary key, b varchar(40), c datetime);
insert into t1 (a,b,c) values (1,'Tom','2004-12-10 12:13:14'),(2,'ball games','2004-12-10 12:13:14'), (3,'Basil','2004-12-10 12:13:14'), (4,'Dean','2004-12-10 12:13:14'),(5,'Ellis','2004-12-10 12:13:14'), (6,'Serg','2004-12-10 12:13:14'), (7,'Sergei','2004-12-10 12:13:14'),(8,'Georg','2004-12-10 12:13:14'),(9,'Salle','2004-12-10 12:13:14'),(10,'Sinisa','2004-12-10 12:13:14');
select count(*) as total, left(c,10) as reg from t1 group by reg order by reg desc limit 0,12;
drop table t1;
...@@ -165,3 +165,10 @@ INSERT INTO t1 (name, kind, line) VALUES ...@@ -165,3 +165,10 @@ INSERT INTO t1 (name, kind, line) VALUES
ALTER TABLE t1 ENABLE KEYS; ALTER TABLE t1 ENABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES ("austria", "pp", GeomFromText('LINESTRING(14.9906 48.9887,14.9946 48.9904,14.9947 48.9916)')); INSERT INTO t1 (name, kind, line) VALUES ("austria", "pp", GeomFromText('LINESTRING(14.9906 48.9887,14.9946 48.9904,14.9947 48.9916)'));
drop table t1; drop table t1;
CREATE TABLE t1 (st varchar(100));
INSERT INTO t1 VALUES ("Fake string");
CREATE TABLE t2 (geom GEOMETRY NOT NULL, SPATIAL KEY gk(geom));
--error 1105
INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
drop table t1, t2;
...@@ -431,3 +431,18 @@ update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1; ...@@ -431,3 +431,18 @@ update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
-- error 1093 -- error 1093
delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1; delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1;
drop table t1,t2; drop table t1,t2;
# Test for BUG#5837 - delete with outer join and const tables
create table t1 (
aclid bigint not null primary key,
status tinyint(1) not null
) engine = innodb;
create table t2 (
refid bigint not null primary key,
aclid bigint, index idx_acl(aclid)
) engine = innodb;
insert into t2 values(1,null);
delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1';
drop table t1, t2;
...@@ -9,6 +9,7 @@ use test; ...@@ -9,6 +9,7 @@ use test;
# create system tables as in mysql-3.20 # create system tables as in mysql-3.20
--disable_warnings
CREATE TABLE db ( CREATE TABLE db (
Host char(60) binary DEFAULT '' NOT NULL, Host char(60) binary DEFAULT '' NOT NULL,
Db char(32) binary DEFAULT '' NOT NULL, Db char(32) binary DEFAULT '' NOT NULL,
...@@ -23,10 +24,12 @@ CREATE TABLE db ( ...@@ -23,10 +24,12 @@ CREATE TABLE db (
KEY User (User) KEY User (User)
) )
type=ISAM; type=ISAM;
--enable-warnings
INSERT INTO db VALUES ('%','test', '','Y','Y','Y','Y','Y','Y'); INSERT INTO db VALUES ('%','test', '','Y','Y','Y','Y','Y','Y');
INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y'); INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y');
--disable_warnings
CREATE TABLE host ( CREATE TABLE host (
Host char(60) binary DEFAULT '' NOT NULL, Host char(60) binary DEFAULT '' NOT NULL,
Db char(32) binary DEFAULT '' NOT NULL, Db char(32) binary DEFAULT '' NOT NULL,
...@@ -39,7 +42,9 @@ CREATE TABLE host ( ...@@ -39,7 +42,9 @@ CREATE TABLE host (
PRIMARY KEY Host (Host,Db) PRIMARY KEY Host (Host,Db)
) )
type=ISAM; type=ISAM;
--enable-warnings
--disable_warnings
CREATE TABLE user ( CREATE TABLE user (
Host char(60) binary DEFAULT '' NOT NULL, Host char(60) binary DEFAULT '' NOT NULL,
User char(16) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL,
...@@ -56,6 +61,7 @@ CREATE TABLE user ( ...@@ -56,6 +61,7 @@ CREATE TABLE user (
PRIMARY KEY Host (Host,User) PRIMARY KEY Host (Host,User)
) )
type=ISAM; type=ISAM;
--enable-warnings
INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y'); INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y');
INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','N'); INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','N');
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Preparing playground # Preparing playground
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1, t2;
--enable_warnings --enable_warnings
...@@ -205,25 +205,64 @@ drop table t1; ...@@ -205,25 +205,64 @@ drop table t1;
# even for unprivileged users. # even for unprivileged users.
# #
# Let us prepare playground
delete from mysql.user where user like 'mysqltest\_%'; delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%'; delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%'; delete from mysql.tables_priv where user like 'mysqltest\_%';
delete from mysql.columns_priv where user like 'mysqltest\_%'; delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges; flush privileges;
create table t1 (a int, b datetime);
create table t2 (c int, d datetime);
grant usage on mysqltest.* to mysqltest_1@localhost; grant all privileges on test.* to mysqltest_1@localhost;
connect (tzuser, localhost, mysqltest_1,,); connect (tzuser, localhost, mysqltest_1,,);
connection tzuser; connection tzuser;
show grants for current_user(); show grants for current_user();
set time_zone= '+00:00'; set time_zone= '+00:00';
set time_zone= 'Europe/Moscow'; set time_zone= 'Europe/Moscow';
select convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC'); select convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC');
select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
# Let us also check whenever multi-update works ok
update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
where t1.a = t2.c and t2.d = (select max(d) from t2);
# But still these two statements should not work: # But still these two statements should not work:
--error 1044 --error 1044
select * from mysql.time_zone_name; select * from mysql.time_zone_name;
--error 1044 --error 1044
select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name; select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
#
# Test for bug #6765 "Implicit access to time zone description tables
# requires privileges for them if some table or column level grants
# present"
#
connection default;
# Let use some table-level grants instead of db-level
# to make life more interesting
delete from mysql.db where user like 'mysqltest\_%';
flush privileges;
grant all privileges on test.t1 to mysqltest_1@localhost;
grant all privileges on test.t2 to mysqltest_1@localhost;
# The test itself is almost the same as previous one
connect (tzuser2, localhost, mysqltest_1,,);
connection tzuser2;
show grants for current_user();
set time_zone= '+00:00';
set time_zone= 'Europe/Moscow';
select convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC');
select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC')
where t1.a = t2.c and t2.d = (select max(d) from t2);
# Again these two statements should not work (but with different errors):
--error 1142
select * from mysql.time_zone_name;
--error 1142
select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
# Clean-up
connection default; connection default;
delete from mysql.user where user like 'mysqltest\_%'; delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
flush privileges; flush privileges;
drop table t1, t2;
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