summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <pem@mysql.com>2006-03-03 12:03:27 +0100
committerunknown <pem@mysql.com>2006-03-03 12:03:27 +0100
commit5a78cd7a7294f7a930389874f64d6c252f485704 (patch)
treee2df16ff96563c43b76904332f584b344892a56f
parent104b9e789a60c8881e6e82cbbf7b8d919ff1bbf1 (diff)
parente2ba74b8252586bd27ace8603aab33c76b2b50cd (diff)
downloadmariadb-git-5a78cd7a7294f7a930389874f64d6c252f485704.tar.gz
Merge mysql.com:/extern/mysql/5.0/bug17476/mysql-5.0
into mysql.com:/extern/mysql/5.1/generic/mysql-5.1-new mysql-test/mysql-test-run.pl: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/grant2.result: Auto merged mysql-test/r/sp.result: Auto merged mysql-test/t/grant2.test: Auto merged mysql-test/t/skip_grants.test: Auto merged mysql-test/t/sp.test: Auto merged scripts/make_binary_distribution.sh: Auto merged sql/field_conv.cc: Auto merged sql/item.h: Auto merged sql/item_timefunc.cc: Auto merged sql/sql_udf.cc: Auto merged VC++Files/mysql.sln: Manual merge (use local). configure.in: Manual merge. sql/table.cc: Manual merge.
-rw-r--r--VC++Files/sql/gen_lex_hash.dsp98
-rw-r--r--VC++Files/sql/gen_lex_hash.vcproj158
-rw-r--r--mysql-test/README60
-rw-r--r--mysql-test/README.gcov16
-rwxr-xr-xmysql-test/mysql-test-run.pl10
-rw-r--r--mysql-test/mysql-test-run.sh9
-rw-r--r--mysql-test/r/binary.result19
-rw-r--r--mysql-test/r/grant2.result2
-rw-r--r--mysql-test/r/join.result5
-rw-r--r--mysql-test/r/skip_grants.result3
-rw-r--r--mysql-test/r/sp.result19
-rw-r--r--mysql-test/t/binary.test12
-rw-r--r--mysql-test/t/grant2.test3
-rw-r--r--mysql-test/t/join.test6
-rw-r--r--mysql-test/t/skip_grants.test3
-rw-r--r--mysql-test/t/sp.test25
-rw-r--r--sql/field_conv.cc18
-rw-r--r--sql/item.h1
-rw-r--r--sql/item_timefunc.cc13
-rw-r--r--sql/net_serv.cc2
-rw-r--r--sql/sql_udf.cc7
-rw-r--r--sql/table.cc19
22 files changed, 463 insertions, 45 deletions
diff --git a/VC++Files/sql/gen_lex_hash.dsp b/VC++Files/sql/gen_lex_hash.dsp
new file mode 100644
index 00000000000..5cc1f70b488
--- /dev/null
+++ b/VC++Files/sql/gen_lex_hash.dsp
@@ -0,0 +1,98 @@
+# Microsoft Developer Studio Project File - Name="gen_lex_hash" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=gen_lex_hash - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "gen_lex_hash.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "gen_lex_hash.mak" CFG="gen_lex_hash - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "gen_lex_hash - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "gen_lex_hash - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "gen_lex_hash - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "gen_lex_hash___Win32_Release"
+# PROP BASE Intermediate_Dir "gen_lex_hash___Win32_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "gen_lex_hash___Win32_Release"
+# PROP Intermediate_Dir "gen_lex_hash___Win32_Release"
+# PROP Target_Dir ""
+MTL=midl.exe
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x419 /d "NDEBUG"
+# ADD RSC /l 0x419 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "gen_lex_hash - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+MTL=midl.exe
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x419 /d "_DEBUG"
+# ADD RSC /l 0x419 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "gen_lex_hash - Win32 Release"
+# Name "gen_lex_hash - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/VC++Files/sql/gen_lex_hash.vcproj b/VC++Files/sql/gen_lex_hash.vcproj
new file mode 100644
index 00000000000..3f600f34cfb
--- /dev/null
+++ b/VC++Files/sql/gen_lex_hash.vcproj
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="gen_lex_hash"
+ ProjectGUID="{D593B5D1-8EFC-44FE-9937-A5AAD1E619A1}"
+ SccProjectName=""
+ SccLocalPath="">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="1"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Debug/gen_lex_hash.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Ws2_32.lib"
+ OutputFile="../sql/gen_lex_hash.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="TRUE"
+ AdditionalLibraryDirectories="../lib_release"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile=".\Debug/gen_lex_hash.pdb"
+ SubSystem="1"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/gen_lex_hash.tlb"
+ HeaderFileName=""/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1049"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\gen_lex_hash___Win32_Release"
+ IntermediateDirectory=".\gen_lex_hash___Win32_Release"
+ ConfigurationType="1"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="../include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\gen_lex_hash___Win32_Release/gen_lex_hash.pch"
+ AssemblerListingLocation=".\gen_lex_hash___Win32_Release/"
+ ObjectFile=".\gen_lex_hash___Win32_Release/"
+ ProgramDataBaseFileName=".\gen_lex_hash___Win32_Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Ws2_32.lib"
+ OutputFile="../sql/gen_lex_hash.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="TRUE"
+ AdditionalLibraryDirectories="../lib_release"
+ ProgramDatabaseFile=".\gen_lex_hash___Win32_Release/gen_lex_hash.pdb"
+ SubSystem="1"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\gen_lex_hash___Win32_Release/gen_lex_hash.tlb"
+ HeaderFileName=""/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1049"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
+ <File
+ RelativePath=".\gen_lex_hash.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl">
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/mysql-test/README b/mysql-test/README
index 0e20ca884a3..77b398ebf39 100644
--- a/mysql-test/README
+++ b/mysql-test/README
@@ -1,45 +1,51 @@
-This directory contains a test suite for mysql daemon. To run
+This directory contains a test suite for the MySQL daemon. To run
the currently existing test cases, simply execute ./mysql-test-run in
this directory. It will fire up the newly built mysqld and test it.
-If you want to run a test with a running MySQL server use the --extern
-option to mysql-test-run. Please note that in this mode the test suite
-expects user to specify test names to run. Otherwise it falls back to the
-normal "non-extern" behaviour. The reason is that some tests
-could not run with external server. Here is the sample command
-to test "alias" and "analyze" tests on external server:
-
-mysql-test-run --extern alias analyze
-
-To match your setup you might also need to provide --socket, --user and
-other relevant options.
-
-Note that you do not have to have to do make install, and you could
-actually have a co-existing MySQL installation - the tests will not
+Note that you do not have to have to do "make install", and you could
+actually have a co-existing MySQL installation. The tests will not
conflict with it.
All tests must pass. If one or more of them fail on your system, please
-read the following manual section of how to report the problem:
+read the following manual section for instructions on how to report the
+problem:
http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html
+If you want to use an already running MySQL server for specific tests,
+use the --extern option to mysql-test-run. Please note that in this mode,
+the test suite expects you to provide the names of the tests to run.
+For example, here is the command to run the "alias" and "analyze" tests
+with an external server:
+
+mysql-test-run --extern alias analyze
+
+To match your setup, you might also need to provide --socket, --user, and
+other relevant options.
+
+With no test cases named on the command line, mysql-test-run falls back
+to the normal "non-extern" behavior. The reason for this is that some
+tests cannot run with an external server.
+
-You can create your own test cases. To create a test case:
+You can create your own test cases. To create a test case, create a new
+file in the t subdirectory using a text editor. The file should have a .test
+extension. For example:
xemacs t/test_case_name.test
- in the file, put a set of SQL commands that will create some tables,
- load test data, run some queries to manipulate it.
+ In the file, put a set of SQL statements that create some tables,
+ load test data, and run some queries to manipulate it.
- We would appreciate if the test tables were called t1, t2, t3 ... (to not
+ We would appreciate it if you name your test tables t1, t2, t3 ... (to not
conflict too much with existing tables).
Your test should begin by dropping the tables you are going to create and
- end by dropping them again. This will ensure that one can run the test
- over and over again.
+ end by dropping them again. This ensures that you can run the test over
+ and over again.
If you are using mysqltest commands (like result file names) in your
- test case you should do create the result file as follows:
+ test case, you should create the result file as follows:
mysql-test-run --record test_case_name
@@ -47,8 +53,8 @@ You can create your own test cases. To create a test case:
mysqltest --record < t/test_case_name.test
- If you only have a simple test cases consistent of SQL commands and comments
- you can create the test case one of the following ways:
+ If you only have a simple test cases consisting of SQL statements and
+ comments, you can create the test case in one of the following ways:
mysql-test-run --record test_case_name
@@ -57,11 +63,11 @@ You can create your own test cases. To create a test case:
mysqltest --record --record-file=r/test_case_name.result < t/test_case_name.test
When this is done, take a look at r/test_case_name.result
- - If the result is wrong, you have found a bug; In this case you should
+ - If the result is incorrect, you have found a bug. In this case, you should
edit the test result to the correct results so that we can verify
that the bug is corrected in future releases.
To submit your test case, put your .test file and .result file(s) into
a tar.gz archive, add a README that explains the problem, ftp the
-archive to ftp://support.mysql.com/pub/mysql/secret/ and send a mail
+archive to ftp://support.mysql.com/pub/mysql/secret/ and send a mail
to bugs@lists.mysql.com
diff --git a/mysql-test/README.gcov b/mysql-test/README.gcov
index 83ddd6df2e1..6d2852e8ca0 100644
--- a/mysql-test/README.gcov
+++ b/mysql-test/README.gcov
@@ -1,11 +1,13 @@
To be able to see the level of coverage with the current test suite,
do the following:
- - make sure gcov is installed
- - compile with BUILD/compile-pentium-gcov ( if your machine is not pentium, hack
-this script, or just live with the pentium-specific stuff)
- - ./mysql-test-run -gcov
- - to see the level of coverage for a given source file:
+ - Make sure gcov is installed
+ - Compile the MySQL distribution with BUILD/compile-pentium-gcov (if your
+ machine does not have a pentium CPU, hack this script, or just live with
+ the pentium-specific stuff)
+ - In the mysql-test directory, run this command: ./mysql-test-run -gcov
+ - To see the level of coverage for a given source file:
grep source_file_name /tmp/gcov.out
- - to see which lines are not yet covered, look at source_file_name.gcov in the source tree. Then think hard about a test case that will cover those
-lines, and write one!
+ - To see which lines are not yet covered, look at source_file_name.gcov in
+ the source tree. Then think hard about a test case that will cover those
+ lines, and write one!
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 44b8a1346d5..acb794bce3b 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -198,6 +198,7 @@ our $opt_big_test= 0; # Send --big-test to mysqltest
our @opt_extra_mysqld_opt;
+our $opt_comment;
our $opt_compress;
our $opt_ssl;
our $opt_skip_ssl;
@@ -669,6 +670,14 @@ sub command_line_setup () {
print '#' x 78, "\n\n";
}
+ if ( $opt_comment )
+ {
+ print "\n";
+ print '#' x 78, "\n";
+ print "# $opt_comment\n";
+ print '#' x 78, "\n\n";
+ }
+
foreach my $arg ( @ARGV )
{
if ( $arg =~ /^--skip-/ )
@@ -3256,6 +3265,7 @@ Options for coverage, profiling etc
Misc options
+ comment=STR Write STR to the output
verbose Verbose output from this script
script-debug Debug this script itself
timer Show test case execution time
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 593b91f4d21..41a9a206306 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -603,7 +603,14 @@ while test $# -gt 0; do
FAST_START=1
;;
--use-old-data)
- USE_OLD_DATA=1;
+ USE_OLD_DATA=1
+ ;;
+ --comment=*)
+ TMP=`$ECHO "$1" | $SED -e "s;--comment=;;"`
+ echo
+ echo '############################################'
+ echo "# $TMP"
+ echo '############################################'
;;
-- ) shift; break ;;
--* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
diff --git a/mysql-test/r/binary.result b/mysql-test/r/binary.result
index a8d6c3bf411..c5673d1c00d 100644
--- a/mysql-test/r/binary.result
+++ b/mysql-test/r/binary.result
@@ -141,3 +141,22 @@ t1 CREATE TABLE `t1` (
`a` binary(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+create table t1 (col1 binary(4));
+insert into t1 values ('a'),('a ');
+select hex(col1) from t1;
+hex(col1)
+61000000
+61200000
+alter table t1 modify col1 binary(10);
+select hex(col1) from t1;
+hex(col1)
+61000000000000000000
+61200000000000000000
+insert into t1 values ('b'),('b ');
+select hex(col1) from t1;
+hex(col1)
+61000000000000000000
+61200000000000000000
+62000000000000000000
+62200000000000000000
+drop table t1;
diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result
index fd3eca56b31..6c6e0f19e08 100644
--- a/mysql-test/r/grant2.result
+++ b/mysql-test/r/grant2.result
@@ -348,7 +348,7 @@ INSERT INTO mysql.db (host, db, user, select_priv) VALUES
('%','TESTDB','mysqltest_1','Y');
FLUSH PRIVILEGES;
create database TEStdb;
-ERROR 42000: Access denied for user 'mysqltest_1'@'%' to database 'TEStdb'
+Got one of the listed errors
delete from mysql.user;
delete from mysql.db where host='%' and user='mysqltest_1' and db='TESTDB';
insert into mysql.user select * from t1;
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result
index 724d1b1e39f..54536d6c32a 100644
--- a/mysql-test/r/join.result
+++ b/mysql-test/r/join.result
@@ -677,6 +677,11 @@ select t1.b from v1a;
ERROR 42S22: Unknown column 't1.b' in 'field list'
select * from v1a join v1b on t1.b = t2.b;
ERROR 42S22: Unknown column 't1.b' in 'on clause'
+select * from information_schema.statistics join information_schema.columns
+using(table_name,column_name) where table_name='user';
+TABLE_NAME COLUMN_NAME TABLE_CATALOG TABLE_SCHEMA NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
+user Host NULL mysql 0 mysql PRIMARY 1 A NULL NULL NULL BTREE NULL mysql 1 NO char 20 60 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
+user User NULL mysql 0 mysql PRIMARY 2 A 5 NULL NULL BTREE NULL mysql 2 NO char 5 16 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
drop table t1;
drop table t2;
drop table t3;
diff --git a/mysql-test/r/skip_grants.result b/mysql-test/r/skip_grants.result
index 5dc770a7363..95464ee4ce5 100644
--- a/mysql-test/r/skip_grants.result
+++ b/mysql-test/r/skip_grants.result
@@ -12,3 +12,6 @@ create table t1 (a int);
create definer='user'@'host' sql security definer view v1 as select * from t1;
drop view v1;
drop table t1;
+drop function if exists f1;
+Warnings:
+Note 1305 FUNCTION f1 does not exist
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 7561a4461d5..1865c2522aa 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -4778,4 +4778,23 @@ Handler
Inner
drop procedure bug15011|
drop table t3|
+drop procedure if exists bug17476|
+create table t3 ( d date )|
+insert into t3 values
+( '2005-01-01' ), ( '2005-01-02' ), ( '2005-01-03' ),
+( '2005-01-04' ), ( '2005-02-01' ), ( '2005-02-02' )|
+create procedure bug17476(pDateFormat varchar(10))
+select date_format(t3.d, pDateFormat), count(*)
+from t3
+group by date_format(t3.d, pDateFormat)|
+call bug17476('%Y-%m')|
+date_format(t3.d, pDateFormat) count(*)
+2005-01 4
+2005-02 2
+call bug17476('%Y-%m')|
+date_format(t3.d, pDateFormat) count(*)
+2005-01 4
+2005-02 2
+drop table t3|
+drop procedure bug17476|
drop table t1,t2;
diff --git a/mysql-test/t/binary.test b/mysql-test/t/binary.test
index 1ac0cfebb28..4ab6ee9eaf1 100644
--- a/mysql-test/t/binary.test
+++ b/mysql-test/t/binary.test
@@ -89,3 +89,15 @@ show create table t1;
drop table t1;
# End of 4.1 tests
+
+#
+# Bug#16857
+#
+create table t1 (col1 binary(4));
+insert into t1 values ('a'),('a ');
+select hex(col1) from t1;
+alter table t1 modify col1 binary(10);
+select hex(col1) from t1;
+insert into t1 values ('b'),('b ');
+select hex(col1) from t1;
+drop table t1;
diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test
index 39ac0b0d105..ce1d0fb2271 100644
--- a/mysql-test/t/grant2.test
+++ b/mysql-test/t/grant2.test
@@ -449,7 +449,8 @@ connect (con1,localhost,mysqltest_1,password,TESTDB);
# The user mysqltest_1 should only be allowed access to
# database TESTDB, not TEStdb
---error 1044
+# On system with "lowercase names" we get error "1007: Can't create db..."
+--error 1044, 1007
create database TEStdb;
# Clean-up
diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test
index 553aaf987bb..90abc61ca07 100644
--- a/mysql-test/t/join.test
+++ b/mysql-test/t/join.test
@@ -523,6 +523,12 @@ select t1.b from v1a;
-- error 1054
select * from v1a join v1b on t1.b = t2.b;
+#
+# Bug #17523 natural join and information_schema
+#
+select * from information_schema.statistics join information_schema.columns
+ using(table_name,column_name) where table_name='user';
+
drop table t1;
drop table t2;
drop table t3;
diff --git a/mysql-test/t/skip_grants.test b/mysql-test/t/skip_grants.test
index a0164cb0759..27220c9b507 100644
--- a/mysql-test/t/skip_grants.test
+++ b/mysql-test/t/skip_grants.test
@@ -30,3 +30,6 @@ create table t1 (a int);
create definer='user'@'host' sql security definer view v1 as select * from t1;
drop view v1;
drop table t1;
+
+# BUG#17595: DROP FUNCTION IF EXISTS f1 crashes server
+drop function if exists f1;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 31336678675..7709fb68e87 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -5621,6 +5621,31 @@ drop table t3|
#
+# BUG#17476: Stored procedure not returning data when it is called first
+# time per connection
+#
+--disable_warnings
+drop procedure if exists bug17476|
+--enable_warnings
+
+create table t3 ( d date )|
+insert into t3 values
+ ( '2005-01-01' ), ( '2005-01-02' ), ( '2005-01-03' ),
+ ( '2005-01-04' ), ( '2005-02-01' ), ( '2005-02-02' )|
+
+create procedure bug17476(pDateFormat varchar(10))
+ select date_format(t3.d, pDateFormat), count(*)
+ from t3
+ group by date_format(t3.d, pDateFormat)|
+
+call bug17476('%Y-%m')|
+call bug17476('%Y-%m')|
+
+drop table t3|
+drop procedure bug17476|
+
+
+#
# BUG#NNNN: New bug synopsis
#
#--disable_warnings
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index d46a3aa8be3..0c385efd10b 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -378,6 +378,16 @@ static void do_cut_string_complex(Copy_field *copy)
+static void do_expand_binary(Copy_field *copy)
+{
+ CHARSET_INFO *cs= copy->from_field->charset();
+ memcpy(copy->to_ptr,copy->from_ptr,copy->from_length);
+ cs->cset->fill(cs, copy->to_ptr+copy->from_length,
+ copy->to_length-copy->from_length, '\0');
+}
+
+
+
static void do_expand_string(Copy_field *copy)
{
CHARSET_INFO *cs= copy->from_field->charset();
@@ -582,7 +592,13 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
return (from->charset()->mbmaxlen == 1 ?
do_cut_string : do_cut_string_complex);
else if (to_length > from_length)
- return do_expand_string;
+ {
+ if ((to->flags & BINARY_FLAG) != 0)
+ return do_expand_binary;
+ else
+ return do_expand_string;
+ }
+
}
else if (to->real_type() != from->real_type() ||
to_length != from_length ||
diff --git a/sql/item.h b/sql/item.h
index d22ae69621b..b9ce418858c 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1629,7 +1629,6 @@ public:
str_value.length(), collation.collation);
}
Item *safe_charset_converter(CHARSET_INFO *tocs);
- String *const_string() { return &str_value; }
inline void append(char *str, uint length) { str_value.append(str, length); }
void print(String *str);
// to prevent drop fixed flag (no need parent cleanup call)
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 2effe3a615c..c4f7dec70d0 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1656,9 +1656,15 @@ longlong Item_func_sec_to_time::val_int()
void Item_func_date_format::fix_length_and_dec()
{
+ /*
+ Must use this_item() in case it's a local SP variable
+ (for ->max_length and ->str_value)
+ */
+ Item *arg1= args[1]->this_item();
+
decimals=0;
collation.set(&my_charset_bin);
- if (args[1]->type() == STRING_ITEM)
+ if (arg1->type() == STRING_ITEM)
{ // Optimize the normal case
fixed_length=1;
@@ -1666,13 +1672,13 @@ void Item_func_date_format::fix_length_and_dec()
The result is a binary string (no reason to use collation->mbmaxlen
This is becasue make_date_time() only returns binary strings
*/
- max_length= format_length(((Item_string*) args[1])->const_string());
+ max_length= format_length(&arg1->str_value);
}
else
{
fixed_length=0;
/* The result is a binary string (no reason to use collation->mbmaxlen */
- max_length=min(args[1]->max_length,MAX_BLOB_WIDTH) * 10;
+ max_length=min(arg1->max_length, MAX_BLOB_WIDTH) * 10;
set_if_smaller(max_length,MAX_BLOB_WIDTH);
}
maybe_null=1; // If wrong date
@@ -1682,6 +1688,7 @@ void Item_func_date_format::fix_length_and_dec()
bool Item_func_date_format::eq(const Item *item, bool binary_cmp) const
{
Item_func_date_format *item_func;
+
if (item->type() != FUNC_ITEM)
return 0;
if (func_name() != ((Item_func*) item)->func_name())
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index c5794fb4d25..c80bb8bad9a 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -233,7 +233,7 @@ static int net_data_is_ready(my_socket sd)
/* Windows uses an _array_ of 64 fd's as default, so it's safe */
if (sd >= FD_SETSIZE)
return -1;
- #define NET_DATA_IS_READY_CAN_RETURN_MINUS_ONE
+#define NET_DATA_IS_READY_CAN_RETURN_MINUS_ONE
#endif
FD_ZERO(&sfds);
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 5d73c139279..69c5388f776 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -284,6 +284,10 @@ static void del_udf(udf_func *udf)
void free_udf(udf_func *udf)
{
DBUG_ENTER("free_udf");
+
+ if (!initialized)
+ DBUG_VOID_RETURN;
+
rw_wrlock(&THR_LOCK_udf);
if (!--udf->usage_count)
{
@@ -308,6 +312,9 @@ udf_func *find_udf(const char *name,uint length,bool mark_used)
udf_func *udf=0;
DBUG_ENTER("find_udf");
+ if (!initialized)
+ DBUG_RETURN(NULL);
+
/* TODO: This should be changed to reader locks someday! */
if (mark_used)
rw_wrlock(&THR_LOCK_udf); /* Called during fix_fields */
diff --git a/sql/table.cc b/sql/table.cc
index 3e766fe6c0f..d6a715ae1b4 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -3336,8 +3336,15 @@ const char *Natural_join_column::db_name()
if (view_field)
return table_ref->view_db.str;
+ /*
+ Test that TABLE_LIST::db is the same as st_table_share::db to
+ ensure consistency. An exception are I_S schema tables, which
+ are inconsistent in this respect.
+ */
DBUG_ASSERT(!strcmp(table_ref->db,
- table_ref->table->s->db.str));
+ table_ref->table->s->db.str) ||
+ (table_ref->schema_table &&
+ table_ref->table->s->db.str[0] == 0));
return table_ref->db;
}
@@ -3539,7 +3546,15 @@ const char *Field_iterator_table_ref::db_name()
else if (table_ref->is_natural_join)
return natural_join_it.column_ref()->db_name();
- DBUG_ASSERT(!strcmp(table_ref->db, table_ref->table->s->db.str));
+ /*
+ Test that TABLE_LIST::db is the same as st_table_share::db to
+ ensure consistency. An exception are I_S schema tables, which
+ are inconsistent in this respect.
+ */
+ DBUG_ASSERT(!strcmp(table_ref->db, table_ref->table->s->db.str) ||
+ (table_ref->schema_table &&
+ table_ref->table->s->db.str[0] == 0));
+
return table_ref->db;
}