diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-03-27 23:41:02 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-03-27 23:41:02 +0100 |
commit | 993ea79f2df42292eceeee394e8ece9f4a3f6cf2 (patch) | |
tree | d105c8288a89a25d412e9006b740c756db6326d6 | |
parent | 1827d9591e24ee469527021771088d842ab18374 (diff) | |
parent | 6599fd3e9c23a8957a63146cbe6a0ffc4c292a3d (diff) | |
download | mariadb-git-993ea79f2df42292eceeee394e8ece9f4a3f6cf2.tar.gz |
5.5 merge
627 files changed, 17002 insertions, 18008 deletions
diff --git a/.bzrignore b/.bzrignore index dedd26a8fb9..ec28fd744bd 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1144,3 +1144,4 @@ sql/db.opt ./_CPack_Packages ./install_manifest_*.txt typescript +mysql-test/collections/default.release.done diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b29c559415..823bac6b6e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -132,14 +132,10 @@ IF (NOT CPACK_GENERATOR) ENDIF(WIN32) ENDIF(NOT CPACK_GENERATOR) -IF(DEB) - SET(INSTALL_LAYOUT "DEB") -ENDIF(DEB) - INCLUDE(mysql_version) -INCLUDE(cpack_rpm) INCLUDE(cpack_source_ignore_files) INCLUDE(install_layout) +INCLUDE(cpack_rpm) # Add macros INCLUDE(character_sets) diff --git a/INSTALL-SOURCE b/INSTALL-SOURCE index b6f4fe546c7..32cfa9792a7 100644 --- a/INSTALL-SOURCE +++ b/INSTALL-SOURCE @@ -1,8254 +1,3 @@ -Installing and Upgrading MariaDB +Instructions for building MariaDB can be found at: +https://kb.askmonty.org/en/compiling-mariadb-from-source/ -This file contains chapter two of the MySQL manual and describes how -to obtain and install MySQL. The instructions below are generally -applicable to both MySQL and MariaDB, but differ in some particulars -(like, for example, the GPG signing key we use is different). - -Detailed, MariaDB-specific instructions are available at: -http://kb.askmonty.org/en/getting-installing-and-upgrading-mariadb/ - -- - - - - -Chapter 2. Installing and Upgrading MySQL - - This chapter describes how to obtain and install MySQL. A summary - of the procedure follows and later sections provide the details. - If you plan to upgrade an existing version of MySQL to a newer - version rather than install MySQL for the first time, see Section - 2.4.1, "Upgrading MySQL," for information about upgrade procedures - and about issues that you should consider before upgrading. - - If you are interested in migrating to MySQL from another database - system, you may wish to read Section A.8, "MySQL 5.1 FAQ --- - Migration," which contains answers to some common questions - concerning migration issues. - - 1. Determine whether MySQL runs and is supported on your - platform. - Please note that not all platforms are equally suitable for - running MySQL, and that not all platforms on which MySQL is - known to run are officially supported by Oracle Corporation: - - 2. Choose which distribution to install. - Several versions of MySQL are available, and most are - available in several distribution formats. You can choose from - pre-packaged distributions containing binary (precompiled) - programs or source code. When in doubt, use a binary - distribution. We also provide public access to our current - source tree for those who want to see our most recent - developments and help us test new code. To determine which - version and type of distribution you should use, see Section - 2.1.2, "Choosing Which MySQL Distribution to Install." - - 3. Download the distribution that you want to install. - For instructions, see Section 2.1.3, "How to Get MySQL." To - verify the integrity of the distribution, use the instructions - in Section 2.1.4, "Verifying Package Integrity Using MD5 - Checksums or GnuPG." - - 4. Install the distribution. - To install MySQL from a binary distribution, use the - instructions in Section 2.2, "Installing MySQL from Generic - Binaries on Unix/Linux." - To install MySQL from a source distribution or from the - current development source tree, use the instructions in - Section 2.3, "MySQL Installation Using a Source Distribution." - - 5. Perform any necessary post-installation setup. - After installing MySQL, read Section 2.13, "Post-Installation - Setup and Testing." This section contains important - information about making sure the MySQL server is working - properly. It also describes how to secure the initial MySQL - user accounts, which have no passwords until you assign - passwords. The section applies whether you install MySQL using - a binary or source distribution. - - 6. If you want to run the MySQL benchmark scripts, Perl support - for MySQL must be available. See Section 2.15, "Perl - Installation Notes." - -2.1. General Installation Guidance - - The immediately following sections contain the information - necessary to choose, download, and verify your distribution. The - instructions in later sections of the chapter describe how to - install the distribution that you choose. For binary - distributions, see the instructions at Section 2.2, "Installing - MySQL from Generic Binaries on Unix/Linux" or the corresponding - section for your platform if available. To build MySQL from - source, use the instructions in Section 2.3, "MySQL Installation - Using a Source Distribution." - -2.1.1. Operating Systems Supported by MySQL Community Server - - This section lists the operating systems on which MySQL Community - Server is known to run. - -Important - - Oracle Corporation does not necessarily provide official support - for all the platforms listed in this section. For information - about those platforms that are officially supported, see - http://www.mysql.com/support/supportedplatforms.html on the MySQL - Web site. - - We use GNU Autoconf, so it is possible to port MySQL to all modern - systems that have a C++ compiler and a working implementation of - POSIX threads. (Thread support is needed for the server. To - compile only the client code, the only requirement is a C++ - compiler.) - - MySQL has been reported to compile successfully on the following - combinations of operating system and thread package. - - * AIX 4.x, 5.x with native threads. See Section 2.12, - "Installing MySQL on AIX." AIX 5.3 should be upgraded to - technology level 7 (5300-07). - - * FreeBSD 5.x and up with native threads. See Section 2.10, - "Installing MySQL on FreeBSD." - - * HP-UX 11.x with the native threads. See Section 2.11, - "Installing MySQL on HP-UX." - - * Linux, builds on all fairly recent Linux distributions with - glibc 2.3. See Section 2.6, "Installing MySQL on Linux." - - * Mac OS X. See Section 2.7, "Installing MySQL on Mac OS X." - - * Solaris 2.8 on SPARC and x86, including support for native - threads. See Section 2.8.1, "Solaris Notes." - - * Windows 2000, Windows XP, Windows Vista, Windows Server 2003, - and Windows Server 2008. See Section 2.5, "Installing MySQL on - Windows." - - MySQL has also been known to run on other systems in the past. See - Section 2.1, "General Installation Guidance." Some porting effort - might be required for current versions of MySQL on these systems. - - Not all platforms are equally well-suited for running MySQL. How - well a certain platform is suited for a high-load mission-critical - MySQL server is determined by the following factors: - - * General stability of the thread library. A platform may have - an excellent reputation otherwise, but MySQL is only as stable - as the thread library it calls, even if everything else is - perfect. - - * The capability of the kernel and the thread library to take - advantage of symmetric multi-processor (SMP) systems. In other - words, when a process creates a thread, it should be possible - for that thread to run on a CPU different from the original - process. - - * The capability of the kernel and the thread library to run - many threads that acquire and release a mutex over a short - critical region frequently without excessive context switches. - If the implementation of pthread_mutex_lock() is too anxious - to yield CPU time, this hurts MySQL tremendously. If this - issue is not taken care of, adding extra CPUs actually makes - MySQL slower. - - * General file system stability and performance. - - * Table size. If your tables are large, performance is affected - by the ability of the file system to deal with large files and - dealing with them efficiently. - - * Our level of expertise here at Oracle Corporation with the - platform. If we know a platform well, we enable - platform-specific optimizations and fixes at compile time. We - can also provide advice on configuring your system optimally - for MySQL. - - * The amount of testing we have done internally for similar - configurations. - - * The number of users that have run MySQL successfully on the - platform in similar configurations. If this number is high, - the likelihood of encountering platform-specific surprises is - much smaller. - -2.1.2. Choosing Which MySQL Distribution to Install - - When preparing to install MySQL, you should decide which version - to use. MySQL development occurs in several release series, and - you can pick the one that best fits your needs. After deciding - which version to install, you can choose a distribution format. - Releases are available in binary or source format. - -2.1.2.1. Choosing Which Version of MySQL to Install - - The first decision to make is whether you want to use a production - (stable) release or a development release. In the MySQL - development process, multiple release series co-exist, each at a - different stage of maturity: - - * MySQL 5.5 is the current development release series. - - * MySQL 5.1 is the current General Availability (Production) - release series. New releases are issued for bugfixes only; no - new features are being added that could affect stability. - - * MySQL 5.0 is the previous stable (production-quality) release - series. MySQL 5.0 is now at the end of the product lifecycle. - Active development and support for this version has ended. - Extended support for MySQL 5.0 remains available. According to - the http://www.mysql.com/about/legal/lifecycle/, only Security - and Severity Level 1 issues are still being fixed for MySQL - 5.0. - - * MySQL 4.1, 4.0, and 3.23 are old stable (production-quality) - release series. Active development and support for these - versions has ended. - - We do not believe in a complete code freeze because this prevents - us from making bugfixes and other fixes that must be done. By - "somewhat frozen" we mean that we may add small things that should - not affect anything that currently works in a production release. - Naturally, relevant bugfixes from an earlier series propagate to - later series. - - Normally, if you are beginning to use MySQL for the first time or - trying to port it to some system for which there is no binary - distribution, go with the General Availability release series. - Currently, this is MySQL 5.1. All MySQL releases, even those from - development series, are checked with the MySQL benchmarks and an - extensive test suite before being issued. - - If you are running an older system and want to upgrade, but do not - want to take the chance of having a nonseamless upgrade, you - should upgrade to the latest version in the same release series - you are using (where only the last part of the version number is - newer than yours). We have tried to fix only fatal bugs and make - only small, relatively "safe" changes to that version. - - If you want to use new features not present in the production - release series, you can use a version from a development series. - Note that development releases are not as stable as production - releases. - - If you want to use the very latest sources containing all current - patches and bugfixes, you can use one of our Bazaar repositories. - These are not "releases" as such, but are available as previews of - the code on which future releases are to be based. - - The MySQL naming scheme uses release names that consist of three - numbers and a suffix; for example, mysql-5.0.14-rc. The numbers - within the release name are interpreted as follows: - - * The first number (5) is the major version and describes the - file format. All MySQL 5 releases have the same file format. - - * The second number (0) is the release level. Taken together, - the major version and release level constitute the release - series number. - - * The third number (14) is the version number within the release - series. This is incremented for each new release. Usually you - want the latest version for the series you have chosen. - - For each minor update, the last number in the version string is - incremented. When there are major new features or minor - incompatibilities with previous versions, the second number in the - version string is incremented. When the file format changes, the - first number is increased. - - Release names also include a suffix to indicates the stability - level of the release. Releases within a series progress through a - set of suffixes to indicate how the stability level improves. The - possible suffixes are: - - * alpha indicates that the release is for preview purposes only. - Known bugs should be documented in the News section (see - Appendix C, "MySQL Change History"). Most alpha releases - implement new commands and extensions. Active development that - may involve major code changes can occur in an alpha release. - However, we do conduct testing before issuing a release. - - * beta indicates that the release is appropriate for use with - new development. Within beta releases, the features and - compatibility should remain consistent. However, beta releases - may contain numerous and major unaddressed bugs. - All APIs, externally visible structures, and columns for SQL - statements will not change during future beta, release - candidate, or production releases. - - * rc indicates a Release Candidate. Release candidates are - believed to be stable, having passed all of MySQL's internal - testing, and with all known fatal runtime bugs fixed. However, - the release has not been in widespread use long enough to know - for sure that all bugs have been identified. Only minor fixes - are added. (A release candidate is what formerly was known as - a gamma release.) - - * If there is no suffix, it indicates that the release is a - General Availability (GA) or Production release. GA releases - are stable, having successfully passed through all earlier - release stages and are believed to be reliable, free of - serious bugs, and suitable for use in production systems. Only - critical bugfixes are applied to the release. - - MySQL uses a naming scheme that is slightly different from most - other products. In general, it is usually safe to use any version - that has been out for a couple of weeks without being replaced by - a new version within the same release series. - - All releases of MySQL are run through our standard tests and - benchmarks to ensure that they are relatively safe to use. Because - the standard tests are extended over time to check for all - previously found bugs, the test suite keeps getting better. - - All releases have been tested at least with these tools: - - * An internal test suite - The mysql-test directory contains an extensive set of test - cases. We run these tests for every server binary. See Section - 22.1.2, "MySQL Test Suite," for more information about this - test suite. - - * The MySQL benchmark suite - This suite runs a range of common queries. It is also a test - to determine whether the latest batch of optimizations - actually made the code faster. See Section 7.1.3, "The MySQL - Benchmark Suite." - - We also test the newest MySQL version in our internal production - environment, on at least one machine. We have more than 100GB of - data to work with. - -2.1.2.2. Choosing a Distribution Format - - After choosing which version of MySQL to install, you should - decide whether to use a binary distribution or a source - distribution. In most cases, you should probably use a binary - distribution, if one exists for your platform. Binary - distributions are available in native format for many platforms, - such as RPM files for Linux or PKG package installers for Mac OS X - or Solaris. Distributions also are available as Zip archives or - compressed tar files. - - Reasons to choose a binary distribution include the following: - - * Binary distributions generally are easier to install than - source distributions. - - * To satisfy different user requirements, we provide several - servers in binary distributions. mysqld is an optimized server - that is a smaller, faster binary. mysqld-debug is compiled - with debugging support. - Each of these servers is compiled from the same source - distribution, though with different configuration options. All - native MySQL clients can connect to servers from either MySQL - version. - - Under some circumstances, you may be better off installing MySQL - from a source distribution: - - * You want to install MySQL at some explicit location. The - standard binary distributions are ready to run at any - installation location, but you might require even more - flexibility to place MySQL components where you want. - - * You want to configure mysqld to ensure that features are - available that might not be included in the standard binary - distributions. Here is a list of the most common extra options - that you may want to use to ensure feature availability: - - + --with-libwrap - - + --with-named-z-libs (this is done for some of the - binaries) - - + --with-debug[=full] - - * You want to configure mysqld without some features that are - included in the standard binary distributions. For example, - distributions normally are compiled with support for all - character sets. If you want a smaller MySQL server, you can - recompile it with support for only the character sets you - need. - - * You have a special compiler (such as pgcc) or want to use - compiler options that are better optimized for your processor. - Binary distributions are compiled with options that should - work on a variety of processors from the same processor - family. - - * You want to use the latest sources from one of the Bazaar - repositories to have access to all current bugfixes. For - example, if you have found a bug and reported it to the MySQL - development team, the bugfix is committed to the source - repository and you can access it there. The bugfix does not - appear in a release until a release actually is issued. - - * You want to read (or modify) the C and C++ code that makes up - MySQL. For this purpose, you should get a source distribution, - because the source code is always the ultimate manual. - - * Source distributions contain more tests and examples than - binary distributions. - -2.1.2.3. How and When Updates Are Released - - MySQL is evolving quite rapidly and we want to share new - developments with other MySQL users. We try to produce a new - release whenever we have new and useful features that others also - seem to have a need for. - - We also try to help users who request features that are easy to - implement. We take note of what our licensed users want, and we - especially take note of what our support customers want and try to - help them in this regard. - - No one is required to download a new release. The News section - helps you determine whether the new release has something you - really want. See Appendix C, "MySQL Change History." - - We use the following policy when updating MySQL: - - * Enterprise Server releases are meant to appear every 18 - months, supplemented by quarterly service packs and monthly - rapid updates. Community Server releases are meant to appear - 2-3 times per year. - - * Releases are issued within each series. For each release, the - last number in the version is one more than the previous - release within the same series. - - * Binary distributions for some platforms are made by us for - major releases. Other people may make binary distributions for - other systems, but probably less frequently. - - * We make fixes available as soon as we have identified and - corrected small or noncritical but annoying bugs. The fixes - are available in source form immediately from our public - Bazaar repositories, and are included in the next release. - - * If by any chance a security vulnerability or critical bug is - found in a release, our policy is to fix it in a new release - as soon as possible. (We would like other companies to do - this, too!) - -2.1.3. How to Get MySQL - - Check our downloads page at http://dev.mysql.com/downloads/ for - information about the current version of MySQL and for downloading - instructions. For a complete up-to-date list of MySQL download - mirror sites, see http://dev.mysql.com/downloads/mirrors.html. You - can also find information there about becoming a MySQL mirror site - and how to report a bad or out-of-date mirror. - - Our main mirror is located at http://mirrors.sunsite.dk/mysql/. - -2.1.4. Verifying Package Integrity Using MD5 Checksums or GnuPG - - After you have downloaded the MySQL package that suits your needs - and before you attempt to install it, you should make sure that it - is intact and has not been tampered with. There are three means of - integrity checking: - - * MD5 checksums - - * Cryptographic signatures using GnuPG, the GNU Privacy Guard - - * For RPM packages, the built-in RPM integrity verification - mechanism - - The following sections describe how to use these methods. - - If you notice that the MD5 checksum or GPG signatures do not - match, first try to download the respective package one more time, - perhaps from another mirror site. If you repeatedly cannot - successfully verify the integrity of the package, please notify us - about such incidents, including the full package name and the - download site you have been using, at webmaster@mysql.com or - build@mysql.com. Do not report downloading problems using the - bug-reporting system. - -2.1.4.1. Verifying the MD5 Checksum - - After you have downloaded a MySQL package, you should make sure - that its MD5 checksum matches the one provided on the MySQL - download pages. Each package has an individual checksum that you - can verify with the following command, where package_name is the - name of the package you downloaded: -shell> md5sum package_name - - Example: -shell> md5sum mysql-standard-5.1.46-linux-i686.tar.gz -aaab65abbec64d5e907dcd41b8699945 mysql-standard-5.1.46-linux-i686.ta -r.gz - - You should verify that the resulting checksum (the string of - hexadecimal digits) matches the one displayed on the download page - immediately below the respective package. - -Note - - Make sure to verify the checksum of the archive file (for example, - the .zip or .tar.gz file) and not of the files that are contained - inside of the archive. - - Note that not all operating systems support the md5sum command. On - some, it is simply called md5, and others do not ship it at all. - On Linux, it is part of the GNU Text Utilities package, which is - available for a wide range of platforms. You can download the - source code from http://www.gnu.org/software/textutils/ as well. - If you have OpenSSL installed, you can use the command openssl md5 - package_name instead. A Windows implementation of the md5 command - line utility is available from http://www.fourmilab.ch/md5/. - winMd5Sum is a graphical MD5 checking tool that can be obtained - from http://www.nullriver.com/index/products/winmd5sum. - -2.1.4.2. Signature Checking Using GnuPG - - Another method of verifying the integrity and authenticity of a - package is to use cryptographic signatures. This is more reliable - than using MD5 checksums, but requires more work. - - We sign MySQL downloadable packages with GnuPG (GNU Privacy - Guard). GnuPG is an Open Source alternative to the well-known - Pretty Good Privacy (PGP) by Phil Zimmermann. See - http://www.gnupg.org/ for more information about GnuPG and how to - obtain and install it on your system. Most Linux distributions - ship with GnuPG installed by default. For more information about - GnuPG, see http://www.openpgp.org/. - - To verify the signature for a specific package, you first need to - obtain a copy of our public GPG build key, which you can download - from http://keyserver.pgp.com/. The key that you want to obtain is - named build@mysql.com. Alternatively, you can cut and paste the - key directly from the following text: ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.4.5 (GNU/Linux) - -mQGiBD4+owwRBAC14GIfUfCyEDSIePvEW3SAFUdJBtoQHH/nJKZyQT7h9bPlUWC3 -RODjQReyCITRrdwyrKUGku2FmeVGwn2u2WmDMNABLnpprWPkBdCk96+OmSLN9brZ -fw2vOUgCmYv2hW0hyDHuvYlQA/BThQoADgj8AW6/0Lo7V1W9/8VuHP0gQwCgvzV3 -BqOxRznNCRCRxAuAuVztHRcEAJooQK1+iSiunZMYD1WufeXfshc57S/+yeJkegNW -hxwR9pRWVArNYJdDRT+rf2RUe3vpquKNQU/hnEIUHJRQqYHo8gTxvxXNQc7fJYLV -K2HtkrPbP72vwsEKMYhhr0eKCbtLGfls9krjJ6sBgACyP/Vb7hiPwxh6rDZ7ITnE -kYpXBACmWpP8NJTkamEnPCia2ZoOHODANwpUkP43I7jsDmgtobZX9qnrAXw+uNDI -QJEXM6FSbi0LLtZciNlYsafwAPEOMDKpMqAK6IyisNtPvaLd8lH0bPAnWqcyefep -rv0sxxqUEMcM3o7wwgfN83POkDasDbs3pjwPhxvhz6//62zQJ7Q7TXlTUUwgUGFj -a2FnZSBzaWduaW5nIGtleSAod3d3Lm15c3FsLmNvbSkgPGJ1aWxkQG15c3FsLmNv -bT6IXQQTEQIAHQULBwoDBAMVAwIDFgIBAheABQJLcC5lBQkQ8/JZAAoJEIxxjTtQ -cuH1oD4AoIcOQ4EoGsZvy06D0Ei5vcsWEy8dAJ4g46i3WEcdSWxMhcBSsPz65sh5 -lohMBBMRAgAMBQI+PqPRBYMJZgC7AAoJEElQ4SqycpHyJOEAn1mxHijft00bKXvu -cSo/pECUmppiAJ41M9MRVj5VcdH/KN/KjRtW6tHFPYhMBBMRAgAMBQI+QoIDBYMJ -YiKJAAoJELb1zU3GuiQ/lpEAoIhpp6BozKI8p6eaabzF5MlJH58pAKCu/ROofK8J -Eg2aLos+5zEYrB/LsrkCDQQ+PqMdEAgA7+GJfxbMdY4wslPnjH9rF4N2qfWsEN/l -xaZoJYc3a6M02WCnHl6ahT2/tBK2w1QI4YFteR47gCvtgb6O1JHffOo2HfLmRDRi -Rjd1DTCHqeyX7CHhcghj/dNRlW2Z0l5QFEcmV9U0Vhp3aFfWC4Ujfs3LU+hkAWzE -7zaD5cH9J7yv/6xuZVw411x0h4UqsTcWMu0iM1BzELqX1DY7LwoPEb/O9Rkbf4fm -Le11EzIaCa4PqARXQZc4dhSinMt6K3X4BrRsKTfozBu74F47D8Ilbf5vSYHbuE5p -/1oIDznkg/p8kW+3FxuWrycciqFTcNz215yyX39LXFnlLzKUb/F5GwADBQf+Lwqq -a8CGrRfsOAJxim63CHfty5mUc5rUSnTslGYEIOCR1BeQauyPZbPDsDD9MZ1ZaSaf -anFvwFG6Llx9xkU7tzq+vKLoWkm4u5xf3vn55VjnSd1aQ9eQnUcXiL4cnBGoTbOW -I39EcyzgslzBdC++MPjcQTcA7p6JUVsP6oAB3FQWg54tuUo0Ec8bsM8b3Ev42Lmu -QT5NdKHGwHsXTPtl0klk4bQk4OajHsiy1BMahpT27jWjJlMiJc+IWJ0mghkKHt92 -6s/ymfdf5HkdQ1cyvsz5tryVI3Fx78XeSYfQvuuwqp2H139pXGEkg0n6KdUOetdZ -Whe70YGNPw1yjWJT1IhMBBgRAgAMBQI+PqMdBQkJZgGAAAoJEIxxjTtQcuH17p4A -n3r1QpVC9yhnW2cSAjq+kr72GX0eAJ4295kl6NxYEuFApmr1+0uUq/SlsQ== -=Mski - ------END PGP PUBLIC KEY BLOCK----- - - To import the build key into your personal public GPG keyring, use - gpg --import. For example, if you have saved the key in a file - named mysql_pubkey.asc, the import command looks like this: -shell> gpg --import mysql_pubkey.asc -gpg: key 5072E1F5: public key "MySQL Package signing key (www.mysql.c -om) <build@mysql.com>" imported -gpg: Total number processed: 1 -gpg: imported: 1 -gpg: no ultimately trusted keys found - - You can also download the key from the public keyserver using the - public key id, 5072E1F5: -shell> gpg --recv-keys 5072E1F5 -gpg: requesting key 5072E1F5 from hkp server subkeys.pgp.net -gpg: key 5072E1F5: "MySQL Package signing key (www.mysql.com) <build@ -mysql.com>" 2 new signatures -gpg: no ultimately trusted keys found -gpg: Total number processed: 1 -gpg: new signatures: 2 - - If you want to import the key into your RPM configuration to - validate RPM install packages, you should be able to import the - key directly: -shell> rpm --import mysql_pubkey.asc - - If you experience problems, try exporting the key from gpg and - importing: -shell> gpg --export -a 5072e1f5 > 5072e1f5.asc -shell> rpm --import 5072e1f5.asc - - Alternatively, rpm also supports loading the key directly from a - URL, and you cas use this manual page: -shell> rpm --import http://dev.mysql.com/doc/refman/5.1/en/checking-g -pg-signature.html - - After you have downloaded and imported the public build key, - download your desired MySQL package and the corresponding - signature, which also is available from the download page. The - signature file has the same name as the distribution file with an - .asc extension, as shown by the examples in the following table. - Distribution file mysql-standard-5.1.46-linux-i686.tar.gz - Signature file mysql-standard-5.1.46-linux-i686.tar.gz.asc - - Make sure that both files are stored in the same directory and - then run the following command to verify the signature for the - distribution file: -shell> gpg --verify package_name.asc - - Example: -shell> gpg --verify mysql-standard-5.1.46-linux-i686.tar.gz.asc -gpg: Signature made Tue 12 Jul 2005 23:35:41 EST using DSA key ID 507 -2E1F5 -gpg: Good signature from "MySQL Package signing key (www.mysql.com) < -build@mysql.com>" - - The Good signature message indicates that everything is all right. - You can ignore any insecure memory warning you might obtain. - - See the GPG documentation for more information on how to work with - public keys. - -2.1.4.3. Signature Checking Using RPM - - For RPM packages, there is no separate signature. RPM packages - have a built-in GPG signature and MD5 checksum. You can verify a - package by running the following command: -shell> rpm --checksig package_name.rpm - - Example: -shell> rpm --checksig MySQL-server-5.1.46-0.glibc23.i386.rpm -MySQL-server-5.1.46-0.glibc23.i386.rpm: md5 gpg OK - -Note - - If you are using RPM 4.1 and it complains about (GPG) NOT OK - (MISSING KEYS: GPG#5072e1f5), even though you have imported the - MySQL public build key into your own GPG keyring, you need to - import the key into the RPM keyring first. RPM 4.1 no longer uses - your personal GPG keyring (or GPG itself). Rather, it maintains - its own keyring because it is a system-wide application and a - user's GPG public keyring is a user-specific file. To import the - MySQL public key into the RPM keyring, first obtain the key as - described in Section 2.1.4.2, "Signature Checking Using GnuPG." - Then use rpm --import to import the key. For example, if you have - saved the public key in a file named mysql_pubkey.asc, import it - using this command: -shell> rpm --import mysql_pubkey.asc - - If you need to obtain the MySQL public key, see Section 2.1.4.2, - "Signature Checking Using GnuPG." - -2.1.5. Installation Layouts - - This section describes the default layout of the directories - created by installing binary or source distributions provided by - Oracle Corporation. A distribution provided by another vendor - might use a layout different from those shown here. - - Installations created from our Linux RPM distributions result in - files under the following system directories. - Directory Contents of Directory - /usr/bin Client programs and scripts - /usr/sbin The mysqld server - /var/lib/mysql Log files, databases - /usr/share/info Manual in Info format - /usr/share/man Unix manual pages - /usr/include/mysql Include (header) files - /usr/lib/mysql Libraries - /usr/share/mysql Error message and character set files - /usr/share/sql-bench Benchmarks - - On Unix, a tar file binary distribution is installed by unpacking - it at the installation location you choose (typically - /usr/local/mysql) and creates the following directories in that - location. - Directory Contents of Directory - bin Client programs and the mysqld server - data Log files, databases - docs Manual in Info format - man Unix manual pages - include Include (header) files - lib Libraries - scripts mysql_install_db - share/mysql Error message files - sql-bench Benchmarks - - A source distribution is installed after you configure and compile - it. By default, the installation step installs files under - /usr/local, in the following subdirectories. - Directory Contents of Directory - bin Client programs and scripts - include/mysql Include (header) files - Docs Manual in Info, CHM formats - man Unix manual pages - lib/mysql Libraries - libexec The mysqld server - share/mysql Error message files - sql-bench Benchmarks and crash-me test - var Databases and log files - - Within its installation directory, the layout of a source - installation differs from that of a binary installation in the - following ways: - - * The mysqld server is installed in the libexec directory rather - than in the bin directory. - - * The data directory is var rather than data. - - * mysql_install_db is installed in the bin directory rather than - in the scripts directory. - - * The header file and library directories are include/mysql and - lib/mysql rather than include and lib. - - You can create your own binary installation from a compiled source - distribution by executing the scripts/make_binary_distribution - script from the top directory of the source distribution. - -2.2. Installing MySQL from Generic Binaries on Unix/Linux - - This section covers the installation of MySQL binary distributions - that are provided for various platforms in the form of compressed - tar files (files with a .tar.gz extension). - - To obtain MySQL, see Section 2.1.3, "How to Get MySQL." - - Sun Microsystems, Inc. provides a set of binary distributions of - MySQL. In addition to binaries provided in platform-specific - package formats, we offer binary distributions for a number of - platforms in the form of compressed tar files (.tar.gz files). For - Windows distributions, see Section 2.5, "Installing MySQL on - Windows." - - If you want to compile a debug version of MySQL from a source - distribution, you should add --with-debug or --with-debug=full to - the configure command used to configure the distribution and - remove any -fomit-frame-pointer options. - - MySQL tar file binary distributions have names of the form - mysql-VERSION-OS.tar.gz, where VERSION is a number (for example, - 5.1.46), and OS indicates the type of operating system for which - the distribution is intended (for example, pc-linux-i686). - - In addition to these generic packages, we also offer binaries in - platform-specific package formats for selected platforms. See the - platform specific sections for more information, for more - information on how to install these. - - You need the following tools to install a MySQL tar file binary - distribution: - - * GNU gunzip to uncompress the distribution. - - * A reasonable tar to unpack the distribution. GNU tar is known - to work. Some operating systems come with a preinstalled - version of tar that is known to have problems. For example, - the tar provided with early versions of Mac OS X, SunOS 4.x, - Solaris 8, Solaris 9, Solaris 10 and OpenSolaris, and HP-UX - are known to have problems with long file names. On Mac OS X, - you can use the preinstalled gnutar program. On Solaris 10 and - OpenSolaris you can use the preinstalled gtar. On other - systems with a deficient tar, you should install GNU tar - first. - - If you run into problems and need to file a bug report, please use - the instructions in Section 1.7, "How to Report Bugs or Problems." - - The basic commands that you must execute to install and use a - MySQL binary distribution are: -shell> groupadd mysql -shell> useradd -g mysql mysql -shell> cd /usr/local -shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf - -shell> ln -s full-path-to-mysql-VERSION-OS mysql -shell> cd mysql -shell> chown -R mysql . -shell> chgrp -R mysql . -shell> scripts/mysql_install_db --user=mysql -shell> chown -R root . -shell> chown -R mysql data -shell> bin/mysqld_safe --user=mysql & - -Note - - This procedure does not set up any passwords for MySQL accounts. - After following the procedure, proceed to Section 2.13, - "Post-Installation Setup and Testing." - - A more detailed version of the preceding description for - installing a binary distribution follows: - - 1. Add a login user and group for mysqld to run as: -shell> groupadd mysql -shell> useradd -g mysql mysql - These commands add the mysql group and the mysql user. The - syntax for useradd and groupadd may differ slightly on - different versions of Unix, or they may have different names - such as adduser and addgroup. - You might want to call the user and group something else - instead of mysql. If so, substitute the appropriate name in - the following steps. - - 2. Pick the directory under which you want to unpack the - distribution and change location into it. In the following - example, we unpack the distribution under /usr/local. (The - instructions, therefore, assume that you have permission to - create files and directories in /usr/local. If that directory - is protected, you must perform the installation as root.) -shell> cd /usr/local - - 3. Obtain a distribution file using the instructions in Section - 2.1.3, "How to Get MySQL." For a given release, binary - distributions for all platforms are built from the same MySQL - source distribution. - - 4. Unpack the distribution, which creates the installation - directory. Then create a symbolic link to that directory: -shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf - -shell> ln -s full-path-to-mysql-VERSION-OS mysql - The tar command creates a directory named mysql-VERSION-OS. - The ln command makes a symbolic link to that directory. This - lets you refer more easily to the installation directory as - /usr/local/mysql. - With GNU tar, no separate invocation of gunzip is necessary. - You can replace the first line with the following alternative - command to uncompress and extract the distribution: -shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz - - 5. Change location into the installation directory: -shell> cd mysql - You will find several files and subdirectories in the mysql - directory. The most important for installation purposes are - the bin and scripts subdirectories: - - + The bin directory contains client programs and the - server. You should add the full path name of this - directory to your PATH environment variable so that your - shell finds the MySQL programs properly. See Section - 2.14, "Environment Variables." - - + The scripts directory contains the mysql_install_db - script used to initialize the mysql database containing - the grant tables that store the server access - permissions. - - 6. Ensure that the distribution contents are accessible to mysql. - If you unpacked the distribution as mysql, no further action - is required. If you unpacked the distribution as root, its - contents will be owned by root. Change its ownership to mysql - by executing the following commands as root in the - installation directory: -shell> chown -R mysql . -shell> chgrp -R mysql . - The first command changes the owner attribute of the files to - the mysql user. The second changes the group attribute to the - mysql group. - - 7. If you have not installed MySQL before, you must create the - MySQL data directory and initialize the grant tables: -shell> scripts/mysql_install_db --user=mysql - If you run the command as root, include the --user option as - shown. If you run the command while logged in as that user, - you can omit the --user option. - The command should create the data directory and its contents - with mysql as the owner. - After creating or updating the grant tables, you need to - restart the server manually. - - 8. Most of the MySQL installation can be owned by root if you - like. The exception is that the data directory must be owned - by mysql. To accomplish this, run the following commands as - root in the installation directory: -shell> chown -R root . -shell> chown -R mysql data - - 9. If you want MySQL to start automatically when you boot your - machine, you can copy support-files/mysql.server to the - location where your system has its startup files. More - information can be found in the support-files/mysql.server - script itself and in Section 2.13.1.2, "Starting and Stopping - MySQL Automatically." - 10. You can set up new accounts using the bin/mysql_setpermission - script if you install the DBI and DBD::mysql Perl modules. See - Section 4.6.14, "mysql_setpermission --- Interactively Set - Permissions in Grant Tables." For Perl module installation - instructions, see Section 2.15, "Perl Installation Notes." - 11. If you would like to use mysqlaccess and have the MySQL - distribution in some nonstandard location, you must change the - location where mysqlaccess expects to find the mysql client. - Edit the bin/mysqlaccess script at approximately line 18. - Search for a line that looks like this: -$MYSQL = '/usr/local/bin/mysql'; # path to mysql executable - Change the path to reflect the location where mysql actually - is stored on your system. If you do not do this, a Broken pipe - error will occur when you run mysqlaccess. - - After everything has been unpacked and installed, you should test - your distribution. To start the MySQL server, use the following - command: -shell> bin/mysqld_safe --user=mysql & - - If you run the command as root, you must use the --user option as - shown. The value of the option is the name of the login account - that you created in the first step to use for running the server. - If you run the command while logged in as mysql, you can omit the - --user option. - - If the command fails immediately and prints mysqld ended, you can - find some information in the host_name.err file in the data - directory. - - More information about mysqld_safe is given in Section 4.3.2, - "mysqld_safe --- MySQL Server Startup Script." - -Note - - The accounts that are listed in the MySQL grant tables initially - have no passwords. After starting the server, you should set up - passwords for them using the instructions in Section 2.13, - "Post-Installation Setup and Testing." - -2.3. MySQL Installation Using a Source Distribution - - Before you proceed with an installation from source, first check - whether our binary is available for your platform and whether it - works for you. We put a great deal of effort into ensuring that - our binaries are built with the best possible options. - - To obtain a source distribution for MySQL, Section 2.1.3, "How to - Get MySQL." If you want to build MySQL from source on Windows, see - Section 2.5.10, "Installing MySQL from Source on Windows." - - MySQL source distributions are provided as compressed tar archives - and have names of the form mysql-VERSION.tar.gz, where VERSION is - a number like 5.1.46. - - You need the following tools to build and install MySQL from - source: - - * GNU gunzip to uncompress the distribution. - - * A reasonable tar to unpack the distribution. GNU tar is known - to work. Some operating systems come with a preinstalled - version of tar that is known to have problems. For example, - the tar provided with early versions of Mac OS X, SunOS 4.x, - Solaris 8, Solaris 9, Solaris 10 and OpenSolaris, and HP-UX - are known to have problems with long file names. On Mac OS X, - you can use the preinstalled gnutar program. On Solaris 10 and - OpenSolaris you can use the preinstalled gtar. On other - systems with a deficient tar, you should install GNU tar - first. - - * A working ANSI C++ compiler. GCC 3.2 or later, Sun Studio 10 - or later, Visual Studio 2005 or later, and many current - vendor-supplied compilers are known to work. - - * A good make program. GNU make is always recommended and is - sometimes required. (BSD make fails, and vendor-provided make - implementations may fail as well.) If you have problems, use - GNU make 3.75 or newer. - - * libtool 1.5.24 or later is also recommended. - - If you are using a version of gcc recent enough to understand the - -fno-exceptions option, it is very important that you use this - option. Otherwise, you may compile a binary that crashes randomly. - Also use -felide-constructors and -fno-rtti along with - -fno-exceptions. When in doubt, do the following: -CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \ - -fno-exceptions -fno-rtti" ./configure \ - --prefix=/usr/local/mysql --enable-assembler \ - --with-mysqld-ldflags=-all-static - - On most systems, this gives you a fast and stable binary. - - If you run into problems and need to file a bug report, please use - the instructions in Section 1.7, "How to Report Bugs or Problems." - -2.3.1. Source Installation Overview - - The basic commands that you must execute to install a MySQL source - distribution are: -shell> groupadd mysql -shell> useradd -g mysql mysql -shell> gunzip < mysql-VERSION.tar.gz | tar -xvf - -shell> cd mysql-VERSION -shell> ./configure --prefix=/usr/local/mysql -shell> make -shell> make install -shell> cp support-files/my-medium.cnf /etc/my.cnf -shell> cd /usr/local/mysql -shell> chown -R mysql . -shell> chgrp -R mysql . -shell> bin/mysql_install_db --user=mysql -shell> chown -R root . -shell> chown -R mysql var -shell> bin/mysqld_safe --user=mysql & - - If you start from a source RPM, do the following: -shell> rpmbuild --rebuild --clean MySQL-VERSION.src.rpm - - This makes a binary RPM that you can install. For older versions - of RPM, you may have to replace the command rpmbuild with rpm - instead. - -Note - - This procedure does not set up any passwords for MySQL accounts. - After following the procedure, proceed to Section 2.13, - "Post-Installation Setup and Testing," for post-installation setup - and testing. - - A more detailed version of the preceding description for - installing MySQL from a source distribution follows: - - 1. Add a login user and group for mysqld to run as: -shell> groupadd mysql -shell> useradd -g mysql mysql - These commands add the mysql group and the mysql user. The - syntax for useradd and groupadd may differ slightly on - different versions of Unix, or they may have different names - such as adduser and addgroup. - You might want to call the user and group something else - instead of mysql. If so, substitute the appropriate name in - the following steps. - - 2. Perform the following steps as the mysql user, except as - noted. - - 3. Pick the directory under which you want to unpack the - distribution and change location into it. - - 4. Obtain a distribution file using the instructions in Section - 2.1.3, "How to Get MySQL." - - 5. Unpack the distribution into the current directory: -shell> gunzip < /path/to/mysql-VERSION.tar.gz | tar xvf - - This command creates a directory named mysql-VERSION. - With GNU tar, no separate invocation of gunzip is necessary. - You can use the following alternative command to uncompress - and extract the distribution: -shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz - - 6. Change location into the top-level directory of the unpacked - distribution: -shell> cd mysql-VERSION - Note that currently you must configure and build MySQL from - this top-level directory. You cannot build it in a different - directory. - - 7. Configure the release and compile everything: -shell> ./configure --prefix=/usr/local/mysql -shell> make - When you run configure, you might want to specify other - options. Run ./configure --help for a list of options. Section - 2.3.2, "Typical configure Options," discusses some of the more - useful options. - If configure fails and you are going to send mail to a MySQL - mailing list to ask for assistance, please include any lines - from config.log that you think can help solve the problem. - Also include the last couple of lines of output from - configure. To file a bug report, please use the instructions - in Section 1.7, "How to Report Bugs or Problems." - If the compile fails, see Section 2.3.4, "Dealing with - Problems Compiling MySQL," for help. - - 8. Install the distribution: -shell> make install - You might need to run this command as root. - If you want to set up an option file, use one of those present - in the support-files directory as a template. For example: -shell> cp support-files/my-medium.cnf /etc/my.cnf - You might need to run this command as root. - If you want to configure support for InnoDB tables, you should - edit the /etc/my.cnf file, remove the # character before the - option lines that start with innodb_..., and modify the option - values to be what you want. See Section 4.2.3.3, "Using Option - Files," and Section 13.6.2, "InnoDB Configuration." - - 9. Change location into the installation directory: -shell> cd /usr/local/mysql - 10. If you ran the make install command as root, the installed - files will be owned by root. Ensure that the installation is - accessible to mysql by executing the following commands as - root in the installation directory: -shell> chown -R mysql . -shell> chgrp -R mysql . - The first command changes the owner attribute of the files to - the mysql user. The second changes the group attribute to the - mysql group. - 11. If you have not installed MySQL before, you must create the - MySQL data directory and initialize the grant tables: -shell> bin/mysql_install_db --user=mysql - If you run the command as root, include the --user option as - shown. If you run the command while logged in as mysql, you - can omit the --user option. - The command should create the data directory and its contents - with mysql as the owner. - After using mysql_install_db to create the grant tables for - MySQL, you must restart the server manually. The mysqld_safe - command to do this is shown in a later step. - 12. Most of the MySQL installation can be owned by root if you - like. The exception is that the data directory must be owned - by mysql. To accomplish this, run the following commands as - root in the installation directory: -shell> chown -R root . -shell> chown -R mysql var - 13. If you want MySQL to start automatically when you boot your - machine, you can copy support-files/mysql.server to the - location where your system has its startup files. More - information can be found in the support-files/mysql.server - script itself; see also Section 2.13.1.2, "Starting and - Stopping MySQL Automatically." - 14. You can set up new accounts using the bin/mysql_setpermission - script if you install the DBI and DBD::mysql Perl modules. See - Section 4.6.14, "mysql_setpermission --- Interactively Set - Permissions in Grant Tables." For Perl module installation - instructions, see Section 2.15, "Perl Installation Notes." - - After everything has been installed, you should test your - distribution. To start the MySQL server, use the following - command: -shell> /usr/local/mysql/bin/mysqld_safe --user=mysql & - - If you run the command as root, you should use the --user option - as shown. The value of the option is the name of the login account - that you created in the first step to use for running the server. - If you run the command while logged in as that user, you can omit - the --user option. - - If the command fails immediately and prints mysqld ended, you can - find some information in the host_name.err file in the data - directory. - - More information about mysqld_safe is given in Section 4.3.2, - "mysqld_safe --- MySQL Server Startup Script." - -Note - - The accounts that are listed in the MySQL grant tables initially - have no passwords. After starting the server, you should set up - passwords for them using the instructions in Section 2.13, - "Post-Installation Setup and Testing." - -2.3.2. Typical configure Options - - The configure script gives you a great deal of control over how - you configure a MySQL source distribution. Typically you do this - using options on the configure command line. You can also affect - configure using certain environment variables. See Section 2.14, - "Environment Variables." For a full list of options supported by - configure, run this command: -shell> ./configure --help - - A list of the available configure options is provided in the table - below. - - Table 2.1. Build (configure) Reference - Formats Description Default Introduced Removed - --bindir=DIR User executables EPREFIX/bin - --build=BUILD Configure for building on BUILD guessed - --cache-file=FILE Cache test results in FILE disabled - -C Alias for `--cache-file=config.cache' - --config-cache - --datadir=DIR Read-only architecture-independent data PREFIX/share - - --disable-FEATURE Do not include FEATURE - --disable-dependency-tracking Disable dependency tracking - --disable-grant-options Disable GRANT options - --disable-largefile Omit support for large files - --disable-libtool-lock Disable libtool lock - --disable-thread-safe-client Compile the client without threads - 5.1.7 - --enable-FEATURE Enable FEATURE - --enable-assembler Use assembler versions of some string functions - if available - --enable-debug-sync Compile in Debug Sync facility 5.1.41 - --enable-dependency-tracking Do not reject slow dependency - extractors - --enable-fast-install Optimize for fast installation yes - --enable-local-infile Enable LOAD DATA LOCAL INFILE disabled - --enable-shared Build shared libraries yes - --enable-static Build static libraries yes - --enable-thread-safe-client Compile the client with threads - --exec-prefix=EPREFIX Install architecture-dependent files in - EPREFIX - -h Display this help and exit - --help - --help=short Display options specific to this package - --help=recursive Display the short help of all the included - packages - --host=HOST Cross-compile to build programs to run on HOST - --includedir=DIR C header files PREFIX/include - --infodir=DIR Info documentation PREFIX/info - --libdir=DIR Object code libraries EPREFIX/lib - --libexecdir=DIR Program executables EPREFIX/libexec - --localstatedir=DIR Modifiable single-machine data PREFIX/var - --mandir=DIR man documentation PREFIX/man - -n Do not create output files - --no-create - --oldincludedir=DIR C header files for non-gcc /usr/include - --prefix=PREFIX Install architecture-independent files in PREFIX - - --program-prefix=PREFIX Prepend PREFIX to installed program names - - --program-suffix=SUFFIX Append SUFFIX to installed program names - - --program-transform-name=PROGRAM run sed PROGRAM on installed - program names - -q Do not print `checking...' messages - --quiet - --sbindir=DIR System admin executables EPREFIX/sbin - --sharedstatedir=DIR Modifiable architecture-independent data - PREFIX/com - --srcdir=DIR Find the sources in DIR configure directory or .. - --sysconfdir=DIR Read-only single-machine data PREFIX/etc - --target=TARGET Configure for building compilers for TARGET - -V Display version information and exit - --version - --with-PACKAGE Use PACKAGE - --with-archive-storage-engine Enable the Archive Storage Engine no - - --with-atomic-ops Implement atomic operations using pthread - rwlocks or atomic CPU instructions for multi-processor 5.1.12 - --with-berkeley-db Use BerkeleyDB located in DIR no - --with-berkeley-db-includes Find Berkeley DB headers in DIR - --with-berkeley-db-libs Find Berkeley DB libraries in DIR - --with-big-tables Support tables with more than 4 G rows even on - 32 bit platforms - --with-blackhole-storage-engine Enable the Blackhole Storage - Engine no - --with-charset Default character set - --with-client-ldflags Extra linking arguments for clients - --with-collation Default collation - --with-comment Comment about compilation environment - --with-csv-storage-engine Enable the CSV Storage Engine yes - --with-darwin-mwcc Use Metrowerks CodeWarrior wrappers on OS - X/Darwin - --with-debug Add debug code 5.1.7 - --with-debug=full Add debug code (adds memory checker, very slow) - - --with-embedded-privilege-control Build parts to check user's - privileges (only affects embedded library) - --with-embedded-server Build the embedded server - --with-error-inject Enable error injection in MySQL Server - 5.1.11 - --with-example-storage-engine Enable the Example Storage Engine no - - --with-extra-charsets Use charsets in addition to default - --with-fast-mutexes Compile with fast mutexes enabled 5.1.5 - --with-federated-storage-engine Enable federated storage engine no - 5.1.3 5.1.9 - --with-gnu-ld Assume the C compiler uses GNU ld no - --with-innodb Enable innobase storage engine no 5.1.3 5.1.9 - --with-lib-ccflags Extra CC options for libraries - --with-libwrap=DIR Compile in libwrap (tcp_wrappers) support - --with-low-memory Try to use less memory to compile to avoid - memory limitations - --with-machine-type Set the machine type, like "powerpc" - --with-max-indexes=N Sets the maximum number of indexes per table - 64 - --with-mysqld-ldflags Extra linking arguments for mysqld - --with-mysqld-libs Extra libraries to link with for mysqld - --with-mysqld-user What user the mysqld daemon shall be run as - - --with-mysqlmanager Build the mysqlmanager binary Build if server - is built - --with-named-curses-libs Use specified curses libraries - --with-named-thread-libs Use specified thread libraries - --with-ndb-ccflags Extra CC options for ndb compile - --with-ndb-docs Include the NDB Cluster ndbapi and mgmapi - documentation - --with-ndb-port Port for NDB Cluster management server - --with-ndb-port-base Port for NDB Cluster management server - --with-ndb-sci=DIR Provide MySQL with a custom location of sci - library - --with-ndb-test Include the NDB Cluster ndbapi test programs - --with-ndbcluster Include the NDB Cluster table handler no - --with-openssl=DIR Include the OpenSSL support - --with-openssl-includes Find OpenSSL headers in DIR - --with-openssl-libs Find OpenSSL libraries in DIR - --with-other-libc=DIR Link against libc and other standard - libraries installed in the specified nonstandard location - --with-pic Try to use only PIC/non-PIC objects Use both - --with-plugin-PLUGIN Forces the named plugin to be linked into - mysqld statically 5.1.11 - --with-plugins Plugins to include in mysqld none 5.1.11 - --with-pstack Use the pstack backtrace library - --with-pthread Force use of pthread library - --with-row-based-replication Include row-based replication 5.1.5 - 5.1.6 - --with-server-suffix Append value to the version string - --with-ssl=DIR Include SSL support 5.1.11 - --with-system-type Set the system type, like "sun-solaris10" - --with-tags Include additional configurations automatic - --with-tcp-port Which port to use for MySQL services 3306 - --with-unix-socket-path Where to put the unix-domain socket - --with-yassl Include the yaSSL support - --with-zlib-dir=no|bundled|DIR Provide MySQL with a custom - location of compression library - --without-PACKAGE Do not use PACKAGE - --without-bench Skip building of the benchmark suite - --without-debug Build a production version without debugging code - - --without-docs Skip building of the documentation - --without-extra-tools Skip building utilities in the tools - directory - --without-geometry Do not build geometry-related parts - --without-libedit Use system libedit instead of bundled copy - --without-man Skip building of the man pages - --without-ndb-binlog Disable ndb binlog 5.1.6 - --without-ndb-debug Disable special ndb debug features - --without-plugin-PLUGIN Exclude PLUGIN 5.1.11 - --without-query-cache Do not build query cache - --without-readline Use system readline instead of bundled copy - - --without-row-based-replication Don't include row-based - replication 5.1.7 5.1.14 - --without-server Only build the client - --without-uca Skip building of the national Unicode collations - - Some of the configure options available are described here. For - options that may be of use if you have difficulties building - MySQL, see Section 2.3.4, "Dealing with Problems Compiling MySQL." - - * To compile just the MySQL client libraries and client programs - and not the server, use the --without-server option: -shell> ./configure --without-server - If you have no C++ compiler, some client programs such as - mysql cannot be compiled because they require C++.. In this - case, you can remove the code in configure that tests for the - C++ compiler and then run ./configure with the - --without-server option. The compile step should still try to - build all clients, but you can ignore any warnings about files - such as mysql.cc. (If make stops, try make -k to tell it to - continue with the rest of the build even if errors occur.) - - * If you want to build the embedded MySQL library (libmysqld.a), - use the --with-embedded-server option. - - * If you don't want your log files and database directories - located under /usr/local/var, use a configure command - something like one of these: -shell> ./configure --prefix=/usr/local/mysql -shell> ./configure --prefix=/usr/local \ - --localstatedir=/usr/local/mysql/data - The first command changes the installation prefix so that - everything is installed under /usr/local/mysql rather than the - default of /usr/local. The second command preserves the - default installation prefix, but overrides the default - location for database directories (normally /usr/local/var) - and changes it to /usr/local/mysql/data. - You can also specify the installation directory and data - directory locations at server startup time by using the - --basedir and --datadir options. These can be given on the - command line or in an MySQL option file, although it is more - common to use an option file. See Section 4.2.3.3, "Using - Option Files." - - * This option specifies the port number on which the server - listens for TCP/IP connections. The default is port 3306. To - listen on a different port, use a configure command like this: -shell> ./configure --with-tcp-port=3307 - - * If you are using Unix and you want the MySQL socket file - location to be somewhere other than the default location - (normally in the directory /tmp or /var/run), use a configure - command like this: -shell> ./configure \ - --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock - The socket file name must be an absolute path name. You can - also change the location of mysql.sock at server startup by - using a MySQL option file. See Section B.5.4.5, "How to - Protect or Change the MySQL Unix Socket File." - - * If you want to compile statically linked programs (for - example, to make a binary distribution, to get better - performance, or to work around problems with some Red Hat - Linux distributions), run configure like this: -shell> ./configure --with-client-ldflags=-all-static \ - --with-mysqld-ldflags=-all-static - - * If you are using gcc and don't have libg++ or libstdc++ - installed, you can tell configure to use gcc as your C++ - compiler: -shell> CC=gcc CXX=gcc ./configure - When you use gcc as your C++ compiler, it does not attempt to - link in libg++ or libstdc++. This may be a good thing to do - even if you have those libraries installed. Some versions of - them have caused strange problems for MySQL users in the past. - The following list indicates some compilers and environment - variable settings that are commonly used with each one. - - + gcc 2.7.2: -CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors" - - + gcc 2.95.2: -CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \ --felide-constructors -fno-exceptions -fno-rtti" - - + pgcc 2.90.29 or newer: -CFLAGS="-O3 -mpentiumpro -mstack-align-double" CXX=gcc \ -CXXFLAGS="-O3 -mpentiumpro -mstack-align-double \ --felide-constructors -fno-exceptions -fno-rtti" - In most cases, you can get a reasonably optimized MySQL binary - by using the options from the preceding list and adding the - following options to the configure line: ---prefix=/usr/local/mysql --enable-assembler \ ---with-mysqld-ldflags=-all-static - The full configure line would, in other words, be something - like the following for all recent gcc versions: -CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \ --felide-constructors -fno-exceptions -fno-rtti" ./configure \ ---prefix=/usr/local/mysql --enable-assembler \ ---with-mysqld-ldflags=-all-static - The binaries we provide on the MySQL Web site at - http://dev.mysql.com/downloads/ are all compiled with full - optimization and should be perfect for most users. See Section - 2.2, "Installing MySQL from Generic Binaries on Unix/Linux." - There are some configuration settings you can tweak to build - an even faster binary, but these are only for advanced users. - See Section 7.5.1, "How Compiling and Linking Affects the - Speed of MySQL." - If the build fails and produces errors about your compiler or - linker not being able to create the shared library - libmysqlclient.so.N (where N is a version number), you can - work around this problem by giving the --disable-shared option - to configure. In this case, configure does not build a shared - libmysqlclient.so.N library. - - * By default, MySQL uses the latin1 (cp1252 West European) - character set. To change the default set, use the - --with-charset option: -shell> ./configure --with-charset=CHARSET - CHARSET may be one of binary, armscii8, ascii, big5, cp1250, - cp1251, cp1256, cp1257, cp850, cp852, cp866, cp932, dec8, - eucjpms, euckr, gb2312, gbk, geostd8, greek, hebrew, hp8, - keybcs2, koi8r, koi8u, latin1, latin2, latin5, latin7, macce, - macroman, sjis, swe7, tis620, ucs2, ujis, utf8. (Additional - character sets might be available. Check the output from - ./configure --help for the current list.) - The default collation may also be specified. MySQL uses the - latin1_swedish_ci collation by default. To change this, use - the --with-collation option: -shell> ./configure --with-collation=COLLATION - To change both the character set and the collation, use both - the --with-charset and --with-collation options. The collation - must be a legal collation for the character set. (Use the SHOW - COLLATION statement to determine which collations are - available for each character set.) - With the configure option --with-extra-charsets=LIST, you can - define which additional character sets should be compiled into - the server. LIST is one of the following: - - + A list of character set names separated by spaces - - + complex to include all character sets that can't be - dynamically loaded - - + all to include all character sets into the binaries - Clients that want to convert characters between the server and - the client should use the SET NAMES statement. See Section - 5.1.5, "Session System Variables," and Section 9.1.4, - "Connection Character Sets and Collations." - - * To configure MySQL with debugging code, use the --with-debug - option: -shell> ./configure --with-debug - This causes a safe memory allocator to be included that can - find some errors and that provides output about what is - happening. See MySQL Internals: Porting - (http://forge.mysql.com/wiki/MySQL_Internals_Porting). - As of MySQL 5.1.12, using --with-debug to configure MySQL with - debugging support enables you to use the - --debug-dbug="d,parser_debug" option when you start the server. - This causes the Bison parser that is used to process SQL - statements to dump a parser trace to the server's standard - error output. Typically, this output is written to the error - log. - - * To cause the Debug Sync facility to be compiled into the - server, use the --enable-debug-sync option. This facility is - used for testing and debugging. When compiled in, Debug Sync - is disabled by default. To enable it, start mysqld with the - --debug-sync-timeout=N option, where N is a timeout value - greater than 0. (The default value is 0, which disables Debug - Sync.) N becomes the default timeout for individual - synchronization points. - Debug Sync is also compiled in if you configure with the - --with-debug option (which implies --enable-debug-sync), - unless you also use the --disable-debug-sync option. - For a description of the Debug Sync facility and how to use - synchronization points, see MySQL Internals: Test - Synchronization - (http://forge.mysql.com/wiki/MySQL_Internals_Test_Synchronizat - ion). - The --enable-debug-sync and --disable-debug-sync options were - added in MySQL 5.1.41. - - * If your client programs are using threads, you must compile a - thread-safe version of the MySQL client library with the - --enable-thread-safe-client configure option. This creates a - libmysqlclient_r library with which you should link your - threaded applications. See Section 21.9.16.2, "How to Make a - Threaded Client." - - * Some features require that the server be built with - compression library support, such as the COMPRESS() and - UNCOMPRESS() functions, and compression of the client/server - protocol. The --with-zlib-dir=no|bundled|DIR option provides - control over compression library support. The value no - explicitly disables compression support. bundled causes the - zlib library bundled in the MySQL sources to be used. A DIR - path name specifies the directory in which to find the - compression library sources. - - * It is possible to build MySQL with large table support using - the --with-big-tables option. - This option causes the variables that store table row counts - to be declared as unsigned long long rather than unsigned - long. This enables tables to hold up to approximately - 1.844E+19 ((2^32)^2) rows rather than 2^32 (~4.295E+09) rows. - Previously it was necessary to pass -DBIG_TABLES to the - compiler manually in order to enable this feature. - - * Run configure with the --disable-grant-options option to cause - the --bootstrap, --skip-grant-tables, and --init-file options - for mysqld to be disabled. For Windows, the configure.js - script recognizes the DISABLE_GRANT_OPTIONS flag, which has - the same effect. The capability is available as of MySQL - 5.1.15. - - * This option allows MySQL Community Server features to be - enabled. Additional options may be required for individual - features, such as --enable-profiling to enable statement - profiling. This option was added in MySQL 5.1.24. It is - enabled by default as of MySQL 5.1.28; to disable it, use - --disable-community-features. - - * When given with --enable-community-features, the - --enable-profiling option enables the statement profiling - capability exposed by the SHOW PROFILE and SHOW PROFILES - statements. (See Section 12.4.5.33, "SHOW PROFILES Syntax.") - This option was added in MySQL 5.1.24. It is enabled by - default as of MySQL 5.1.28; to disable it, use - --disable-profiling. - - * See Section 2.1, "General Installation Guidance," for options - that pertain to particular operating systems. - - * See Section 5.5.6.2, "Using SSL Connections," for options that - pertain to configuring MySQL to support secure (encrypted) - connections. - - * Several configure options apply to plugin selection and - building: ---with-plugins=PLUGIN[,PLUGIN]... ---with-plugins=GROUP ---with-plugin-PLUGIN ---without-plugin-PLUGIN - PLUGIN is an individual plugin name such as csv or archive. - As shorthand, GROUP is a configuration group name such as none - (select no plugins) or all (select all plugins). - You can build a plugin as static (compiled into the server) or - dynamic (built as a dynamic library that must be installed - using the INSTALL PLUGIN statement before it can be used). - Some plugins might not support static or dynamic build. - configure --help shows the following information pertaining to - plugins: - - + The plugin-related options - - + The names of all available plugins - - + For each plugin, a description of its purpose, which - build types it supports (static or dynamic), and which - plugin groups it is a part of. - --with-plugins can take a list of one or more plugin names - separated by commas, or a plugin group name. The named plugins - are configured to be built as static plugins. - --with-plugin-PLUGIN configures the given plugin to be built - as a static plugin. - --without-plugin-PLUGIN disables the given plugin from being - built. - If a plugin is named both with a --with and --without option, - the result is undefined. - For any plugin that is not explicitly selected or disabled, it - is selected to be built dynamically if it supports dynamic - build, and not built if it does not support dynamic build. - (Thus, in the case that no plugin options are given, all - plugins that support dynamic build are selected to be built as - dynamic plugins. Plugins that do not support dynamic build are - not built.) - -2.3.3. Installing from the Development Source Tree - -Caution - - You should read this section only if you are interested in helping - us test our new code. If you just want to get MySQL up and running - on your system, you should use a standard release distribution - (either a binary or source distribution). - - To obtain the most recent development source tree, you must have - Bazaar installed. You can obtain Bazaar from the Bazaar VCS Web - site (http://bazaar-vcs.org). Bazaar is supported by any platform - that supports Python, and is therefore compatible with any Linux, - Unix, Windows or Mac OS X host. Instructions for downloading and - installing Bazaar on the different platforms are available on the - Bazaar Web site. - - All MySQL projects are hosted on Launchpad - (http://launchpad.net/). MySQL projects, including MySQL server, - MySQL Workbench, and others are available from the Sun/MySQL - Engineering (http://launchpad.net/~mysql) page. For the - repositories related only to MySQL server, see the MySQL Server - (http://launchpad.net/mysql-server) page. - - To build under Unix/Linux, you must have the following tools - installed: - - * GNU make, available from http://www.gnu.org/software/make/. - Although some platforms come with their own make - implementations, it is highly recommended that you use GNU - make. It may already be available on your system as gmake. - - * autoconf 2.58 (or newer), available from - http://www.gnu.org/software/autoconf/. - - * automake 1.8.1, available from - http://www.gnu.org/software/automake/. - - * libtool 1.5, available from - http://www.gnu.org/software/libtool/. - - * m4, available from http://www.gnu.org/software/m4/. - - * bison, available from http://www.gnu.org/software/bison/. You - should use the latest version of bison where possible. Version - 1.75 and version 2.1 are known to work. There have been - reported problems with bison 1.875. If you experience - problems, upgrade to a later, rather than earlier, version. - Versions of bison older than 1.75 may report this error: -sql_yacc.yy:#####: fatal error: maximum table size (32767) exceeded - The maximum table size is not actually exceeded; the error is - caused by bugs in older versions of bison. - - To build under Windows you must have Microsoft Visual C++ 2005 - Express Edition, Visual Studio .Net 2003 (7.1), or Visual Studio - 2005 (8.0) compiler system. - - Once the necessary tools are installed, you must create a local - branch of the MySQL source code on your machine: - - 1. To obtain a copy of the MySQL source code, you must create a - new Bazaar branch. If you do not already have a Bazaar - repository directory set up, you need to initialize a new - directory: -shell> mkdir mysql-server -shell> bzr init-repo --trees mysql-server - - 2. Once you have an initialized directory, you can branch from - the public MySQL server repositories to create a local source - tree. To create a branch of a specific version: -shell> cd mysql-server -shell> bzr branch lp:mysql-server/5.1 mysql-5.1 - - 3. The initial download will take some time to complete, - depending on the speed of your connection. Please be patient. - Once you have downloaded the first tree, additional trees - should take significantly less time to download. - - 4. When building from the Bazaar branch, you may want to create a - copy of your active branch so that you can make configuration - and other changes without affecting the original branch - contents. You can achieve this by branching from the original - branch: -shell> bzr branch mysql-5.1 mysql-5.1-build - - 5. To obtain changes made after you have set up the branch - initially, update it using the pull option periodically. Use - this command in the top-level directory of the local copy: -shell> bzr pull - You can examine the changeset comments for the tree by using - the log option to bzr: -shell> bzr log - You can also browse changesets, comments, and source code - online. To browse this information for MySQL 5.1, go to the - Launchpad MySQL Server (http://launchpad.net/mysql-server) - page. - If you see diffs (changes) or code that you have a question - about, do not hesitate to send email to the MySQL internals - mailing list. See Section 1.6.1, "MySQL Mailing Lists." Also, - if you think you have a better idea on how to do something, - send an email message to the list with a patch. - - After you have the local branch, you can build MySQL server from - the source code. On Windows, the build process is different from - Unix/Linux: see Section 2.5.10, "Installing MySQL from Source on - Windows." - - On Unix/Linux, use the autoconf system to create the configure - script so that you can configure the build environment before - building. The following example shows the typical commands - required to build MySQL from a source tree. - - 1. Change location to the top-level directory of the source tree; - replace mysql-5.1 with the appropriate directory name. -shell> cd mysql-5.1 - - 2. Prepare the source tree for configuration. - Prior to MySQL 5.1.12, you must separately configure the - InnoDB storage engine. Run the following command from the main - source directory: -shell> (cd storage/innobase; autoreconf --force --install) - You can omit the previous command for MySQL 5.1.12 and later, - or if you do not require InnoDB support. - Prepare the remainder of the source tree: -shell> autoreconf --force --install - As an alternative to the preceding autoreconf command, you can - use BUILD/autorun.sh, which acts as a shortcut for the - following sequence of commands: -shell> aclocal; autoheader -shell> libtoolize --automake --force -shell> automake --force --add-missing; autoconf - If you get some strange errors during this stage, verify that - you have the correct version of libtool installed. - - 3. Configure the source tree and compile MySQL: -shell> ./configure # Add your favorite options here -shell> make - For a description of some configure options, see Section - 2.3.2, "Typical configure Options." - A collection of our standard configuration scripts is located - in the BUILD/ subdirectory. For example, you may find it more - convenient to use the BUILD/compile-pentium-debug script than - the preceding set of shell commands. To compile on a different - architecture, modify the script by removing flags that are - Pentium-specific, or use another script that may be more - appropriate. These scripts are provided on an "as-is" basis. - They are not officially maintained and their contents may - change from release to release. - - 4. When the build is done, run make install. Be careful with this - on a production machine; the command may overwrite your live - release installation. If you already have MySQL installed and - do not want to overwrite it, run ./configure with values for - the --prefix, --with-tcp-port, and --with-unix-socket-path - options different from those used for your production server. - - 5. Play hard with your new installation and try to make the new - features crash. Start by running make test. See Section - 22.1.2, "MySQL Test Suite." - - 6. If you have gotten to the make stage, but the distribution - does not compile, please enter the problem into our bugs - database using the instructions given in Section 1.7, "How to - Report Bugs or Problems." If you have installed the latest - versions of the required GNU tools, and they crash trying to - process our configuration files, please report that also. - However, if you get a command not found error or a similar - problem for aclocal, configure, or other required tools, do - not report it. Instead, make sure that all the required tools - are installed and that your PATH variable is set correctly so - that your shell can find them. - -2.3.4. Dealing with Problems Compiling MySQL - - All MySQL programs compile cleanly for us with no warnings on - Solaris or Linux using gcc. On other systems, warnings may occur - due to differences in system include files. See Section 2.3.5, - "MIT-pthreads Notes," for warnings that may occur when using - MIT-pthreads. For other problems, check the following list. - - The solution to many problems involves reconfiguring. If you do - need to reconfigure, take note of the following: - - * If configure is run after it has previously been run, it may - use information that was gathered during its previous - invocation. This information is stored in config.cache. When - configure starts up, it looks for that file and reads its - contents if it exists, on the assumption that the information - is still correct. That assumption is invalid when you - reconfigure. - - * Each time you run configure, you must run make again to - recompile. However, you may want to remove old object files - from previous builds first because they were compiled using - different configuration options. - - To prevent old configuration information or object files from - being used, run these commands before re-running configure: -shell> rm config.cache -shell> make clean - - Alternatively, you can run make distclean. - - The following list describes some of the problems when compiling - MySQL that have been found to occur most often: - - * If you get errors such as the ones shown here when compiling - sql_yacc.cc, you probably have run out of memory or swap - space: -Internal compiler error: program cc1plus got fatal signal 11 -Out of virtual memory -Virtual memory exhausted - The problem is that gcc requires a huge amount of memory to - compile sql_yacc.cc with inline functions. Try running - configure with the --with-low-memory option: -shell> ./configure --with-low-memory - This option causes -fno-inline to be added to the compile line - if you are using gcc and -O0 if you are using something else. - You should try the --with-low-memory option even if you have - so much memory and swap space that you think you can't - possibly have run out. This problem has been observed to occur - even on systems with generous hardware configurations, and the - --with-low-memory option usually fixes it. - - * By default, configure picks c++ as the compiler name and GNU - c++ links with -lg++. If you are using gcc, that behavior can - cause problems during configuration such as this: -configure: error: installation or configuration problem: -C++ compiler cannot create executables. - You might also observe problems during compilation related to - g++, libg++, or libstdc++. - One cause of these problems is that you may not have g++, or - you may have g++ but not libg++, or libstdc++. Take a look at - the config.log file. It should contain the exact reason why - your C++ compiler didn't work. To work around these problems, - you can use gcc as your C++ compiler. Try setting the - environment variable CXX to "gcc -O3". For example: -shell> CXX="gcc -O3" ./configure - This works because gcc compiles C++ source files as well as - g++ does, but does not link in libg++ or libstdc++ by default. - Another way to fix these problems is to install g++, libg++, - and libstdc++. However, do not use libg++ or libstdc++ with - MySQL because this only increases the binary size of mysqld - without providing any benefits. Some versions of these - libraries have also caused strange problems for MySQL users in - the past. - - * If your compile fails with errors such as any of the - following, you must upgrade your version of make to GNU make: -making all in mit-pthreads -make: Fatal error in reader: Makefile, line 18: -Badly formed macro assignment - Or: -make: file `Makefile' line 18: Must be a separator (: - Or: -pthread.h: No such file or directory - Solaris and FreeBSD are known to have troublesome make - programs. - GNU make 3.75 is known to work. - - * If you want to define flags to be used by your C or C++ - compilers, do so by adding the flags to the CFLAGS and - CXXFLAGS environment variables. You can also specify the - compiler names this way using CC and CXX. For example: -shell> CC=gcc -shell> CFLAGS=-O3 -shell> CXX=gcc -shell> CXXFLAGS=-O3 -shell> export CC CFLAGS CXX CXXFLAGS - See Section 2.2, "Installing MySQL from Generic Binaries on - Unix/Linux," for a list of flag definitions that have been - found to be useful on various systems. - - * If you get errors such as those shown here when compiling - mysqld, configure did not correctly detect the type of the - last argument to accept(), getsockname(), or getpeername(): -cxx: Error: mysqld.cc, line 645: In this statement, the referenced - type of the pointer value ''length'' is ''unsigned long'', - which is not compatible with ''int''. -new_sock = accept(sock, (struct sockaddr *)&cAddr, &length); - To fix this, edit the config.h file (which is generated by - configure). Look for these lines: -/* Define as the base type of the last arg to accept */ -#define SOCKET_SIZE_TYPE XXX - Change XXX to size_t or int, depending on your operating - system. (You must do this each time you run configure because - configure regenerates config.h.) - - * The sql_yacc.cc file is generated from sql_yacc.yy. Normally, - the build process does not need to create sql_yacc.cc because - MySQL comes with a pre-generated copy. However, if you do need - to re-create it, you might encounter this error: -"sql_yacc.yy", line xxx fatal: default action causes potential... - This is a sign that your version of yacc is deficient. You - probably need to install bison (the GNU version of yacc) and - use that instead. - - * On Debian Linux 3.0, you need to install gawk instead of the - default mawk. - - * If you need to debug mysqld or a MySQL client, run configure - with the --with-debug option, and then recompile and link your - clients with the new client library. See MySQL Internals: - Porting (http://forge.mysql.com/wiki/MySQL_Internals_Porting). - - * If you get a compilation error on Linux (for example, SuSE - Linux 8.1 or Red Hat Linux 7.3) similar to the following one, - you probably do not have g++ installed: -libmysql.c:1329: warning: passing arg 5 of `gethostbyname_r' from -incompatible pointer type -libmysql.c:1329: too few arguments to function `gethostbyname_r' -libmysql.c:1329: warning: assignment makes pointer from integer -without a cast -make[2]: *** [libmysql.lo] Error 1 - By default, the configure script attempts to determine the - correct number of arguments by using g++ (the GNU C++ - compiler). This test yields incorrect results if g++ is not - installed. There are two ways to work around this problem: - - + Make sure that the GNU C++ g++ is installed. On some - Linux distributions, the required package is called gpp; - on others, it is named gcc-c++. - - + Use gcc as your C++ compiler by setting the CXX - environment variable to gcc: -export CXX="gcc" - You must run configure again after making either of those - changes. - -2.3.5. MIT-pthreads Notes - - This section describes some of the issues involved in using - MIT-pthreads. - - On Linux, you should not use MIT-pthreads. Use the installed - LinuxThreads implementation instead. See Section 2.6, "Installing - MySQL on Linux." - - If your system does not provide native thread support, you should - build MySQL using the MIT-pthreads package. This includes older - FreeBSD systems, SunOS 4.x, Solaris 2.4 and earlier, and some - others. See Section 2.1, "General Installation Guidance." - - MIT-pthreads is not part of the MySQL 5.1 source distribution. If - you require this package, you need to download it separately from - http://dev.mysql.com/Downloads/Contrib/pthreads-1_60_beta6-mysql.t - ar.gz - - After downloading, extract this source archive into the top level - of the MySQL source directory. It creates a new subdirectory named - mit-pthreads. - - * On most systems, you can force MIT-pthreads to be used by - running configure with the --with-mit-threads option: -shell> ./configure --with-mit-threads - Building in a nonsource directory is not supported when using - MIT-pthreads because we want to minimize our changes to this - code. - - * The checks that determine whether to use MIT-pthreads occur - only during the part of the configuration process that deals - with the server code. If you have configured the distribution - using --without-server to build only the client code, clients - do not know whether MIT-pthreads is being used and use Unix - socket file connections by default. Because Unix socket files - do not work under MIT-pthreads on some platforms, this means - you need to use -h or --host with a value other than localhost - when you run client programs. - - * When MySQL is compiled using MIT-pthreads, system locking is - disabled by default for performance reasons. You can tell the - server to use system locking with the --external-locking - option. This is needed only if you want to be able to run two - MySQL servers against the same data files, but that is not - recommended, anyway. - - * Sometimes the pthread bind() command fails to bind to a socket - without any error message (at least on Solaris). The result is - that all connections to the server fail. For example: -shell> mysqladmin version -mysqladmin: connect to server at '' failed; -error: 'Can't connect to mysql server on localhost (146)' - The solution to this problem is to kill the mysqld server and - restart it. This has happened to us only when we have forcibly - stopped the server and restarted it immediately. - - * With MIT-pthreads, the sleep() system call isn't interruptible - with SIGINT (break). This is noticeable only when you run - mysqladmin --sleep. You must wait for the sleep() call to - terminate before the interrupt is served and the process - stops. - - * When linking, you might receive warning messages like these - (at least on Solaris); they can be ignored: -ld: warning: symbol `_iob' has differing sizes: - (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4; -file /usr/lib/libc.so value=0x140); - /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken -ld: warning: symbol `__iob' has differing sizes: - (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4; -file /usr/lib/libc.so value=0x140); - /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken - - * Some other warnings also can be ignored: -implicit declaration of function `int strtoll(...)' -implicit declaration of function `int strtoul(...)' - - * We have not been able to make readline work with MIT-pthreads. - (This is not necessary, but may be of interest to some.) - -2.4. Upgrading or Downgrading MySQL - -2.4.1. Upgrading MySQL - - As a general rule, to upgrade from one release series to another, - you should go to the next series rather than skipping a series. To - upgrade from a release series previous to MySQL 5.0, upgrade to - each successive release series in turn until you have reached - MySQL 5.0, and then proceed with the upgrade to MySQL 5.1. For - example, if you currently are running MySQL 4.0 and wish to - upgrade to a newer series, upgrade to MySQL 4.1 first before - upgrading to 5.0, and so forth. For information on upgrading to - MySQL 5.0, see the MySQL 5.0 Reference Manual; for earlier - releases, see the MySQL 3.23, 4.0, 4.1 Reference Manual. - - If you perform a binary (in-place) upgrade without dumping and - reloading tables, you cannot upgrade directly from MySQL 4.1 to - 5.1. This occurs due to an incompatible change in the MyISAM table - index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and - repair all MyISAM tables (see Section 2.4.4, "Rebuilding or - Repairing Tables or Indexes"). Then upgrade from MySQL 5.0 to 5.1 - and check and repair your tables. - - To upgrade from MySQL 5.0 to 5.1, use the items in the following - checklist as a guide: - - * Before any upgrade, back up your databases, including the - mysql database that contains the grant tables. See Section - 6.2, "Database Backup Methods." - - * Read all the notes in Section 2.4.1.1, "Upgrading from MySQL - 5.0 to 5.1." These notes enable you to identify upgrade issues - that apply to your current MySQL installation. Some - incompatibilities discussed in that section require your - attention before upgrading. Others should be dealt with after - upgrading. - - * Read Appendix C, "MySQL Change History" as well, which - provides information about features that are new in MySQL 5.1 - or differ from those found in MySQL 5.0. - - * After you upgrade to a new version of MySQL, run mysql_upgrade - (see Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL - Upgrade"). This program checks your tables, and attempts to - repair them if necessary. It also updates your grant tables to - make sure that they have the current structure so that you can - take advantage of any new capabilities. (Some releases of - MySQL introduce changes to the structure of the grant tables - to add new privileges or features.) - - * If you are running MySQL Server on Windows, see Section 2.5.7, - "Upgrading MySQL on Windows." - - * If you are using replication, see Section 16.4.3, "Upgrading a - Replication Setup," for information on upgrading your - replication setup. - - * If you are upgrading an installation originally produced by - installing multiple RPM packages, it is best to upgrade all - the packages, not just some. For example, if you previously - installed the server and client RPMs, do not upgrade just the - server RPM. - - * As of MySQL 5.1.9, the mysqld-max server is included in binary - distributions. There is no separate MySQL-Max distribution. As - of MySQL 5.1.12, there is no mysqld-max server at all in - binary distributions. They contain a server that includes the - features previously included in mysqld-max. - - * If you have created a user-defined function (UDF) with a given - name and upgrade MySQL to a version that implements a new - built-in function with the same name, the UDF becomes - inaccessible. To correct this, use DROP FUNCTION to drop the - UDF, and then use CREATE FUNCTION to re-create the UDF with a - different nonconflicting name. The same is true if the new - version of MySQL implements a built-in function with the same - name as an existing stored function. See Section 8.2.4, - "Function Name Parsing and Resolution," for the rules - describing how the server interprets references to different - kinds of functions. - - You can always move the MySQL format files and data files between - different versions on systems with the same architecture as long - as you stay within versions for the same release series of MySQL. - - If you are cautious about using new versions, you can always - rename your old mysqld before installing a newer one. For example, - if you are using MySQL 5.0.13 and want to upgrade to 5.1.10, - rename your current server from mysqld to mysqld-5.0.13. If your - new mysqld then does something unexpected, you can simply shut it - down and restart with your old mysqld. - - If, after an upgrade, you experience problems with recompiled - client programs, such as Commands out of sync or unexpected core - dumps, you probably have used old header or library files when - compiling your programs. In this case, you should check the date - for your mysql.h file and libmysqlclient.a library to verify that - they are from the new MySQL distribution. If not, recompile your - programs with the new headers and libraries. - - If problems occur, such as that the new mysqld server does not - start or that you cannot connect without a password, verify that - you do not have an old my.cnf file from your previous - installation. You can check this with the --print-defaults option - (for example, mysqld --print-defaults). If this command displays - anything other than the program name, you have an active my.cnf - file that affects server or client operation. - - If your MySQL installation contains a large amount of data that - might take a long time to convert after an in-place upgrade, you - might find it useful to create a "dummy" database instance for - assessing what conversions might be needed and the work involved - to perform them. Make a copy of your MySQL instance that contains - a full copy of the mysql database, plus all other databases - without data. Run your upgrade procedure on this dummy instance to - see what actions might be needed so that you can better evaluate - the work involved when performing actual data conversion on your - original database instance. - - It is a good idea to rebuild and reinstall the Perl DBD::mysql - module whenever you install a new release of MySQL. The same - applies to other MySQL interfaces as well, such as PHP mysql - extensions and the Python MySQLdb module. - -2.4.1.1. Upgrading from MySQL 5.0 to 5.1 - - After upgrading a 5.0 installation to 5.0.10 or above, it is - necessary to upgrade your grant tables. Otherwise, creating stored - procedures and functions might not work. To perform this upgrade, - run mysql_upgrade. - -Note - - It is good practice to back up your data before installing any new - version of software. Although MySQL works very hard to ensure a - high level of quality, you should protect your data by making a - backup. - - To upgrade to 5.1 from any previous version, MySQL recommends that - you dump your tables with mysqldump before upgrading and reload - the dump file after upgrading. - - If you perform a binary (in-place) upgrade without dumping and - reloading tables, you cannot upgrade directly from MySQL 4.1 to - 5.1. This occurs due to an incompatible change in the MyISAM table - index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and - repair all MyISAM tables (see Section 2.4.4, "Rebuilding or - Repairing Tables or Indexes"). Then upgrade from MySQL 5.0 to 5.1 - and check and repair your tables. - - In general, you should do the following when upgrading from MySQL - 5.0 to 5.1: - - * Read all the items in the following sections to see whether - any of them might affect your applications: - - + Section 2.4.1, "Upgrading MySQL," has general update - information. - - + The items in the change lists found later in this section - enable you to identify upgrade issues that apply to your - current MySQL installation. - - + The MySQL 5.1 change history describes significant new - features you can use in 5.1 or that differ from those - found in MySQL 5.0. Some of these changes may result in - incompatibilities. See Section C.1, "Changes in Release - 5.1.x (Production)." - - * Note particularly any changes that are marked Known issue or - Incompatible change. These incompatibilities with earlier - versions of MySQL may require your attention before you - upgrade. - Our aim is to avoid these changes, but occasionally they are - necessary to correct problems that would be worse than an - incompatibility between releases. If any upgrade issue - applicable to your installation involves an incompatibility - that requires special handling, follow the instructions given - in the incompatibility description. Often this will involve a - dump and reload, or use of a statement such as CHECK TABLE or - REPAIR TABLE. - For dump and reload instructions, see Section 2.4.4, - "Rebuilding or Repairing Tables or Indexes." Any procedure - that involves REPAIR TABLE with the USE_FRM option must be - done before upgrading. Use of this statement with a version of - MySQL different from the one used to create the table (that - is, using it after upgrading) may damage the table. See - Section 12.4.2.6, "REPAIR TABLE Syntax." - - * After you upgrade to a new version of MySQL, run mysql_upgrade - (see Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL - Upgrade"). This program checks your tables, and attempts to - repair them if necessary. It also updates your grant tables to - make sure that they have the current structure so that you can - take advantage of any new capabilities. (Some releases of - MySQL introduce changes to the structure of the grant tables - to add new privileges or features.) - - * Check Section 2.4.3, "Checking Whether Tables or Indexes Must - Be Rebuilt," to see whether changes to table formats or to - character sets or collations were made between your current - version of MySQL and the version to which you are upgrading. - If so and these changes result in an incompatibility between - MySQL versions, you will need to upgrade the affected tables - using the instructions in Section 2.4.4, "Rebuilding or - Repairing Tables or Indexes." - - * If you are running MySQL Server on Windows, see Section 2.5.7, - "Upgrading MySQL on Windows." - - * If you are using replication, see Section 16.4.3, "Upgrading a - Replication Setup," for information on upgrading your - replication setup. - - If your MySQL installation contains a large amount of data that - might take a long time to convert after an in-place upgrade, you - might find it useful to create a "dummy" database instance for - assessing what conversions might be needed and the work involved - to perform them. Make a copy of your MySQL instance that contains - a full copy of the mysql database, plus all other databases - without data. Run your upgrade procedure on this dummy instance to - see what actions might be needed so that you can better evaluate - the work involved when performing actual data conversion on your - original database instance. - - MySQL Enterprise MySQL Enterprise subscribers will find more - information about upgrading in the Knowledge Base articles found - at Upgrading - (https://kb.mysql.com/search.php?cat=search&category=41). Access - to the MySQL Knowledge Base collection of articles is one of the - advantages of subscribing to MySQL Enterprise. For more - information, see - http://www.mysql.com/products/enterprise/advisors.html. - - The following lists describe changes that may affect applications - and that you should watch out for when upgrading to MySQL 5.1. - - Configuration Changes: - - * Before MySQL 5.1.11, to build MySQL from source with SSL - support enabled, you would invoke configure with either the - --with-openssl or --with-yassl option. In MySQL 5.1.11, those - options both have been replaced by the --with-ssl option. By - default, --with-ssl causes the bundled yaSSL library to be - used. To select OpenSSL instead, give the option as - --with-ssl=path, where path is the directory where the OpenSSL - header files and libraries are located. - - Server Changes: - - * Known issue: After a binary upgrade to MySQL 5.1 from a MySQL - 5.0 installation that contains ARCHIVE tables, accessing those - tables will cause the server to crash, even if you have run - mysql_upgrade or CHECK TABLE ... FOR UPGRADE. To work around - this problem, use mysqldump to dump all ARCHIVE tables before - upgrading, and reload them into MySQL 5.1 after upgrading. - - * Known issue: The fix for - Bug#23491: http://bugs.mysql.com/bug.php?id=23491 introduced a - problem with SHOW CREATE VIEW, which is used by mysqldump. - This causes an incompatibility when upgrading from versions - affected by that bug fix (MySQL 5.0.40 through 5.0.43, MySQL - 5.1.18 through 5.1.19): If you use mysqldump before upgrading - from an affected version and reload the data after upgrading - to a higher version, you must drop and recreate your views. - - * Known issue: Dumps performed by using mysqldump to generate a - dump file before the upgrade and reloading the file after - upgrading are subject to the following problem: - Before MySQL 5.0.40, mysqldump displays SPATIAL index - definitions using prefix lengths for the indexed columns. - These prefix lengths are accepted in MySQL 5.0, but not as of - MySQL 5.1. If you use mysqldump from versions of MySQL older - than 5.0.40, any table containing SPATIAL indexes will cause - an error when the dump file is reloaded into MySQL 5.1 or - higher. - For example, a table definition might look like this when - dumped in MySQL 5.0: -CREATE TABLE `t` ( - `g` geometry NOT NULL, - SPATIAL KEY `g` (`g`(32)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 - The SPATIAL index definition will not be accepted in MySQL - 5.1. To work around this, edit the dump file to remove the - prefix: -CREATE TABLE `t` ( - `g` geometry NOT NULL, - SPATIAL KEY `g` (`g`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 - Dump files can be large, so it may be preferable to dump table - definitions and data separately to make it easier to edit the - definitions: -shell> mysqldump --no-data other_args > definitions.sql -shell> mysqldump --no-create-info other_args > data.sql - Then edit definitions.sql before reloading definitions.sql and - data.sql, in that order. - If you upgrade to a version of MySQL 5.0 higher than 5.0.40 - before upgrading to MySQL 5.1, this problem does not occur. - - * Known issue: Before MySQL 5.1.30, the CHECK TABLE ... FOR - UPGRADE statement did not check for incompatible collation - changes made in MySQL 5.1.24. (This also affects mysqlcheck - and mysql_upgrade, which cause that statement to be executed.) - Prior to the fix made in 5.1.30, a binary upgrade (performed - without dumping tables with mysqldump before the upgrade and - reloading the dump file after the upgrade) would corrupt - tables. After the fix, CHECK TABLE ... FOR UPGRADE properly - detects the problem and warns about tables that need repair. - However, the fix is not backward compatible and can result in - a downgrading problem under these circumstances: - - 1. Perform a binary upgrade to a version of MySQL that - includes the fix. - - 2. Run CHECK TABLE ... FOR UPGRADE (or mysqlcheck or - mysql_upgrade) to upgrade tables. - - 3. Perform a binary downgrade to a version of MySQL that - does not include the fix. - The solution is to dump tables with mysqldump before the - downgrade and reload the dump file after the downgrade. - Alternatively, drop and recreate affected indexes. - - * Known issue: MySQL introduces encoding for table names that - have non-ASCII characters (see Section 8.2.3, "Mapping of - Identifiers to File Names"). After a binary upgrade from MySQL - 5.0 to 5.1 or higher, the server recognizes names that have - non-ASCII characters and adds a #mysql50# prefix to them. - As of MySQL 5.1.31, mysql_upgrade encodes these names by - executing the following command: -mysqlcheck --all-databases --check-upgrade --fix-db-names --fix-table --names - Prior to MySQL 5.1.31, mysql_upgrade does not execute this - command, so you should execute it manually if you have - database or table names that contain nonalphanumeric - characters. - Prior to MySQL 5.1.23, the mysqlcheck command does not perform - the name encoding for views. To work around this problem, drop - each affected view and recreate it. - mysqlcheck cannot fix names that contain literal instances of - the @ character that is used for encoding special characters. - If you have databases or tables that contain this character, - use mysqldump to dump them before upgrading to MySQL 5.1, and - then reload the dump file after upgrading. - - * Known issue: When upgrading from MySQL 5.0 to versions of 5.1 - prior to 5.1.23, running mysqlcheck (or mysql_upgrade, which - runs mysqlcheck) to upgrade tables fails for names that must - be written as quoted identifiers. To work around this problem, - rename each affected table to a name that does not require - quoting: -RENAME TABLE `tab``le_a` TO table_a; -RENAME TABLE `table b` TO table_b; - After renaming the tables, run the mysql_upgrade program. Then - rename the tables back to their original names: -RENAME TABLE table_a TO `tab``le_a`; -RENAME TABLE table_b TO `table b`; - - * Known issue: In connection with view creation, the server - created arc directories inside database directories and - maintained useless copies of .frm files there. Creation and - renaming procedures of those copies as well as creation of arc - directories has been discontinued in MySQL 5.1.29. - This change does cause a problem when downgrading to older - server versions which manifests itself under these - circumstances: - - 1. Create a view v_orig in MySQL 5.1.29 or higher. - - 2. Rename the view to v_new and then back to v_orig. - - 3. Downgrade to an older 5.1.x server and run mysql_upgrade. - - 4. Try to rename v_orig to v_new again. This operation - fails. - As a workaround to avoid this problem, use either of these - approaches: - - + Dump your data using mysqldump before downgrading and - reload the dump file after downgrading. - - + Instead of renaming a view after the downgrade, drop it - and recreate it. - - * Incompatible change: Character set or collation changes were - made in MySQL 5.1.21, 5.1.23, and 5.1.24 that may require - table indexes to be rebuilt. For details, see Section 2.4.3, - "Checking Whether Tables or Indexes Must Be Rebuilt." - - * Incompatible change: MySQL 5.1 implements support for a plugin - API that allows the loading and unloading of components at - runtime, without restarting the server. Section 22.2, "The - MySQL Plugin API." The plugin API requires the mysql.plugin - table. After upgrading from an older version of MySQL, you - should run the mysql_upgrade command to create this table. See - Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL - Upgrade." - Plugins are installed in the directory named by the plugin_dir - system variable. This variable also controls the location from - which the server loads user-defined functions (UDFs), which is - a change from earlier versions of MySQL. That is, all UDF - library files now must be installed in the plugin directory. - When upgrading from an older version of MySQL, you must - migrate your UDF files to the plugin directory. - - * Incompatible change: The table_cache system variable has been - renamed to table_open_cache. Any scripts that refer to - table_cache must be updated to use the new name. - - * Incompatible change: In MySQL 5.1.36, options for loading - plugins such as pluggable storage engines were changed from - boolean to tristate format. The implementations overlap, but - if you previously used options of the form --plugin_name=0 or - --plugin_name=1, you should instead use --plugin_name=OFF or - --plugin_name=ON, respectively. For details, see Section - 5.1.3, "Server Options for Loading Plugins." - - * Incompatible change: From MySQL 5.1.24 to 5.1.31, the UPDATE - statement was changed such that assigning NULL to a NOT NULL - column caused an error even when strict SQL mode was not - enabled. The original behavior before MySQL 5.1.24 was that - such assignments caused an error only in strict SQL mode, and - otherwise set the column to the implicit default value for the - column data type and generated a warning. (For information - about implicit default values, see Section 10.1.4, "Data Type - Default Values.") - The change caused compatibility problems for applications that - relied on the original behavior. It also caused replication - problems between servers that had the original behavior and - those that did not, for applications that assigned NULL to NOT - NULL columns in UPDATE statements without strict SQL mode - enabled. The change was reverted in MySQL 5.1.32 so that - UPDATE again had the original behavior. Problems can still - occur if you replicate between servers that have the modified - UPDATE behavior and those that do not. - - * Incompatible change: As of MySQL 5.1.29, the default binary - logging mode has been changed from MIXED to STATEMENT for - compatibility with MySQL 5.0. - - * Incompatible change: In MySQL 5.1.25, a change was made to the - way that the server handles prepared statements. This affects - prepared statements processed at the SQL level (using the - PREPARE statement) and those processed using the binary - client-server protocol (using the mysql_stmt_prepare() C API - function). - Previously, changes to metadata of tables or views referred to - in a prepared statement could cause a server crash when the - statement was next executed, or perhaps an error at execute - time with a crash occurring later. For example, this could - happen after dropping a table and recreating it with a - different definition. - Now metadata changes to tables or views referred to by - prepared statements are detected and cause automatic - repreparation of the statement when it is next executed. - Metadata changes occur for DDL statements such as those that - create, drop, alter, rename, or truncate tables, or that - analyze, optimize, or repair tables. Repreparation also occurs - after referenced tables or views are flushed from the table - definition cache, either implicitly to make room for new - entries in the cache, or explicitly due to FLUSH TABLES. - Repreparation is automatic, but to the extent that it occurs, - performance of prepared statements is diminished. - Table content changes (for example, with INSERT or UPDATE) do - not cause repreparation, nor do SELECT statements. - An incompatibility with previous versions of MySQL is that a - prepared statement may now return a different set of columns - or different column types from one execution to the next. For - example, if the prepared statement is SELECT * FROM t1, - altering t1 to contain a different number of columns causes - the next execution to return a number of columns different - from the previous execution. - Older versions of the client library cannot handle this change - in behavior. For applications that use prepared statements - with the new server, an upgrade to the new client library is - strongly recommended. - Along with this change to statement repreparation, the default - value of the table_definition_cache system variable has been - increased from 128 to 256. The purpose of this increase is to - lessen the chance that prepared statements will need - repreparation due to referred-to tables/views having been - flushed from the cache to make room for new entries. - A new status variable, Com_stmt_reprepare, has been introduced - to track the number of repreparations. - - * Incompatible change: As of MySQL 5.1.23, within a stored - routine, it is no longer allowable to declare a cursor for a - SHOW or DESCRIBE statement. This happened to work in some - instances, but is no longer supported. In many cases, a - workaround for this change is to use the cursor with a SELECT - query to read from an INFORMATION_SCHEMA table that produces - the same information as the SHOW statement. - - * Incompatible change: SHOW CREATE VIEW displays view - definitions using an AS alias_name clause for each column. If - a column is created from an expression, the default alias is - the expression text, which can be quite long. As of MySQL - 5.1.23, aliases for column names in CREATE VIEW statements are - checked against the maximum column length of 64 characters - (not the maximum alias length of 256 characters). As a result, - views created from the output of SHOW CREATE VIEW fail if any - column alias exceeds 64 characters. This can cause problems - for replication or loading dump files. For additional - information and workarounds, see Section D.4, "Restrictions on - Views." - - * Incompatible change: Several issues were identified for stored - programs (stored procedures and functions, triggers, and - events) and views containing non-ASCII symbols. These issues - involved conversion errors due to incomplete character set - information when translating these objects to and from stored - format. - To address these problems, the representation for these - objects was changed in MySQL 5.1.21. However, the fixes affect - all stored programs and views. (For example, you will see - warnings about "no creation context.") To avoid warnings from - the server about the use of old definitions from any release - prior to 5.1.21, you should dump stored programs and views - with mysqldump after upgrading to 5.1.21 or higher, and then - reload them to recreate them with new definitions. Invoke - mysqldump with a --default-character-set option that names the - non-ASCII character set that was used for the definitions when - the objects were originally defined. - - * Incompatible change: As of MySQL 5.1.20, mysqld_safe supports - error logging to syslog on systems that support the logger - command. The new --syslog and --skip-syslog options can be - used instead of the --log-error option to control logging - behavior, as described in Section 4.3.2, "mysqld_safe --- - MySQL Server Startup Script." - In 5.1.21 and up, the default is --skip-syslog, which is - compatible with the default behavior of writing an error log - file for releases prior to 5.1.20. - In 5.1.20 only, the following conditions apply: 1) The default - is to use syslog, which is not compatible with releases prior - to 5.1.20. 2) Logging to syslog may fail to operate correctly - in some cases. For these reasons, avoid using MySQL 5.1.20. - - * Incompatible change: As of MySQL 5.1.18, the plugin interface - and its handling of system variables was changed. Command-line - options such as --skip-innodb now cause an error if InnoDB is - not built-in or plugin-loaded. You should use - --loose-skip-innodb if you do not want any error even if - InnoDB is not available. The --loose prefix modifier should be - used for all command-line options where you are uncertain - whether the plugin exists and when you want the operation to - proceed even if the option is necessarily ignored due to the - absence of the plugin. (For a desecription of how --loose - works, see Section 4.2.3.1, "Using Options on the Command - Line.") - - * Incompatible change: As of MySQL 5.1.15, InnoDB rolls back - only the last statement on a transaction timeout. A new - option, --innodb_rollback_on_timeout, causes InnoDB to abort - and roll back the entire transaction if a transaction timeout - occurs (the same behavior as in MySQL 4.1). - - * Incompatible change: As of MySQL 5.1.15, the following - conditions apply to enabling the read_only system variable: - - + If you attempt to enable read_only while you have any - explicit locks (acquired with LOCK TABLES or have a - pending transaction, an error will occur. - - + If other clients hold explicit table locks or have - pending transactions, the attempt to enable read_only - blocks until the locks are released and the transactions - end. While the attempt to enable read_only is pending, - requests by other clients for table locks or to begin - transactions also block until read_only has been set. - - + read_only can be enabled while you hold a global read - lock (acquired with FLUSH TABLES WITH READ LOCK) because - that does not involve table locks. - Previously, the attempt to enable read_only would return - immediately even if explicit locks or transactions were - pending, so some data changes could occur for statements - executing in the server at the same time. - - * Incompatible change: The number of function names affected by - IGNORE_SPACE was reduced significantly in MySQL 5.1.13, from - about 200 to about 30. (For details about IGNORE_SPACE, see - Section 8.2.4, "Function Name Parsing and Resolution.") This - change improves the consistency of parser operation. However, - it also introduces the possibility of incompatibility for old - SQL code that relies on the following conditions: - - + IGNORE_SPACE is disabled. - - + The presence or absence of whitespace following a - function name is used to distinguish between a built-in - function and stored function that have the same name (for - example, PI() versus PI ()). - For functions that are no longer affected by IGNORE_SPACE as - of MySQL 5.1.13, that strategy no longer works. Either of the - following approaches can be used if you have code that is - subject to the preceding incompatibility: - - + If a stored function has a name that conflicts with a - built-in function, refer to the stored function with a - schema name qualifier, regardless of whether whitespace - is present. For example, write schema_name.PI() or - schema_name.PI (). - - + Alternatively, rename the stored function to use a - nonconflicting name and change invocations of the - function to use the new name. - - * Incompatible change: For utf8 columns, the full-text parser - incorrectly considered several nonword punctuation and - whitespace characters as word characters, causing some - searches to return incorrect results. The fix involves a - change to the full-text parser in MySQL 5.1.12, so as of - 5.1.12, any tables that have FULLTEXT indexes on utf8 columns - must be repaired with REPAIR TABLE: -REPAIR TABLE tbl_name QUICK; - - * Incompatible change: Storage engines can be pluggable at - runtime, so the distinction between disabled and invalid - storage engines no longer applies. As of MySQL 5.1.12, this - affects the NO_ENGINE_SUBSTITUTION SQL mode, as described in - Section 5.1.8, "Server SQL Modes." - - * Incompatible change: The structure of FULLTEXT indexes has - been changed in MySQL 5.1.6. After upgrading to MySQL 5.1.6 or - greater, any tables that have FULLTEXT indexes must be - repaired with REPAIR TABLE: -REPAIR TABLE tbl_name QUICK; - - * Incompatible change: In MySQL 5.1.6, when log tables were - implemented, the default log destination for the general query - and slow query log was TABLE. As of MySQL 5.1.21, this default - has been changed to FILE, which is compatible with MySQL 5.0, - but incompatible with earlier releases of MySQL 5.1. If you - are upgrading from MySQL 5.0 to 5.1.21 or higher, no logging - option changes should be necessary. However, if you are - upgrading from 5.1.6 through 5.1.20 to 5.1.21 or higher and - were using TABLE logging, use the --log-output=TABLE option - explicitly to preserve your server's table-logging behavior. - - * Incompatible change: For ENUM columns that had enumeration - values containing commas, the commas were mapped to 0xff - internally. However, this rendered the commas - indistinguishable from true 0xff characters in the values. - This no longer occurs. However, the fix requires that you dump - and reload any tables that have ENUM columns containing true - 0xff in their values: Dump the tables using mysqldump with the - current server before upgrading from a version of MySQL 5.1 - older than 5.1.15 to version 5.1.15 or newer. - - * As of MySQL 5.1.12, the lc_time_names system variable - specifies the locale that controls the language used to - display day and month names and abbreviations. This variable - affects the output from the DATE_FORMAT(), DAYNAME() and - MONTHNAME() functions. See Section 9.7, "MySQL Server Locale - Support." - - * As of MySQL 5.1.9, mysqld_safe no longer implicitly invokes - mysqld-max if it exists. Instead, it invokes mysqld unless a - --mysqld or --mysqld-version option is given to specify - another server explicitly. If you previously relied on the - implicit invocation of mysqld-max, you should use an - appropriate option now. As of MySQL 5.1.12, there is no longer - any separate mysqld-max server, so no change should be - necessary. - - SQL Changes: - - * Known issue: Prior to MySQL 5.1.17, the parser accepted - invalid code in SQL condition handlers, leading to server - crashes or unexpected execution behavior in stored programs. - Specifically, the parser allowed a condition handler to refer - to labels for blocks that enclose the handler declaration. - This was incorrect because block label scope does not include - the code for handlers declared within the labeled block. - As of 5.1.17, the parser rejects this invalid construct, but - if you perform a binary upgrade (without dumping and reloading - your databases), existing handlers that contain the construct - still are invalid and should be rewritten even if they appear - to function as you expect. - To find affected handlers, use mysqldump to dump all stored - procedures and functions, triggers, and events. Then attempt - to reload them into an upgraded server. Handlers that contain - illegal label references will be rejected. - For more information about condition handlers and writing them - to avoid invalid jumps, see Section 12.7.4.2, "DECLARE for - Handlers." - - * Incompatible change: The parser accepted statements that - contained /* ... */ that were not properly closed with */, - such as SELECT 1 /* + 2. As of MySQL 5.1.23, statements that - contain unclosed /*-comments now are rejected with a syntax - error. - This fix has the potential to cause incompatibilities. Because - of Bug#26302: http://bugs.mysql.com/bug.php?id=26302, which - caused the trailing */ to be truncated from comments in views, - stored routines, triggers, and events, it is possible that - objects of those types may have been stored with definitions - that now will be rejected as syntactically invalid. Such - objects should be dropped and re-created so that their - definitions do not contain truncated comments. - - * Incompatible change: Multiple-table DELETE statements - containing ambiguous aliases could have unintended side - effects such as deleting rows from the wrong table. Example: -DELETE FROM t1 AS a2 USING t1 AS a1 INNER JOIN t2 AS a2; - As of MySQL 5.1.23, alias declarations can be declared only in - the table_references part. Elsewhere in the statement, alias - references are allowed but not alias declarations. Statements - containing aliases that are no longer allowed must be - rewritten. - - * Incompatible change: As of MySQL 5.1.8, TYPE = engine_name is - still accepted as a synonym for the ENGINE = engine_name table - option but generates a warning. You should note that this - option is not available in MySQL 5.1.7, and is removed - altogether as of MySQL 5.4 and produces a syntax error. - TYPE has been deprecated since MySQL 4.0. - - * Incompatible change: The namespace for triggers changed in - MySQL 5.0.10. Previously, trigger names had to be unique per - table. Now they must be unique within the schema (database). - An implication of this change is that DROP TRIGGER syntax now - uses a schema name instead of a table name (schema name is - optional and, if omitted, the current schema will be used). - When upgrading from a version of MySQL 5 older than 5.0.10 to - MySQL 5.0.10 or newer, you must drop all triggers and - re-create them or DROP TRIGGER will not work after the - upgrade. Here is a suggested procedure for doing this: - - 1. Upgrade to MySQL 5.0.10 or later to be able to access - trigger information in the INFORMATION_SCHEMA.TRIGGERS - table. (This should work even for pre-5.0.10 triggers.) - - 2. Dump all trigger definitions using the following SELECT - statement: -SELECT CONCAT('CREATE TRIGGER ', t.TRIGGER_SCHEMA, '.', t.TRIGGER_NAM -E, - ' ', t.ACTION_TIMING, ' ', t.EVENT_MANIPULATION, ' ON ' -, - t.EVENT_OBJECT_SCHEMA, '.', t.EVENT_OBJECT_TABLE, - ' FOR EACH ROW ', t.ACTION_STATEMENT, '//' ) -INTO OUTFILE '/tmp/triggers.sql' -FROM INFORMATION_SCHEMA.TRIGGERS AS t; - The statement uses INTO OUTFILE, so you must have the - FILE privilege. The file will be created on the server - host. Use a different file name if you like. To be 100% - safe, inspect the trigger definitions in the triggers.sql - file, and perhaps make a backup of the file. - - 3. Stop the server and drop all triggers by removing all - .TRG files in your database directories. Change location - to your data directory and issue this command: -shell> rm */*.TRG - - 4. Start the server and re-create all triggers using the - triggers.sql file: -mysql> delimiter // ; -mysql> source /tmp/triggers.sql // - - 5. Check that all triggers were successfully created using - the SHOW TRIGGERS statement. - - * Incompatible change: MySQL 5.1.6 introduces the TRIGGER - privilege. Previously, the SUPER privilege was needed to - create or drop triggers. Now those operations require the - TRIGGER privilege. This is a security improvement because you - no longer need to grant users the SUPER privilege to enable - them to create triggers. However, the requirement that the - account named in a trigger's DEFINER clause must have the - SUPER privilege has changed to a requirement for the TRIGGER - privilege. When upgrading from a previous version of MySQL 5.0 - or 5.1 to MySQL 5.1.6 or newer, be sure to update your grant - tables by running mysql_upgrade. This will assign the TRIGGER - privilege to all accounts that had the SUPER privilege. If you - fail to update the grant tables, triggers may fail when - activated. After updating the grant tables, you can revoke the - SUPER privilege from those accounts that no longer otherwise - require it. - - * Some keywords may be reserved in MySQL 5.1 that were not - reserved in MySQL 5.0. See Section 8.3, "Reserved Words." - - * The BACKUP TABLE, and RESTORE TABLE statements are deprecated. - mysqldump or mysqlhotcopy can be used as alternatives. - - * The LOAD DATA FROM MASTER and LOAD TABLE FROM MASTER - statements are deprecated. See Section 12.5.2.2, "LOAD DATA - FROM MASTER Syntax," for recommended alternatives. - - * The INSTALL PLUGIN and UNINSTALL PLUGIN statements that are - used for the plugin API are new. So is the WITH PARSER clause - for FULLTEXT index creation that associates a parser plugin - with a full-text index. Section 22.2, "The MySQL Plugin API." - - C API Changes: - - * Incompatible change: As of MySQL 5.1.7, the - mysql_stmt_attr_get() C API function returns a boolean rather - than an unsigned int for STMT_ATTR_UPDATE_MAX_LENGTH. - (Bug#16144: http://bugs.mysql.com/bug.php?id=16144) - -2.4.2. Downgrading MySQL - - This section describes what you should do to downgrade to an older - MySQL version in the unlikely case that the previous version - worked better than the new one. - - If you are downgrading within the same release series (for - example, from 5.0.13 to 5.0.12) the general rule is that you just - have to install the new binaries on top of the old ones. There is - no need to do anything with the databases. As always, however, it - is always a good idea to make a backup. - - The following items form a checklist of things you should do - whenever you perform a downgrade: - - * Read the upgrading section for the release series from which - you are downgrading to be sure that it does not have any - features you really need. See Section 2.4.1, "Upgrading - MySQL." - - * If there is a downgrading section for that version, you should - read that as well. - - * To see which new features were added between the version to - which you are downgrading and your current version, see the - change logs (Appendix C, "MySQL Change History"). - - * Check Section 2.4.3, "Checking Whether Tables or Indexes Must - Be Rebuilt," to see whether changes to table formats or to - character sets or collations were made between your current - version of MySQL and the version to which you are downgrading. - If so and these changes result in an incompatibility between - MySQL versions, you will need to downgrade the affected tables - using the instructions in Section 2.4.4, "Rebuilding or - Repairing Tables or Indexes." - - In most cases, you can move the MySQL format files and data files - between different versions on the same architecture as long as you - stay within versions for the same release series of MySQL. - - If you downgrade from one release series to another, there may be - incompatibilities in table storage formats. In this case, use - mysqldump to dump your tables before downgrading. After - downgrading, reload the dump file using mysql or mysqlimport to - re-create your tables. For examples, see Section 2.4.5, "Copying - MySQL Databases to Another Machine." - - A typical symptom of a downward-incompatible table format change - when you downgrade is that you cannot open tables. In that case, - use the following procedure: - - 1. Stop the older MySQL server that you are downgrading to. - - 2. Restart the newer MySQL server you are downgrading from. - - 3. Dump any tables that were inaccessible to the older server by - using mysqldump to create a dump file. - - 4. Stop the newer MySQL server and restart the older one. - - 5. Reload the dump file into the older server. Your tables should - be accessible. - - It might also be the case that system tables in the mysql database - have changed and that downgrading introduces some loss of - functionality or requires some adjustments. Here are some - examples: - - * Trigger creation requires the TRIGGER privilege as of MySQL - 5.1. In MySQL 5.0, there is no TRIGGER privilege and SUPER is - required instead. If you downgrade from MySQL 5.1 to 5.0, you - will need to give the SUPER privilege to those accounts that - had the TRIGGER privilege in 5.1. - - * Triggers were added in MySQL 5.0, so if you downgrade from 5.0 - to 4.1, you cannot use triggers at all. - - * The mysql.proc.comment column definition changed between MySQL - 5.1 and 5.5. After a downgrade from 5.5 to 5.1, this table is - seen as corrupt and in need of repair. To workaround this - problem, execute mysql_upgrade from the version of MySQL to - which you downgraded. - -2.4.2.1. Downgrading to MySQL 5.0 - - When downgrading to MySQL 5.0 from MySQL 5.1, you should keep in - mind the following issues relating to features found in MySQL 5.1, - but not in MySQL 5.0: - - * Partitioning. MySQL 5.0 does not support user-defined - partitioning. If a table was created as a partitioned table in - 5.1 (or if an table created in a previous version of MySQL was - altered to include partitions after an upgrade to 5.1), the - table is accessible after downgrade only if you do one of the - following: - - + Export the table using mysqldump and then drop it in - MySQL 5.1; import the table again following the downgrade - to MySQL 5.0. - - + Prior to the downgrade, remove the table's partitioning - using ALTER TABLE table_name REMOVE PARTITIONING. - - * Event Scheduler. MySQL 5.0 does not support scheduled events. - If your databases contain scheduled event definitions, you - should prevent them from being dumped when you use mysqldump - by using the --skip-events option. (See Section 4.5.4, - "mysqldump --- A Database Backup Program.") - - * Stored routines. MySQL 5.1.21 added a number of new columns - to the mysql.proc table in which stored routine definitions - are stored. If you are downgrading from MySQL 5.1.21 or later - to MySQL 5.0, you cannot import the MySQL 5.1 routine - definitions into MySQL 5.0.46 or earlier using the dump of - mysql.proc created by mysqldump (such as when using the - --all-databases option). Instead, you should run mysqldump - --routines prior to performing the downgrade and run the - stored routines DDL statements following the downgrade. - See Bug#11986: http://bugs.mysql.com/bug.php?id=11986, - Bug#30029: http://bugs.mysql.com/bug.php?id=30029, and - Bug#30660: http://bugs.mysql.com/bug.php?id=30660, for more - information. - - * Triggers. Trigger creation requires the TRIGGER privilege as - of MySQL 5.1. In MySQL 5.0, there is no TRIGGER privilege and - SUPER is required instead. If you downgrade from MySQL 5.1 to - 5.0, you will need to give the SUPER privilege to those - accounts that had the TRIGGER privilege in 5.1. - -2.4.3. Checking Whether Tables or Indexes Must Be Rebuilt - - A binary upgrade or downgrade is one that installs one version of - MySQL "in place" over an existing version, without dumping and - reloading tables: - - 1. Stop the server for the existing version if it is running. - - 2. Install a different version of MySQL. This is an upgrade if - the new version is higher than the original version, a - downgrade if the version is lower. - - 3. Start the server for the new version. - - In many cases, the tables from the previous version of MySQL can - be used without problem by the new version. However, sometimes - changes occur that require tables or table indexes to be rebuilt, - as described in this section. If you have tables that are affected - by any of the issues described here, rebuild the tables or indexes - as necessary using the instructions given in Section 2.4.4, - "Rebuilding or Repairing Tables or Indexes." - - Table Incompatibilities - - After a binary upgrade to MySQL 5.1 from a MySQL 5.0 installation - that contains ARCHIVE tables, accessing those tables causes the - server to crash, even if you have run mysql_upgrade or CHECK TABLE - ... FOR UPGRADE. To work around this problem, use mysqldump to - dump all ARCHIVE tables before upgrading, and reload them into - MySQL 5.1 after upgrading. The same problem occurs for binary - downgrades from MySQL 5.1 to 5.0. - - Index Incompatibilities - - If you perform a binary upgrade without dumping and reloading - tables, you cannot upgrade directly from MySQL 4.1 to 5.1 or - higher. This occurs due to an incompatible change in the MyISAM - table index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and - repair all MyISAM tables. Then upgrade from MySQL 5.0 to 5.1 and - check and repair your tables. - - Modifications to the handling of character sets or collations - might change the character sort order, which causes the ordering - of entries in any index that uses an affected character set or - collation to be incorrect. Such changes result in several possible - problems: - - * Comparison results that differ from previous results - - * Inability to find some index values due to misordered index - entries - - * Misordered ORDER BY results - - * Tables that CHECK TABLE reports as being in need of repair - - The solution to these problems is to rebuild any indexes that use - an affected character set or collation, either by dropping and - re-creating the indexes, or by dumping and reloading the entire - table. For information about rebuilding indexes, see Section - 2.4.4, "Rebuilding or Repairing Tables or Indexes." - - To check whether a table has indexes that must be rebuilt, consult - the following list. It indicates which versions of MySQL - introduced character set or collation changes that require indexes - to be rebuilt. Each entry indicates the version in which the - change occurred and the character sets or collations that the - change affects. If the change is associated with a particular bug - report, the bug number is given. - - The list applies both for binary upgrades and downgrades. For - example, Bug#27877: http://bugs.mysql.com/bug.php?id=27877 was - fixed in MySQL 5.1.24 and 5.4.0, so it applies to upgrades from - versions older than 5.1.24 to 5.1.24 or newer, and to downgrades - from 5.1.24 or newer to versions older than 5.1.24. - - In many cases, you can use CHECK TABLE ... FOR UPGRADE to identify - tables for which index rebuilding is required. (It will report: - Table upgrade required. Please do "REPAIR TABLE `tbl_name`" or - dump/reload to fix it!) In these cases, you can also use - mysqlcheck --check-upgrade or mysql_upgrade, which execute CHECK - TABLE. However, the use of CHECK TABLE applies only after - upgrades, not downgrades. Also, CHECK TABLE is not applicable to - all storage engines. For details about which storage engines CHECK - TABLE supports, see Section 12.4.2.3, "CHECK TABLE Syntax." - - Changes that cause index rebuilding to be necessary: - - * MySQL 5.0.48, 5.1.21 - (Bug#29461: http://bugs.mysql.com/bug.php?id=29461) - Affects indexes for columns that use any of these character - sets: eucjpms, euc_kr, gb2312, latin7, macce, ujis - Affected tables can be detected by CHECK TABLE ... FOR UPGRADE - as of MySQL 5.1.29, 5.4.0 (see - Bug#39585: http://bugs.mysql.com/bug.php?id=39585). - - * MySQL 5.0.48, 5.1.23 - (Bug#27562: http://bugs.mysql.com/bug.php?id=27562) - Affects indexes that use the ascii_general_ci collation for - columns that contain any of these characters: '`' GRAVE - ACCENT, '[' LEFT SQUARE BRACKET, '\' REVERSE SOLIDUS, ']' - RIGHT SQUARE BRACKET, '~' TILDE - Affected tables can be detected by CHECK TABLE ... FOR UPGRADE - as of MySQL 5.1.29, 5.4.0 (see - Bug#39585: http://bugs.mysql.com/bug.php?id=39585). - - * MySQL 5.1.24, 5.4.0 - (Bug#27877: http://bugs.mysql.com/bug.php?id=27877) - Affects indexes that use the utf8_general_ci or - ucs2_general_ci collation for columns that contain 'ß' LATIN - SMALL LETTER SHARP S (German). - Affected tables can be detected by CHECK TABLE ... FOR UPGRADE - as of MySQL 5.1.30, 5.4.0 (see - Bug#40053: http://bugs.mysql.com/bug.php?id=40053). - -2.4.4. Rebuilding or Repairing Tables or Indexes - - This section describes how to rebuild a table. This can be - necessitated by changes to MySQL such as how data types are - handled or changes to character set handling. For example, an - error in a collation might have been corrected, necessitating a - table rebuild to update the indexes for character columns that use - the collation. (For examples, see Section 2.4.3, "Checking Whether - Tables or Indexes Must Be Rebuilt.") It might also be that a table - repair or upgrade should be done as indicated by a table check - operation such as that performed by CHECK TABLE, mysqlcheck, or - mysql_upgrade. - - Methods for rebuilding a table include dumping and reloading it, - or using ALTER TABLE or REPAIR TABLE. - -Note - - If you are rebuilding tables because a different version of MySQL - will not handle them after a binary (in-place) upgrade or - downgrade, you must use the dump-and-reload method. Dump the - tables before upgrading or downgrading using your original version - of MySQL. Then reload the tables after upgrading or downgrading. - - If you use the dump-and-reload method of rebuilding tables only - for the purpose of rebuilding indexes, you can perform the dump - either before or after upgrading or downgrading. Reloading still - must be done afterward. - - To rebuild a table by dumping and reloading it, use mysqldump to - create a dump file and mysql to reload the file: -shell> mysqldump db_name t1 > dump.sql -shell> mysql db_name < dump.sql - - To rebuild all the tables in a single database, specify the - database name without any following table name: -shell> mysqldump db_name > dump.sql -shell> mysql db_name < dump.sql - - To rebuild all tables in all databases, use the --all-databases - option: -shell> mysqldump --all-databases > dump.sql -shell> mysql < dump.sql - - To rebuild a table with ALTER TABLE, use a "null" alteration; that - is, an ALTER TABLE statement that "changes" the table to use the - storage engine that it already has. For example, if t1 is a MyISAM - table, use this statement: -mysql> ALTER TABLE t1 ENGINE = MyISAM; - - If you are not sure which storage engine to specify in the ALTER - TABLE statement, use SHOW CREATE TABLE to display the table - definition. - - If you must rebuild a table because a table checking operation - indicates that the table is corrupt or needs an upgrade, you can - use REPAIR TABLE if that statement supports the table's storage - engine. For example, to repair a MyISAM table, use this statement: -mysql> REPAIR TABLE t1; - - For storage engines such as InnoDB that REPAIR TABLE does not - support, use mysqldump to create a dump file and mysql to reload - the file, as described earlier. - - For specifics about which storage engines REPAIR TABLE supports, - see Section 12.4.2.6, "REPAIR TABLE Syntax." - - mysqlcheck --repair provides command-line access to the REPAIR - TABLE statement. This can be a more convenient means of repairing - tables because you can use the --databases or --all-databases - option to repair all tables in specific databases or all - databases, respectively: -shell> mysqlcheck --repair --databases db_name ... -shell> mysqlcheck --repair --all-databases - -2.4.5. Copying MySQL Databases to Another Machine - - You can copy the .frm, .MYI, and .MYD files for MyISAM tables - between different architectures that support the same - floating-point format. (MySQL takes care of any byte-swapping - issues.) See Section 13.5, "The MyISAM Storage Engine." - - In cases where you need to transfer databases between different - architectures, you can use mysqldump to create a file containing - SQL statements. You can then transfer the file to the other - machine and feed it as input to the mysql client. - - Use mysqldump --help to see what options are available. - - The easiest (although not the fastest) way to move a database - between two machines is to run the following commands on the - machine on which the database is located: -shell> mysqladmin -h 'other_hostname' create db_name -shell> mysqldump db_name | mysql -h 'other_hostname' db_name - - If you want to copy a database from a remote machine over a slow - network, you can use these commands: -shell> mysqladmin create db_name -shell> mysqldump -h 'other_hostname' --compress db_name | mysql db_na -me - - You can also store the dump in a file, transfer the file to the - target machine, and then load the file into the database there. - For example, you can dump a database to a compressed file on the - source machine like this: -shell> mysqldump --quick db_name | gzip > db_name.gz - - Transfer the file containing the database contents to the target - machine and run these commands there: -shell> mysqladmin create db_name -shell> gunzip < db_name.gz | mysql db_name - - You can also use mysqldump and mysqlimport to transfer the - database. For large tables, this is much faster than simply using - mysqldump. In the following commands, DUMPDIR represents the full - path name of the directory you use to store the output from - mysqldump. - - First, create the directory for the output files and dump the - database: -shell> mkdir DUMPDIR -shell> mysqldump --tab=DUMPDIR db_name - - Then transfer the files in the DUMPDIR directory to some - corresponding directory on the target machine and load the files - into MySQL there: -shell> mysqladmin create db_name # create database -shell> cat DUMPDIR/*.sql | mysql db_name # create tables in databas -e -shell> mysqlimport db_name DUMPDIR/*.txt # load data into tables - - Do not forget to copy the mysql database because that is where the - grant tables are stored. You might have to run commands as the - MySQL root user on the new machine until you have the mysql - database in place. - - After you import the mysql database on the new machine, execute - mysqladmin flush-privileges so that the server reloads the grant - table information. - -2.5. Installing MySQL on Windows - - This section describes the process for installing MySQL on - Windows. - - To run MySQL on Windows, you need the following: - - * A Windows operating system such as Windows 2000, Windows XP, - Windows Vista, Windows Server 2003, or Windows Server 2008. - Both 32-bit and 64-bit versions are supported. - In addition to running MySQL as a standard application, you - can also run the MySQL server as a Windows service. By using a - service you can monitor and control the operation of the - server through the standard Windows service management tools. - For more information, see Section 2.5.5.6, "Starting MySQL as - a Windows Service." - Generally, you should install MySQL on Windows using an - account that has administrator rights. Otherwise, you may - encounter problems with certain operations such as editing the - PATH environment variable or accessing the Service Control - Manager. Once installed, MySQL does not need to be executed - using a user with Administrator privileges. - - * TCP/IP protocol support. - - * Enough space on the hard drive to unpack, install, and create - the databases in accordance with your requirements (generally - a minimum of 200 megabytes is recommended.) - - For a list of limitations within the Windows version of MySQL, see - Section D.7.3, "Windows Platform Limitations." - - In addition to the MySQL Server package, you may need or want - additional components to use MySQL with your application or - development environment. These include, but are not limited to: - - * If you plan to connect to the MySQL server via ODBC, you need - a Connector/ODBC driver. For more information, including - installation and configuration instructions, see Section 21.1, - "MySQL Connector/ODBC." - - * If you plan to use MySQL server with .NET applications, you - need the Connector/NET driver. For more information, including - installation and configuration instructions, see Section 21.2, - "MySQL Connector/NET." - - MySQL distributions for Windows can be downloaded from - http://dev.mysql.com/downloads/. See Section 2.1.3, "How to Get - MySQL." - - MySQL for Windows is available in several distribution formats, - detailed below. Generally speaking, you should use a binary - distribution that includes an installer. It is simpler to use than - the others, and you need no additional tools to get MySQL up and - running. The installer for the Windows version of MySQL, combined - with a GUI Config Wizard, automatically installs MySQL, creates an - option file, starts the server, and secures the default user - accounts. - - * Binary installer distribution. The installable distribution - comes packaged as a Microsoft Windows Installer (MSI) package - that you can install manually or automatically on your - systems. Two formats are available, an essentials package that - contains all the files you need to install and configure - MySQL, but no additional components, and a complete package - that includes MySQL, configuration tools, benchmarks and other - components. For more information on the specific differences, - see Section 2.5.2, "Choosing An Installation Package" - For instructions on installing MySQL using one of the MSI - installation packages, see Section 2.5.3, "Installing MySQL - with the MSI Package." - - * Standard binary distribution format packaged as a Zip file - containing all of the necessary files that you unpack into - your chosen location. This package contains all of the files - in the full Windows MSI Installer package, but does not - including an installation program. - For instructions on installing MySQL using the Zip file, see - Section 2.5.5, "Installing MySQL from a noinstall Zip - Archive." - - * The source distribution contains all the code and support - files for building the executables using the Visual Studio - compiler system. - For instructions on building MySQL from source on Windows, see - Section 2.5.10, "Installing MySQL from Source on Windows." - - MySQL on Windows considerations: - - * Large Table Support - If you need tables with a size larger than 4GB, install MySQL - on an NTFS or newer file system. Don't forget to use MAX_ROWS - and AVG_ROW_LENGTH when you create tables. See Section - 12.1.17, "CREATE TABLE Syntax." - - * MySQL and Virus Checking Software - Using virus scanning software such as Norton/Symantec - Anti-Virus on directories containing MySQL data and temporary - tables can cause issues, both in terms of the performance of - MySQL and the virus-scanning software mis-identifying the - contents of the files as containing spam. This is because of - the fingerprinting mechanism used by the virus scanning - software, and the way in which MySQL rapidly updates different - files, which may be identified as a potential security risk. - After installing MySQL Server, it is recommended that you - disable virus scanning on the main directory (datadir) being - used to store your MySQL table data. There is usually a system - built into the virus scanning software to allow certain - directories to be specifically ignored during virus scanning. - In addition, by default, MySQL creates temporary files in the - standard Windows temporary directory. To prevent the temporary - files also being scanned, you should configure a separate - temporary directory for MySQL temporary files and add this to - the virus scanning exclusion list. To do this, add a - configuration option for the tmpdir parameter to your my.ini - configuration file. For more information, see Section 2.5.5.2, - "Creating an Option File." - -2.5.1. Windows Installation Layout - - For MySQL 5.1 on Windows, the default installation directory is - C:\Program Files\MySQL\MySQL Server 5.1. Some Windows users prefer - to install in C:\mysql, the directory that formerly was used as - the default. However, the layout of the subdirectories remains the - same. - - For MySQL 5.1.23 and earlier, all of the files are located within - this parent directory, using the following structure: - - Table 2.2. Installation Layout for Windows using MySQL 5.1.23 and - earlier - Directory Contents of Directory - bin Client programs and the mysqld server - data Log files, databases - Docs Manual in CHM format - examples Example programs and scripts - include Include (header) files - lib Libraries - scripts Utility scripts - share Error message files - - For MySQL 5.1.24 and later, the default location of data directory - was changed. The remainder of the directory structure remains the - same: - - Table 2.3. Installation Layout for Windows using MySQL 5.1.24 and - later - Directory Contents of Directory - bin Client programs and the mysqld server - C:\Documents and Settings\All Users\Application Data\MySQL Log - files, databases - Docs Manual in CHM format - examples Example programs and scripts - include Include (header) files - lib Libraries - scripts Utility scripts - share Error message files - -2.5.2. Choosing An Installation Package - - For MySQL 5.1, there are three installation packages to choose - from when installing MySQL on Windows: - Packaging - Feature Essentials Complete Zip (No-install) - Installer Yes Yes No - Directory-only - MySQL Server Instance Config Wizard Yes Yes No - Test Suite No Yes Yes - MySQL Server Yes Yes Yes - MySQL Client Programs Yes Yes Yes - C Headers/Libraries Yes Yes Yes - Embedded Server No Optional Yes - Scripts and Examples No Optional Yes - - In the above table: - - * Yes indiciates that the component is installed by default. - - * No indicates that the component is not installed or included. - - * Optional indicates that the component is included with the - package, but not installed unless explicitly requested using - the Custom installation mode. - - The workflow for installing using the MSI installer is shown - below: - - Figure 2.1. Installation Workflow for Windows using MSI - Installation Workflow for Windows using MSI - - The workflow for installing using the MSI installer is shown - below: - - Figure 2.2. Installation Workflow for Windows using Zip - Installation Workflow for Windows using Zip - -Note - - For the Essentials and Complete packages in the MSI installer, you - can select individual components to be installed by using the - Custom mode, including disable the components confiurated for - installation by default. - - Full details on the components are suggested uses are provided - below for reference: - - * Windows Essentials --- this package has a file name similar to - mysql-essential-5.1.46-win32.msi and is supplied as a - Microsoft Installer (MSI) package. The package includes the - minimum set of files needed to install MySQL on Windows, - including the MySQL Server Instance Config Wizard. This - package does not include optional components such as the - embedded server, developer headers and libraries or benchmark - suite. - To install using this package, see Section 2.5.3, "Installing - MySQL with the MSI Package." - - * Windows MSI Installer (Complete) --- this package has a file - name similar to mysql-5.1.46-win32.zip and contains all files - needed for a complete Windows installation, including the - MySQL Server Instance Config Wizard. This package includes - optional components such as the embedded server and benchmark - suite. - To install using this package, see Section 2.5.3, "Installing - MySQL with the MSI Package." - - * Without installer --- this package has a file name similar to - mysql-noinstall-5.1.46-win32.zip and contains all the files - found in the Complete install package, with the exception of - the MySQL Server Instance Config Wizard. This package does not - include an automated installer, and must be manually installed - and configured. - - The Essentials package is recommended for most users. Both the - Essentials and Complete distributions are available as an .msi - file for use with the Windows Installer. The Noinstall - distribution is packaged as Zip archives. To use Zip archives, you - must have a tool that can unpack .zip files. - - When using the MSI installers you can automate the installation - process. For more information, see Section 2.5.3.2, "Installing - MySQL Automatically using MSI." To automate the creation of a - MySQL instance, see Section 2.5.4.13, "Creating an Instance from - the Command Line." - - Your choice of install package affects the installation process - you must follow. If you choose to install either the Essentials or - Complete install packages, see Section 2.5.3, "Installing MySQL - with the MSI Package." If you choose to install MySQL from the - Noinstall archive, see Section 2.5.5, "Installing MySQL from a - noinstall Zip Archive." - -2.5.3. Installing MySQL with the MSI Package - - The MSI package are designed to install and configure MySQL in - such a way that you can immediately get started using MySQL. - - The MySQL Installation Wizard and MySQL Config Wizard are - available in the Essentials and Complete install packages. They - are recommended for most standard MySQL installations. Exceptions - include users who need to install multiple instances of MySQL on a - single server host and advanced users who want complete control of - server configuration. - - * For information on installing using the GUI MSI installer - process, see Section 2.5.3, "Installing MySQL with the MSI - Package." - - * For information on installing using the command line using the - MSI package, see Section 2.5.3.2, "Installing MySQL - Automatically using MSI." - - * If you have previously installed MySQL using the MSI package - and want to remove MySQL, see Section 2.5.3.3, "Removing MySQL - Installed from the MSI Package." - - The workflow sequence for using the installer is shown in the - figure below: - - Figure 2.3. Installation Workflow for Windows using MSI Installer - Installation Workflow for Windows using MSI Installer - -Note - - Microsoft Windows XP and later include a firewall which - specifically blocks ports. If you plan on using MySQL through a - network port then you should open and create an exception for this - port before performing the installation. To check and if necessary - add an exception to the firewall settings: - - 1. First ensure that you are logged in as an Administrator or a - user with Administrator privileges. - - 2. Go to the Control Panel, and double click the Windows Firewall - icon. - - 3. Choose the Allow a program through Windows Firewall option and - click the Add port button. - - 4. Enter MySQL into the Name text box and 3306 (or the port of - your choice) into the Port number text box. - - 5. Also ensure that the TCP protocol radio button is selected. - - 6. If you wish, you can also limit access to the MySQL server by - choosing the Change scope button. - - 7. Confirm your choices by clicking the OK button. - - Additionally, when running the MySQL Installation Wizard on - Windows Vista, ensure that you are logged in as a user with - administrative rights. - -Note - - When using Windows Vista, you may want to disable User Account - Control (UAC) before performing the installation. If you do not do - so, then MySQL may be identified as a security risk, which will - mean that you need to enable MySQL. You can disable the security - checking by following these instructions: - - 1. Open Control Panel. - - 2. Under the User Accounts and Family Safety, select Add or - remove user accounts. - - 3. Click on the Got to the main User Accounts page link. - - 4. Click on Turn User Account Control on or off. You may be - prompted to provide permission to change this setting. Click - Continue. - - 5. Deselect or unceck the checkbox next to Use User Account - Control (UAC) to help protect your computer. Click OK to save - the setting. - - You will need to restart to complete the process. Click Restart - Now to reboot the machine and apply the changes. You can then - follow the instructions below for installing Windows. - -2.5.3.1. Using the MySQL Installation Wizard - - MySQL Installation Wizard is an installer for the MySQL server - that uses the latest installer technologies for Microsoft Windows. - The MySQL Installation Wizard, in combination with the MySQL - Config Wizard, allows a user to install and configure a MySQL - server that is ready for use immediately after installation. - - The MySQL Installation Wizard uses the standard Microsoft - Installer Engine (MSI) system is the standard installer for all - MySQL server distributions, version 4.1.5 and higher. Users of - previous versions of MySQL need to shut down and remove their - existing MySQL installations manually before installing MySQL with - the MySQL Installation Wizard. See Section 2.5.3.1.6, "Upgrading - MySQL with the Installation Wizard," for more information on - upgrading from a previous version. - - If you are upgrading an installation from MySQL 5.1.31 or earlier - to MySQL 5.1.32 or later, read the notes provided in Section - 2.5.3.1.6, "Upgrading MySQL with the Installation Wizard." - - The Microsoft Windows Installer Engine was updated with the - release of Windows XP; those using a previous version of Windows - can reference this Microsoft Knowledge Base article - (http://support.microsoft.com/default.aspx?scid=kb;EN-US;292539) - for information on upgrading to the latest version of the Windows - Installer Engine. - - In addition, Microsoft has introduced the WiX (Windows Installer - XML) toolkit. This is the first highly acknowledged Open Source - project from Microsoft. We have switched to WiX because it is an - Open Source project and it allows us to handle the complete - Windows installation process in a flexible manner using scripts. - - Improving the MySQL Installation Wizard depends on the support and - feedback of users like you. If you find that the MySQL - Installation Wizard is lacking some feature important to you, or - if you discover a bug, please report it in our bugs database using - the instructions given in Section 1.7, "How to Report Bugs or - Problems." - -2.5.3.1.1. Downloading and Starting the MySQL Installation Wizard - - The MySQL installation packages can be downloaded from - http://dev.mysql.com/downloads/. If the package you download is - contained within a Zip archive, you need to extract the archive - first. - - The process for starting the wizard depends on the contents of the - installation package you download. If there is a setup.exe file - present, double-click it to start the installation process. If - there is an .msi file present, double-click it to start the - installation process. - -2.5.3.1.2. Choosing an Install Type - - There are three installation types available: Typical, Complete, - and Custom. - - The Typical installation type installs the MySQL server, the mysql - command-line client, and the command-line utilities. The - command-line clients and utilities include mysqldump, myisamchk, - and several other tools to help you manage the MySQL server. - - The Complete installation type installs all components included in - the installation package. The full installation package includes - components such as the embedded server library, the benchmark - suite, support scripts, and documentation. - - The Custom installation type gives you complete control over which - packages you wish to install and the installation path that is - used. See Section 2.5.3.1.3, "The Custom Install Dialog," for more - information on performing a custom install. - - If you choose the Typical or Complete installation types and click - the Next button, you advance to the confirmation screen to verify - your choices and begin the installation. If you choose the Custom - installation type and click the Next button, you advance to the - custom installation dialog, described in Section 2.5.3.1.3, "The - Custom Install Dialog." - -2.5.3.1.3. The Custom Install Dialog - - If you wish to change the installation path or the specific - components that are installed by the MySQL Installation Wizard, - choose the Custom installation type. - - A tree view on the left side of the custom install dialog lists - all available components. Components that are not installed have a - red X icon; components that are installed have a gray icon. To - change whether a component is installed, click on that component's - icon and choose a new option from the drop-down list that appears. - - You can change the default installation path by clicking the - Change... button to the right of the displayed installation path. - - After choosing your installation components and installation path, - click the Next button to advance to the confirmation dialog. - -2.5.3.1.4. The Confirmation Dialog - - Once you choose an installation type and optionally choose your - installation components, you advance to the confirmation dialog. - Your installation type and installation path are displayed for you - to review. - - To install MySQL if you are satisfied with your settings, click - the Install button. To change your settings, click the Back - button. To exit the MySQL Installation Wizard without installing - MySQL, click the Cancel button. - - After installation is complete, you have the option of registering - with the MySQL web site. Registration gives you access to post in - the MySQL forums at forums.mysql.com (http://forums.mysql.com), - along with the ability to report bugs at bugs.mysql.com - (http://bugs.mysql.com) and to subscribe to our newsletter. The - final screen of the installer provides a summary of the - installation and gives you the option to launch the MySQL Config - Wizard, which you can use to create a configuration file, install - the MySQL service, and configure security settings. - -2.5.3.1.5. Changes Made by MySQL Installation Wizard - - Once you click the Install button, the MySQL Installation Wizard - begins the installation process and makes certain changes to your - system which are described in the sections that follow. - - Changes to the Registry - - The MySQL Installation Wizard creates one Windows registry key in - a typical install situation, located in - HKEY_LOCAL_MACHINE\SOFTWARE\MySQL AB. - - The MySQL Installation Wizard creates a key named after the major - version of the server that is being installed, such as MySQL - Server 5.1. It contains two string values, Location and Version. - The Location string contains the path to the installation - directory. In a default installation it contains C:\Program - Files\MySQL\MySQL Server 5.1\. The Version string contains the - release number. For example, for an installation of MySQL Server - 5.1.46, the key contains a value of 5.1.46. - - These registry keys are used to help external tools identify the - installed location of the MySQL server, preventing a complete scan - of the hard-disk to determine the installation path of the MySQL - server. The registry keys are not required to run the server, and - if you install MySQL using the noinstall Zip archive, the registry - keys are not created. - - Changes to the Start Menu - - The MySQL Installation Wizard creates a new entry in the Windows - Start menu under a common MySQL menu heading named after the major - version of MySQL that you have installed. For example, if you - install MySQL 5.1, the MySQL Installation Wizard creates a MySQL - Server 5.1 section in the Start menu. - - The following entries are created within the new Start menu - section: - - * MySQL Command Line Client: This is a shortcut to the mysql - command-line client and is configured to connect as the root - user. The shortcut prompts for a root user password when you - connect. - - * MySQL Server Instance Config Wizard: This is a shortcut to the - MySQL Config Wizard. Use this shortcut to configure a newly - installed server, or to reconfigure an existing server. - - * MySQL Documentation: This is a link to the MySQL server - documentation that is stored locally in the MySQL server - installation directory. This option is not available when the - MySQL server is installed using the Essentials installation - package. - - Changes to the File System - - The MySQL Installation Wizard by default installs the MySQL 5.1 - server to C:\Program Files\MySQL\MySQL Server 5.1, where Program - Files is the default location for applications in your system, and - 5.1 is the major version of your MySQL server. This is the - recommended location for the MySQL server, replacing the former - default location C:\mysql. - - By default, all MySQL applications are stored in a common - directory at C:\Program Files\MySQL, where Program Files is the - default location for applications in your Windows installation. A - typical MySQL installation on a developer machine might look like - this: -C:\Program Files\MySQL\MySQL Server 5.1 -C:\Program Files\MySQL\MySQL Workbench 5.1 OSS - - This approach makes it easier to manage and maintain all MySQL - applications installed on a particular system. - - In MySQL 5.1.23 and earlier, the default location for the data - files used by MySQL is located within the corresponding MySQL - Server installation directory. For MySQL 5.1.24 and later, the - default location of the data directory is the AppData directory - configured for the user that installed the MySQL application. - -2.5.3.1.6. Upgrading MySQL with the Installation Wizard - - The MySQL Installation Wizard can perform server upgrades - automatically using the upgrade capabilities of MSI. That means - you do not need to remove a previous installation manually before - installing a new release. The installer automatically shuts down - and removes the previous MySQL service before installing the new - version. - - Automatic upgrades are available only when upgrading between - installations that have the same major and minor version numbers. - For example, you can upgrade automatically from MySQL 5.1.34 to - MySQL 5.1.37, but not from MySQL 5.0 to MySQL 5.1. - - In MySQL 5.1.32 and later, the EXE version of the MSI installer - packages were removed. When upgrading an existing MySQL - installation from the old EXE based installer to the MSI based - installer, please keep the following notes in mind: - - * The MSI installer will not identify an existing installation - that was installed using the old EXE installer. This means - that the installer will not stop the existing server, or - detect that the existing password is required before - installing the new version. To work around this: - - 1. Stop the current server manually using net stop or - mysqladmin shutdown. - - 2. Remove the existing installation manually by using the - Add/Remove Programs control panel. This will keep the - existing configuration and data files, as these are not - removed automatically. - - 3. Install the new version of MySQL using the MSI installer. - When running the installation, skip updating the security - by deselecting the checkbox on the security screen. - - 4. Complete the installation, and then start the server - again. You should be able to login with your existing - user and password credentials. - - * You can only upgrade the version and release using the MSI - installer. For example, you can upgrade an open source - installation with an open source installer. You cannot upgrade - an open source installation using the enterprise installer. - - See Section 2.5.7, "Upgrading MySQL on Windows." - -2.5.3.2. Installing MySQL Automatically using MSI - - The Microsoft Installer (MSI) supports a both a quiet and a - passive mode that can be used to install MySQL automatically - without requireing intervention. You can use this either in - scripts to automatically install MySQL or through a terminal - connection such as Telnet where you do not have access to the - standard Windows user interface. The MSI packages can also be used - in combination with Microsoft's Group Policy system (part of - Windows Server 2003 and Windows Server 2008) to install MySQL - across multiple machines. - - To install MySQL from one of the MSI packages automatically from - the command line (or within a script), you need to use the - msiexec.exe tool. For example, to perform a quiet installation - (which shows no dialog boxes or progress): -shell> msiexec /i /quiet mysql-5.1.39.msi - - The /i indicates that you want to perform an installation. The - /quiet option indicates that you want no interactive elements. - - To provide a dialog box showing the progress during installation, - and the dialog boxes providing information on the installation and - registration of MySQL, use /passive mode instead of /quiet: -shell> msiexec /i /passive mysql-5.1.39.msi - - Regardless of the mode of the installation, installing the package - in this manner performs a 'Typical' installation, and installs the - default components into the standard location. - - You can also use this method to uninstall MySQL by using the - /uninstall or /x options: -shell> msiexec /x /quiet mysql-5.1.39.msi - - To install MySQL and configure a MySQL instance from the command - line, see Section 2.5.4.13, "Creating an Instance from the Command - Line." - - For information on using MSI packages to install software - automatically using Group Policy, see How to use Group Policy to - remotely install software in Windows Server 2003 - (http://support.microsoft.com/kb/816102). - -2.5.3.3. Removing MySQL Installed from the MSI Package - - To uninstall a MySQL where you have used the MSI packages, you - must use the Add/Remove Programs tool within Control Panel. To do - this: - - 1. Right click on the start menu and choose Control Panel. - - 2. If the Control Panel is set to category mode (you will see - Pick a category at the top of the Control Panel window), - double click on Add or Remove Programs. If the Control is set - to classic mode, doubgle click on the Add or Remove Programs - icon. - - 3. Find MySQL in the list of installed software. MySQL Server is - installed against major version numbers (MySQL 5.0, MySQL 5.1, - etc.). Select the version that you want to remove and click - Remove. - - 4. You will be prompted to confirm the removal. Click Yes to - remove MySQL. - - When MySQL is removed using this method, only the installed - components are removed. Any database information (including the - tables and data), import or export files, log files, and binary - logs produced during execution are kept in their configured - location. - -2.5.4. MySQL Server Instance Config Wizard - - The MySQL Server Instance Config Wizard helps automate the process - of configuring your server. It creates a custom MySQL - configuration file (my.ini or my.cnf) by asking you a series of - questions and then applying your responses to a template to - generate the configuration file that is tuned to your - installation. - - The complete and essential MSI installation packages include the - MySQL Server Instance Config Wizard in the MySQL 5.1 server. The - MySQL Server Instance Config Wizard is only available for Windows. - - The workflow sequence for using the MySQL Server Instance Config - Wizard is shown in the figure below: - - Figure 2.4. MySQL Server Instance Config Wizard Workflow - MySQL Server Instance Config Wizard Workflow - -2.5.4.1. Starting the MySQL Server Instance Config Wizard - - The MySQL Server Instance Config Wizard is normally started as - part of the installation process. You should only need to run the - MySQL Server Instance Config Wizard again when you need to change - the configuration parameters of your server. - - If you chose not to open a port prior to installing MySQL on - Windows Vista, you can choose to use the MySQL Server Instance - Config Wizard after installation. However, you must open a port in - the Windows Firewall. To do this see the instructions given in - Section 2.5.3.1.1, "Downloading and Starting the MySQL - Installation Wizard." Rather than opening a port, you also have - the option of adding MySQL as a program that bypasses the Windows - Firewall. One or the other option is sufficient --- you need not - do both. Additionally, when running the MySQL Server Config Wizard - on Windows Vista ensure that you are logged in as a user with - administrative rights. - MySQL Server Instance Config Wizard - - You can launch the MySQL Config Wizard by clicking the MySQL - Server Instance Config Wizard entry in the MySQL section of the - Windows Start menu. - - Alternatively, you can navigate to the bin directory of your MySQL - installation and launch the MySQLInstanceConfig.exe file directly. - - The MySQL Server Instance Config Wizard places the my.ini file in - the installation directory for the MySQL server. This helps - associate configuration files with particular server instances. - - To ensure that the MySQL server knows where to look for the my.ini - file, an argument similar to this is passed to the MySQL server as - part of the service installation: ---defaults-file="C:\Program Files\MySQL\MySQL Server 5.1\my.ini" - - Here, C:\Program Files\MySQL\MySQL Server 5.1 is replaced with the - installation path to the MySQL Server. The --defaults-file option - instructs the MySQL server to read the specified file for - configuration options when it starts. - - Apart from making changes to the my.ini file by running the MySQL - Server Instance Config Wizard again, you can modify it by opening - it with a text editor and making any necessary changes. You can - also modify the server configuration with the - http://www.mysql.com/products/administrator/ utility. For more - information about server configuration, see Section 5.1.2, "Server - Command Options." - - MySQL clients and utilities such as the mysql and mysqldump - command-line clients are not able to locate the my.ini file - located in the server installation directory. To configure the - client and utility applications, create a new my.ini file in the - Windows installation directory (for example, C:\WINDOWS). - - Under Windows Server 2003, Windows Server 2000, Windows XP, and - Windows Vista MySQL Server Instance Config Wizard will configure - MySQL to work as a Windows service. To start and stop MySQL you - use the Services application that is supplied as part of the - Windows Administrator Tools. - -2.5.4.2. Choosing a Maintenance Option - - If the MySQL Server Instance Config Wizard detects an existing - configuration file, you have the option of either reconfiguring - your existing server, or removing the server instance by deleting - the configuration file and stopping and removing the MySQL - service. - - To reconfigure an existing server, choose the Re-configure - Instance option and click the Next button. Any existing - configuration file is not overwritten, but renamed (within the - same directory) using a timestamp (Windows) or sequential number - (Linux). To remove the existing server instance, choose the Remove - Instance option and click the Next button. - - If you choose the Remove Instance option, you advance to a - confirmation window. Click the Execute button. The MySQL Server - Config Wizard stops and removes the MySQL service, and then - deletes the configuration file. The server installation and its - data folder are not removed. - - If you choose the Re-configure Instance option, you advance to the - Configuration Type dialog where you can choose the type of - installation that you wish to configure. - -2.5.4.3. Choosing a Configuration Type - - When you start the MySQL Server Instance Config Wizard for a new - MySQL installation, or choose the Re-configure Instance option for - an existing installation, you advance to the Configuration Type - dialog. - MySQL Server Instance Config Wizard: Configuration Type - - There are two configuration types available: Detailed - Configuration and Standard Configuration. The Standard - Configuration option is intended for new users who want to get - started with MySQL quickly without having to make many decisions - about server configuration. The Detailed Configuration option is - intended for advanced users who want more fine-grained control - over server configuration. - - If you are new to MySQL and need a server configured as a - single-user developer machine, the Standard Configuration should - suit your needs. Choosing the Standard Configuration option causes - the MySQL Config Wizard to set all configuration options - automatically with the exception of Service Options and Security - Options. - - The Standard Configuration sets options that may be incompatible - with systems where there are existing MySQL installations. If you - have an existing MySQL installation on your system in addition to - the installation you wish to configure, the Detailed Configuration - option is recommended. - - To complete the Standard Configuration, please refer to the - sections on Service Options and Security Options in Section - 2.5.4.10, "The Service Options Dialog," and Section 2.5.4.11, "The - Security Options Dialog," respectively. - -2.5.4.4. The Server Type Dialog - - There are three different server types available to choose from. - The server type that you choose affects the decisions that the - MySQL Server Instance Config Wizard makes with regard to memory, - disk, and processor usage. - MySQL Server Instance Config Wizard: Server Type - - * Developer Machine: Choose this option for a typical desktop - workstation where MySQL is intended only for personal use. It - is assumed that many other desktop applications are running. - The MySQL server is configured to use minimal system - resources. - - * Server Machine: Choose this option for a server machine where - the MySQL server is running alongside other server - applications such as FTP, email, and Web servers. The MySQL - server is configured to use a moderate portion of the system - resources. - - * Dedicated MySQL Server Machine: Choose this option for a - server machine that is intended to run only the MySQL server. - It is assumed that no other applications are running. The - MySQL server is configured to use all available system - resources. - -Note - - By selecting one of the preconfigured configurations, the values - and settings of various options in your my.cnf or my.ini will be - altered accordingly. The default values and options as described - in the reference manual may therefore be different to the options - and values that were created during the execution of the Config - Wizard. - -2.5.4.5. The Database Usage Dialog - - The Database Usage dialog allows you to indicate the storage - engines that you expect to use when creating MySQL tables. The - option you choose determines whether the InnoDB storage engine is - available and what percentage of the server resources are - available to InnoDB. - MySQL Server Instance Config Wizard: Usage Dialog - - * Multifunctional Database: This option enables both the InnoDB - and MyISAM storage engines and divides resources evenly - between the two. This option is recommended for users who use - both storage engines on a regular basis. - - * Transactional Database Only: This option enables both the - InnoDB and MyISAM storage engines, but dedicates most server - resources to the InnoDB storage engine. This option is - recommended for users who use InnoDB almost exclusively and - make only minimal use of MyISAM. - - * Non-Transactional Database Only: This option disables the - InnoDB storage engine completely and dedicates all server - resources to the MyISAM storage engine. This option is - recommended for users who do not use InnoDB. - - The Config Wizard uses a template to generate the server - configuration file. The Database Usage dialog sets one of the - following option strings: -Multifunctional Database: MIXED -Transactional Database Only: INNODB -Non-Transactional Database Only: MYISAM - - When these options are processed through the default template - (my-template.ini) the result is: -Multifunctional Database: -default-storage-engine=InnoDB -_myisam_pct=50 - -Transactional Database Only: -default-storage-engine=InnoDB -_myisam_pct=5 - -Non-Transactional Database Only: -default-storage-engine=MyISAM -_myisam_pct=100 -skip-innodb - - The _myisam_pct value is used to calculate the percentage of - resources dedicated to MyISAM. The remaining resources are - allocated to InnoDB. - -2.5.4.6. The InnoDB Tablespace Dialog - - Some users may want to locate the InnoDB tablespace files in a - different location than the MySQL server data directory. Placing - the tablespace files in a separate location can be desirable if - your system has a higher capacity or higher performance storage - device available, such as a RAID storage system. - MySQL Server Instance Config Wizard: InnoDB Data Tablespace - - To change the default location for the InnoDB tablespace files, - choose a new drive from the drop-down list of drive letters and - choose a new path from the drop-down list of paths. To create a - custom path, click the ... button. - - If you are modifying the configuration of an existing server, you - must click the Modify button before you change the path. In this - situation you must move the existing tablespace files to the new - location manually before starting the server. - -2.5.4.7. The Concurrent Connections Dialog - - To prevent the server from running out of resources, it is - important to limit the number of concurrent connections to the - MySQL server that can be established. The Concurrent Connections - dialog allows you to choose the expected usage of your server, and - sets the limit for concurrent connections accordingly. It is also - possible to set the concurrent connection limit manually. - MySQL Server Instance Config Wizard: Connections - - * Decision Support (DSS)/OLAP: Choose this option if your server - does not require a large number of concurrent connections. The - maximum number of connections is set at 100, with an average - of 20 concurrent connections assumed. - - * Online Transaction Processing (OLTP): Choose this option if - your server requires a large number of concurrent connections. - The maximum number of connections is set at 500. - - * Manual Setting: Choose this option to set the maximum number - of concurrent connections to the server manually. Choose the - number of concurrent connections from the drop-down box - provided, or enter the maximum number of connections into the - drop-down box if the number you desire is not listed. - -2.5.4.8. The Networking and Strict Mode Options Dialog - - Use the Networking Options dialog to enable or disable TCP/IP - networking and to configure the port number that is used to - connect to the MySQL server. - MySQL Server Instance Config Wizard: Network Configuration - - TCP/IP networking is enabled by default. To disable TCP/IP - networking, uncheck the box next to the Enable TCP/IP Networking - option. - - Port 3306 is used by default. To change the port used to access - MySQL, choose a new port number from the drop-down box or type a - new port number directly into the drop-down box. If the port - number you choose is in use, you are prompted to confirm your - choice of port number. - - Set the Server SQL Mode to either enable or disable strict mode. - Enabling strict mode (default) makes MySQL behave more like other - database management systems. If you run applications that rely on - MySQL's old "forgiving" behavior, make sure to either adapt those - applications or to disable strict mode. For more information about - strict mode, see Section 5.1.8, "Server SQL Modes." - -2.5.4.9. The Character Set Dialog - - The MySQL server supports multiple character sets and it is - possible to set a default server character set that is applied to - all tables, columns, and databases unless overridden. Use the - Character Set dialog to change the default character set of the - MySQL server. - MySQL Server Instance Config Wizard: Character Set - - * Standard Character Set: Choose this option if you want to use - latin1 as the default server character set. latin1 is used for - English and many Western European languages. - - * Best Support For Multilingualism: Choose this option if you - want to use utf8 as the default server character set. This is - a Unicode character set that can store characters from many - different languages. - - * Manual Selected Default Character Set / Collation: Choose this - option if you want to pick the server's default character set - manually. Choose the desired character set from the provided - drop-down list. - -2.5.4.10. The Service Options Dialog - - On Windows platforms, the MySQL server can be installed as a - Windows service. When installed this way, the MySQL server can be - started automatically during system startup, and even restarted - automatically by Windows in the event of a service failure. - - The MySQL Server Instance Config Wizard installs the MySQL server - as a service by default, using the service name MySQL. If you do - not wish to install the service, uncheck the box next to the - Install As Windows Service option. You can change the service name - by picking a new service name from the drop-down box provided or - by entering a new service name into the drop-down box. - -Note - - Service names can include any legal character except forward (/) - or backward (\) slashes, and must be less than 256 characters - long. - -Warning - - If you are installing multiple versions of MySQL onto the same - machine, you must choose a different service name for each version - that you install. If you do not choose a different service for - each installed version then the service manager information will - be inconsistent and this will cause problems when you try to - uninstall a previous version. - - If you have already installed multiple versions using the same - service name, you must manually edit the contents of the - HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services parameters - within the Windows registry to update the association of the - service name with the correct server version. - - Typically, when installing multiple versions you create a service - name based on the version information. For example, you might - install MySQL 5.x as mysql5, or specific versions such as MySQL - 5.1.30 as mysql50130. - - To install the MySQL server as a service but not have it started - automatically at startup, uncheck the box next to the Launch the - MySQL Server Automatically option. - -2.5.4.11. The Security Options Dialog - - The content of the security options portion of the MySQL Server - Instance Configuration Wizard will depend on whether this is a new - installation, or modifying an existing installation. - - * Setting the root password for a new installation - It is strongly recommended that you set a root password for - your MySQL server, and the MySQL Server Instance Config Wizard - requires by default that you do so. If you do not wish to set - a root password, uncheck the box next to the Modify Security - Settings option. - MySQL Server Instance Config Wizard: Security - - * To set the root password, enter the desired password into both - the New root password and Confirm boxes. - Setting the root password for an existing installation - If you are modifying the configuration of an existing - configuration, or you are installing an upgrade and the MySQL - Server Instance Configuration Wizard has detected an existing - MySQL system, then you must enter the existing password for - root before changing the configuration information. - MySQL Server Instance Config Wizard: Security (Existing - Installation) - If you want to change the current root password, enter the - desired new password into both the New root password and - Confirm boxes. - - To allow root logins from across the network, check the box next - to the Enable root access from remote machines option. This - decreases the security of your root account. - - To create an anonymous user account, check the box next to the - Create An Anonymous Account option. Creating an anonymous account - can decrease server security and cause login and permission - difficulties. For this reason, it is not recommended. - -2.5.4.12. The Confirmation Dialog - - The final dialog in the MySQL Server Instance Config Wizard is the - Confirmation Dialog. To start the configuration process, click the - Execute button. To return to a previous dialog, click the Back - button. To exit the MySQL Server Instance Config Wizard without - configuring the server, click the Cancel button. - MySQL Server Instance Config Wizard: Confirmation - - After you click the Execute button, the MySQL Server Instance - Config Wizard performs a series of tasks and displays the progress - onscreen as the tasks are performed. - - The MySQL Server Instance Config Wizard first determines - configuration file options based on your choices using a template - prepared by MySQL developers and engineers. This template is named - my-template.ini and is located in your server installation - directory. - - The MySQL Config Wizard then writes these options to the - corresponding configuration file. - - If you chose to create a service for the MySQL server, the MySQL - Server Instance Config Wizard creates and starts the service. If - you are reconfiguring an existing service, the MySQL Server - Instance Config Wizard restarts the service to apply your - configuration changes. - - If you chose to set a root password, the MySQL Config Wizard - connects to the server, sets your new root password, and applies - any other security settings you may have selected. - - After the MySQL Server Instance Config Wizard has completed its - tasks, it displays a summary. Click the Finish button to exit the - MySQL Server Config Wizard. - -2.5.4.13. Creating an Instance from the Command Line - - In addition to using the GUI interface to the MySQL Server - Instance Config Wizard, you can also create instances - automatically from the command line. - - To use the MySQL Server Instance Config Wizard on the command - line, you need to use the MySQLInstanceConfig.exe command that is - installed with MySQL in the bin directory within the installation - directory. MySQLInstanceConfig.exe takes a number of command-line - arguments the set the properties that would normally be selected - through the GUI interface, and then creates a new configuration - file (my.ini) by combining these selections with a template - configuration file to produce the working configuration file. - - The main command line options are provided in the table below. - Some of the options are required, while some options are optional. - - Table 2.4. MySQL Server Instance Config Wizard Command Line - Options - Option Description - Required Parameters - -nPRODUCTNAME The name of the instance when installed - -pPATH Path of the base directory for installation. This is - equivalent to the directory when using the basedir configuration - parameter - -vVERSION The version tag to use for this installation - Action to Perform - -i Install an instance - -r Remove an instance - -s Stop an existing instance - -q Perform the operation quietly - -lFILENAME Sae the installation progress in a logfile - Config File to Use - -tFILENAME Path to the template config file that will be used to - generate the installed configuration file - -cFILENAME Path to a config file to be generated - - The -t and -c options work together to set the configuration - parameters for a new instance. The -t option specifies the - template configuration file to use as the basic configuration, - which are then merged with the configuration parameters generated - by the MySQL Server Instance Config Wizard into the configuration - file specified by the -c option. - - A sample template file, my-template.ini is provided in the - toplevel MySQL installation directory. The file contains elements - are replaced automatically by the MySQL Server Instance Config - Wizard during configuration. - - If you specify a configuration file that already exists, the - existing configuration file will be saved in the file with the - original, with the date and time added. For example, the mysql.ini - will be copied to mysql 2009-10-27 1646.ini.bak. - - The parameters that you can specify on the command line are listed - in the table below. - - Table 2.5. MySQL Server Instance Config Wizard Parameters - Parameter Description - ServiceName=$ Specify the name of the service to be created - AddBinToPath={yes | no} Specifies whether to add the binary - directory of MySQL to the standard PATH environment variable - ServerType={DEVELOPMENT | SERVER | DEDICATED} Specify the server - type. For more information, see Section 2.5.4.4, "The Server Type - Dialog" - DatabaseType={MIXED | INNODB | MYISAM} Specify the default - database type. For more information, see Section 2.5.4.5, "The - Database Usage Dialog" - ConnectionUsage={DSS | OLTP} Specify the type of connection - support, this automates the setting for the number of concurrent - connections (see the ConnectionCount parameter). For more - information, see Section 2.5.4.7, "The Concurrent Connections - Dialog" - ConnectionCount=# Specify the number of concurrent connections to - support. For more information, see Section 2.5.4.4, "The Server - Type Dialog" - SkipNetworking={yes | no} Specify whether network support should - be supported. Specifying yes disables network access altogether - Port=# Specify the network port number to use for network - connections. For more information, see Section 2.5.4.8, "The - Networking and Strict Mode Options Dialog" - StrictMode={yes | no} Specify whether to use the strict SQL mode. - For more information, see Section 2.5.4.8, "The Networking and - Strict Mode Options Dialog" - Charset=$ Specify the default character set. For more information, - see Section 2.5.4.9, "The Character Set Dialog" - RootPassword=$ Specify the root password - RootCurrentPassword=$ Specify the current root password then - stopping and/or reconfiguring an existing service - -Note - - When specifying options on the command line, you can enclose the - entire command-line option and the value you are specifying using - double quotes. This enables you to use spaces in the options. For - example, "-cC:\mysql.ini". - - The following command installs a MySQL Server 5.1 instance from - the directory C:\Program Files\MySQL\MySQL Server 5.1 using the - service name MySQL51 and setting the root password to 1234. -shell> MySQLInstanceConfig.exe -i -q "-lC:\mysql_install_log.txt" » - "-nMySQL Server 5.1" "-pC:\Program Files\MySQL\MySQL Server 5.1" - -v5.1.39 » - "-tmy-template.ini" "-cC:\mytest.ini" ServerType=DEVELOPMENT Datab -aseType=MIXED » - ConnectionUsage=DSS Port=3311 ServiceName=MySQL51 RootPassword=123 -4 - - In the above example, a log file will be generated in - mysql_install_log.txt containing the information about the - instance creation process. The log file generated by the above - example is shown below: -Welcome to the MySQL Server Instance Configuration Wizard 1.0.16.0 -Date: 2009-10-27 17:07:21 - -Installing service ... - -Product Name: MySQL Server 5.1 -Version: 5.1.39 -Installation Path: C:\Program Files\MySQL\MySQL Server 5.1\ - -Creating configuration file C:\mytest.ini using template my-template. -ini. -Options: -DEVELOPMENT -MIXED -DSS -STRICTMODE - -Variables: -port: 3311 -default-character-set: latin1 -basedir: "C:/Program Files/MySQL/MySQL Server 5.1/" -datadir: "C:/Program Files/MySQL/MySQL Server 5.1/Data/" - - -Creating Windows service entry. -Service name: "MySQL51" -Parameters: "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" -- -defaults-file="C:\mytest.ini" MySQL51. -Windows service MySQL51 installed. - - When using the command-line, the return values in the following - table indicate an error performing the specified option. - - Table 2.6. Return Value from MySQL Server Instance Config Wizard - Value Description - 2 Configuration template file cannot be found - 3 The Windows service entry cannot be created - 4 Could not connect to the Service Control Manager - 5 The MySQL service cannot be started - 6 The MySQL service cannot be stopped - 7 The security settings cannot be applied - 8 The configuration file cannot be written - 9 The Windows service entry cannot be removed - - You can perform an installation of MySQL automatically using the - MSI packe. For more information, see Section 2.5.3.2, "Installing - MySQL Automatically using MSI." - -2.5.5. Installing MySQL from a noinstall Zip Archive - - Users who are installing from the noinstall package can use the - instructions in this section to manually install MySQL. The - process for installing MySQL from a Zip archive is as follows: - - 1. Extract the archive to the desired install directory - - 2. Create an option file - - 3. Choose a MySQL server type - - 4. Start the MySQL server - - 5. Secure the default user accounts - - This process is described in the sections that follow. - -2.5.5.1. Extracting the Install Archive - - To install MySQL manually, do the following: - - 1. If you are upgrading from a previous version please refer to - Section 2.5.7, "Upgrading MySQL on Windows," before beginning - the upgrade process. - - 2. Make sure that you are logged in as a user with administrator - privileges. - - 3. Choose an installation location. Traditionally, the MySQL - server is installed in C:\mysql. The MySQL Installation Wizard - installs MySQL under C:\Program Files\MySQL. If you do not - install MySQL at C:\mysql, you must specify the path to the - install directory during startup or in an option file. See - Section 2.5.5.2, "Creating an Option File." - - 4. Extract the install archive to the chosen installation - location using your preferred Zip archive tool. Some tools may - extract the archive to a folder within your chosen - installation location. If this occurs, you can move the - contents of the subfolder into the chosen installation - location. - -2.5.5.2. Creating an Option File - - If you need to specify startup options when you run the server, - you can indicate them on the command line or place them in an - option file. For options that are used every time the server - starts, you may find it most convenient to use an option file to - specify your MySQL configuration. This is particularly true under - the following circumstances: - - * The installation or data directory locations are different - from the default locations (C:\Program Files\MySQL\MySQL - Server 5.1 and C:\Program Files\MySQL\MySQL Server 5.1\data). - - * You need to tune the server settings, such as memory, cache, - or InnoDB configuration information. - - When the MySQL server starts on Windows, it looks for option files - in several locations, such as the Windows directory, C:\, and the - MySQL installation directory (for the full list of locations, see - Section 4.2.3.3, "Using Option Files"). The Windows directory - typically is named something like C:\WINDOWS. You can determine - its exact location from the value of the WINDIR environment - variable using the following command: -C:\> echo %WINDIR% - - MySQL looks for options in each location first in the my.ini file, - and then in the my.cnf file. However, to avoid confusion, it is - best if you use only one file. If your PC uses a boot loader where - C: is not the boot drive, your only option is to use the my.ini - file. Whichever option file you use, it must be a plain text file. - - You can also make use of the example option files included with - your MySQL distribution; see Section 4.2.3.3.2, "Preconfigured - Option Files." - - An option file can be created and modified with any text editor, - such as Notepad. For example, if MySQL is installed in E:\mysql - and the data directory is in E:\mydata\data, you can create an - option file containing a [mysqld] section to specify values for - the basedir and datadir options: -[mysqld] -# set basedir to your installation path -basedir=E:/mysql -# set datadir to the location of your data directory -datadir=E:/mydata/data - - Note that Windows path names are specified in option files using - (forward) slashes rather than backslashes. If you do use - backslashes, double them: -[mysqld] -# set basedir to your installation path -basedir=E:\\mysql -# set datadir to the location of your data directory -datadir=E:\\mydata\\data - - The rules for use of backslash in option file values are given in - Section 4.2.3.3, "Using Option Files." - - MySQL Enterprise For expert advice on the start-up options - appropriate to your circumstances, subscribe to the MySQL - Enterprise Monitor. For more information, see - http://www.mysql.com/products/enterprise/advisors.html. - - In MySQL 5.1.23 and earlier, the MySQL installer places the data - directory directly under the directory where you install MySQL. On - MySQL 5.1.24 and later, the data directory is located within the - AppData directory for the user running MySQL. - - If you would like to use a data directory in a different location, - you should copy the entire contents of the data directory to the - new location. For example, if you want to use E:\mydata as the - data directory instead, you must do two things: - - 1. Move the entire data directory and all of its contents from - the default location (for example C:\Program Files\MySQL\MySQL - Server 5.1\data) to E:\mydata. - - 2. Use a --datadir option to specify the new data directory - location each time you start the server. - -2.5.5.3. Selecting a MySQL Server Type - - The following table shows the available servers for Windows in - MySQL 5.1.20 and earlier. - Binary Description - mysqld-nt Optimized binary with named-pipe support - mysqld Optimized binary without named-pipe support - mysqld-debug Like mysqld-nt, but compiled with full debugging and - automatic memory allocation checking - - The following table shows the available servers for Windows in - MySQL 5.1.21 and later. - Binary Description - mysqld Optimized binary with named-pipe support - mysqld-debug Like mysqld, but compiled with full debugging and - automatic memory allocation checking - - All of the preceding binaries are optimized for modern Intel - processors, but should work on any Intel i386-class or higher - processor. - - Each of the servers in a distribution support the same set of - storage engines. The SHOW ENGINES statement displays which engines - a given server supports. - - All Windows MySQL 5.1 servers have support for symbolic linking of - database directories. - - MySQL supports TCP/IP on all Windows platforms. MySQL servers on - Windows support named pipes as indicated in the following list. - However, the default is to use TCP/IP regardless of platform. - (Named pipes are slower than TCP/IP in many Windows - configurations.) - - Use of named pipes is subject to these conditions: - - * Named pipes are enabled only if you start the server with the - --enable-named-pipe option. It is necessary to use this option - explicitly because some users have experienced problems with - shutting down the MySQL server when named pipes were used. - - * For MySQL 5.1.20 and earlier, named-pipe connections are - allowed only by the mysqld-nt and mysqld-debug servers. For - MySQL 5.1.21 and later, the mysqld and mysqld-debug servers - both contain support for named-pipe connections. - -Note - - Most of the examples in this manual use mysqld as the server name. - If you choose to use a different server, such as mysqld-nt or - mysqld-debug, make the appropriate substitutions in the commands - that are shown in the examples. - -2.5.5.4. Starting the Server for the First Time - - This section gives a general overview of starting the MySQL - server. The following sections provide more specific information - for starting the MySQL server from the command line or as a - Windows service. - - The information here applies primarily if you installed MySQL - using the Noinstall version, or if you wish to configure and test - MySQL manually rather than with the GUI tools. - - The examples in these sections assume that MySQL is installed - under the default location of C:\Program Files\MySQL\MySQL Server - 5.1. Adjust the path names shown in the examples if you have MySQL - installed in a different location. - - Clients have two options. They can use TCP/IP, or they can use a - named pipe if the server supports named-pipe connections. - - MySQL for Windows also supports shared-memory connections if the - server is started with the --shared-memory option. Clients can - connect through shared memory by using the --protocol=MEMORY - option. - - For information about which server binary to run, see Section - 2.5.5.3, "Selecting a MySQL Server Type." - - Testing is best done from a command prompt in a console window (or - "DOS window"). In this way you can have the server display status - messages in the window where they are easy to see. If something is - wrong with your configuration, these messages make it easier for - you to identify and fix any problems. - - To start the server, enter this command: -C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --console - - For a server that includes InnoDB support, you should see the - messages similar to those following as it starts (the path names - and sizes may differ): -InnoDB: The first specified datafile c:\ibdata\ibdata1 did not exist: -InnoDB: a new database to be created! -InnoDB: Setting file c:\ibdata\ibdata1 size to 209715200 -InnoDB: Database physically writes the file full: wait... -InnoDB: Log file c:\iblogs\ib_logfile0 did not exist: new to be creat -ed -InnoDB: Setting log file c:\iblogs\ib_logfile0 size to 31457280 -InnoDB: Log file c:\iblogs\ib_logfile1 did not exist: new to be creat -ed -InnoDB: Setting log file c:\iblogs\ib_logfile1 size to 31457280 -InnoDB: Log file c:\iblogs\ib_logfile2 did not exist: new to be creat -ed -InnoDB: Setting log file c:\iblogs\ib_logfile2 size to 31457280 -InnoDB: Doublewrite buffer not found: creating new -InnoDB: Doublewrite buffer created -InnoDB: creating foreign key constraint system tables -InnoDB: foreign key constraint system tables created -011024 10:58:25 InnoDB: Started - - When the server finishes its startup sequence, you should see - something like this, which indicates that the server is ready to - service client connections: -mysqld: ready for connections -Version: '5.1.46' socket: '' port: 3306 - - The server continues to write to the console any further - diagnostic output it produces. You can open a new console window - in which to run client programs. - - If you omit the --console option, the server writes diagnostic - output to the error log in the data directory (C:\Program - Files\MySQL\MySQL Server 5.1\data by default). The error log is - the file with the .err extension. - -Note - - The accounts that are listed in the MySQL grant tables initially - have no passwords. After starting the server, you should set up - passwords for them using the instructions in Section 2.13, - "Post-Installation Setup and Testing." - -2.5.5.5. Starting MySQL from the Windows Command Line - - The MySQL server can be started manually from the command line. - This can be done on any version of Windows. - - To start the mysqld server from the command line, you should start - a console window (or "DOS window") and enter this command: -C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" - - The path to mysqld may vary depending on the install location of - MySQL on your system. - - You can stop the MySQL server by executing this command: -C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" -u root - shutdown - -Note - - If the MySQL root user account has a password, you need to invoke - mysqladmin with the -p option and supply the password when - prompted. - - This command invokes the MySQL administrative utility mysqladmin - to connect to the server and tell it to shut down. The command - connects as the MySQL root user, which is the default - administrative account in the MySQL grant system. Note that users - in the MySQL grant system are wholly independent from any login - users under Windows. - - If mysqld doesn't start, check the error log to see whether the - server wrote any messages there to indicate the cause of the - problem. The error log is located in the C:\Program - Files\MySQL\MySQL Server 5.1\data directory. It is the file with a - suffix of .err. You can also try to start the server as mysqld - --console; in this case, you may get some useful information on - the screen that may help solve the problem. - - The last option is to start mysqld with the --standalone and - --debug-dbug options. In this case, mysqld writes a log file - C:\mysqld.trace that should contain the reason why mysqld doesn't - start. See MySQL Internals: Porting - (http://forge.mysql.com/wiki/MySQL_Internals_Porting). - - Use mysqld --verbose --help to display all the options that mysqld - supports. - -2.5.5.6. Starting MySQL as a Windows Service - - On Windows, the recommended way to run MySQL is to install it as a - Windows service, whereby MySQL starts and stops automatically when - Windows starts and stops. A MySQL server installed as a service - can also be controlled from the command line using NET commands, - or with the graphical Services utility. Generally, to install - MySQL as a Windows service you should be logged in using an - account that has administrator rights. - - The Services utility (the Windows Service Control Manager) can be - found in the Windows Control Panel (under Administrative Tools on - Windows 2000, XP, Vista and Server 2003). To avoid conflicts, it - is advisable to close the Services utility while performing server - installation or removal operations from the command line. - - Before installing MySQL as a Windows service, you should first - stop the current server if it is running by using the following - command: -C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" - -u root shutdown - -Note - - If the MySQL root user account has a password, you need to invoke - mysqladmin with the -p option and supply the password when - prompted. - - This command invokes the MySQL administrative utility mysqladmin - to connect to the server and tell it to shut down. The command - connects as the MySQL root user, which is the default - administrative account in the MySQL grant system. Note that users - in the MySQL grant system are wholly independent from any login - users under Windows. - - Install the server as a service using this command: -C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install - - The service-installation command does not start the server. - Instructions for that are given later in this section. - - To make it easier to invoke MySQL programs, you can add the path - name of the MySQL bin directory to your Windows system PATH - environment variable: - - * On the Windows desktop, right-click on the My Computer icon, - and select Properties. - - * Next select the Advanced tab from the System Properties menu - that appears, and click the Environment Variables button. - - * Under System Variables, select Path, and then click the Edit - button. The Edit System Variable dialogue should appear. - - * Place your cursor at the end of the text appearing in the - space marked Variable Value. (Use the End key to ensure that - your cursor is positioned at the very end of the text in this - space.) Then enter the complete path name of your MySQL bin - directory (for example, C:\Program Files\MySQL\MySQL Server - 5.1\bin), Note that there should be a semicolon separating - this path from any values present in this field. Dismiss this - dialogue, and each dialogue in turn, by clicking OK until all - of the dialogues that were opened have been dismissed. You - should now be able to invoke any MySQL executable program by - typing its name at the DOS prompt from any directory on the - system, without having to supply the path. This includes the - servers, the mysql client, and all MySQL command-line - utilities such as mysqladmin and mysqldump. - You should not add the MySQL bin directory to your Windows - PATH if you are running multiple MySQL servers on the same - machine. - -Warning - - You must exercise great care when editing your system PATH by - hand; accidental deletion or modification of any portion of the - existing PATH value can leave you with a malfunctioning or even - unusable system. - - The following additional arguments can be used in MySQL 5.1 when - installing the service: - - * You can specify a service name immediately following the - --install option. The default service name is MySQL. - - * If a service name is given, it can be followed by a single - option. By convention, this should be - --defaults-file=file_name to specify the name of an option - file from which the server should read options when it starts. - The use of a single option other than --defaults-file is - possible but discouraged. --defaults-file is more flexible - because it enables you to specify multiple startup options for - the server by placing them in the named option file. - - * You can also specify a --local-service option following the - service name. This causes the server to run using the - LocalService Windows account that has limited system - privileges. This account is available only for Windows XP or - newer. If both --defaults-file and --local-service are given - following the service name, they can be in any order. - - For a MySQL server that is installed as a Windows service, the - following rules determine the service name and option files that - the server uses: - - * If the service-installation command specifies no service name - or the default service name (MySQL) following the --install - option, the server uses the a service name of MySQL and reads - options from the [mysqld] group in the standard option files. - - * If the service-installation command specifies a service name - other than MySQL following the --install option, the server - uses that service name. It reads options from the [mysqld] - group and the group that has the same name as the service in - the standard option files. This allows you to use the [mysqld] - group for options that should be used by all MySQL services, - and an option group with the service name for use by the - server installed with that service name. - - * If the service-installation command specifies a - --defaults-file option after the service name, the server - reads options only from the [mysqld] group of the named file - and ignores the standard option files. - - As a more complex example, consider the following command: -C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" - --install MySQL --defaults-file=C:\my-opts.cnf - - Here, the default service name (MySQL) is given after the - --install option. If no --defaults-file option had been given, - this command would have the effect of causing the server to read - the [mysqld] group from the standard option files. However, - because the --defaults-file option is present, the server reads - options from the [mysqld] option group, and only from the named - file. - - You can also specify options as Start parameters in the Windows - Services utility before you start the MySQL service. - - Once a MySQL server has been installed as a service, Windows - starts the service automatically whenever Windows starts. The - service also can be started immediately from the Services utility, - or by using a NET START MySQL command. The NET command is not case - sensitive. - - When run as a service, mysqld has no access to a console window, - so no messages can be seen there. If mysqld does not start, check - the error log to see whether the server wrote any messages there - to indicate the cause of the problem. The error log is located in - the MySQL data directory (for example, C:\Program - Files\MySQL\MySQL Server 5.1\data). It is the file with a suffix - of .err. - - When a MySQL server has been installed as a service, and the - service is running, Windows stops the service automatically when - Windows shuts down. The server also can be stopped manually by - using the Services utility, the NET STOP MySQL command, or the - mysqladmin shutdown command. - - You also have the choice of installing the server as a manual - service if you do not wish for the service to be started - automatically during the boot process. To do this, use the - --install-manual option rather than the --install option: -C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install-m -anual - - To remove a server that is installed as a service, first stop it - if it is running by executing NET STOP MySQL. Then use the - --remove option to remove it: -C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --remove - - If mysqld is not running as a service, you can start it from the - command line. For instructions, see Section 2.5.5.5, "Starting - MySQL from the Windows Command Line." - - Please see Section 2.5.6, "Troubleshooting a MySQL Installation - Under Windows," if you encounter difficulties during installation. - -2.5.5.7. Testing The MySQL Installation - - You can test whether the MySQL server is working by executing any - of the following commands: -C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow" -C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow" -u root -mysql -C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" version - status proc -C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql" test - -Note - - By default, mysqlshow will try to connect using the ODBC user. - This user is not created by default. You should specify a valid - user, or root with the right password to check the operation of - the server. - - If mysqld is slow to respond to TCP/IP connections from client - programs, there is probably a problem with your DNS. In this case, - start mysqld with the --skip-name-resolve option and use only - localhost and IP numbers in the Host column of the MySQL grant - tables. - - You can force a MySQL client to use a named-pipe connection rather - than TCP/IP by specifying the --pipe or --protocol=PIPE option, or - by specifying . (period) as the host name. Use the --socket option - to specify the name of the pipe if you do not want to use the - default pipe name. - - Note that if you have set a password for the root account, deleted - the anonymous account, or created a new user account, then you - must use the appropriate -u and -p options with the commands shown - above in order to connect with the MySQL Server. See Section - 4.2.2, "Connecting to the MySQL Server." - - For more information about mysqlshow, see Section 4.5.6, - "mysqlshow --- Display Database, Table, and Column Information." - -2.5.6. Troubleshooting a MySQL Installation Under Windows - - When installing and running MySQL for the first time, you may - encounter certain errors that prevent the MySQL server from - starting. The purpose of this section is to help you diagnose and - correct some of these errors. - - Your first resource when troubleshooting server issues is the - error log. The MySQL server uses the error log to record - information relevant to the error that prevents the server from - starting. The error log is located in the data directory specified - in your my.ini file. The default data directory location is - C:\Program Files\MySQL\MySQL Server 5.1\data. See Section 5.2.2, - "The Error Log." - - Another source of information regarding possible errors is the - console messages displayed when the MySQL service is starting. Use - the NET START MySQL command from the command line after installing - mysqld as a service to see any error messages regarding the - starting of the MySQL server as a service. See Section 2.5.5.6, - "Starting MySQL as a Windows Service." - - The following examples show other common error messages you may - encounter when installing MySQL and starting the server for the - first time: - - * If the MySQL server cannot find the mysql privileges database - or other critical files, you may see these messages: -System error 1067 has occurred. -Fatal error: Can't open privilege tables: Table 'mysql.host' doesn't -exist - These messages often occur when the MySQL base or data - directories are installed in different locations than the - default locations (C:\Program Files\MySQL\MySQL Server 5.1 and - C:\Program Files\MySQL\MySQL Server 5.1\data, respectively). - This situation may occur when MySQL is upgraded and installed - to a new location, but the configuration file is not updated - to reflect the new location. In addition, there may be old and - new configuration files that conflict. Be sure to delete or - rename any old configuration files when upgrading MySQL. - If you have installed MySQL to a directory other than - C:\Program Files\MySQL\MySQL Server 5.1, you need to ensure - that the MySQL server is aware of this through the use of a - configuration (my.ini) file. The my.ini file needs to be - located in your Windows directory, typically C:\WINDOWS. You - can determine its exact location from the value of the WINDIR - environment variable by issuing the following command from the - command prompt: -C:\> echo %WINDIR% - An option file can be created and modified with any text - editor, such as Notepad. For example, if MySQL is installed in - E:\mysql and the data directory is D:\MySQLdata, you can - create the option file and set up a [mysqld] section to - specify values for the basedir and datadir options: -[mysqld] -# set basedir to your installation path -basedir=E:/mysql -# set datadir to the location of your data directory -datadir=D:/MySQLdata - Note that Windows path names are specified in option files - using (forward) slashes rather than backslashes. If you do use - backslashes, double them: -[mysqld] -# set basedir to your installation path -basedir=C:\\Program Files\\MySQL\\MySQL Server 5.1 -# set datadir to the location of your data directory -datadir=D:\\MySQLdata - The rules for use of backslash in option file values are given - in Section 4.2.3.3, "Using Option Files." - If you change the datadir value in your MySQL configuration - file, you must move the contents of the existing MySQL data - directory before restarting the MySQL server. - See Section 2.5.5.2, "Creating an Option File." - - * If you reinstall or upgrade MySQL without first stopping and - removing the existing MySQL service and install MySQL using - the MySQL Config Wizard, you may see this error: -Error: Cannot create Windows service for MySql. Error: 0 - This occurs when the Config Wizard tries to install the - service and finds an existing service with the same name. - One solution to this problem is to choose a service name other - than mysql when using the configuration wizard. This allows - the new service to be installed correctly, but leaves the - outdated service in place. Although this is harmless, it is - best to remove old services that are no longer in use. - To permanently remove the old mysql service, execute the - following command as a user with administrative privileges, on - the command-line: -C:\> sc delete mysql -[SC] DeleteService SUCCESS - If the sc utility is not available for your version of - Windows, download the delsrv utility from - http://www.microsoft.com/windows2000/techinfo/reskit/tools/exi - sting/delsrv-o.asp and use the delsrv mysql syntax. - -2.5.7. Upgrading MySQL on Windows - - This section lists some of the steps you should take when - upgrading MySQL on Windows. - - 1. Review Section 2.4.1, "Upgrading MySQL," for additional - information on upgrading MySQL that is not specific to - Windows. - - 2. You should always back up your current MySQL installation - before performing an upgrade. See Section 6.2, "Database - Backup Methods." - - 3. Download the latest Windows distribution of MySQL from - http://dev.mysql.com/downloads/. - - 4. Before upgrading MySQL, you must stop the server. If the - server is installed as a service, stop the service with the - following command from the command prompt: -C:\> NET STOP MySQL - If you are not running the MySQL server as a service, use the - following command to stop it: -C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" -u root - shutdown - -Note - If the MySQL root user account has a password, you need to - invoke mysqladmin with the -p option and supply the password - when prompted. - - 5. When upgrading to MySQL 5.1 from a version previous to 4.1.5, - or when upgrading from a version of MySQL installed from a Zip - archive to a version of MySQL installed with the MySQL - Installation Wizard, you must manually remove the previous - installation and MySQL service (if the server is installed as - a service). - To remove the MySQL service, use the following command: -C:\> C:\mysql\bin\mysqld --remove - If you do not remove the existing service, the MySQL - Installation Wizard may fail to properly install the new MySQL - service. - - 6. When upgrading from MySQL 5.1.23 to MySQL 5.1.24, the change - in the default location of the data directory from a directory - within the MySQL installation to the AppData folder means that - you must manually copy the data files from your old - installation to the new location. - - 7. If you are using the MySQL Installation Wizard, start the - wizard as described in Section 2.5.3.1, "Using the MySQL - Installation Wizard." - - 8. If you are installing MySQL from a Zip archive, extract the - archive. You may either overwrite your existing MySQL - installation (usually located at C:\mysql), or install it into - a different directory, such as C:\mysql5. Overwriting the - existing installation is recommended. - - 9. If you were running MySQL as a Windows service and you had to - remove the service earlier in this procedure, reinstall the - service. (See Section 2.5.5.6, "Starting MySQL as a Windows - Service.") - 10. Restart the server. For example, use NET START MySQL if you - run MySQL as a service, or invoke mysqld directly otherwise. - 11. If you encounter errors, see Section 2.5.6, "Troubleshooting a - MySQL Installation Under Windows." - -2.5.8. Windows Post-Installation Procedures - - On Windows, the data directory and the grant tables do not have to - be created. MySQL Windows distributions include the grant tables - with a set of preinitialized accounts in the mysql database under - the data directory. It is unnecessary to run the mysql_install_db - script that is used on Unix. Regarding passwords, if you installed - MySQL using the Windows Installation Wizard, you may have already - assigned passwords to the accounts. (See Section 2.5.3.1, "Using - the MySQL Installation Wizard.") Otherwise, use the - password-assignment procedure given in Section 2.13.2, "Securing - the Initial MySQL Accounts." - - Before setting up passwords, you might want to try running some - client programs to make sure that you can connect to the server - and that it is operating properly. Make sure that the server is - running (see Section 2.5.5.4, "Starting the Server for the First - Time"), and then issue the following commands to verify that you - can retrieve information from the server. The output should be - similar to what is shown here: -C:\> C:\mysql\bin\mysqlshow -+--------------------+ -| Databases | -+--------------------+ -| information_schema | -| mysql | -| test | -+--------------------+ - -Note - - The above may not work if the correct user does not exist. If you - installed using the MSI packages and used the MySQL Server - Instance Config Wizard, then the root will haqve been created - automatically with the password you supplied. In this case, you - should use the -u and -p options where you will be prompted for - the password. - -Note - - The list of installed databases may vary, but will always include - the minimum of mysql and information_schema. In most cases, the - test database will also be installed automatically. - - If you specify the name of the database, then a list of the tables - within a given database will be displayed: -C:\> C:\mysql\bin\mysqlshow mysql -Database: mysql -+---------------------------+ -| Tables | -+---------------------------+ -| columns_priv | -| db | -| event | -| func | -| general_log | -| help_category | -| help_keyword | -| help_relation | -| help_topic | -| host | -| plugin | -| proc | -| procs_priv | -| servers | -| slow_log | -| tables_priv | -| time_zone | -| time_zone_leap_second | -| time_zone_name | -| time_zone_transition | -| time_zone_transition_type | -| user | -+---------------------------+ - - -C:\> C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM db" mysql -+------+-------+------+ -| host | db | user | -+------+-------+------+ -| % | test% | | -+------+-------+------+ - - You may need to specify a different directory from the one shown; - if you used the Windows Installation Wizard, then the default - directory is C:\Program Files\MySQL\MySQL Server 5.1, and the - mysql and mysqlshow client programs are in C:\Program - Files\MySQL\MySQL Server 5.1\bin. See Section 2.5.3.1, "Using the - MySQL Installation Wizard," for more information. - - If you have already secured the initial MySQL accounts, you may - need to use the -u and -p options to supply a user name and - password to the mysqlshow and mysql client programs; otherwise the - programs may fail with an error, or you may not be able to view - all databases. For example, if you have assigned the password - "secretpass" to the MySQL root account, then you can invoke - mysqlshow and mysql as shown here: -C:\> C:\mysql\bin\mysqlshow -uroot -psecretpass -+--------------------+ -| Databases | -+--------------------+ -| information_schema | -| mysql | -| test | -+--------------------+ - -C:\> C:\mysql\bin\mysqlshow -uroot -psecretpass mysql -Database: mysql -+---------------------------+ -| Tables | -+---------------------------+ -| columns_priv | -| db | -| event | -| func | -| general_log | -| help_category | -| help_keyword | -| help_relation | -| help_topic | -| host | -| plugin | -| proc | -| procs_priv | -| servers | -| slow_log | -| tables_priv | -| time_zone | -| time_zone_leap_second | -| time_zone_name | -| time_zone_transition | -| time_zone_transition_type | -| user | -+---------------------------+ - - -C:\> C:\mysql\bin\mysql -uroot -psecretpass -e "SELECT Host,Db,User F -ROM db" mysql -+------+-------+------+ -| host | db | user | -+------+-------+------+ -| % | test% | | -+------+-------+------+ - - For more information about these programs, see Section 4.5.6, - "mysqlshow --- Display Database, Table, and Column Information," - and Section 4.5.1, "mysql --- The MySQL Command-Line Tool." - - If you are running a version of Windows that supports services and - you want the MySQL server to run automatically when Windows - starts, see Section 2.5.5.6, "Starting MySQL as a Windows - Service." - -2.5.9. MySQL on Windows Compared to MySQL on Unix - - MySQL for Windows has proven itself to be very stable. The Windows - version of MySQL has the same features as the corresponding Unix - version, with the following exceptions: - - * Limited number of ports - Windows systems have about 4,000 ports available for client - connections, and after a connection on a port closes, it takes - two to four minutes before the port can be reused. In - situations where clients connect to and disconnect from the - server at a high rate, it is possible for all available ports - to be used up before closed ports become available again. If - this happens, the MySQL server appears to be unresponsive even - though it is running. Note that ports may be used by other - applications running on the machine as well, in which case the - number of ports available to MySQL is lower. - For more information about this problem, see - http://support.microsoft.com/default.aspx?scid=kb;en-us;196271 - . - - * Concurrent reads - MySQL depends on the pread() and pwrite() system calls to be - able to mix INSERT and SELECT. Currently, we use mutexes to - emulate pread() and pwrite(). We intend to replace the file - level interface with a virtual interface in the future so that - we can use the readfile()/writefile() interface to get more - speed. The current implementation limits the number of open - files that MySQL 5.1 can use to 2,048, which means that you - cannot run as many concurrent threads on Windows as on Unix. - - * Blocking read - MySQL uses a blocking read for each connection. That has the - following implications if named-pipe connections are enabled: - - + A connection is not disconnected automatically after - eight hours, as happens with the Unix version of MySQL. - - + If a connection hangs, it is not possible to break it - without killing MySQL. - - + mysqladmin kill does not work on a sleeping connection. - - + mysqladmin shutdown cannot abort as long as there are - sleeping connections. - We plan to fix this problem in the future. - - * ALTER TABLE - While you are executing an ALTER TABLE statement, the table is - locked from being used by other threads. This has to do with - the fact that on Windows, you can't delete a file that is in - use by another thread. In the future, we may find some way to - work around this problem. - - * DATA DIRECTORY and INDEX DIRECTORY - The DATA DIRECTORY and INDEX DIRECTORY options for CREATE - TABLE are ignored on Windows, because Windows doesn't support - symbolic links. These options also are ignored on systems that - have a nonfunctional realpath() call. - - * DROP DATABASE - You cannot drop a database that is in use by another thread. - - * Case-insensitive names - File names are not case sensitive on Windows, so MySQL - database and table names are also not case sensitive on - Windows. The only restriction is that database and table names - must be specified using the same case throughout a given - statement. See Section 8.2.2, "Identifier Case Sensitivity." - - * Directory and file names - On Windows, MySQL Server supports only directory and file - names that are compatible with the current ANSI code pages. - For example, the following Japanese directory name will not - work in the Western locale (code page 1252): -datadir="C:/ç§ãŸã¡ã®ãƒ—ãƒã‚¸ã‚§ã‚¯ãƒˆã®ãƒ‡ãƒ¼ã‚¿" - The same limitation applies to directory and file names - referred to in SQL statements, such as the data file path name - in LOAD DATA INFILE. - - * The "\" path name separator character - Path name components in Windows are separated by the "\" - character, which is also the escape character in MySQL. If you - are using LOAD DATA INFILE or SELECT ... INTO OUTFILE, use - Unix-style file names with "/" characters: -mysql> LOAD DATA INFILE 'C:/tmp/skr.txt' INTO TABLE skr; -mysql> SELECT * INTO OUTFILE 'C:/tmp/skr.txt' FROM skr; - Alternatively, you must double the "\" character: -mysql> LOAD DATA INFILE 'C:\\tmp\\skr.txt' INTO TABLE skr; -mysql> SELECT * INTO OUTFILE 'C:\\tmp\\skr.txt' FROM skr; - - * Problems with pipes - Pipes do not work reliably from the Windows command-line - prompt. If the pipe includes the character ^Z / CHAR(24), - Windows thinks that it has encountered end-of-file and aborts - the program. - This is mainly a problem when you try to apply a binary log as - follows: -C:\> mysqlbinlog binary_log_file | mysql --user=root - If you have a problem applying the log and suspect that it is - because of a ^Z / CHAR(24) character, you can use the - following workaround: -C:\> mysqlbinlog binary_log_file --result-file=/tmp/bin.sql -C:\> mysql --user=root --execute "source /tmp/bin.sql" - The latter command also can be used to reliably read in any - SQL file that may contain binary data. - - * Access denied for user error - If MySQL cannot resolve your host name properly, you may get - the following error when you attempt to run a MySQL client - program to connect to a server running on the same machine: -Access denied for user 'some_user'@'unknown' -to database 'mysql' - To fix this problem, you should create a file named - \windows\hosts containing the following information: -127.0.0.1 localhost - - Here are some open issues for anyone who might want to help us - improve MySQL on Windows: - - * Add macros to use the faster thread-safe increment/decrement - methods provided by Windows. - -2.5.10. Installing MySQL from Source on Windows - - These instructions describe how to build binaries from source for - MySQL 5.1 on Windows. Instructions are provided for building - binaries from a standard source distribution or from the Bazaar - tree that contains the latest development source. - -Note - - The instructions here are strictly for users who want to test - MySQL on Microsoft Windows from the latest source distribution or - from the Bazaar tree. For production use, we do not advise using a - MySQL server built by yourself from source. Normally, it is best - to use precompiled binary distributions of MySQL that are built - specifically for optimal performance on Windows by Oracle - Corporation. Instructions for installing binary distributions are - available in Section 2.5, "Installing MySQL on Windows." - - To build MySQL on Windows from source, you must satisfy the - following system, compiler, and resource requirements: - - * Windows 2000, Windows XP, or newer version. - Windows Vista is supported when using Visual Studio 2005 - provided you have installed the following updates: - - + Microsoft Visual Studio 2005 Professional Edition - ENU - Service Pack 1 (KB926601) - (http://support.microsoft.com/?kbid=926601) - - + Security Update for Microsoft Visual Studio 2005 - Professional Edition - ENU (KB937061) - (http://support.microsoft.com/?kbid=937061) - - + Update for Microsoft Visual Studio 2005 Professional - Edition - ENU (KB932232) - (http://support.microsoft.com/?kbid=932232) - - * CMake, which can be downloaded from http://www.cmake.org. - After installing, modify your path to include the cmake - binary. - - * Microsoft Visual C++ 2005 Express Edition, Visual Studio .Net - 2003 (7.1), or Visual Studio 2005 (8.0) compiler system. - - * If you are using Visual C++ 2005 Express Edition, you must - also install an appropriate Platform SDK. More information and - links to downloads for various Windows platforms is available - from - http://www.microsoft.com/downloads/details.aspx?familyid=0baf2 - b35-c656-4969-ace8-e4c0c0716adb. - - * If you are compiling from a Bazaar tree or making changes to - the parser, you need bison for Windows, which can be - downloaded from - http://gnuwin32.sourceforge.net/packages/bison.htm. Download - the package labeled "Complete package, excluding sources". - After installing the package, modify your path to include the - bison binary and ensure that this binary is accessible from - Visual Studio. - - * Cygwin might be necessary if you want to run the test script - or package the compiled binaries and support files into a Zip - archive. (Cygwin is needed only to test or package the - distribution, not to build it.) Cygwin is available from - http://cygwin.com. - - * 3GB to 5GB of disk space. - - The exact system requirements for Visual Studio can be found here: - http://msdn.microsoft.com/vstudio/Previous/2003/sysreqs/default.as - px and - http://msdn.microsoft.com/vstudio/products/sysreqs/default.aspx - - You also need a MySQL source distribution for Windows, which can - be obtained two ways: - - * Obtain a source distribution packaged by Oracle Corporation. - These are available from http://dev.mysql.com/downloads/. - - * Package a source distribution yourself from the latest Bazaar - developer source tree. For instructions on pulling the latest - source files, see Section 2.3.3, "Installing from the - Development Source Tree." - - If you find something not working as expected, or you have - suggestions about ways to improve the current build process on - Windows, please send a message to the win32 mailing list. See - Section 1.6.1, "MySQL Mailing Lists." - -2.5.10.1. Building MySQL from Source Using CMake and Visual Studio - - You can build MySQL on Windows by using a combination of cmake and - Microsoft Visual Studio .NET 2003 (7.1), Microsoft Visual Studio - 2005 (8.0), Microsoft Visual Studio 2008 (9.0) or Microsoft Visual - C++ 2005 Express Edition. You must have the appropriate Microsoft - Platform SDK installed. - -Note - - To compile from the source code on Windows you must use the - standard source distribution (for example, mysql-5.1.46.tar.gz). - You build from the same distribution as used to build MySQL on - Unix, Linux and other platforms. Do not use the Windows Source - distributions as they do not contain the necessary configuration - script and other files. - - Follow this procedure to build MySQL: - - 1. If you are installing from a packaged source distribution, - create a work directory (for example, C:\workdir), and unpack - the source distribution there using WinZip or another Windows - tool that can read .zip files. This directory is the work - directory in the following instructions. - -Note - You must run the commands in the win directory from the - top-level source directory. Do not change into the win - directory, as the commands will not be executed correctly. - - 2. Start a command shell. If you have not configured the PATH and - other environment variables for all command shells, you may be - able to start a command shell from the Start Menu within the - Windows Visual Studio menu that contains the necessary - environment changes. - - 3. Within the command shell, navigate to the work directory and - run the following command: -C:\workdir>win\configure.js options - If you have associated the .js file extension with an - application such as a text editor, then you may need to use - the following command to force configure.js to be executed as - a script: -C:\workdir>cscript win\configure.js options - These options are available for configure.js: - - + WITH_INNOBASE_STORAGE_ENGINE: Enable the InnoDB storage - engine. - - + WITH_PARTITION_STORAGE_ENGINE: Enable user-defined - partitioning. - - + WITH_ARCHIVE_STORAGE_ENGINE: Enable the ARCHIVE storage - engine. - - + WITH_BLACKHOLE_STORAGE_ENGINE: Enable the BLACKHOLE - storage engine. - - + WITH_EXAMPLE_STORAGE_ENGINE: Enable the EXAMPLE storage - engine. - - + WITH_FEDERATED_STORAGE_ENGINE: Enable the FEDERATED - storage engine. - - + WITH_NDBCLUSTER_STORAGE_ENGINE (experimental): Enable the - NDBCLUSTER storage engine in the MySQL server; cause - binaries for the MySQL Cluster management and data node, - management client, and other programs to be built. - This option is supported only in MySQL Cluster NDB 7.0 - (NDBCLUSTER storage engine versions 6.4.0 and later) - using the MySQL Cluster sources. It cannot be used to - enable clustering support in other MySQL source trees or - distributions. - - + MYSQL_SERVER_SUFFIX=suffix: Server suffix, default none. - - + COMPILATION_COMMENT=comment: Server comment, default - "Source distribution". - - + MYSQL_TCP_PORT=port: Server port, default 3306. - - + DISABLE_GRANT_OPTIONS: Disables the --bootstrap, - --skip-grant-tables, and --init-file options for mysqld. - This option is available as of MySQL 5.1.15. - For example (type the command on one line): -C:\workdir>win\configure.js WITH_INNOBASE_STORAGE_ENGINE - WITH_PARTITION_STORAGE_ENGINE MYSQL_SERVER_SUFFIX=-pro - - 4. From the work directory, execute the win\build-vs9.bat - (Windows Visual Studio 2008), win\build-vs8.bat (Windows - Visual Studio 2005), or win\build-vs71.bat (Windows Visual - Stidion 2003) script, depending on the version of Visual - Studio you have installed. The script invokes CMake, which - generates the mysql.sln solution file. - You can also use the corresponding 64-bit file (for example - win\build-vs8_x64.bat or win\build-vs9_x64.bat) to build the - 64-bit version of MySQL. However, you cannot build the 64-bit - version with Visual Studio Express Edition. You must use - Visual Studio 2005 (8.0) or higher. - - 5. From the work directory, open the generated mysql.sln file - with Visual Studio and select the proper configuration using - the Configuration menu. The menu provides Debug, Release, - RelwithDebInfo, MinRelInfo options. Then select Solution > - Build to build the solution. - Remember the configuration that you use in this step. It is - important later when you run the test script because that - script needs to know which configuration you used. - - 6. Test the server. The server built using the preceding - instructions expects that the MySQL base directory and data - directory are C:\mysql and C:\mysql\data by default. If you - want to test your server using the source tree root directory - and its data directory as the base directory and data - directory, you need to tell the server their path names. You - can either do this on the command line with the --basedir and - --datadir options, or by placing appropriate options in an - option file. (See Section 4.2.3.3, "Using Option Files.") If - you have an existing data directory elsewhere that you want to - use, you can specify its path name instead. - When the server is running in standalone fashion or as a - service based on your configuration, try to connect to it from - the mysql interactive command-line utility. - You can also run the standard test script, mysql-test-run.pl. - This script is written in Perl, so you'll need either Cygwin - or ActiveState Perl to run it. You may also need to install - the modules required by the script. To run the test script, - change location into the mysql-test directory under the work - directory, set the MTR_VS_CONFIG environment variable to the - configuration you selected earlier (or use the --vs-config - option), and invoke mysql-test-run.pl. For example (using - Cygwin and the bash shell): -shell> cd mysql-test -shell> export MTR_VS_CONFIG=debug -shell> ./mysql-test-run.pl --force --timer -shell> ./mysql-test-run.pl --force --timer --ps-protocol - - When you are satisfied that the programs you have built are - working correctly, stop the server. Now you can install the - distribution. One way to do this is to use the make_win_bin_dist - script in the scripts directory of the MySQL source distribution - (see Section 4.4.2, "make_win_bin_dist --- Package MySQL - Distribution as ZIP Archive"). This is a shell script, so you must - have Cygwin installed if you want to use it. It creates a Zip - archive of the built executables and support files that you can - unpack in the location at which you want to install MySQL. - - It is also possible to install MySQL by copying directories and - files directly: - - 1. Create the directories where you want to install MySQL. For - example, to install into C:\mysql, use these commands: -C:\> mkdir C:\mysql -C:\> mkdir C:\mysql\bin -C:\> mkdir C:\mysql\data -C:\> mkdir C:\mysql\share -C:\> mkdir C:\mysql\scripts - If you want to compile other clients and link them to MySQL, - you should also create several additional directories: -C:\> mkdir C:\mysql\include -C:\> mkdir C:\mysql\lib -C:\> mkdir C:\mysql\lib\debug -C:\> mkdir C:\mysql\lib\opt - If you want to benchmark MySQL, create this directory: -C:\> mkdir C:\mysql\sql-bench - Benchmarking requires Perl support. See Section 2.15, "Perl - Installation Notes." - - 2. From the work directory, copy into the C:\mysql directory the - following files and directories: -C:\> cd \workdir -C:\workdir> mkdir C:\mysql -C:\workdir> mkdir C:\mysql\bin -C:\workdir> copy client\Release\*.exe C:\mysql\bin -C:\workdir> copy sql\Release\mysqld.exe C:\mysql\bin\mysqld.exe -C:\workdir> xcopy scripts\*.* C:\mysql\scripts /E -C:\workdir> xcopy share\*.* C:\mysql\share /E - If you want to compile other clients and link them to MySQL, - you should also copy several libraries and header files: -C:\workdir> copy lib\Release\mysqlclient.lib C:\mysql\lib\debug -C:\workdir> copy lib\Release\libmysql.* C:\mysql\lib\debug -C:\workdir> copy lib\Release\zlib.* C:\mysql\lib\debug -C:\workdir> copy lib\Release\mysqlclient.lib C:\mysql\lib\opt -C:\workdir> copy lib\Release\libmysql.* C:\mysql\lib\opt -C:\workdir> copy lib\Release\zlib.* C:\mysql\lib\opt -C:\workdir> copy include\*.h C:\mysql\include -C:\workdir> copy libmysql\libmysql.def C:\mysql\include - -Note - If you have compiled a Debug, rather than Release solution, - you can replace Release with Debug in the source file names - shown above. - If you want to benchmark MySQL, you should also do this: -C:\workdir> xcopy sql-bench\*.* C:\mysql\bench /E - - After installation, set up and start the server in the same way as - for binary Windows distributions. This includes creating the - system tables by running mysql_install_db. For more information, - see Section 2.5, "Installing MySQL on Windows." - -2.5.11. Compiling MySQL Clients on Windows - - In your source files, you should include my_global.h before - mysql.h: -#include <my_global.h> -#include <mysql.h> - - my_global.h includes any other files needed for Windows - compatibility (such as windows.h) if you compile your program on - Windows. - - You can either link your code with the dynamic libmysql.lib - library, which is just a wrapper to load in libmysql.dll on - demand, or link with the static mysqlclient.lib library. - - The MySQL client libraries are compiled as threaded libraries, so - you should also compile your code to be multi-threaded. - -2.6. Installing MySQL on Linux - - The following sections covers the installation of Linux using - RPMs. For information on using a generic binary package using tar, - see Section 2.2, "Installing MySQL from Generic Binaries on - Unix/Linux." For information on installing from source, see - Section 2.3, "MySQL Installation Using a Source Distribution." - - mysql.server can be found in the support-files directory under the - MySQL installation directory or in a MySQL source tree. You can - install it as /etc/init.d/mysql for automatic MySQL startup and - shutdown. See Section 2.13.1.2, "Starting and Stopping MySQL - Automatically." - -2.6.1. Installing MySQL from RPM Packages on Linux - - The recommended way to install MySQL on RPM-based Linux - distributions is by using the RPM packages. The RPMs that we - provide to the community should work on all versions of Linux that - support RPM packages and use glibc 2.3. To obtain RPM packages, - see Section 2.1.3, "How to Get MySQL." - - For non-RPM Linux distributions, you can install MySQL using a - .tar.gz package. See Section 2.2, "Installing MySQL from Generic - Binaries on Unix/Linux." - - We do provide some platform-specific RPMs; the difference between - a platform-specific RPM and a generic RPM is that a - platform-specific RPM is built on the targeted platform and is - linked dynamically whereas a generic RPM is linked statically with - LinuxThreads. - -Note - - RPM distributions of MySQL often are provided by other vendors. Be - aware that they may differ in features and capabilities from those - built by us, and that the instructions in this manual do not - necessarily apply to installing them. The vendor's instructions - should be consulted instead. - - In most cases, you need to install only the MySQL-server and - MySQL-client packages to get a functional MySQL installation. The - other packages are not required for a standard installation. - - RPMs for MySQL Cluster. Beginning with MySQL 5.1.24, standard - MySQL server RPMs built by MySQL no longer provide support for the - NDBCLUSTER storage engine. MySQL Cluster users wanting to upgrade - MySQL 5.1.23 or earlier installations from RPMs built by MySQL - should upgrade to MySQL Cluster NDB 6.2 or MySQL Cluster NDB 6.3; - RPMs that should work with most Linux distributions are available - for both of these release series. - -Important - - When upgrading a MySQL Cluster RPM installation, you must upgrade - all installed RPMs, including the Server and Client RPMs. - - For more information about installing MySQL Cluster from RPMs, see - Section 17.2.1, "MySQL Cluster Multi-Computer Installation." - - For upgrades, if your installation was originally produced by - installing multiple RPM packages, it is best to upgrade all the - packages, not just some. For example, if you previously installed - the server and client RPMs, do not upgrade just the server RPM. - - The RPM packages shown in the following list are available. The - names shown here use a suffix of .glibc23.i386.rpm, but particular - packages can have different suffixes, described later. - - * MySQL-server-VERSION.glibc23.i386.rpm - The MySQL server. You need this unless you only want to - connect to a MySQL server running on another machine. - - * MySQL-client-VERSION.glibc23.i386.rpm - The standard MySQL client programs. You probably always want - to install this package. - - * MySQL-devel-VERSION.glibc23.i386.rpm - The libraries and include files that are needed if you want to - compile other MySQL clients, such as the Perl modules. - - * MySQL-debuginfo-VERSION.glibc23.i386.rpm - This package contains debugging information. debuginfo RPMs - are never needed to use MySQL software; this is true both for - the server and for client programs. However, they contain - additional information that might be needed by a debugger to - analyze a crash. - - * MySQL-shared-VERSION.glibc23.i386.rpm - This package contains the shared libraries - (libmysqlclient.so*) that certain languages and applications - need to dynamically load and use MySQL. It contains - single-threaded and thread-safe libraries. If you install this - package, do not install the MySQL-shared-compat package. - - * MySQL-shared-compat-VERSION.glibc23.i386.rpm - This package includes the shared libraries for MySQL 3.23, - 4.0, and so on, up to the current release. It contains - single-threaded and thread-safe libraries. Install this - package instead of MySQL-shared if you have applications - installed that are dynamically linked against older versions - of MySQL but you want to upgrade to the current version - without breaking the library dependencies. - - * MySQL-shared-compat-advanced-gpl-VERSION.glibc23.i386.rpm, - MySQL-shared-compat-advanced-VERSION.glibc23.i386.rpm - These are like the MySQL-shared-compat package, but are for - the "MySQL Enterprise Server - Advanced Edition" products. - Install these packages rather than the normal - MySQL-shared-compat package if you want to included shared - client libraries for older MySQL versions. - - * MySQL-embedded-VERSION.glibc23.i386.rpm - The embedded MySQL server library. - - * MySQL-ndb-management-VERSION.glibc23.i386.rpm, - MySQL-ndb-storage-VERSION.glibc23.i386.rpm, - MySQL-ndb-tools-VERSION.glibc23.i386.rpm, - MySQL-ndb-extra-VERSION.glibc23.i386.rpm - Packages that contain additional files for MySQL Cluster - installations. - -Note - The MySQL-ndb-tools RPM requires a working installation of - perl. Prior to MySQL 5.1.18, the DBI and HTML::Template - packages were also required. See Section 2.15, "Perl - Installation Notes," and Section 17.4.21, "ndb_size.pl --- - NDBCLUSTER Size Requirement Estimator," for more information. - - * MySQL-test-VERSION.glibc23.i386.rpm - This package includes the MySQL test suite. - - * MySQL-VERSION.src.rpm - This contains the source code for all of the previous - packages. It can also be used to rebuild the RPMs on other - architectures (for example, Alpha or SPARC). - - The suffix of RPM package names (following the VERSION value) has - the following syntax: -.PLATFORM.CPU.rpm - - The PLATFORM and CPU values indicate the type of system for which - the package is built. PLATFORM indicates the platform and CPU - indicates the processor type or family. - - All packages are dynamically linked against glibc 2.3. The - PLATFORM value indicates whether the package is platform - independent or intended for a specific platform, as shown in the - following table. - glibc23 Platform independent, should run on any Linux distribution - that supports glibc 2.3 - rhel3, rhel4 Red Hat Enterprise Linux 3 or 4 - sles9, sles10 SuSE Linux Enterprise Server 9 or 10 - - In MySQL 5.1, only glibc23 packages are available currently. - - The CPU value indicates the processor type or family for which the - package is built. - i386 x86 processor, 386 and up - i586 x86 processor, Pentium and up - x86_64 64-bit x86 processor - ia64 Itanium (IA-64) processor - - To see all files in an RPM package (for example, a MySQL-server - RPM), run a command like this: -shell> rpm -qpl MySQL-server-VERSION.glibc23.i386.rpm - - To perform a standard minimal installation, install the server and - client RPMs: -shell> rpm -i MySQL-server-VERSION.glibc23.i386.rpm -shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm - - To install only the client programs, install just the client RPM: -shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm - - RPM provides a feature to verify the integrity and authenticity of - packages before installing them. If you would like to learn more - about this feature, see Section 2.1.4, "Verifying Package - Integrity Using MD5 Checksums or GnuPG." - - The server RPM places data under the /var/lib/mysql directory. The - RPM also creates a login account for a user named mysql (if one - does not exist) to use for running the MySQL server, and creates - the appropriate entries in /etc/init.d/ to start the server - automatically at boot time. (This means that if you have performed - a previous installation and have made changes to its startup - script, you may want to make a copy of the script so that you - don't lose it when you install a newer RPM.) See Section 2.13.1.2, - "Starting and Stopping MySQL Automatically," for more information - on how MySQL can be started automatically on system startup. - - If you want to install the MySQL RPM on older Linux distributions - that do not support initialization scripts in /etc/init.d - (directly or via a symlink), you should create a symbolic link - that points to the location where your initialization scripts - actually are installed. For example, if that location is - /etc/rc.d/init.d, use these commands before installing the RPM to - create /etc/init.d as a symbolic link that points there: -shell> cd /etc -shell> ln -s rc.d/init.d . - - However, all current major Linux distributions should support the - new directory layout that uses /etc/init.d, because it is required - for LSB (Linux Standard Base) compliance. - - If the RPM files that you install include MySQL-server, the mysqld - server should be up and running after installation. You should be - able to start using MySQL. - - If something goes wrong, you can find more information in the - binary installation section. See Section 2.2, "Installing MySQL - from Generic Binaries on Unix/Linux." - -Note - - The accounts that are listed in the MySQL grant tables initially - have no passwords. After starting the server, you should set up - passwords for them using the instructions in Section 2.13, - "Post-Installation Setup and Testing." - - During RPM installation, a user named mysql and a group named - mysql are created on the system. This is done using the useradd, - groupadd, and usermod commands. Those commands require appropriate - administrative privileges, which is ensured for locally managed - users and groups (as listed in the /etc/passwd and /etc/group - files) by the RPM installation process being run by root. - - For nonlocal user management (LDAP, NIS, and so forth), the - administrative tools may require additional authentication (such - as a password), and will fail if the installing user does not - provide this authentication. Even if they fail, the RPM - installation will not abort but succeed, and this is intentional. - If they failed, some of the intended transfer of ownership may be - missing, and it is recommended that the system administrator then - manually ensures some appropriate user andgroup exists and - manually transfers ownership following the actions in the RPM spec - file. - -2.7. Installing MySQL on Mac OS X - - MySQL for Mac OS X is available in a number of different forms: - - * Native Package Installer format, which uses the native Mac OS - X installer to walk you through the installation of MySQL. For - more information, see Section 2.7.1, "Installing MySQL Using - the Installation Package." You can use the package installer - with Mac OS X 10.3 and later, and available for both PowerPC - and Intel architectures, and both 32-bit and 64-bit - architectures. There is no Universal Binary available using - the package installation method. The user you use to perform - the installation must have administrator privileges. - - * Tar package format, which uses a file packaged using the Unix - tar and gzip commands. To use this method, you will need to - open a Terminal window. You do not need administrator - privileges using this method, as you can install the MySQL - server anywhere using this method. For more information on - using this method, you can use the generic instructions for - using a tarball, Section 2.2, "Installing MySQL from Generic - Binaries on Unix/Linux."You can use the package installer with - Mac OS X 10.3 and later, and available for both PowerPC and - Intel architectures, and both 32-bit and 64-bit architectures. - A Universal Binary, incorporating both Power PC and Intel - architectures and 32-bit and 64-bit binaries is available. - In addition to the core installation, the Package Installer - also includes Section 2.7.2, "Installing the MySQL Startup - Item" and Section 2.7.3, "Installing and Using the MySQL - Preference Pane," both of which simplify the management of - your installation. - - * Mac OS X server includes a version of MySQL as standard. If - you want to use a more recent version than that supplied with - the Mac OS X server release, you can make use of the package - or tar formats. For more information on using the MySQL - bundled with Mac OS X, see Section 2.7.4, "Using MySQL on Mac - OS X Server." - - For additional information on using MySQL on Mac OS X, see Section - 2.7.5, "MySQL Installation on Mac OS X Notes." - -2.7.1. Installing MySQL Using the Installation Package - - You can install MySQL on Mac OS X 10.3.x ("Panther") or newer - using a Mac OS X binary package in PKG format instead of the - binary tarball distribution. Please note that older versions of - Mac OS X (for example, 10.1.x or 10.2.x) are not supported by this - package. - - The package is located inside a disk image (.dmg) file that you - first need to mount by double-clicking its icon in the Finder. It - should then mount the image and display its contents. - -Note - - Before proceeding with the installation, be sure to shut down all - running MySQL server instances by either using the MySQL Manager - Application (on Mac OS X Server) or via mysqladmin shutdown on the - command line. - - When installing from the package version, you should also install - the MySQL Preference Pane, which will allow you to control the - startup and execution of your MySQL server from System - Preferences. For more information, see Section 2.7.3, "Installing - and Using the MySQL Preference Pane." - - When installing using the package installer, the files are - installed into a directory within /usr/local matching the name of - the installation version and platform. For example, the installer - file mysql-5.1.39-osx10.5-x86_64.pkg installs MySQL into - /usr/local/mysql-5.1.39-osx10.5-x86_64 . The installation layout - of the directory is as shown in the following table: - Directory Contents of Directory - bin Client programs and the mysqld server - data Log files, databases - docs Manual in Info format - include Include (header) files - lib Libraries - man Unix manual pages - mysql-test MySQL test suite - scripts Contains the mysql_install_db script - share/mysql Error message files - sql-bench Benchmarks - support-files Scripts and sample configuration files - /tmp/mysql.sock The location of the MySQL Unix socket - - During the package installer process, a symbolic link from - /usr/local/mysql to the version/platform specific directory - created during installation will be created automatically. - - 1. Download and open the MySQL package installer, which is - provided on a disk image (.dmg). Double-click to open the disk - image, which includes the main MySQL installation package, the - MySQLStartupItem.pkg installation package, and the - MySQL.prefPane. - - 2. Double-click on the MySQL installer package. It will be named - according to the version of MySQL you have downloaded. For - example, if you have downloaded MySQL 5.1.39, double-click - mysql-5.1.39-osx10.5-x86.pkg. - - 3. You will be presented with the openin installer dialog. Click - Continue to begihn installation. - MySQL Package Installer: Step 1 - - 4. A copy of the installation instructions and other important - information relevant to this installation are display. Click - Continue . - - 5. If you have downloaded the community version of MySQL, you - will be shown a copy of the relevent GNU General Public - License. Click Continue . - - 6. Select the drive you want to use to install the MySQL Startup - Item. The drive must have a valid, bootable, Mac OS X - operating system installed. Click Continue. - MySQL Package Installer: Step 4 - - 7. You will be asked to confirm the details of the installation, - including the space required for the installation. To change - the drive on which the startup item is installed you can click - either Go Back or Change Install Location.... To install the - startup item, click Install. - - 8. Once the installation has been completed successfully, you - will be given an Install Succeeded message. - - Once you have completed the basic installation, you must complete - the post-installation steps as specifed in Section 2.13, - "Post-Installation Setup and Testing." - - For convenience, you may also want to install the Section 2.7.2, - "Installing the MySQL Startup Item" and Section 2.7.3, "Installing - and Using the MySQL Preference Pane." - -2.7.2. Installing the MySQL Startup Item - - The MySQL Installation Package includes a startup item that can be - used to automatically startup and shutdown MySQL during boot. - - To install the MySQL Startup Item: - - 1. Download and open the MySQL package installer, which is - provided on a disk image (.dmg). Double-click to open the disk - image, which includes the main MySQL installation package, the - MySQLStartupItem.pkg installation package, and the - MySQL.prefPane. - - 2. Double-click on the MySQLStartItem.pkg file to start the - installation process. - - 3. You will be presented with the Install MySQL Startup Item - dialog. - MySQL Startup Item Installer: Step 1 - Click Continue to continue the installation process. - - 4. A copy of the installation instructions and other important - information relevant to this installation are display. Click - Continue . - - 5. Select the drive you want to use to install the MySQL Startup - Item. The drive must have a valid, bootable, Mac OS X - operating system installed. Click Continue. - MySQL Startup Item Installer: Step 3 - - 6. You will be asked to confirm the details of the installation. - To change the drive on which the startup item is installed you - can click either Go Back or Change Install Location.... To - install the startup item, click Install. - - 7. Once the installation has been completed successfully, you - will be given an Install Succeeded message. - MySQL Startup Item Installer: Step 5 - - The Startup Item for MySQL is installed into - /Library/StartupItems/MySQLCOM. The Startup Item installation adds - a variable MYSQLCOM=-YES- to the system configuration file - /etc/hostconfig. If you want to disable the automatic startup of - MySQL, simply change this variable to MYSQLCOM=-NO-. - - After the installation, you can start up MySQL by running the - following commands in a terminal window. You must have - administrator privileges to perform this task. - - If you have installed the Startup Item, use this command to start - the server: -shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start - - You may be prompted for your password to complete the startup. - - If you have installed the Startup Item, use this command to stop - the server: -shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop - - You may be prompted for your password to complete the shutdown. - -2.7.3. Installing and Using the MySQL Preference Pane - - The MySQL Package installer disk image also includes a custom - MySQL Preference Pane that enables you to start, stop and control - automated startup during boot of your MySQL installation. - - To install the MySQL Preference Pane: - - 1. Download and open the MySQL package installer package, which - is provided on a disk image (.dmg). Double-click to open the - disk image, which includes the main MySQL installation - package, the MySQLStartupItem.pkg installation package, and - the MySQL.prefPane. - - 2. Double click on MySQL.prefPane. The MySQL System Preferences - will open. - - 3. If this is the first time you have installed the preference - pane, you will be asked to confirm installation and whether - you want to install the preference pane for all users, or only - the current user. To install the preference pane for all users - you will need administrator privileges. If necessary, you will - be prompted for the username and password for a user with - administrator privileges. - - 4. If you already have the MySQL Preference Pane installed, you - will be asked to confirm whether you want to overwrite the - existing MySQL Preference Pane. - -Note - - The MySQL Preference Pane only starts and stops MySQL installation - installed from the MySQL package installation that have been - installed in the default location. - - Once the MySQL Preference Pane has been installed, you can control - your MySQL server instance using the preference pane. To use the - preference pane, open the System Preferences... from the Apple - menu. Select the MySQL preference pane by clicking on the MySQL - logo within the Other section of the preference panes list. - MySQL Preference Pane - - The MySQL Preference Pane shows the current status of the MySQL - server, showing stopped (in red) if the server is not running and - running (in green) if the server has already been started. The - preference pane will also show the current setting for whether the - MySQL server has been set to start up automatically. - - * To start MySQL using the preference pane: - Click Start MySQL Server. You may be prompted for the username - and password of a user with administrator privileges to start - the MySQL server. - - * To stop MySQL using the preference pane: - Click Stop MySQL Server. You may be prompted for the username - and password of a user with administrator privileges to - shutdown the MySQL server. - - * To automatically start the MySQL server when the system boots: - Check the checkbox next to Automatically Start MySQL Server on - Startup. - - * To disable the automatic starting of the MySQL server when the - system boots: - Uncheck the checkbox next to Automatically Start MySQL Server - on Startup. - - You can close the System Preferences... once you have completed - your settings. - -2.7.4. Using MySQL on Mac OS X Server - - If you are running Mac OS X Server, a version of MySQL should - already be installed. The following table shows the versions of - MySQL that ship with Mac OS X Server versions. - Mac OS X Server Version MySQL Version - 10.2-10.2.2 3.23.51 - 10.2.3-10.2.6 3.23.53 - 10.3 4.0.14 - 10.3.2 4.0.16 - 10.4.0 4.1.10a - 10.5.0 5.0.45 - 10.6.0 5.0.82 - - The installation layout of MySQL on Mac OS X Server is as shown in - the table below: - Directory Contents of Directory - /usr/bin Client programs - /var/mysql Log files, databases - /usr/libexec The mysqld server - /usr/share/man Unix manual pages - /usr/share/mysql/mysql-test MySQL test suite - /usr/share/mysql Contains the mysql_install_db script - /var/mysql/mysql.sock The location of the MySQL Unix socket - -Note - - The MySQL server bundled with Mac OS X Server does not include the - MySQL client libraries and header files required if you want to - access and use MySQL from a third-party driver, such as Perl DBI - or PHP. For more information on obtaining and installing MySQL - libraries, see Mac OS X Server version 10.5: MySQL libraries - available for download (http://support.apple.com/kb/TA25017). - Alternatively, you can ignore the bundled MySQL server and install - MySQL from the package or tarball installation. - - For more information on managing the bundled MySQL instance in Mac - OS X Server 10.5, see Mac OS X Server: Web Technologies - Administration For Version 10.5 Leopard - (http://images.apple.com/server/macosx/docs/Web_Technologies_Admin - _v10.5.pdf). For more information on managing the bundled MySQL - instance in Mac OS X Server 10.6, see Mac OS X Server: Web - Technologies Administration Version 10.6 Snow Leopard - (http://manuals.info.apple.com/en_US/WebTech_v10.6.pdf). - -2.7.5. MySQL Installation on Mac OS X Notes - - You should keep the following issues and notes in mind: - - * The default location for the MySQL Unix socket is different on - Mac OS X and Mac OS X Server depending on the installation - type you chose. The default locations by installation are as - follows: - - Package Installer from MySQL /tmp/mysql.sock - Tarball from MySQL /tmp/mysql.sock - MySQL Bundled with Mac OS X Server /var/mysql/mysql.sock - To prevent issues, you should either change the configuration - of the socket used within your application (for example, - changing php.ini), or you should configure the socket location - using a MySQL configuration file and the socket option. For - more information, see Section 5.1.2, "Server Command Options." - - * You may need (or want) to create a specific mysql user to own - the MySQL directory and data. On Mac OS X 10.4 and lower you - can do this by using the Netinfo Manager application, located - within the Utilities folder within the Applications folder. On - Mac OS X 10.5 and later you can do this through the Directory - Utility. From Mac OS X 10.5 and later (including Mac OS X - Server 10.5) the mysql should already exist. For use in single - user mode, an entry for _mysql (note the underscore prefix) - should already exist within the system /etc/passwd file. - - * Due to a bug in the Mac OS X package installer, you may see - this error message in the destination disk selection dialog: -You cannot install this software on this disk. (null) - If this error occurs, simply click the Go Back button once to - return to the previous screen. Then click Continue to advance - to the destination disk selection again, and you should be - able to choose the destination disk correctly. We have - reported this bug to Apple and it is investigating this - problem. - - * Because the MySQL package installer installs the MySQL - contents into a version and platform specific directory, you - can use this to upgrade and migrate your database between - versions. You will need to either copy the data directory from - the old version to the new version, or alternatively specify - an alternative datadir value to set location of the data - directory. - - * You might want to add aliases to your shell's resource file to - make it easier to access commonly used programs such as mysql - and mysqladmin from the command line. The syntax for bash is: -alias mysql=/usr/local/mysql/bin/mysql -alias mysqladmin=/usr/local/mysql/bin/mysqladmin - For tcsh, use: -alias mysql /usr/local/mysql/bin/mysql -alias mysqladmin /usr/local/mysql/bin/mysqladmin - Even better, add /usr/local/mysql/bin to your PATH environment - variable. You can do this by modifying the appropriate startup - file for your shell. For more information, see Section 4.2.1, - "Invoking MySQL Programs." - - * After you have copied over the MySQL database files from the - previous installation and have successfully started the new - server, you should consider removing the old installation - files to save disk space. Additionally, you should also remove - older versions of the Package Receipt directories located in - /Library/Receipts/mysql-VERSION.pkg. - -2.8. Installing MySQL on Solaris - - To obtain a binary MySQL distribution for Solaris in tarball or - PKG format, http://dev.mysql.com/downloads/mysql/5.1.html. - - If you install MySQL using a binary tarball distribution on - Solaris, you may run into trouble even before you get the MySQL - distribution unpacked, as the Solaris tar cannot handle long file - names. This means that you may see errors when you try to unpack - MySQL. - - If this occurs, you must use GNU tar (gtar) to unpack the - distribution. - - You can install MySQL on Solaris using a binary package in PKG - format instead of the binary tarball distribution. Before - installing using the binary PKG format, you should create the - mysql user and group, for example: -groupadd mysql -useradd -g mysql mysql - - Some basic PKG-handling commands follow: - - * To add a package: -pkgadd -d package_name.pkg - - * To remove a package: -pkgrm package_name - - * To get a full list of installed packages: -pkginfo - - * To get detailed information for a package: -pkginfo -l package_name - - * To list the files belonging to a package: -pkgchk -v package_name - - * To get packaging information for an arbitrary file: -pkgchk -l -p file_name - -2.8.1. Solaris Notes - - For information about installing MySQL on Solaris using PKG - distributions, see Section 2.8, "Installing MySQL on Solaris." - - On Solaris, you may run into trouble even before you get the MySQL - distribution unpacked, as the Solaris tar cannot handle long file - names. This means that you may see errors when you try to unpack - MySQL. - - If this occurs, you must use GNU tar (gtar) to unpack the - distribution. - - If you have an UltraSPARC system, you can get 4% better - performance by adding -mcpu=v8 -Wa,-xarch=v8plusa to the CFLAGS - and CXXFLAGS environment variables. - - If you have Sun's Forte 5.0 (or newer) compiler, you can run - configure like this: -CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt" \ -CXX=CC CXXFLAGS="-noex -mt" \ -./configure --prefix=/usr/local/mysql --enable-assembler - - To create a 64-bit binary with Sun's Forte compiler, use the - following configuration options: -CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt -xarch=v9" \ -CXX=CC CXXFLAGS="-noex -mt -xarch=v9" ASFLAGS="-xarch=v9" \ -./configure --prefix=/usr/local/mysql --enable-assembler - - To create a 64-bit Solaris binary using gcc, add -m64 to CFLAGS - and CXXFLAGS and remove --enable-assembler from the configure - line. - - In the MySQL benchmarks, we obtained a 4% speed increase on - UltraSPARC when using Forte 5.0 in 32-bit mode, as compared to - using gcc 3.2 with the -mcpu flag. - - If you create a 64-bit mysqld binary, it is 4% slower than the - 32-bit binary, but can handle more threads and memory. - - When using Solaris 10 for x86_64, you should mount any file - systems on which you intend to store InnoDB files with the - forcedirectio option. (By default mounting is done without this - option.) Failing to do so will cause a significant drop in - performance when using the InnoDB storage engine on this platform. - - If you get a problem with fdatasync or sched_yield, you can fix - this by adding LIBS=-lrt to the configure line - - Solaris does not provide static versions of all system libraries - (libpthreads and libdl), so you cannot compile MySQL with - --static. If you try to do so, you get one of the following - errors: -ld: fatal: library -ldl: not found -undefined reference to `dlopen' -cannot find -lrt - - If you link your own MySQL client programs, you may see the - following error at runtime: -ld.so.1: fatal: libmysqlclient.so.#: -open failed: No such file or directory - - This problem can be avoided by one of the following methods: - - * Link clients with the -Wl,r/full/path/to/libmysqlclient.so - flag rather than with -Lpath). - - * Copy libmysqclient.so to /usr/lib. - - * Add the path name of the directory where libmysqlclient.so is - located to the LD_RUN_PATH environment variable before running - your client. - - If you have problems with configure trying to link with -lz when - you don't have zlib installed, you have two options: - - * If you want to be able to use the compressed communication - protocol, you need to get and install zlib from ftp.gnu.org. - - * Run configure with the --with-named-z-libs=no option when - building MySQL. - - If you are using gcc and have problems with loading user-defined - functions (UDFs) into MySQL, try adding -lgcc to the link line for - the UDF. - - If you would like MySQL to start automatically, you can copy - support-files/mysql.server to /etc/init.d and create a symbolic - link to it named /etc/rc3.d/S99mysql.server. - - If too many processes try to connect very rapidly to mysqld, you - should see this error in the MySQL log: -Error in accept: Protocol error - - You might try starting the server with the --back_log=50 option as - a workaround for this. (Use -O back_log=50 before MySQL 4.) - - To configure the generation of core files on Solaris you should - use the coreadm command. Because of the security implications of - generating a core on a setuid() application, by default, Solaris - does not support core files on setuid() programs. However, you can - modify this behavior using coreadm. If you enable setuid() core - files for the current user, they will be generated using the mode - 600 and owned by the superuser. - -2.9. Installing MySQL on i5/OS - - The i5/OS POWER MySQL package was created in cooperation with IBM. - MySQL works within the Portable Application Solution Environment - (PASE) on the System i series of hardware and will also provide - database services for the Zend Core for i5/OS. - - MySQL for i5/OS is provided both as a tar file and as a save file - (.savf) package that can be downloaded and installed directly - without any additional installation steps required. To install - MySQL using the tar file, see Section 2.2, "Installing MySQL from - Generic Binaries on Unix/Linux." - - MySQL is only supported on i5/OS V5R4 or later releases. The i5/OS - PASE must be installed for MySQL to operate. You must be able to - login as a user in *SECOFR class. - - You should the installation notes and tips for i5/OS before - starting installation. See i5/OS Installation Notes. - - Before Installation: - -Note - - The installation package will use an existing configuration if you - have previously installed MySQL (which is identified by looking - for the file /etc/my.cnf). The values for the data directory - (DATADIR) and owner of the MySQL files (USRPRF) specified during - the installation will be ignored, and the values determined from - the /etc/my.cnf will be used instead. - - If you want to change these parameters during a new install, you - should temporarily rename /etc/my.cnf, install MySQL using the new - parameters you want to use, and then merge your previous - /etc/my.cnf configuration settings with the new /etc/my.cnf file - that is created during installation. - - * You must have a user profile with PASE with suitable - privileges. The user should be within the *SECOFR class, such - as the QSECOFR user ID. You can use the WRKUSRPRF command to - check your user profile. - - * For network connections to MySQL, you must have TCP/IP - enabled. You should also check the following: - - + Ensure that a name has defined for the system. Run the - Configure TCP/IP (CFGTCP) command and select option 12 - (Change TCP/IP domain information) to display this - setting. Make sure that a value is listed in the Host - name field. - - + Make sure that the system has a loopback entry which - represents the localhost or 127.0.0.1. - - + Ensure that the IP address of the IBM i machine is mapped - correctly to the host name. - - To install MySQL on i5/OS, follow these steps: - - 1. On the System i machine, create a save file that will be used - to receive the downloaded installation save file. The file - should be located within the General Purpose Library (QGPL): -CRTSAVF FILE(QGPL/MYSQLINST) TESXT('MySQL Save file') - - 2. Download the MySQL installation save file in 32-bit - (mysql-5.1.39-i5os-power-32bit.savf) or 64-bit - (mysql-5.1.39-i5os-power-64bit.savf) from MySQL Downloads - (http://dev.mysql.com/downloads). - - 3. You need to FTP the downloaded .savf file directly into the - QGPL/MYSQLINST file on the System i server. You can do this - through FTP using the following steps after logging in to the - System i machine: -ftp> bin -ftp> cd qgpl -ftp> put mysql-5.1.39-i5os-power.savf mysqlinst - - 4. Log into the System i server using a user in the *SECOFR - class, such as the QSECOFR user ID. - - 5. You need to restore the installation library stored in the - .savf save file: -RSTLIB MYSQLINST DEV(*SAVF) SAVF(QGPL/MYSQLINST) MBROPT(*ALL) ALWOBJD -IF(*ALL) - -Note - You can ignore the security changes-type message at the bottom - of the installation panel. - - 6. Once you have finished restoring the MYSQLINST library, check - that all the necessary objects for installation are on the - system by using the Display Library (DSPLIB) command: -DSPLIB LIB(MYSQLINST) - - 7. You need to execute the installation command, - MYSQLINST/INSMYSQL. You can specify three parameter settings - during installation: - - + DIR('/QOpenSys/usr/local/mysql') sets the installation - location for the MySQL files. The directory will be - created if it does not already exist. - - + DATADIR('/QOpenSys/usr/local/mysql/data') sets the - location of the directory that will be used to store the - database files and binary logs. The default setting is - /QOpenSys/usr/local/mysql/data. Note that if the - installer detects an existing installation (due to the - existence of /etc/my.cnf), then the existing setting will - be used instead of the default. - - + USRPRF(MYSQL) sets the user profile that will own the - files that are installed. The profile will be created if - it does not already exist. - -Note - You should choose an appropriate user for using the MySQL - server installation. The user will be used whenever you - need to do any administration on the MySQL server. - Once you have set the appropriate parameters, you can begin - the installation. - The installation copies all the necessary files into a - directory matching the DIR configuration value; sets the - ownership on those files, sets up the MySQL environment and - creates the MySQL configuration file (in /etc/my.cnf) - completing all the steps in a typical binary installation - process automatically. If this is a new installation of MySQL, - or if the installer detects that this is a new version - (because the /etc/my.cnf file does not exist), then the - initial core MySQL databases will also be created during - installation. - Once the installation has been completed, you will get a - notice advising you to set the password for the root user. For - more information, Section 2.13, "Post-Installation Setup and - Testing." - - 8. Once the installation has completed, you can delete the - installation file: -DLTLIB LIB(MYSQLINST) - - Upgrading an existing MySQL instance - - You need to execute the upgrade command, MYSQLINST/UPGMYSQL. - -Note - - You cannot use MYSQLINST/UPGMYSQL to upgrade between major - versions of MySQL (for example from 5.0 to 5.1). For information - and advice on migrating between major versions you can use the - advice provided in Section 2.4.1.1, "Upgrading from MySQL 5.0 to - 5.1." - - You must specify 6 parameters to perform an upgrade: - - * DIR('/QOpenSys/usr/local/') --- sets the installation location - for the MySQL files. The directory will be created if it does - not already exist. This is the directory that the MySQL server - will be installed into, inside a directory with a name - matching the version and release. For example, if installing - MySQL 5.1.39 with the DIR set to /QOpenSys/usr/local/ would - result in /QOpenSys/usr/local/mysql-5.1.39-i5os-power64 and a - symbolic link to this directory will be created in - /QOpenSys/usr/local/mysql. - - * DATADIR('/QOpenSys/mysql/data') --- sets the location of the - directory that will be upgraded. - - * USRPRF('MYSQL') --- sets the user profile that will own the - files that are installed. The profile will be created if it - does not already exist; if it is created as part of the - upgrade process, it will be disabled initially. You may wish - to enable this user profile so that it can be used to start - the MySQL server later. It is best practice to use the one - previously created during the first installation. - - * MYSQLUSR('root user') --- any user account in the current - MySQL server with SUPER privileges. - - * PASSWORD('root user password') --- the password for the above - account. This is necessary as the upgrade starts the MySQL - server to upgrade the tables and the password is need to be - able to shutdown the MySQL server. - - * CURINST('path to previous install') --- the full path to the - installation that is being upgraded. For example an - installation in /QOpenSys/usr/local/ will be - /QOpenSys/usr/local/msyql-5.1.30-i5os-power64. Failure to - specify this option may result in corruption of your existing - data files. - - For example: -MYSQLINST/UPGMYSQL DIR('/QOpenSys/usr/local/') DATADIR('/QOpenSys/mys -ql/data') » - USERPRF(MYSQL) MYSQLUSR('root') PASSWORD('root') CURINST('/QOpen -Sys/usr/local/mysql-5.1.30-i5os-power64') - - You should receive a Program Message indicating UPGRADE - SUCCESSFUL! upon completion or an error message if there is a - problem.You can view the upgrade programs progression and the - error in the text file upgrade.log in the installation directory. - - To start MySQL: - - 1. Log into the System i server using the user profile create or - specified during installation. By default, this is MYSQL. - -Note - You should start mysqld_safe using a user that in the PASE - environment has the id=0 (the equivalent of the standard Unix - root user). If you do not use a user with this ID then the - system will be unable to change the user when executing mysqld - as set using --user option. If this happens, mysqld may be - unable to read the files located within the MySQL data - directory and the execution will fail. - - 2. Enter the PASE environment using call qp2term. - - 3. Start the MySQL server by changing to the installation - directory and running mysqld_safe, specifying the user name - used to install the server. The installer conveniently - installs a symbolic link to the installation directory - (mysql-5.0.42-i5os-power-32bit) as /opt/mysql/mysql: -> cd /opt/mysql/mysql -> bin/mysqld_safe --user=mysql & - You should see a message similar to the following: -Starting mysqld daemon with databases » - from /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data - - If you are having problems starting MySQL server, see Section - 2.13.1.3, "Starting and Troubleshooting the MySQL Server." - - To stop MySQL: - - 1. Log into the System i server using the user profile create or - specified during installation. By default, this is MYSQL. - - 2. Enter the PASE environment using call qp2term. - - 3. Stop the MySQL server by changing into the installation - directory and running mysqladmin, specifying the user name - used to install the server: -> cd /opt/mysql/mysql -> bin/mysqladmin -u root shutdown - If the session that you started and stopped MySQL are the - same, you may get the log output from mysqld: - STOPPING server from pid file » - /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data/I5DBX.R -CHLAND.IBM.COM.pid - 070718 10:34:20 mysqld ended - If the sessions used to start and stop MySQL are different, - you will not receive any confirmation of the shutdown. - - Note and tips - - * A problem has been identified with the installation process on - DBCS systems. If you are having problems install MySQL on a - DBCS system, you need to change your job's coded character set - identifier (CSSID) to 37 (EBCDIC) before executing the install - command, INSMYSQL. To do this, determine your existing CSSID - (using DSPJOB and selecting option 2), execute CHGJOB - CSSID(37), run INSMYSQL to install MySQL and then execute - CHGJOB again with your original CSSID. - - * If you want to use the Perl scripts that are included with - MySQL, you need to download the iSeries Tools for Developers - (5799-PTL). See - http://www-03.ibm.com/servers/enable/site/porting/tools/. - -2.10. Installing MySQL on FreeBSD - - This section provides information about using MySQL on variants of - FreeBSD Unix. - - The easiest (and preferred) way to install MySQL is to use the - mysql-server and mysql-client ports available at - http://www.freebsd.org/. Using these ports gives you the following - benefits: - - * A working MySQL with all optimizations enabled that are known - to work on your version of FreeBSD. - - * Automatic configuration and build. - - * Startup scripts installed in /usr/local/etc/rc.d. - - * The ability to use pkg_info -L to see which files are - installed. - - * The ability to use pkg_delete to remove MySQL if you no longer - want it on your machine. - - The MySQL build process requires GNU make (gmake) to work. If GNU - make is not available, you must install it first before compiling - MySQL. - - The recommended way to compile and install MySQL on FreeBSD with - gcc (2.95.2 and up) is: -CC=gcc CFLAGS="-O2 -fno-strength-reduce" \ - CXX=gcc CXXFLAGS="-O2 -fno-rtti -fno-exceptions \ - -felide-constructors -fno-strength-reduce" \ - ./configure --prefix=/usr/local/mysql --enable-assembler -gmake -gmake install -cd /usr/local/mysql -bin/mysql_install_db --user=mysql -bin/mysqld_safe & - - FreeBSD is known to have a very low default file handle limit. See - Section B.5.2.18, "'File' Not Found and Similar Errors." Start the - server by using the --open-files-limit option for mysqld_safe, or - raise the limits for the mysqld user in /etc/login.conf and - rebuild it with cap_mkdb /etc/login.conf. Also be sure that you - set the appropriate class for this user in the password file if - you are not using the default (use chpass mysqld-user-name). See - Section 4.3.2, "mysqld_safe --- MySQL Server Startup Script." - - In current versions of FreeBSD (at least 4.x and greater), you may - increase the limit on the amount of memory available for a process - by adding the following entries to the /boot/loader.conf file and - rebooting the machine (these are not settings that can be changed - at run time with the sysctl command): -kern.maxdsiz="1073741824" # 1GB -kern.dfldsiz="1073741824" # 1GB -kern.maxssiz="134217728" # 128MB - - For older versions of FreeBSD, you must recompile your kernel to - change the maximum data segment size for a process. In this case, - you should look at the MAXDSIZ option in the LINT config file for - more information. - - If you get problems with the current date in MySQL, setting the TZ - variable should help. See Section 2.14, "Environment Variables." - -2.11. Installing MySQL on HP-UX - - If you install MySQL using a binary tarball distribution on HP-UX, - you may run into trouble even before you get the MySQL - distribution unpacked, as the HP-UX tar cannot handle long file - names. This means that you may see errors when you try to unpack - MySQL. - - If this occurs, you must use GNU tar (gtar) to unpack the - distribution. - - Because of some critical bugs in the standard HP-UX libraries, you - should install the following patches before trying to run MySQL on - HP-UX 11.0: -PHKL_22840 Streams cumulative -PHNE_22397 ARPA cumulative - - This solves the problem of getting EWOULDBLOCK from recv() and - EBADF from accept() in threaded applications. - - If you are using gcc 2.95.1 on an unpatched HP-UX 11.x system, you - may get the following error: -In file included from /usr/include/unistd.h:11, - from ../include/global.h:125, - from mysql_priv.h:15, - from item.cc:19: -/usr/include/sys/unistd.h:184: declaration of C function ... -/usr/include/sys/pthread.h:440: previous declaration ... -In file included from item.h:306, - from mysql_priv.h:158, - from item.cc:19: - - The problem is that HP-UX does not define pthreads_atfork() - consistently. It has conflicting prototypes in - /usr/include/sys/unistd.h:184 and /usr/include/sys/pthread.h:440. - - One solution is to copy /usr/include/sys/unistd.h into - mysql/include and edit unistd.h and change it to match the - definition in pthread.h. Look for this line: -extern int pthread_atfork(void (*prepare)(), void (*parent)(), - void (*child)()); - - Change it to look like this: -extern int pthread_atfork(void (*prepare)(void), void (*parent)(void) -, - void (*child)(void)); - - After making the change, the following configure line should work: -CFLAGS="-fomit-frame-pointer -O3 -fpic" CXX=gcc \ -CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti -O3" \ -./configure --prefix=/usr/local/mysql --disable-shared - - If you are using HP-UX compiler, you can use the following command - (which has been tested with cc B.11.11.04): -CC=cc CXX=aCC CFLAGS=+DD64 CXXFLAGS=+DD64 ./configure \ - --with-extra-character-set=complex - - You can ignore any errors of the following type: -aCC: warning 901: unknown option: `-3': use +help for online -documentation - - If you get the following error from configure, verify that you - don't have the path to the K&R compiler before the path to the - HP-UX C and C++ compiler: -checking for cc option to accept ANSI C... no -configure: error: MySQL requires an ANSI C compiler (and a C++ compil -er). -Try gcc. See the Installation chapter in the Reference Manual. - - Another reason for not being able to compile is that you didn't - define the +DD64 flags as just described. - - Another possibility for HP-UX 11 is to use the MySQL binaries - provided at http://dev.mysql.com/downloads/, which we have built - and tested ourselves. We have also received reports that the HP-UX - 10.20 binaries supplied by MySQL can be run successfully on HP-UX - 11. If you encounter problems, you should be sure to check your - HP-UX patch level. - -2.12. Installing MySQL on AIX - - Automatic detection of xlC is missing from Autoconf, so a number - of variables need to be set before running configure. The - following example uses the IBM compiler: -export CC="xlc_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192 " -export CXX="xlC_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192" -export CFLAGS="-I /usr/local/include" -export LDFLAGS="-L /usr/local/lib" -export CPPFLAGS=$CFLAGS -export CXXFLAGS=$CFLAGS - -./configure --prefix=/usr/local \ - --localstatedir=/var/mysql \ - --sbindir='/usr/local/bin' \ - --libexecdir='/usr/local/bin' \ - --enable-thread-safe-client \ - --enable-large-files - - The preceding options are used to compile the MySQL distribution - that can be found at http://www-frec.bull.com/. - - If you change the -O3 to -O2 in the preceding configure line, you - must also remove the -qstrict option. This is a limitation in the - IBM C compiler. - - If you are using gcc to compile MySQL, you must use the - -fno-exceptions flag, because the exception handling in gcc is not - thread-safe! There are also some known problems with IBM's - assembler that may cause it to generate bad code when used with - gcc. - - Use the following configure line with gcc 2.95 on AIX: -CC="gcc -pipe -mcpu=power -Wa,-many" \ -CXX="gcc -pipe -mcpu=power -Wa,-many" \ -CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti" \ -./configure --prefix=/usr/local/mysql --with-low-memory - - The -Wa,-many option is necessary for the compile to be - successful. IBM is aware of this problem but is in no hurry to fix - it because of the workaround that is available. We don't know if - the -fno-exceptions is required with gcc 2.95, but because MySQL - doesn't use exceptions and the option generates faster code, you - should always use it with gcc. - - If you get a problem with assembler code, try changing the - -mcpu=xxx option to match your CPU. Typically power2, power, or - powerpc may need to be used. Alternatively, you might need to use - 604 or 604e. We are not positive but suspect that power would - likely be safe most of the time, even on a power2 machine. - - If you don't know what your CPU is, execute a uname -m command. It - produces a string that looks like 000514676700, with a format of - xxyyyyyymmss where xx and ss are always 00, yyyyyy is a unique - system ID and mm is the ID of the CPU Planar. A chart of these - values can be found at - http://www16.boulder.ibm.com/pseries/en_US/cmds/aixcmds5/uname.htm - . - - This gives you a machine type and a machine model you can use to - determine what type of CPU you have. - - If you have problems with threads on AIX 5.3, you should upgrade - AIX 5.3 to technology level 7 (5300-07). - - If you have problems with signals (MySQL dies unexpectedly under - high load), you may have found an OS bug with threads and signals. - In this case, you can tell MySQL not to use signals by configuring - as follows: -CFLAGS=-DDONT_USE_THR_ALARM CXX=gcc \ -CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti \ --DDONT_USE_THR_ALARM" \ -./configure --prefix=/usr/local/mysql --with-debug \ - --with-low-memory - - This doesn't affect the performance of MySQL, but has the side - effect that you can't kill clients that are "sleeping" on a - connection with mysqladmin kill or mysqladmin shutdown. Instead, - the client dies when it issues its next command. - - On some versions of AIX, linking with libbind.a makes - getservbyname() dump core. This is an AIX bug and should be - reported to IBM. - - For AIX 4.2.1 and gcc, you have to make the following changes. - - After configuring, edit config.h and include/my_config.h and - change the line that says this: -#define HAVE_SNPRINTF 1 - - to this: -#undef HAVE_SNPRINTF - - And finally, in mysqld.cc, you need to add a prototype for - initgroups(). -#ifdef _AIX41 -extern "C" int initgroups(const char *,int); -#endif - - For 32-bit binaries, if you need to allocate a lot of memory to - the mysqld process, it is not enough to just use ulimit -d - unlimited. You may also have to modify mysqld_safe to add a line - something like this: -export LDR_CNTRL='MAXDATA=0x80000000' - - You can find more information about using a lot of memory at - http://publib16.boulder.ibm.com/pseries/en_US/aixprggd/genprogc/lr - g_prg_support.htm. - - Users of AIX 4.3 should use gmake instead of the make utility - included with AIX. - - As of AIX 4.1, the C compiler has been unbundled from AIX as a - separate product. gcc 3.3.2 can be obtained here: - ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/gc - c/ - - The steps for compiling MySQL on AIX with gcc 3.3.2 are similar to - those for using gcc 2.95 (in particular, the need to edit config.h - and my_config.h after running configure). However, before running - configure, you should also patch the curses.h file as follows: -/opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/include/curses -.h.ORIG - Mon Dec 26 02:17:28 2005 ---- /opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/include/cu -rses.h -Mon Dec 26 02:40:13 2005 -*************** -*** 2023,2029 **** - - - #endif /* _AIX32_CURSES */ -! #if defined(__USE_FIXED_PROTOTYPES__) || defined(__cplusplus) || de -fined -(__STRICT_ANSI__) - extern int delwin (WINDOW *); - extern int endwin (void); - extern int getcurx (WINDOW *); ---- 2023,2029 ---- - - - #endif /* _AIX32_CURSES */ -! #if 0 && (defined(__USE_FIXED_PROTOTYPES__) || defined(__cplusplus) -|| defined -(__STRICT_ANSI__)) - extern int delwin (WINDOW *); - extern int endwin (void); - extern int getcurx (WINDOW *); - -2.13. Post-Installation Setup and Testing - - After installing MySQL, there are some issues that you should - address. For example, on Unix, you should initialize the data - directory and create the MySQL grant tables. On all platforms, an - important security concern is that the initial accounts in the - grant tables have no passwords. You should assign passwords to - prevent unauthorized access to the MySQL server. Optionally, you - can create time zone tables to enable recognition of named time - zones. - - The following sections include post-installation procedures that - are specific to Windows systems and to Unix systems. Another - section, Section 2.13.1.3, "Starting and Troubleshooting the MySQL - Server," applies to all platforms; it describes what to do if you - have trouble getting the server to start. Section 2.13.2, - "Securing the Initial MySQL Accounts," also applies to all - platforms. You should follow its instructions to make sure that - you have properly protected your MySQL accounts by assigning - passwords to them. - - When you are ready to create additional user accounts, you can - find information on the MySQL access control system and account - management in Section 5.4, "The MySQL Access Privilege System," - and Section 5.5, "MySQL User Account Management." - -2.13.1. Unix Post-Installation Procedures - - After installing MySQL on Unix, you need to initialize the grant - tables, start the server, and make sure that the server works - satisfactorily. You may also wish to arrange for the server to be - started and stopped automatically when your system starts and - stops. You should also assign passwords to the accounts in the - grant tables. - - On Unix, the grant tables are set up by the mysql_install_db - program. For some installation methods, this program is run for - you automatically: - - * If you install MySQL on Linux using RPM distributions, the - server RPM runs mysql_install_db. - - * If you install MySQL on Mac OS X using a PKG distribution, the - installer runs mysql_install_db. - - Otherwise, you'll need to run mysql_install_db yourself. - - The following procedure describes how to initialize the grant - tables (if that has not previously been done) and then start the - server. It also suggests some commands that you can use to test - whether the server is accessible and working properly. For - information about starting and stopping the server automatically, - see Section 2.13.1.2, "Starting and Stopping MySQL Automatically." - - After you complete the procedure and have the server running, you - should assign passwords to the accounts created by - mysql_install_db. Instructions for doing so are given in Section - 2.13.2, "Securing the Initial MySQL Accounts." - - In the examples shown here, the server runs under the user ID of - the mysql login account. This assumes that such an account exists. - Either create the account if it does not exist, or substitute the - name of a different existing login account that you plan to use - for running the server. - - 1. Change location into the top-level directory of your MySQL - installation, represented here by BASEDIR: -shell> cd BASEDIR - BASEDIR is likely to be something like /usr/local/mysql or - /usr/local. The following steps assume that you are located in - this directory. - - 2. If necessary, run the mysql_install_db program to set up the - initial MySQL grant tables containing the privileges that - determine how users are allowed to connect to the server. - You'll need to do this if you used a distribution type for - which the installation procedure doesn't run the program for - you. - Typically, mysql_install_db needs to be run only the first - time you install MySQL, so you can skip this step if you are - upgrading an existing installation, However, mysql_install_db - does not overwrite any existing privilege tables, so it should - be safe to run in any circumstances. - To initialize the grant tables, use one of the following - commands, depending on whether mysql_install_db is located in - the bin or scripts directory: -shell> bin/mysql_install_db --user=mysql -shell> scripts/mysql_install_db --user=mysql - It might be necessary to specify other options such as - --basedir or --datadir if mysql_install_db does not use the - correct locations for the installation directory or data - directory. For example: -shell> bin/mysql_install_db --user=mysql \ - --basedir=/opt/mysql/mysql \ - --datadir=/opt/mysql/mysql/data - The mysql_install_db script creates the server's data - directory. Under the data directory, it creates directories - for the mysql database that holds all database privileges and - the test database that you can use to test MySQL. The script - also creates privilege table entries for root and - anonymous-user accounts. The accounts have no passwords - initially. A description of their initial privileges is given - in Section 2.13.2, "Securing the Initial MySQL Accounts." - Briefly, these privileges allow the MySQL root user to do - anything, and allow anybody to create or use databases with a - name of test or starting with test_. - It is important to make sure that the database directories and - files are owned by the mysql login account so that the server - has read and write access to them when you run it later. To - ensure this, the --user option should be used as shown if you - run mysql_install_db as root. Otherwise, you should execute - the script while logged in as mysql, in which case you can - omit the --user option from the command. - mysql_install_db creates several tables in the mysql database, - including user, db, host, tables_priv, columns_priv, func, and - others. See Section 5.4, "The MySQL Access Privilege System," - for a complete listing and description of these tables. - If you don't want to have the test database, you can remove it - with mysqladmin -u root drop test after starting the server. - If you have trouble with mysql_install_db at this point, see - Section 2.13.1.1, "Problems Running mysql_install_db." - - 3. Start the MySQL server: -shell> bin/mysqld_safe --user=mysql & - It is important that the MySQL server be run using an - unprivileged (non-root) login account. To ensure this, the - --user option should be used as shown if you run mysqld_safe - as system root. Otherwise, you should execute the script while - logged in to the system as mysql, in which case you can omit - the --user option from the command. - Further instructions for running MySQL as an unprivileged user - are given in Section 5.3.6, "How to Run MySQL as a Normal - User." - If you neglected to create the grant tables before proceeding - to this step, the following message appears in the error log - file when you start the server: -mysqld: Can't find file: 'host.frm' - If you have other problems starting the server, see Section - 2.13.1.3, "Starting and Troubleshooting the MySQL Server." - - 4. Use mysqladmin to verify that the server is running. The - following commands provide simple tests to check whether the - server is up and responding to connections: -shell> bin/mysqladmin version -shell> bin/mysqladmin variables - The output from mysqladmin version varies slightly depending - on your platform and version of MySQL, but should be similar - to that shown here: -shell> bin/mysqladmin version -mysqladmin Ver 14.12 Distrib 5.1.46, for pc-linux-gnu on i686 -... - -Server version 5.1.46 -Protocol version 10 -Connection Localhost via UNIX socket -UNIX socket /var/lib/mysql/mysql.sock -Uptime: 14 days 5 hours 5 min 21 sec - -Threads: 1 Questions: 366 Slow queries: 0 -Opens: 0 Flush tables: 1 Open tables: 19 -Queries per second avg: 0.000 - To see what else you can do with mysqladmin, invoke it with - the --help option. - - 5. Verify that you can shut down the server: -shell> bin/mysqladmin -u root shutdown - - 6. Verify that you can start the server again. Do this by using - mysqld_safe or by invoking mysqld directly. For example: -shell> bin/mysqld_safe --user=mysql --log & - If mysqld_safe fails, see Section 2.13.1.3, "Starting and - Troubleshooting the MySQL Server." - - 7. Run some simple tests to verify that you can retrieve - information from the server. The output should be similar to - what is shown here: -shell> bin/mysqlshow -+-----------+ -| Databases | -+-----------+ -| mysql | -| test | -+-----------+ - -shell> bin/mysqlshow mysql -Database: mysql -+---------------------------+ -| Tables | -+---------------------------+ -| columns_priv | -| db | -| func | -| help_category | -| help_keyword | -| help_relation | -| help_topic | -| host | -| proc | -| procs_priv | -| tables_priv | -| time_zone | -| time_zone_leap_second | -| time_zone_name | -| time_zone_transition | -| time_zone_transition_type | -| user | -+---------------------------+ - -shell> bin/mysql -e "SELECT Host,Db,User FROM db" mysql -+------+--------+------+ -| host | db | user | -+------+--------+------+ -| % | test | | -| % | test_% | | -+------+--------+------+ - - 8. There is a benchmark suite in the sql-bench directory (under - the MySQL installation directory) that you can use to compare - how MySQL performs on different platforms. The benchmark suite - is written in Perl. It requires the Perl DBI module that - provides a database-independent interface to the various - databases, and some other additional Perl modules: -DBI -DBD::mysql -Data::Dumper -Data::ShowTable - These modules can be obtained from CPAN - (http://www.cpan.org/). See also Section 2.15.1, "Installing - Perl on Unix." - The sql-bench/Results directory contains the results from many - runs against different databases and platforms. To run all - tests, execute these commands: -shell> cd sql-bench -shell> perl run-all-tests - If you don't have the sql-bench directory, you probably - installed MySQL using RPM files other than the source RPM. - (The source RPM includes the sql-bench benchmark directory.) - In this case, you must first install the benchmark suite - before you can use it. There are separate benchmark RPM files - named mysql-bench-VERSION.i386.rpm that contain benchmark code - and data. - If you have a source distribution, there are also tests in its - tests subdirectory that you can run. For example, to run - auto_increment.tst, execute this command from the top-level - directory of your source distribution: -shell> mysql -vvf test < ./tests/auto_increment.tst - The expected result of the test can be found in the - ./tests/auto_increment.res file. - - 9. At this point, you should have the server running. However, - none of the initial MySQL accounts have a password, so you - should assign passwords using the instructions found in - Section 2.13.2, "Securing the Initial MySQL Accounts." - - The MySQL 5.1 installation procedure creates time zone tables in - the mysql database. However, you must populate the tables manually - using the instructions in Section 9.6, "MySQL Server Time Zone - Support." - -2.13.1.1. Problems Running mysql_install_db - - The purpose of the mysql_install_db script is to generate new - MySQL privilege tables. It does not overwrite existing MySQL - privilege tables, and it does not affect any other data. - - If you want to re-create your privilege tables, first stop the - mysqld server if it is running. Then rename the mysql directory - under the data directory to save it, and then run - mysql_install_db. Suppose that your current directory is the MySQL - installation directory and that mysql_install_db is located in the - bin directory and the data directory is named data. To rename the - mysql database and re-run mysql_install_db, use these commands. -shell> mv data/mysql data/mysql.old -shell> bin/mysql_install_db --user=mysql - - When you run mysql_install_db, you might encounter the following - problems: - - * mysql_install_db fails to install the grant tables - You may find that mysql_install_db fails to install the grant - tables and terminates after displaying the following messages: -Starting mysqld daemon with databases from XXXXXX -mysqld ended - In this case, you should examine the error log file very - carefully. The log should be located in the directory XXXXXX - named by the error message and should indicate why mysqld - didn't start. If you do not understand what happened, include - the log when you post a bug report. See Section 1.7, "How to - Report Bugs or Problems." - - * There is a mysqld process running - This indicates that the server is running, in which case the - grant tables have probably been created already. If so, there - is no need to run mysql_install_db at all because it needs to - be run only once (when you install MySQL the first time). - - * Installing a second mysqld server does not work when one - server is running - This can happen when you have an existing MySQL installation, - but want to put a new installation in a different location. - For example, you might have a production installation, but you - want to create a second installation for testing purposes. - Generally the problem that occurs when you try to run a second - server is that it tries to use a network interface that is in - use by the first server. In this case, you should see one of - the following error messages: -Can't start server: Bind on TCP/IP port: -Address already in use -Can't start server: Bind on unix socket... - For instructions on setting up multiple servers, see Section - 5.6, "Running Multiple MySQL Servers on the Same Machine." - - * You do not have write access to the /tmp directory - If you do not have write access to create temporary files or a - Unix socket file in the default location (the /tmp directory), - an error occurs when you run mysql_install_db or the mysqld - server. - You can specify different locations for the temporary - directory and Unix socket file by executing these commands - prior to starting mysql_install_db or mysqld, where - some_tmp_dir is the full path name to some directory for which - you have write permission: -shell> TMPDIR=/some_tmp_dir/ -shell> MYSQL_UNIX_PORT=/some_tmp_dir/mysql.sock -shell> export TMPDIR MYSQL_UNIX_PORT - Then you should be able to run mysql_install_db and start the - server with these commands: -shell> bin/mysql_install_db --user=mysql -shell> bin/mysqld_safe --user=mysql & - If mysql_install_db is located in the scripts directory, - modify the first command to scripts/mysql_install_db. - See Section B.5.4.5, "How to Protect or Change the MySQL Unix - Socket File," and Section 2.14, "Environment Variables." - - There are some alternatives to running the mysql_install_db script - provided in the MySQL distribution: - - * If you want the initial privileges to be different from the - standard defaults, you can modify mysql_install_db before you - run it. However, it is preferable to use GRANT and REVOKE to - change the privileges after the grant tables have been set up. - In other words, you can run mysql_install_db, and then use - mysql -u root mysql to connect to the server as the MySQL root - user so that you can issue the necessary GRANT and REVOKE - statements. - If you want to install MySQL on several machines with the same - privileges, you can put the GRANT and REVOKE statements in a - file and execute the file as a script using mysql after - running mysql_install_db. For example: -shell> bin/mysql_install_db --user=mysql -shell> bin/mysql -u root < your_script_file - By doing this, you can avoid having to issue the statements - manually on each machine. - - * It is possible to re-create the grant tables completely after - they have previously been created. You might want to do this - if you're just learning how to use GRANT and REVOKE and have - made so many modifications after running mysql_install_db that - you want to wipe out the tables and start over. - To re-create the grant tables, remove all the .frm, .MYI, and - .MYD files in the mysql database directory. Then run the - mysql_install_db script again. - - * You can start mysqld manually using the --skip-grant-tables - option and add the privilege information yourself using mysql: -shell> bin/mysqld_safe --user=mysql --skip-grant-tables & -shell> bin/mysql mysql - From mysql, manually execute the SQL commands contained in - mysql_install_db. Make sure that you run mysqladmin - flush-privileges or mysqladmin reload afterward to tell the - server to reload the grant tables. - Note that by not using mysql_install_db, you not only have to - populate the grant tables manually, you also have to create - them first. - -2.13.1.2. Starting and Stopping MySQL Automatically - - Generally, you start the mysqld server in one of these ways: - - * Invoke mysqld directly. This works on any platform. - - * Run the MySQL server as a Windows service. The service can be - set to start the server automatically when Windows starts, or - as a manual service that you start on request. For - instructions, see Section 2.5.5.6, "Starting MySQL as a - Windows Service." - - * Invoke mysqld_safe, which tries to determine the proper - options for mysqld and then runs it with those options. This - script is used on Unix and Unix-like systems. See Section - 4.3.2, "mysqld_safe --- MySQL Server Startup Script." - - * Invoke mysql.server. This script is used primarily at system - startup and shutdown on systems that use System V-style run - directories, where it usually is installed under the name - mysql. The mysql.server script starts the server by invoking - mysqld_safe. See Section 4.3.3, "mysql.server --- MySQL Server - Startup Script." - - * On Mac OS X, install a separate MySQL Startup Item package to - enable the automatic startup of MySQL on system startup. The - Startup Item starts the server by invoking mysql.server. See - Section 2.7, "Installing MySQL on Mac OS X," for details. - - The mysqld_safe and mysql.server scripts and the Mac OS X Startup - Item can be used to start the server manually, or automatically at - system startup time. mysql.server and the Startup Item also can be - used to stop the server. - - To start or stop the server manually using the mysql.server - script, invoke it with start or stop arguments: -shell> mysql.server start -shell> mysql.server stop - - Before mysql.server starts the server, it changes location to the - MySQL installation directory, and then invokes mysqld_safe. If you - want the server to run as some specific user, add an appropriate - user option to the [mysqld] group of the /etc/my.cnf option file, - as shown later in this section. (It is possible that you will need - to edit mysql.server if you've installed a binary distribution of - MySQL in a nonstandard location. Modify it to change location into - the proper directory before it runs mysqld_safe. If you do this, - your modified version of mysql.server may be overwritten if you - upgrade MySQL in the future, so you should make a copy of your - edited version that you can reinstall.) - - mysql.server stop stops the server by sending a signal to it. You - can also stop the server manually by executing mysqladmin - shutdown. - - To start and stop MySQL automatically on your server, you need to - add start and stop commands to the appropriate places in your - /etc/rc* files. - - If you use the Linux server RPM package - (MySQL-server-VERSION.rpm), the mysql.server script is installed - in the /etc/init.d directory with the name mysql. You need not - install it manually. See Section 2.6.1, "Installing MySQL from RPM - Packages on Linux," for more information on the Linux RPM - packages. - - Some vendors provide RPM packages that install a startup script - under a different name such as mysqld. - - If you install MySQL from a source distribution or using a binary - distribution format that does not install mysql.server - automatically, you can install it manually. The script can be - found in the support-files directory under the MySQL installation - directory or in a MySQL source tree. - - To install mysql.server manually, copy it to the /etc/init.d - directory with the name mysql, and then make it executable. Do - this by changing location into the appropriate directory where - mysql.server is located and executing these commands: -shell> cp mysql.server /etc/init.d/mysql -shell> chmod +x /etc/init.d/mysql - - Older Red Hat systems use the /etc/rc.d/init.d directory rather - than /etc/init.d. Adjust the preceding commands accordingly. - Alternatively, first create /etc/init.d as a symbolic link that - points to /etc/rc.d/init.d: -shell> cd /etc -shell> ln -s rc.d/init.d . - - After installing the script, the commands needed to activate it to - run at system startup depend on your operating system. On Linux, - you can use chkconfig: -shell> chkconfig --add mysql - - On some Linux systems, the following command also seems to be - necessary to fully enable the mysql script: -shell> chkconfig --level 345 mysql on - - On FreeBSD, startup scripts generally should go in - /usr/local/etc/rc.d/. The rc(8) manual page states that scripts in - this directory are executed only if their basename matches the - *.sh shell file name pattern. Any other files or directories - present within the directory are silently ignored. In other words, - on FreeBSD, you should install the mysql.server script as - /usr/local/etc/rc.d/mysql.server.sh to enable automatic startup. - - As an alternative to the preceding setup, some operating systems - also use /etc/rc.local or /etc/init.d/boot.local to start - additional services on startup. To start up MySQL using this - method, you could append a command like the one following to the - appropriate startup file: -/bin/sh -c 'cd /usr/local/mysql; ./bin/mysqld_safe --user=mysql &' - - For other systems, consult your operating system documentation to - see how to install startup scripts. - - You can add options for mysql.server in a global /etc/my.cnf file. - A typical /etc/my.cnf file might look like this: -[mysqld] -datadir=/usr/local/mysql/var -socket=/var/tmp/mysql.sock -port=3306 -user=mysql - -[mysql.server] -basedir=/usr/local/mysql - - The mysql.server script supports the following options: basedir, - datadir, and pid-file. If specified, they must be placed in an - option file, not on the command line. mysql.server supports only - start and stop as command-line arguments. - - The following table shows which option groups the server and each - startup script read from option files. - Script Option Groups - mysqld [mysqld], [server], [mysqld-major_version] - mysqld_safe [mysqld], [server], [mysqld_safe] - mysql.server [mysqld], [mysql.server], [server] - - [mysqld-major_version] means that groups with names like - [mysqld-5.0] and [mysqld-5.1] are read by servers having versions - 5.0.x, 5.1.x, and so forth. This feature can be used to specify - options that can be read only by servers within a given release - series. - - For backward compatibility, mysql.server also reads the - [mysql_server] group and mysqld_safe also reads the [safe_mysqld] - group. However, you should update your option files to use the - [mysql.server] and [mysqld_safe] groups instead when using MySQL - 5.1. - - See Section 4.2.3.3, "Using Option Files." - -2.13.1.3. Starting and Troubleshooting the MySQL Server - - This section provides troubleshooting suggestions for problems - starting the server on Unix. If you are using Windows, see Section - 2.5.6, "Troubleshooting a MySQL Installation Under Windows." - - If you have problems starting the server, here are some things to - try: - - * Check the error log to see why the server does not start. - - * Specify any special options needed by the storage engines you - are using. - - * Make sure that the server knows where to find the data - directory. - - * Make sure that the server can access the data directory. The - ownership and permissions of the data directory and its - contents must be set such that the server can read and modify - them. - - * Verify that the network interfaces the server wants to use are - available. - - Some storage engines have options that control their behavior. You - can create a my.cnf file and specify startup options for the - engines that you plan to use. If you are going to use storage - engines that support transactional tables (InnoDB, NDB), be sure - that you have them configured the way you want before starting the - server: - - * If you are using InnoDB tables, see Section 13.6.2, "InnoDB - Configuration." - - * If you are using MySQL Cluster, see Section 17.3, "MySQL - Cluster Configuration." - - MySQL Enterprise For expert advice on start-up options appropriate - to your circumstances, subscribe to The MySQL Enterprise Monitor. - For more information, see - http://www.mysql.com/products/enterprise/advisors.html. - - Storage engines will use default option values if you specify - none, but it is recommended that you review the available options - and specify explicit values for those for which the defaults are - not appropriate for your installation. - - When the mysqld server starts, it changes location to the data - directory. This is where it expects to find databases and where it - expects to write log files. The server also writes the pid - (process ID) file in the data directory. - - The data directory location is hardwired in when the server is - compiled. This is where the server looks for the data directory by - default. If the data directory is located somewhere else on your - system, the server will not work properly. You can determine what - the default path settings are by invoking mysqld with the - --verbose and --help options. - - If the default locations don't match the MySQL installation layout - on your system, you can override them by specifying options to - mysqld or mysqld_safe on the command line or in an option file. - - To specify the location of the data directory explicitly, use the - --datadir option. However, normally you can tell mysqld the - location of the base directory under which MySQL is installed and - it looks for the data directory there. You can do this with the - --basedir option. - - To check the effect of specifying path options, invoke mysqld with - those options followed by the --verbose and --help options. For - example, if you change location into the directory where mysqld is - installed and then run the following command, it shows the effect - of starting the server with a base directory of /usr/local: -shell> ./mysqld --basedir=/usr/local --verbose --help - - You can specify other options such as --datadir as well, but - --verbose and --help must be the last options. - - Once you determine the path settings you want, start the server - without --verbose and --help. - - If mysqld is currently running, you can find out what path - settings it is using by executing this command: -shell> mysqladmin variables - - Or: -shell> mysqladmin -h host_name variables - - host_name is the name of the MySQL server host. - - If you get Errcode 13 (which means Permission denied) when - starting mysqld, this means that the privileges of the data - directory or its contents do not allow the server access. In this - case, you change the permissions for the involved files and - directories so that the server has the right to use them. You can - also start the server as root, but this raises security issues and - should be avoided. - - On Unix, change location into the data directory and check the - ownership of the data directory and its contents to make sure the - server has access. For example, if the data directory is - /usr/local/mysql/var, use this command: -shell> ls -la /usr/local/mysql/var - - If the data directory or its files or subdirectories are not owned - by the login account that you use for running the server, change - their ownership to that account. If the account is named mysql, - use these commands: -shell> chown -R mysql /usr/local/mysql/var -shell> chgrp -R mysql /usr/local/mysql/var - - If it possible that even with correct ownership, MySQL may fail to - start up if there is other security software running on your - system that manages application access to various parts of the - file system. In this case, you may need to reconfigure that - software to enable mysqld to access the directories it uses during - normal operation. - - If the server fails to start up correctly, check the error log. - Log files are located in the data directory (typically C:\Program - Files\MySQL\MySQL Server 5.1\data on Windows, - /usr/local/mysql/data for a Unix binary distribution, and - /usr/local/var for a Unix source distribution). Look in the data - directory for files with names of the form host_name.err and - host_name.log, where host_name is the name of your server host. - Then examine the last few lines of these files. On Unix, you can - use tail to display them: -shell> tail host_name.err -shell> tail host_name.log - - The error log should contain information that indicates why the - server couldn't start. - - If either of the following errors occur, it means that some other - program (perhaps another mysqld server) is using the TCP/IP port - or Unix socket file that mysqld is trying to use: -Can't start server: Bind on TCP/IP port: Address already in use -Can't start server: Bind on unix socket... - - Use ps to determine whether you have another mysqld server - running. If so, shut down the server before starting mysqld again. - (If another server is running, and you really want to run multiple - servers, you can find information about how to do so in Section - 5.6, "Running Multiple MySQL Servers on the Same Machine.") - - If no other server is running, try to execute the command telnet - your_host_name tcp_ip_port_number. (The default MySQL port number - is 3306.) Then press Enter a couple of times. If you don't get an - error message like telnet: Unable to connect to remote host: - Connection refused, some other program is using the TCP/IP port - that mysqld is trying to use. You'll need to track down what - program this is and disable it, or else tell mysqld to listen to a - different port with the --port option. In this case, you'll also - need to specify the port number for client programs when - connecting to the server via TCP/IP. - - Another reason the port might be inaccessible is that you have a - firewall running that blocks connections to it. If so, modify the - firewall settings to allow access to the port. - - If the server starts but you can't connect to it, you should make - sure that you have an entry in /etc/hosts that looks like this: -127.0.0.1 localhost - - This problem occurs only on systems that do not have a working - thread library and for which MySQL must be configured to use - MIT-pthreads. - - If you cannot get mysqld to start, you can try to make a trace - file to find the problem by using the --debug-dbug option. See MySQL - Internals: Porting - (http://forge.mysql.com/wiki/MySQL_Internals_Porting). - -2.13.2. Securing the Initial MySQL Accounts - - Part of the MySQL installation process is to set up the mysql - database that contains the grant tables: - - * Windows distributions contain preinitialized grant tables that - are installed automatically. - - * On Unix, the grant tables are populated by the - mysql_install_db program. Some installation methods run this - program for you. Others require that you execute it manually. - For details, see Section 2.13.1, "Unix Post-Installation - Procedures." - - The grant tables define the initial MySQL user accounts and their - access privileges. These accounts are set up as follows: - - * Accounts with the user name root are created. These are - superuser accounts that can do anything. The initial root - account passwords are empty, so anyone can connect to the - MySQL server as root --- without a password --- and be granted - all privileges. - - + On Windows, one root account is created; this account - allows connecting from the local host only. The Windows - installer will optionally create an account allowing for - connections from any host only if the user selects the - Enable root access from remote machines option during - installation. - - + On Unix, both root accounts are for connections from the - local host. Connections must be made from the local host - by specifying a host name of localhost for one of the - accounts, or the actual host name or IP number for the - other. - - * Two anonymous-user accounts are created, each with an empty - user name. The anonymous accounts have no password, so anyone - can use them to connect to the MySQL server. - - + On Windows, one anonymous account is for connections from - the local host. It has no global privileges. (Before - MySQL 5.1.16, it has all global privileges, just like the - root accounts.) The other is for connections from any - host and has all privileges for the test database and for - other databases with names that start with test. - - + On Unix, both anonymous accounts are for connections from - the local host. Connections must be made from the local - host by specifying a host name of localhost for one of - the accounts, or the actual host name or IP number for - the other. These accounts have all privileges for the - test database and for other databases with names that - start with test_. - - As noted, none of the initial accounts have passwords. This means - that your MySQL installation is unprotected until you do something - about it: - - * If you want to prevent clients from connecting as anonymous - users without a password, you should either assign a password - to each anonymous account or else remove the accounts. - - * You should assign a password to each MySQL root account. - - The following instructions describe how to set up passwords for - the initial MySQL accounts, first for the anonymous accounts and - then for the root accounts. Replace "newpwd" in the examples with - the actual password that you want to use. The instructions also - cover how to remove the anonymous accounts, should you prefer not - to allow anonymous access at all. - - You might want to defer setting the passwords until later, so that - you don't need to specify them while you perform additional setup - or testing. However, be sure to set them before using your - installation for production purposes. - - Anonymous Account Password Assignment - - To assign passwords to the anonymous accounts, connect to the - server as root and then use either SET PASSWORD or UPDATE. In - either case, be sure to encrypt the password using the PASSWORD() - function. - - To use SET PASSWORD on Windows, do this: -shell> mysql -u root -mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd'); -mysql> SET PASSWORD FOR ''@'%' = PASSWORD('newpwd'); - - To use SET PASSWORD on Unix, do this: -shell> mysql -u root -mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd'); -mysql> SET PASSWORD FOR ''@'host_name' = PASSWORD('newpwd'); - - In the second SET PASSWORD statement, replace host_name with the - name of the server host. This is the name that is specified in the - Host column of the non-localhost record for root in the user - table. If you don't know what host name this is, issue the - following statement before using SET PASSWORD: -mysql> SELECT Host, User FROM mysql.user; - - Look for the record that has root in the User column and something - other than localhost in the Host column. Then use that Host value - in the second SET PASSWORD statement. - - Anonymous Account Removal - - If you prefer to remove the anonymous accounts instead, do so as - follows: -shell> mysql -u root -mysql> DROP USER ''; - - The DROP statement applies both to Windows and to Unix. On - Windows, if you want to remove only the anonymous account that has - the same privileges as root, do this instead: -shell> mysql -u root -mysql> DROP USER ''@'localhost'; - - That account allows anonymous access but has full privileges, so - removing it improves security. - - root Account Password Assignment - - You can assign passwords to the root accounts in several ways. The - following discussion demonstrates three methods: - - * Use the SET PASSWORD statement - - * Use the mysqladmin command-line client program - - * Use the UPDATE statement - - To assign passwords using SET PASSWORD, connect to the server as - root and issue SET PASSWORD statements. Be sure to encrypt the - password using the PASSWORD() function. - - For Windows, do this: -shell> mysql -u root -mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd'); -mysql> SET PASSWORD FOR 'root'@'%' = PASSWORD('newpwd'); - - For Unix, do this: -shell> mysql -u root -mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd'); -mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('newpwd'); - - In the second SET PASSWORD statement, replace host_name with the - name of the server host. This is the same host name that you used - when you assigned the anonymous account passwords. - - If the user table contains an account with User and Host values of - 'root' and '127.0.0.1', use an additional SET PASSWORD statement - to set that account's password: -mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('newpwd'); - - To assign passwords to the root accounts using mysqladmin, execute - the following commands: -shell> mysqladmin -u root password "newpwd" -shell> mysqladmin -u root -h host_name password "newpwd" - - These commands apply both to Windows and to Unix. In the second - command, replace host_name with the name of the server host. The - double quotes around the password are not always necessary, but - you should use them if the password contains spaces or other - characters that are special to your command interpreter. - - The mysqladmin method of setting the root account passwords does - not set the password for the 'root'@'127.0.0.1' account. To do so, - use SET PASSWORD as shown earlier. - - You can also use UPDATE to modify the user table directly. The - following UPDATE statement assigns a password to all root - accounts: -shell> mysql -u root -mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd') - -> WHERE User = 'root'; -mysql> FLUSH PRIVILEGES; - - The UPDATE statement applies both to Windows and to Unix. - - After the passwords have been set, you must supply the appropriate - password whenever you connect to the server. For example, if you - want to use mysqladmin to shut down the server, you can do so - using this command: -shell> mysqladmin -u root -p shutdown -Enter password: (enter root password here) - -Note - - If you forget your root password after setting it up, Section - B.5.4.1, "How to Reset the Root Password," covers the procedure - for resetting it. - - To set up additional accounts, you can use the GRANT statement. - For instructions, see Section 5.5.2, "Adding User Accounts." - -2.14. Environment Variables - - This section lists all the environment variables that are used - directly or indirectly by MySQL. Most of these can also be found - in other places in this manual. - - Note that any options on the command line take precedence over - values specified in option files and environment variables, and - values in option files take precedence over values in environment - variables. - - In many cases, it is preferable to use an option file instead of - environment variables to modify the behavior of MySQL. See Section - 4.2.3.3, "Using Option Files." - Variable Description - CXX The name of your C++ compiler (for running configure). - CC The name of your C compiler (for running configure). - CFLAGS Flags for your C compiler (for running configure). - CXXFLAGS Flags for your C++ compiler (for running configure). - DBI_USER The default user name for Perl DBI. - DBI_TRACE Trace options for Perl DBI. - HOME The default path for the mysql history file is - $HOME/.mysql_history. - LD_RUN_PATH Used to specify the location of libmysqlclient.so. - MYSQL_DEBUG Debug trace options when debugging. - MYSQL_GROUP_SUFFIX Option group suffix value (like specifying - --defaults-group-suffix). - MYSQL_HISTFILE The path to the mysql history file. If this - variable is set, its value overrides the default for - $HOME/.mysql_history. - MYSQL_HOME The path to the directory in which the server-specific - my.cnf file resides (as of MySQL 5.0.3). - MYSQL_HOST The default host name used by the mysql command-line - client. - MYSQL_PS1 The command prompt to use in the mysql command-line - client. - MYSQL_PWD The default password when connecting to mysqld. Note - that using this is insecure. See Section 5.3.2.2, "End-User - Guidelines for Password Security." - MYSQL_TCP_PORT The default TCP/IP port number. - MYSQL_UNIX_PORT The default Unix socket file name; used for - connections to localhost. - PATH Used by the shell to find MySQL programs. - TMPDIR The directory where temporary files are created. - TZ This should be set to your local time zone. See Section - B.5.4.6, "Time Zone Problems." - UMASK The user-file creation mode when creating files. See note - following table. - UMASK_DIR The user-directory creation mode when creating - directories. See note following table. - USER The default user name on Windows and NetWare used when - connecting to mysqld. - - The UMASK and UMASK_DIR variables, despite their names, are used - as modes, not masks: - - * If UMASK is set, mysqld uses ($UMASK | 0600) as the mode for - file creation, so that newly created files have a mode in the - range from 0600 to 0666 (all values octal). - - * If UMASK_DIR is set, mysqld uses ($UMASK_DIR | 0700) as the - base mode for directory creation, which then is AND-ed with - ~(~$UMASK & 0666), so that newly created directories have a - mode in the range from 0700 to 0777 (all values octal). The - AND operation may remove read and write permissions from the - directory mode, but not execute permissions. - - MySQL assumes that the value for UMASK or UMASK_DIR is in octal if - it starts with a zero. - -2.15. Perl Installation Notes - - Perl support for MySQL is provided by means of the DBI/DBD client - interface. The interface requires Perl 5.6.0, and 5.6.1 or later - is preferred. DBI does not work if you have an older version of - Perl. - - If you want to use transactions with Perl DBI, you need to have - DBD::mysql 2.0900. If you are using the MySQL 4.1 or newer client - library, you must use DBD::mysql 2.9003 or newer. Support for - server-side prepared statements requires DBD::mysql 3.0009 or - newer. - - Perl support is not included with MySQL distributions. You can - obtain the necessary modules from http://search.cpan.org for Unix, - or by using the ActiveState ppm program on Windows. The following - sections describe how to do this. - - Perl support for MySQL must be installed if you want to run the - MySQL benchmark scripts; see Section 7.1.3, "The MySQL Benchmark - Suite." It is also required for the MySQL Cluster ndb_size.pl - utility; see Section 17.4.21, "ndb_size.pl --- NDBCLUSTER Size - Requirement Estimator." - -2.15.1. Installing Perl on Unix - - MySQL Perl support requires that you have installed MySQL client - programming support (libraries and header files). Most - installation methods install the necessary files. However, if you - installed MySQL from RPM files on Linux, be sure that you've - installed the developer RPM. The client programs are in the client - RPM, but client programming support is in the developer RPM. - - If you want to install Perl support, the files you need can be - obtained from the CPAN (Comprehensive Perl Archive Network) at - http://search.cpan.org. - - The easiest way to install Perl modules on Unix is to use the CPAN - module. For example: -shell> perl -MCPAN -e shell -cpan> install DBI -cpan> install DBD::mysql - - The DBD::mysql installation runs a number of tests. These tests - attempt to connect to the local MySQL server using the default - user name and password. (The default user name is your login name - on Unix, and ODBC on Windows. The default password is "no - password.") If you cannot connect to the server with those values - (for example, if your account has a password), the tests fail. You - can use force install DBD::mysql to ignore the failed tests. - - DBI requires the Data::Dumper module. It may be installed; if not, - you should install it before installing DBI. - - It is also possible to download the module distributions in the - form of compressed tar archives and build the modules manually. - For example, to unpack and build a DBI distribution, use a - procedure such as this: - - 1. Unpack the distribution into the current directory: -shell> gunzip < DBI-VERSION.tar.gz | tar xvf - - This command creates a directory named DBI-VERSION. - - 2. Change location into the top-level directory of the unpacked - distribution: -shell> cd DBI-VERSION - - 3. Build the distribution and compile everything: -shell> perl Makefile.PL -shell> make -shell> make test -shell> make install - - The make test command is important because it verifies that the - module is working. Note that when you run that command during the - DBD::mysql installation to exercise the interface code, the MySQL - server must be running or the test fails. - - It is a good idea to rebuild and reinstall the DBD::mysql - distribution whenever you install a new release of MySQL, - particularly if you notice symptoms such as that all your DBI - scripts fail after you upgrade MySQL. - - If you do not have access rights to install Perl modules in the - system directory or if you want to install local Perl modules, the - following reference may be useful: - http://servers.digitaldaze.com/extensions/perl/modules.html#module - s - - Look under the heading "Installing New Modules that Require - Locally Installed Modules." - -2.15.2. Installing ActiveState Perl on Windows - - On Windows, you should do the following to install the MySQL DBD - module with ActiveState Perl: - - 1. Get ActiveState Perl from - http://www.activestate.com/Products/ActivePerl/ and install - it. - - 2. Open a console window (a "DOS window"). - - 3. If necessary, set the HTTP_proxy variable. For example, you - might try a setting like this: -set HTTP_proxy=my.proxy.com:3128 - - 4. Start the PPM program: -C:\> C:\perl\bin\ppm.pl - - 5. If you have not previously done so, install DBI: -ppm> install DBI - - 6. If this succeeds, run the following command: -ppm> install DBD-mysql - - This procedure should work with ActiveState Perl 5.6 or newer. - - If you cannot get the procedure to work, you should install the - MyODBC driver instead and connect to the MySQL server through - ODBC: -use DBI; -$dbh= DBI->connect("DBI:ODBC:$dsn",$user,$password) || - die "Got error $DBI::errstr when connecting to $dsn\n"; - -2.15.3. Problems Using the Perl DBI/DBD Interface - - If Perl reports that it cannot find the ../mysql/mysql.so module, - the problem is probably that Perl cannot locate the - libmysqlclient.so shared library. You should be able to fix this - problem by one of the following methods: - - * Compile the DBD::mysql distribution with perl Makefile.PL - -static -config rather than perl Makefile.PL. - - * Copy libmysqlclient.so to the directory where your other - shared libraries are located (probably /usr/lib or /lib). - - * Modify the -L options used to compile DBD::mysql to reflect - the actual location of libmysqlclient.so. - - * On Linux, you can add the path name of the directory where - libmysqlclient.so is located to the /etc/ld.so.conf file. - - * Add the path name of the directory where libmysqlclient.so is - located to the LD_RUN_PATH environment variable. Some systems - use LD_LIBRARY_PATH instead. - - Note that you may also need to modify the -L options if there are - other libraries that the linker fails to find. For example, if the - linker cannot find libc because it is in /lib and the link command - specifies -L/usr/lib, change the -L option to -L/lib or add -L/lib - to the existing link command. - - If you get the following errors from DBD::mysql, you are probably - using gcc (or using an old binary compiled with gcc): -/usr/bin/perl: can't resolve symbol '__moddi3' -/usr/bin/perl: can't resolve symbol '__divdi3' - - Add -L/usr/lib/gcc-lib/... -lgcc to the link command when the - mysql.so library gets built (check the output from make for - mysql.so when you compile the Perl client). The -L option should - specify the path name of the directory where libgcc.a is located - on your system. - - Another cause of this problem may be that Perl and MySQL are not - both compiled with gcc. In this case, you can solve the mismatch - by compiling both with gcc. - - You may see the following error from DBD::mysql when you run the - tests: -t/00base............install_driver(mysql) failed: -Can't load '../blib/arch/auto/DBD/mysql/mysql.so' for module DBD::mys -ql: -../blib/arch/auto/DBD/mysql/mysql.so: undefined symbol: -uncompress at /usr/lib/perl5/5.00503/i586-linux/DynaLoader.pm line 16 -9. - - This means that you need to include the -lz compression library on - the link line. That can be done by changing the following line in - the file lib/DBD/mysql/Install.pm: -$sysliblist .= " -lm"; - - Change that line to: -$sysliblist .= " -lm -lz"; - - After this, you must run make realclean and then proceed with the - installation from the beginning. - - If you want to install DBI on SCO, you have to edit the Makefile - in DBI-xxx and each subdirectory. Note that the following assumes - gcc 2.95.2 or newer: -OLD: NEW: -CC = cc CC = gcc -CCCDLFLAGS = -KPIC -W1,-Bexport CCCDLFLAGS = -fpic -CCDLFLAGS = -wl,-Bexport CCDLFLAGS = - -LD = ld LD = gcc -G -fpic -LDDLFLAGS = -G -L/usr/local/lib LDDLFLAGS = -L/usr/local/lib -LDFLAGS = -belf -L/usr/local/lib LDFLAGS = -L/usr/local/lib - -LD = ld LD = gcc -G -fpic -OPTIMISE = -Od OPTIMISE = -O1 - -OLD: -CCCFLAGS = -belf -dy -w0 -U M_XENIX -DPERL_SCO5 -I/usr/local/include - -NEW: -CCFLAGS = -U M_XENIX -DPERL_SCO5 -I/usr/local/include - - These changes are necessary because the Perl dynaloader does not - load the DBI modules if they were compiled with icc or cc. - - If you want to use the Perl module on a system that does not - support dynamic linking (such as SCO), you can generate a static - version of Perl that includes DBI and DBD::mysql. The way this - works is that you generate a version of Perl with the DBI code - linked in and install it on top of your current Perl. Then you use - that to build a version of Perl that additionally has the DBD code - linked in, and install that. - - On SCO, you must have the following environment variables set: -LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:/usr/progressive/lib - - Or: -LD_LIBRARY_PATH=/usr/lib:/lib:/usr/local/lib:/usr/ccs/lib:\ - /usr/progressive/lib:/usr/skunk/lib -LIBPATH=/usr/lib:/lib:/usr/local/lib:/usr/ccs/lib:\ - /usr/progressive/lib:/usr/skunk/lib -MANPATH=scohelp:/usr/man:/usr/local1/man:/usr/local/man:\ - /usr/skunk/man: - - First, create a Perl that includes a statically linked DBI module - by running these commands in the directory where your DBI - distribution is located: -shell> perl Makefile.PL -static -config -shell> make -shell> make install -shell> make perl - - Then you must install the new Perl. The output of make perl - indicates the exact make command you need to execute to perform - the installation. On SCO, this is make -f Makefile.aperl inst_perl - MAP_TARGET=perl. - - Next, use the just-created Perl to create another Perl that also - includes a statically linked DBD::mysql by running these commands - in the directory where your DBD::mysql distribution is located: -shell> perl Makefile.PL -static -config -shell> make -shell> make install -shell> make perl - - Finally, you should install this new Perl. Again, the output of - make perl indicates the command to use. diff --git a/client/mysql.cc b/client/mysql.cc index 38054668411..d2be06e3ea8 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2312,17 +2312,19 @@ static bool add_line(String &buffer,char *line,char *in_string, { uint length=(uint) (out-line); - if (!truncated && - (length < 9 || - my_strnncoll (charset_info, - (uchar *)line, 9, (const uchar *) "delimiter", 9))) + if (!truncated && (length < 9 || + my_strnncoll (charset_info, (uchar *)line, 9, + (const uchar *) "delimiter", 9) || + (*in_string || *ml_comment))) { /* Don't add a new line in case there's a DELIMITER command to be added to the glob buffer (e.g. on processing a line like "<command>;DELIMITER <non-eof>") : similar to how a new line is not added in the case when the DELIMITER is the first command - entered with an empty glob buffer. + entered with an empty glob buffer. However, if the delimiter is + part of a string or a comment, the new line should be added. (e.g. + SELECT '\ndelimiter\n';\n) */ *out++='\n'; length++; @@ -4723,7 +4725,13 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate) if (info_type == INFO_ERROR) { if (!opt_nobeep) + { +#ifdef _WIN32 + MessageBeep(MB_ICONWARNING); +#else putchar('\a'); /* This should make a bell */ +#endif + } vidattr(A_STANDOUT); if (error) { diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 87198347b10..c8c989753f4 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -2444,6 +2444,8 @@ int main(int argc, char** argv) else load_processor.init_by_cur_dir(); + fprintf(result_file, "/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;\n"); + fprintf(result_file, "/*!40019 SET @@session.max_insert_delayed_threads=0*/;\n"); @@ -2494,6 +2496,8 @@ int main(int argc, char** argv) "/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\n" "/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n"); + fprintf(result_file, "/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;\n"); + if (tmpdir.list) free_tmpdir(&tmpdir); if (result_file != stdout) diff --git a/client/mysqldump.c b/client/mysqldump.c index a1789beae68..47cb5132b85 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -2296,7 +2296,6 @@ static uint dump_routines_for_db(char *db) const char *routine_type[]= {"FUNCTION", "PROCEDURE"}; char db_name_buff[NAME_LEN*2+3], name_buff[NAME_LEN*2+3]; char *routine_name; - char *query_str; int i; FILE *sql_file= md_result_file; MYSQL_RES *routine_res, *routine_list_res; @@ -2390,17 +2389,6 @@ static uint dump_routines_for_db(char *db) fprintf(sql_file, "/*!50003 DROP %s IF EXISTS %s */;\n", routine_type[i], routine_name); - query_str= cover_definer_clause(row[2], strlen(row[2]), - C_STRING_WITH_LEN("50020"), - C_STRING_WITH_LEN("50003"), - C_STRING_WITH_LEN(" FUNCTION")); - - if (!query_str) - query_str= cover_definer_clause(row[2], strlen(row[2]), - C_STRING_WITH_LEN("50020"), - C_STRING_WITH_LEN("50003"), - C_STRING_WITH_LEN(" PROCEDURE")); - if (mysql_num_fields(routine_res) >= 6) { if (switch_db_collation(sql_file, db_name_buff, ";", @@ -2438,9 +2426,9 @@ static uint dump_routines_for_db(char *db) fprintf(sql_file, "DELIMITER ;;\n" - "/*!50003 %s */;;\n" + "%s ;;\n" "DELIMITER ;\n", - (const char *) (query_str != NULL ? query_str : row[2])); + (const char *) row[2]); restore_sql_mode(sql_file, ";"); @@ -2455,7 +2443,6 @@ static uint dump_routines_for_db(char *db) } } - my_free(query_str); } } /* end of routine printing */ mysql_free_result(routine_res); diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index 056366e6ee6..ee7c4af7155 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -2,7 +2,7 @@ IF(RPM) SET(CPACK_GENERATOR "RPM") SET(CPACK_RPM_PACKAGE_DEBUG 1) -SET(INSTALL_LAYOUT "RPM") +SET(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7) SET(CPACK_RPM_COMPONENT_INSTALL ON) @@ -49,9 +49,13 @@ MariaDB bug reports should be submitted through https://mariadb.atlassian.net/ SET(CPACK_RPM_SPEC_MORE_DEFINE " %define mysql_vendor ${CPACK_PACKAGE_VENDOR} %define mysqlversion ${MYSQL_NO_DASH_VERSION} -%define mysqldatadir /var/lib/mysql +%define mysqlbasedir ${CMAKE_INSTALL_PREFIX} +%define mysqldatadir ${INSTALL_MYSQLDATADIR} %define mysqld_user mysql %define mysqld_group mysql +%define _bindir ${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR} +%define _sbindir ${CMAKE_INSTALL_PREFIX}/${INSTALL_SBINDIR} +%define _sysconfdir ${INSTALL_SYSCONFDIR} ") # this creative hack is described here: http://www.cmake.org/pipermail/cmake/2012-January/048416.html @@ -68,18 +72,18 @@ SET(ignored "%ignore /etc" "%ignore /etc/init.d" "%ignore /etc/logrotate.d" - "%ignore /usr" - "%ignore /usr/bin" - "%ignore /usr/include" - "%ignore /usr/lib" - "%ignore /usr/lib64" - "%ignore /usr/sbin" - "%ignore /usr/share" - "%ignore /usr/share/aclocal" - "%ignore /usr/share/doc" - "%ignore /usr/share/man" - "%ignore /usr/share/man/man1*" - "%ignore /usr/share/man/man8*" + "%ignore ${CMAKE_INSTALL_PREFIX}" + "%ignore ${CMAKE_INSTALL_PREFIX}/bin" + "%ignore ${CMAKE_INSTALL_PREFIX}/include" + "%ignore ${CMAKE_INSTALL_PREFIX}/lib" + "%ignore ${CMAKE_INSTALL_PREFIX}/lib64" + "%ignore ${CMAKE_INSTALL_PREFIX}/sbin" + "%ignore ${CMAKE_INSTALL_PREFIX}/share" + "%ignore ${CMAKE_INSTALL_PREFIX}/share/aclocal" + "%ignore ${CMAKE_INSTALL_PREFIX}/share/doc" + "%ignore ${CMAKE_INSTALL_PREFIX}/share/man" + "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man1*" + "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man8*" ) SET(CPACK_RPM_server_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*") @@ -103,7 +107,7 @@ SET(CPACK_RPM_devel_PACKAGE_OBSOLETES "mysql-devel MySQL-devel MySQL-OurDelta-de SET(CPACK_RPM_devel_PACKAGE_PROVIDES "MariaDB-devel MySQL-devel mysql-devel") SET(CPACK_RPM_server_PACKAGE_OBSOLETES "MariaDB mysql mysql-server MySQL-server MySQL-OurDelta-server") -SET(CPACK_RPM_server_PACKAGE_PROVIDES "MariaDB MariaDB-server MySQL-server config(MariaDB-server) msqlormysql mysql mysql-server") +SET(CPACK_RPM_server_PACKAGE_PROVIDES "MariaDB MariaDB-server MySQL-server config(MariaDB-server) msqlormysql mysql mysql(x86-32) mysql(x86-64) mysql-server") SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-prein.sh) SET(CPACK_RPM_server_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-preun.sh) SET(CPACK_RPM_server_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postin.sh) diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake index 0542b8d2e21..22b0255a22a 100644 --- a/cmake/install_layout.cmake +++ b/cmake/install_layout.cmake @@ -67,7 +67,13 @@ # http://forge.mysql.com/wiki/CMake#Fine-tuning_installation_paths IF(NOT INSTALL_LAYOUT) - SET(INSTALL_LAYOUT "STANDALONE") + IF(DEB) + SET(INSTALL_LAYOUT "DEB") + ELSEIF(RPM) + SET(INSTALL_LAYOUT "RPM") + ELSE() + SET(INSTALL_LAYOUT "STANDALONE") + ENDIF() ENDIF() SET(INSTALL_LAYOUT "${INSTALL_LAYOUT}" @@ -187,7 +193,7 @@ SET(INSTALL_SHAREDIR_DEB "share") SET(INSTALL_MYSQLSHAREDIR_DEB "share/mysql") SET(INSTALL_MYSQLTESTDIR_DEB "mysql-test") SET(INSTALL_SQLBENCHDIR_DEB ".") -SET(INSTALL_SUPPORTFILESDIR_DEB "support-files") +SET(INSTALL_SUPPORTFILESDIR_DEB "share/mysql") # SET(INSTALL_MYSQLDATADIR_DEB "/var/lib/mysql") SET(INSTALL_PLUGINTESTDIR_DEB ${plugin_tests}) diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake index b93a1c12a2e..83ea3b0f3b3 100644 --- a/cmake/os/WindowsCache.cmake +++ b/cmake/os/WindowsCache.cmake @@ -267,6 +267,7 @@ SET(HAVE_SYNCH_H CACHE INTERNAL "") SET(HAVE_SYSENT_H CACHE INTERNAL "") SET(HAVE_SYS_CDEFS_H CACHE INTERNAL "") SET(HAVE_SYS_DIR_H CACHE INTERNAL "") +SET(HAVE_SYS_EVENT_H CACHE INTERNAL "") SET(HAVE_SYS_ERRLIST CACHE INTERNAL "") SET(HAVE_SYS_FILE_H CACHE INTERNAL "") SET(HAVE_SYS_FPU_H CACHE INTERNAL "") diff --git a/config.h.cmake b/config.h.cmake index fa1740783ec..204119e9f73 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -44,6 +44,7 @@ #cmakedefine HAVE_IA64INTRIN_H 1 #cmakedefine HAVE_IEEEFP_H 1 #cmakedefine HAVE_INTTYPES_H 1 +#cmakedefine HAVE_KQUEUE 1 #cmakedefine HAVE_LIMITS_H 1 #cmakedefine HAVE_LINUX_UNISTD_H 1 #cmakedefine HAVE_LOCALE_H 1 diff --git a/configure.cmake b/configure.cmake index bb9b4f9e7e8..f98b42ec159 100644 --- a/configure.cmake +++ b/configure.cmake @@ -152,6 +152,7 @@ IF(UNIX) SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} wrap) CHECK_C_SOURCE_COMPILES( " + #include <sys/types.h> #include <tcpd.h> int allow_severity = 0; int deny_severity = 0; @@ -209,6 +210,7 @@ CHECK_INCLUDE_FILES (sched.h HAVE_SCHED_H) CHECK_INCLUDE_FILES (select.h HAVE_SELECT_H) CHECK_INCLUDE_FILES (semaphore.h HAVE_SEMAPHORE_H) CHECK_INCLUDE_FILES ("sys/types.h;sys/dir.h" HAVE_SYS_DIR_H) +CHECK_INCLUDE_FILES ("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H) CHECK_INCLUDE_FILES (sys/ndir.h HAVE_SYS_NDIR_H) CHECK_INCLUDE_FILES (sys/pte.h HAVE_SYS_PTE_H) CHECK_INCLUDE_FILES (stddef.h HAVE_STDDEF_H) @@ -222,13 +224,13 @@ CHECK_INCLUDE_FILES (sys/cdefs.h HAVE_SYS_CDEFS_H) CHECK_INCLUDE_FILES (sys/file.h HAVE_SYS_FILE_H) CHECK_INCLUDE_FILES (sys/fpu.h HAVE_SYS_FPU_H) CHECK_INCLUDE_FILES (sys/ioctl.h HAVE_SYS_IOCTL_H) -CHECK_INCLUDE_FILES (sys/ipc.h HAVE_SYS_IPC_H) -CHECK_INCLUDE_FILES (sys/malloc.h HAVE_SYS_MALLOC_H) +CHECK_INCLUDE_FILES ("sys/types.h;sys/ipc.h" HAVE_SYS_IPC_H) +CHECK_INCLUDE_FILES ("sys/types.h;sys/malloc.h" HAVE_SYS_MALLOC_H) CHECK_INCLUDE_FILES (sys/mman.h HAVE_SYS_MMAN_H) CHECK_INCLUDE_FILES (sys/prctl.h HAVE_SYS_PRCTL_H) CHECK_INCLUDE_FILES (sys/resource.h HAVE_SYS_RESOURCE_H) CHECK_INCLUDE_FILES (sys/select.h HAVE_SYS_SELECT_H) -CHECK_INCLUDE_FILES (sys/shm.h HAVE_SYS_SHM_H) +CHECK_INCLUDE_FILES ("sys/types.h;sys/shm.h" HAVE_SYS_SHM_H) CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H) CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H) CHECK_INCLUDE_FILES (sys/stream.h HAVE_SYS_STREAM_H) @@ -458,6 +460,10 @@ CHECK_FUNCTION_EXISTS (memalign HAVE_MEMALIGN) CHECK_FUNCTION_EXISTS (chown HAVE_CHOWN) CHECK_FUNCTION_EXISTS (nl_langinfo HAVE_NL_LANGINFO) +IF(HAVE_SYS_EVENT_H) +CHECK_FUNCTION_EXISTS (kqueue HAVE_KQUEUE) +ENDIF() + #-------------------------------------------------------------------- # Support for WL#2373 (Use cycle counter for timing) #-------------------------------------------------------------------- diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index 8a16e677cb9..7558d6d00ae 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -26,8 +26,13 @@ #include <my_sys.h> #include <m_string.h> #include <my_getopt.h> +#include <mysql_version.h> +#define load_default_groups mysqld_groups +#include <mysqld_default_groups.h> +#undef load_default_groups +my_bool opt_mysqld; const char *config_file="my"; /* Default config file */ uint verbose= 0, opt_defaults_file_used= 0; const char *default_dbug_option="d:t:o,/tmp/my_print_defaults.trace"; @@ -78,6 +83,8 @@ static struct my_option my_long_options[] = (void *)&my_defaults_extra_file, (void *)&my_defaults_extra_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"mysqld", 0, "Read the same set of groups that the mysqld binary does.", + &opt_mysqld, &opt_mysqld, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"no-defaults", 'n', "Return an empty string (useful for scripts).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"help", '?', "Display this help message and exit.", @@ -98,11 +105,12 @@ static void usage(my_bool version) return; puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); puts("Prints all arguments that is give to some program using the default files"); - printf("Usage: %s [OPTIONS] groups\n", my_progname); + printf("Usage: %s [OPTIONS] [groups]\n", my_progname); my_print_help(my_long_options); my_print_default_files(config_file); my_print_variables(my_long_options); printf("\nExample usage:\n%s --defaults-file=example.cnf client client-server mysql\n", my_progname); + exit(0); } @@ -115,17 +123,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_defaults_file_used= 1; break; case 'n': - exit(0); + exit(0); case 'I': case '?': - usage(0); - exit(0); + usage(0); case 'v': verbose++; break; case 'V': - usage(1); - exit(0); + usage(1); case '#': DBUG_PUSH(argument ? argument : default_dbug_option); break; @@ -141,11 +147,6 @@ static int get_options(int *argc,char ***argv) if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) exit(ho_error); - if (*argc < 1) - { - usage(0); - return 1; - } return 0; } @@ -153,9 +154,10 @@ static int get_options(int *argc,char ***argv) int main(int argc, char **argv) { int count, error, args_used; - char **load_default_groups, *tmp_arguments[6]; + char **load_default_groups= 0, *tmp_arguments[6]; char **argument, **arguments, **org_argv; char *defaults, *extra_defaults, *group_suffix; + int nargs, i= 0; MY_INIT(argv[0]); org_argv= argv; @@ -169,13 +171,25 @@ int main(int argc, char **argv) arguments[count]= 0; /* Check out the args */ - if (!(load_default_groups=(char**) my_malloc((argc+1)*sizeof(char*), - MYF(MY_WME)))) - exit(1); if (get_options(&argc,&argv)) exit(1); - memcpy((char*) load_default_groups, (char*) argv, (argc + 1) * sizeof(*argv)); + nargs= argc + 1; + if (opt_mysqld) + nargs+= array_elements(mysqld_groups); + + if (nargs < 2) + usage(0); + + load_default_groups=(char**) my_malloc(nargs*sizeof(char*), MYF(MY_WME)); + if (!load_default_groups) + exit(1); + if (opt_mysqld) + { + for (; mysqld_groups[i]; i++) + load_default_groups[i]= (char*) mysqld_groups[i]; + } + memcpy(load_default_groups + i, argv, (argc + 1) * sizeof(*argv)); if ((error= load_defaults(config_file, (const char **) load_default_groups, &count, &arguments))) { @@ -198,6 +212,6 @@ int main(int argc, char **argv) puts(*argument); my_free(load_default_groups); free_defaults(arguments); - + my_end(0); exit(0); } diff --git a/extra/yassl/src/handshake.cpp b/extra/yassl/src/handshake.cpp index c1ee61d043e..c7dbaf86071 100644 --- a/extra/yassl/src/handshake.cpp +++ b/extra/yassl/src/handshake.cpp @@ -767,8 +767,14 @@ int DoProcessReply(SSL& ssl) while (buffer.get_current() < hdr.length_ + RECORD_HEADER + offset) { // each message in record, can be more than 1 if not encrypted - if (ssl.getSecurity().get_parms().pending_ == false) // cipher on + if (ssl.getSecurity().get_parms().pending_ == false) { // cipher on + // sanity check for malicious/corrupted/illegal input + if (buffer.get_remaining() < hdr.length_) { + ssl.SetError(bad_input); + return 0; + } decrypt_message(ssl, buffer, hdr.length_); + } mySTL::auto_ptr<Message> msg(mf.CreateObject(hdr.type_)); if (!msg.get()) { diff --git a/include/myisamchk.h b/include/myisamchk.h index 7e7b685a88a..c079b7d290b 100644 --- a/include/myisamchk.h +++ b/include/myisamchk.h @@ -140,9 +140,9 @@ typedef struct st_handler_check_param /* Following is used to check if rows are visible */ ulonglong max_trid, max_found_trid; ulonglong not_visible_rows_found; + ulonglong sort_buffer_length; ulonglong use_buffers; /* Used as param to getopt() */ - size_t read_buffer_length, write_buffer_length; - size_t sort_buffer_length, sort_key_blocks; + size_t read_buffer_length, write_buffer_length, sort_key_blocks; time_t backup_time; /* To sign backup files */ ulong rec_per_key_part[HA_MAX_KEY_SEG * HA_MAX_POSSIBLE_KEY]; double new_rec_per_key_part[HA_MAX_KEY_SEG * HA_MAX_POSSIBLE_KEY]; diff --git a/include/mysql/plugin_auth.h b/include/mysql/plugin_auth.h index 75e7fba5266..156fb386aae 100644 --- a/include/mysql/plugin_auth.h +++ b/include/mysql/plugin_auth.h @@ -27,7 +27,7 @@ #include <mysql/plugin.h> -#define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0100 +#define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0200 #include <mysql/plugin_auth_common.h> @@ -78,7 +78,7 @@ typedef struct st_mysql_server_auth_info Not used by the server. Available through the @@EXTERNAL_USER variable. */ - char external_user[512]; + char external_user[MYSQL_USERNAME_LENGTH+1]; /** This only affects the "Authentication failed. Password used: %s" diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp index 46811825142..0f5dd26cfb3 100644 --- a/include/mysql/plugin_auth.h.pp +++ b/include/mysql/plugin_auth.h.pp @@ -266,8 +266,8 @@ typedef struct st_mysql_server_auth_info unsigned int user_name_length; const char *auth_string; unsigned long auth_string_length; - char authenticated_as[48 +1]; - char external_user[512]; + char authenticated_as[512 +1]; + char external_user[512 +1]; int password_used; const char *host_or_ip; unsigned int host_or_ip_length; diff --git a/include/mysql/plugin_auth_common.h b/include/mysql/plugin_auth_common.h index 820d299bf88..c0b61730d0d 100644 --- a/include/mysql/plugin_auth_common.h +++ b/include/mysql/plugin_auth_common.h @@ -28,7 +28,7 @@ #define MYSQL_PLUGIN_AUTH_COMMON_INCLUDED /** the max allowed length for a user name */ -#define MYSQL_USERNAME_LENGTH 48 +#define MYSQL_USERNAME_LENGTH 512 /** return values of the plugin authenticate_user() method. diff --git a/include/mysql/service_my_snprintf.h b/include/mysql/service_my_snprintf.h index 57b67f1416d..a7fd3e8a2c6 100644 --- a/include/mysql/service_my_snprintf.h +++ b/include/mysql/service_my_snprintf.h @@ -49,6 +49,7 @@ string will be quoted according to MySQL identifier quoting rules. Both <width> and <precision> can be specified as numbers or '*'. + If an asterisk is used, an argument of type int is consumed. <length modifier> can be 'l', 'll', or 'z'. diff --git a/include/mysqld_default_groups.h b/include/mysqld_default_groups.h new file mode 100644 index 00000000000..a2e94ddd854 --- /dev/null +++ b/include/mysqld_default_groups.h @@ -0,0 +1,8 @@ +const char *load_default_groups[]= { +#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE +"mysql_cluster", +#endif +"mysqld", "server", MYSQL_BASE_VERSION, +"mariadb", MARIADB_BASE_VERSION, +"client-server", +0, 0}; diff --git a/include/thread_pool_priv.h b/include/thread_pool_priv.h index 78526894e21..84c7faa2e2b 100644 --- a/include/thread_pool_priv.h +++ b/include/thread_pool_priv.h @@ -61,6 +61,7 @@ uint thd_get_net_read_write(THD *thd); void thd_set_mysys_var(THD *thd, st_my_thread_var *mysys_var); ulong thd_get_net_wait_timeout(THD *thd); my_socket thd_get_fd(THD *thd); +int thd_store_globals(THD* thd); THD *first_global_thread(); THD *next_global_thread(THD *thd); diff --git a/include/welcome_copyright_notice.h b/include/welcome_copyright_notice.h index 01139677b7d..9878ab1c07d 100644 --- a/include/welcome_copyright_notice.h +++ b/include/welcome_copyright_notice.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. +/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. Copyright (c) 2011, 2012, Monty Program Ab This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ #ifndef _welcome_copyright_notice_h_ #define _welcome_copyright_notice_h_ -#define COPYRIGHT_NOTICE_CURRENT_YEAR "2012" +#define COPYRIGHT_NOTICE_CURRENT_YEAR "2013" /* This define specifies copyright notice which is displayed by every MySQL diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index 9996b167323..1ddb0f7db98 100644 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -141,13 +141,14 @@ mysql_load_plugin mysql_load_plugin_v mysql_plugin_options # Async API +mysql_get_timeout_value +mysql_get_timeout_value_ms +mysql_get_socket mysql_autocommit_cont mysql_autocommit_start mysql_change_user_cont mysql_change_user_start mysql_close_cont -mysql_close_slow_part_cont -mysql_close_slow_part_start mysql_close_start mysql_commit_cont mysql_commit_start @@ -262,17 +263,26 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux") IF(RPM) # Fedora & Co declared following functions as part of API - # These functions are alias of another function (given mysql_ prefix=. The - # renaming is handled in rpm_support.cc below SET(CLIENT_API_EXTRA mysql_default_charset_info mysql_get_charset mysql_get_charset_by_csname mysql_net_realloc mysql_client_errors - ) + + # Also export the non-renamed variants + # (in case someone wants to rebuild mysqli-php or something similar) + # See MDEV-4127 + default_charset_info + get_charset + get_charset_by_csname + net_realloc + client_errors + THR_KEY_mysys + ) + # Add special script to fix symbols renames by Fedora - SET(CLIENT_SOURCES_EXTRA ${CLIENT_SOURCES} rpm_support.cc) + SET(CLIENT_SOURCES_EXTRA rpm_support.cc) SET(VERSION_SCRIPT_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/libmysql_rpm_version.in) ELSEIF(DEB) @@ -361,7 +371,7 @@ IF(UNIX) ENDIF() IF(NOT DISABLE_SHARED) - MERGE_LIBRARIES(libmysql SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS} COMPONENT SharedLibraries) + MERGE_LIBRARIES(libmysql SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS} ${CLIENT_API_EXTRA} COMPONENT SharedLibraries) IF(UNIX) # libtool compatability IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR APPLE) diff --git a/libmysql/get_password.c b/libmysql/get_password.c index 16f6b25822d..e704aec8337 100644 --- a/libmysql/get_password.c +++ b/libmysql/get_password.c @@ -62,13 +62,35 @@ /* were just going to fake it here and get input from the keyboard */ void get_tty_password_buff(const char *opt_message, char *to, size_t length) { + HANDLE consoleinput; + DWORD oldstate; char *pos=to,*end=to+length-1; int i=0; + + consoleinput= CreateFile("CONIN$", GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ , + NULL, OPEN_EXISTING, 0, NULL); + if (consoleinput == NULL || consoleinput == INVALID_HANDLE_VALUE) + { + /* This is a GUI application or service without console input, bail out. */ + *to= 0; + return; + } _cputs(opt_message ? opt_message : "Enter password: "); + + /* + Switch to raw mode (no line input, no echo input). + Allow Ctrl-C handler with ENABLE_PROCESSED_INPUT. + */ + GetConsoleMode(consoleinput, &oldstate); + SetConsoleMode(consoleinput, ENABLE_PROCESSED_INPUT); for (;;) { - int tmp; - tmp=_getch(); + char tmp; + DWORD chars_read; + if (!ReadConsole(consoleinput, &tmp, 1, &chars_read, NULL)) + break; + if (chars_read == 0) + break; if (tmp == '\b' || tmp == 127) { if (pos != to) @@ -78,13 +100,16 @@ void get_tty_password_buff(const char *opt_message, char *to, size_t length) continue; } } - if (tmp == -1 || tmp == '\n' || tmp == '\r' || tmp == 3) + if (tmp == '\n' || tmp == '\r') break; if (iscntrl(tmp) || pos == end) continue; _cputs("*"); - *(pos++) = (char)tmp; + *(pos++) = tmp; } + /* Reset console mode after password input. */ + SetConsoleMode(consoleinput, oldstate); + CloseHandle(consoleinput); *pos=0; _cputs("\n"); } diff --git a/libmysql/libmysql_rpm_version.in b/libmysql/libmysql_rpm_version.in index ad15c8aa2c8..ff0707cdb75 100644 --- a/libmysql/libmysql_rpm_version.in +++ b/libmysql/libmysql_rpm_version.in @@ -21,6 +21,8 @@ libmysqlclient_16 { my_print_help; # pure-ftpd requires this my_make_scrambled_password; +# fedora18 export + THR_KEY_mysys; # hydra requires this scramble; # DBD::mysql requires this @@ -34,15 +36,27 @@ libmysqlclient_18 { @CLIENT_API_5_5_LIST@ # # Ideally the following symbols wouldn't be exported, but various applications -# require them. We limit the namespace damage by prefixing mysql_ +# require them. Fedora limits the namespace damage by prefixing mysql_ # (see mysql-dubious-exports.patch), which means the symbols are not present # in libmysqlclient_16. # +# MariaDB does not do the Fedora-style function renaming via #define in headers, +# however it exports mysql_ prefixed symbols in addition to the "normal" ones. +# +# To ensure successful recompilation of affected projects, as well as drop-in replacement +# for MySQL libraries, provided by distribution, both original symbols and their mysql_ +# prefixed counterparts have to be exported. + # mysql-connector-odbc requires these mysql_default_charset_info; mysql_get_charset; mysql_get_charset_by_csname; mysql_net_realloc; + default_charset_info; + get_charset; + get_charset_by_csname; + net_realloc; # PHP's mysqli.so requires this (via the ER() macro) mysql_client_errors; + client_errors; }; diff --git a/mysql-test/CMakeLists.txt b/mysql-test/CMakeLists.txt index d065e8935c2..c0ee12fbd23 100644 --- a/mysql-test/CMakeLists.txt +++ b/mysql-test/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. # # 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 @@ -154,8 +154,10 @@ ENDMACRO() FILE(GLOB infiles "collections/*.in") FOREACH(collin ${infiles}) STRING(REPLACE ".in" "" collection ${collin}) + STRING(REPLACE ".in" ".done" colldone ${collin}) # Only generate file once - IF(NOT EXISTS ${collection}) + IF(NOT EXISTS ${colldone}) PROCESS_COLLECTION_INCLUDE(${collin} ${collection}) + FILE(APPEND ${colldone} "${collin}\n") ENDIF() ENDFOREACH() diff --git a/mysql-test/collections/default.daily b/mysql-test/collections/default.daily index e8b15acb34d..665da0d152c 100644 --- a/mysql-test/collections/default.daily +++ b/mysql-test/collections/default.daily @@ -1,5 +1,5 @@ -perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=normal --vardir=var-normal --report-features --skip-test-list=collections/disabled-daily.list --unit-tests +perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=normal --vardir=var-normal --report-features --skip-test-list=collections/disabled-daily.list perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --skip-test-list=collections/disabled-daily.list perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=row --vardir=var-row --mysqld=--binlog-format=row --skip-test-list=collections/disabled-daily.list perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --mysqld=--binlog-format=row --ps-protocol --skip-test-list=collections/disabled-daily.list diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index 1f4d29968a5..56b8feb6739 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -18,9 +18,4 @@ rpl.rpl_row_sp011 @solaris # Bug#11753919 2011-07-25 sven Several sys_vars.max_sp_recursion_depth_func @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun sys_vars.wait_timeout_func # Bug#11750645 2010-04-26 alik wait_timeout_func fails -# BUG #59055 : All ndb tests should be removed from the repository -# Leaving the sys_vars tests for now. sys_vars.all_vars.test fails on removing ndb tests -sys_vars.ndb_log_update_as_write_basic -sys_vars.have_ndbcluster_basic -sys_vars.ndb_log_updated_only_basic sys_vars.rpl_init_slave_func # Bug#12535301 2011-05-09 andrei sys_vars.rpl_init_slave_func mismatches in daily-5.5 diff --git a/mysql-test/collections/default.push b/mysql-test/collections/default.push index c8402aecd75..e1781d5082c 100644 --- a/mysql-test/collections/default.push +++ b/mysql-test/collections/default.push @@ -1,5 +1,6 @@ -perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list --unit-tests -perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list -perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --vardir=var-emebbed --embedded --experimental=collections/default.experimental --skip-ndb -perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list -perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental --skip-ndb +perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-test-list=collections/disabled-per-push.list +perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-test-list=collections/disabled-per-push.list +perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --vardir=var-emebbed --embedded --experimental=collections/default.experimental +perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-test-list=collections/disabled-per-push.list +perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental + diff --git a/mysql-test/collections/default.release.in b/mysql-test/collections/default.release.in index 0e3ad30671b..8833086fad9 100644 --- a/mysql-test/collections/default.release.in +++ b/mysql-test/collections/default.release.in @@ -4,14 +4,14 @@ # include default.daily # include default.weekly -perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=debug --vardir=var-debug --skip-ndbcluster --skip-rpl --report-features --debug-server -perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=normal --vardir=var-normal --skip-ndbcluster --report-features -perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=ps --vardir=var-ps --skip-ndbcluster --ps-protocol +perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=debug --vardir=var-debug --skip-rpl --report-features --debug-server +perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=normal --vardir=var-normal --report-features +perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=ps --vardir=var-ps --ps-protocol perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=funcs1+ps --vardir=var-funcs_1_ps --suite=funcs_1 --ps-protocol perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=funcs2 --vardir=var-funcs2 --suite=funcs_2 perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=partitions --vardir=var-parts --suite=parts perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=stress --vardir=var-stress --suite=stress perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=jp --vardir=var-jp --suite=jp -perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-embedded --embedded-server --skip-rpl --skip-ndbcluster +perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-embedded --embedded-server --skip-rpl perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=nist --vardir=var-nist --suite=nist perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=nist+ps --vardir=var-nist_ps --suite=nist --ps-protocol diff --git a/mysql-test/include/get_binlog_dump_thread_id.inc b/mysql-test/include/get_binlog_dump_thread_id.inc deleted file mode 100644 index bfc8506b39e..00000000000 --- a/mysql-test/include/get_binlog_dump_thread_id.inc +++ /dev/null @@ -1,22 +0,0 @@ ---exec $MYSQL test -e "show processlist" > $MYSQLTEST_VARDIR/tmp/bl_dump_thread_id ---disable_warnings -drop table if exists t999; ---enable_warnings -# Create a table to hold the process list -create temporary table t999( - id int, - user char(255), - host char(255), - db char(255), - Command char(255), - time int, - State char(255), - info char(255) -); -# Load processlist into table, headers will create seom warnings ---disable_warnings ---replace_result $MYSQLTEST_VARDIR "." -eval LOAD DATA INFILE "$MYSQLTEST_VARDIR/tmp/bl_dump_thread_id" into table t999; ---enable_warnings -let $id = `select Id from t999 where Command="Binlog Dump"`; -drop table t999; diff --git a/mysql-test/include/support_long_file_names.inc b/mysql-test/include/support_long_file_names.inc new file mode 100644 index 00000000000..1f5b3d7be08 --- /dev/null +++ b/mysql-test/include/support_long_file_names.inc @@ -0,0 +1,37 @@ +--error 0,3 +--perl +my $n = 254 - length($ENV{MYSQLTEST_VARDIR}); +my $name = $ENV{MYSQLTEST_VARDIR} . '/' . sprintf("%0${n}d", $$); +if (!open(LONG_NAME,">$name")) +{ + # We cannot rely either on a particular error code, or error string + # to check that we indeed hit "File name too long". + # Instead, we will try to create a file with a short name + # the same way, in the same location. If it goes all right, + # we will assume the problem was with the file name length + + open(SHORT_NAME,">$ENV{MYSQLTEST_VARDIR}/$$") || + # Even a shorter name could not be created, something else is wrong + die "Could not create file $ENV{MYSQLTEST_VARDIR}/$$: $!"; + close(SHORT_NAME); + unlink("$ENV{MYSQLTEST_VARDIR}/$$"); + exit(3); +} else { + close(LONG_NAME); + unlink($name); + exit(0); +} +EOF + +# If perl exited with error code 0, the check has passed, +# so the calling test will be executed. +# If perl exited with error code 3, it will be caught by +# --error above, and processed by the check below. +# If perl exited with some other error code, something went wrong, +# so the test will fail. + +if ($errno) +{ + --skip Long file names are not supported +} + diff --git a/mysql-test/lib/My/SafeProcess/CMakeLists.txt b/mysql-test/lib/My/SafeProcess/CMakeLists.txt index 810096805c8..95e23756c30 100644 --- a/mysql-test/lib/My/SafeProcess/CMakeLists.txt +++ b/mysql-test/lib/My/SafeProcess/CMakeLists.txt @@ -29,4 +29,4 @@ INSTALL(TARGETS my_safe_process DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/Safe IF(WIN32) INSTALL(TARGETS my_safe_kill DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess" COMPONENT Test) ENDIF() -INSTALL(FILES safe_process.pl Base.pm DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess" COMPONENT Test) +INSTALL(FILES Base.pm DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess" COMPONENT Test) diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc index ffe11417e7d..f41a77ff6ac 100644 --- a/mysql-test/lib/My/SafeProcess/safe_process.cc +++ b/mysql-test/lib/My/SafeProcess/safe_process.cc @@ -153,12 +153,19 @@ int main(int argc, char* const argv[] ) pid_t own_pid= getpid(); pid_t parent_pid= getppid(); bool nocore = false; + struct sigaction sa,sa_abort; + sa.sa_handler= handle_signal; + sa.sa_flags= SA_NOCLDSTOP; + sigemptyset(&sa.sa_mask); + + sa_abort.sa_handler= handle_abort; + sigemptyset(&sa_abort.sa_mask); /* Install signal handlers */ - signal(SIGTERM, handle_signal); - signal(SIGINT, handle_signal); - signal(SIGCHLD, handle_signal); - signal(SIGABRT, handle_abort); + sigaction(SIGTERM, &sa,NULL); + sigaction(SIGINT, &sa,NULL); + sigaction(SIGCHLD, &sa,NULL); + sigaction(SIGABRT, &sa_abort,NULL); sprintf(safe_process_name, "safe_process[%ld]", (long) own_pid); diff --git a/mysql-test/lib/My/SafeProcess/safe_process.pl b/mysql-test/lib/My/SafeProcess/safe_process.pl deleted file mode 100644 index de844e010a1..00000000000 --- a/mysql-test/lib/My/SafeProcess/safe_process.pl +++ /dev/null @@ -1,166 +0,0 @@ -#!/usr/bin/perl -# -*- cperl -*- - -# Copyright (c) 2007, 2011, Oracle and/or its affiliates -# -# 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; version 2 of the License. -# -# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -use strict; -use warnings; - -use lib 'lib'; -use My::SafeProcess::Base; -use POSIX qw(WNOHANG); - -########################################################################### -# Util functions -########################################################################### - -# -#Print message to stderr -# -my $verbose= 0; -sub message { - if ($verbose > 0){ - use Time::localtime; - my $tm= localtime(); - my $timestamp= sprintf("%02d%02d%02d %2d:%02d:%02d", - $tm->year % 100, $tm->mon+1, $tm->mday, - $tm->hour, $tm->min, $tm->sec); - print STDERR $timestamp, " monitor[$$]: ", @_, "\n"; - } -} - - -########################################################################### -# Main program -########################################################################### - -my $terminated= 0; - -# Protect against being killed in the middle -# of child creation, just set the terminated flag -# to make sure the child will be killed off -# when program is ready to do that -$SIG{TERM}= sub { message("!Got signal @_"); $terminated= 1; }; -$SIG{INT}= sub { message("!Got signal @_"); $terminated= 1; }; - -my $parent_pid= getppid(); - -my $found_double_dash= 0; -while (my $arg= shift(@ARGV)){ - - if ($arg =~ /^--$/){ - $found_double_dash= 1; - last; - } - elsif ($arg =~ /^--verbose$/){ - $verbose= 1; - } - else { - die "Unknown option: $arg"; - } -} - -my $path= shift(@ARGV); # Executable - -die "usage:\n" . - " safe_process.pl [opts] -- <path> [<args> [...<args_n>]]" - unless defined $path || $found_double_dash; - - -message("started"); -#message("path: '$path'"); -message("parent: $parent_pid"); - -# Start process to monitor -my $child_pid= - create_process( - path => $path, - args => \@ARGV, - setpgrp => 1, - ); -message("Started child $child_pid"); - -eval { - sub handle_signal { - $terminated= 1; - message("Got signal @_"); - - # Ignore all signals - foreach my $name (keys %SIG){ - $SIG{$name}= 'IGNORE'; - } - - die "signaled\n"; - }; - local $SIG{TERM}= \&handle_signal; - local $SIG{INT}= \&handle_signal; - local $SIG{CHLD}= sub { - message("Got signal @_"); - kill('KILL', -$child_pid); - my $ret= waitpid($child_pid, 0); - if ($? & 127){ - exit(65); # Killed by signal - } - exit($? >> 8); - }; - - # Monitoring loop - while(!$terminated) { - - # Check if parent is still alive - if (kill(0, $parent_pid) < 1){ - message("Parent is not alive anymore"); - last; - } - - # Wait for child to terminate but wakeup every - # second to also check that parent is still alive - my $ret_pid; - $ret_pid= waitpid($child_pid, &WNOHANG); - if ($ret_pid == $child_pid) { - # Process has exited, collect return status - my $ret_code= $? >> 8; - message("Child exit: $ret_code"); - # Exit with exit status of the child - exit ($ret_code); - } - sleep(1); - } -}; -if ( $@ ) { - # The monitoring loop should have been - # broken by handle_signal - warn "Unexpected: $@" unless ( $@ =~ /signaled/ ); -} - -# Use negative pid in order to kill the whole -# process group -# -my $ret= kill('KILL', -$child_pid); -message("Killed child: $child_pid, ret: $ret"); -if ($ret > 0) { - message("Killed child: $child_pid"); - # Wait blocking for the child to return - my $ret_pid= waitpid($child_pid, 0); - if ($ret_pid != $child_pid){ - message("unexpected pid $ret_pid returned from waitpid($child_pid)"); - } -} - -message("DONE!"); -exit (1); - - diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index a8db67f1e67..32ec24da492 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -769,18 +769,11 @@ sub collect_one_test_case { if ( $tinfo->{'ndb_test'} ) { # This is a NDB test - if ( $::opt_skip_ndbcluster == 2 ) + if ( $::ndbcluster_enabled == 0) { - # Ndb is not supported, skip it + # ndbcluster is disabled $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "No ndbcluster support or ndb tests not enabled"; - return $tinfo; - } - elsif ( $::opt_skip_ndbcluster ) - { - # All ndb test's should be skipped - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "No ndbcluster"; + $tinfo->{'comment'}= "ndbcluster disabled"; return $tinfo; } } diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm index e68ac783369..9ab82c454ed 100644 --- a/mysql-test/lib/mtr_report.pm +++ b/mysql-test/lib/mtr_report.pm @@ -28,7 +28,7 @@ our @EXPORT= qw(report_option mtr_print_line mtr_print_thick_line mtr_warning mtr_error mtr_debug mtr_verbose mtr_verbose_restart mtr_report_test_passed mtr_report_test_skipped mtr_print - mtr_report_test); + mtr_report_test isotime); use mtr_match; use My::Platform; @@ -106,6 +106,8 @@ sub mtr_report_test_passed ($) { $tinfo->{'result'}= 'MTR_RES_PASSED'; mtr_report_test($tinfo); + + resfile_global("endtime ", isotime (time)); } @@ -550,4 +552,12 @@ sub mtr_verbose_restart (@) { } +# Used by --result-file for for formatting times + +sub isotime($) { + my ($sec,$min,$hr,$day,$mon,$yr)= gmtime($_[0]); + return sprintf "%d-%02d-%02dT%02d:%02d:%02dZ", + $yr+1900, $mon+1, $day, $hr, $min, $sec; +} + 1; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index ac911c5e4e8..def3cba672c 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -334,8 +334,9 @@ sub check_timeout ($) { return testcase_timeout($_[0]) / 10; } our $opt_warnings= 1; -our $opt_include_ndbcluster= 0; -our $opt_skip_ndbcluster= 1; +our $ndbcluster_enabled= 0; +my $opt_include_ndbcluster= 0; +my $opt_skip_ndbcluster= 0; my $exe_ndbd; my $exe_ndbmtd; @@ -362,14 +363,6 @@ my $opt_stop_keep_alive= $ENV{MTR_STOP_KEEP_ALIVE}; select(STDOUT); $| = 1; # Automatically flush STDOUT -# Used by --result-file for for formatting times - -sub isotime($) { - my ($sec,$min,$hr,$day,$mon,$yr)= gmtime($_[0]); - return sprintf "%d-%02d-%02dT%02d:%02d:%02dZ", - $yr+1900, $mon+1, $day, $hr, $min, $sec; -} - main(); @@ -394,26 +387,6 @@ sub main { if (!$opt_suites) { $opt_suites= $DEFAULT_SUITES; - - # Check for any extra suites to enable based on the path name - my %extra_suites= - ( - "mysql-5.1-new-ndb" => "ndb_team", - "mysql-5.1-new-ndb-merge" => "ndb_team", - "mysql-5.1-telco-6.2" => "ndb_team", - "mysql-5.1-telco-6.2-merge" => "ndb_team", - "mysql-5.1-telco-6.3" => "ndb_team", - "mysql-6.0-ndb" => "ndb_team", - ); - - foreach my $dir ( reverse splitdir($basedir) ) { - my $extra_suite= $extra_suites{$dir}; - if (defined $extra_suite) { - mtr_report("Found extra suite: $extra_suite"); - $opt_suites= "$extra_suite,$opt_suites"; - last; - } - } } mtr_report("Using suites: $opt_suites") unless @opt_cases; @@ -763,6 +736,10 @@ sub run_test_server ($$$) { else { mtr_report("\nRetrying test $tname, ". "attempt($retries/$opt_retry)...\n"); + #saving the log file as filename.failed in case of retry + my $worker_logdir= $result->{savedir}; + my $log_file_name=dirname($worker_logdir)."/".$result->{shortname}.".log"; + rename $log_file_name,$log_file_name.".failed"; delete($result->{result}); $result->{retries}= $retries+1; $result->write_test($sock, 'TESTCASE'); @@ -1139,7 +1116,7 @@ sub command_line_setup { # Control what test suites or cases to run 'force+' => \$opt_force, 'with-ndbcluster-only' => \&collect_option, - 'include-ndbcluster' => \$opt_include_ndbcluster, + 'ndb|include-ndbcluster' => \$opt_include_ndbcluster, 'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster, 'suite|suites=s' => \$opt_suites, 'skip-rpl' => \&collect_option, @@ -1581,7 +1558,6 @@ sub command_line_setup { # -------------------------------------------------------------------------- if ( $opt_embedded_server ) { - $opt_skip_ndbcluster= 1; # Turn off use of NDB cluster $opt_skip_ssl= 1; # Turn off use of SSL # Turn off use of bin log @@ -2037,7 +2013,7 @@ sub executable_setup () { $exe_mysql_embedded= mtr_exe_maybe_exists("$basedir/libmysqld/examples/mysql_embedded"); - if ( ! $opt_skip_ndbcluster ) + if ( $ndbcluster_enabled ) { # Look for single threaded NDB $exe_ndbd= @@ -2299,7 +2275,7 @@ sub environment_setup { # -------------------------------------------------------------------------- # Add the path where libndbclient can be found # -------------------------------------------------------------------------- - if ( !$opt_skip_ndbcluster ) + if ( $ndbcluster_enabled ) { push(@ld_library_paths, "$basedir/storage/ndb/src/.libs"); } @@ -2392,7 +2368,7 @@ sub environment_setup { # ---------------------------------------------------- # Setup env for NDB # ---------------------------------------------------- - if ( ! $opt_skip_ndbcluster ) + if ( $ndbcluster_enabled ) { $ENV{'NDB_MGM'}= my_find_bin($bindir, @@ -2823,7 +2799,7 @@ sub fix_vs_config_dir () { $opt_vs_config=""; - for (<$bindir/sql/*/mysqld.exe>) { + for (<$bindir/sql/*/mysqld.exe>) { #/ if (-M $_ < $modified) { $modified = -M _; @@ -2865,37 +2841,87 @@ sub vs_config_dirs ($$) { sub check_ndbcluster_support { - # Check if this is MySQL Cluster, ie. mysql version string ends - # with -ndb-Y.Y.Y[-status] - if ( defined $mysql_version_extra && - $mysql_version_extra =~ /^-ndb-/ ) + my $ndbcluster_supported = 0; + if ($mysqld_variables{'ndb-connectstring'}) { - mtr_report(" - MySQL Cluster"); - # Enable ndb engine and add more test suites - $opt_include_ndbcluster = 1; - $DEFAULT_SUITES.=",ndb"; + $ndbcluster_supported = 1; } - if ($opt_include_ndbcluster) + if ($opt_skip_ndbcluster && $opt_include_ndbcluster) { - $opt_skip_ndbcluster= 0; + # User is ambivalent. Theoretically the arg which was + # given last on command line should win, but that order is + # unknown at this time. + mtr_error("Ambigous command, both --include-ndbcluster " . + " and --skip-ndbcluster was specified"); } - if ($opt_skip_ndbcluster) + # Check if this is MySQL Cluster, ie. mysql version string ends + # with -ndb-Y.Y.Y[-status] + if ( defined $mysql_version_extra && + $mysql_version_extra =~ /-ndb-([0-9]*)\.([0-9]*)\.([0-9]*)/ ) { - mtr_report(" - skipping ndbcluster"); - return; - } + # MySQL Cluster tree + mtr_report(" - MySQL Cluster detected"); - if ( ! $mysqld_variables{'ndb-connectstring'} ) - { - #mtr_report(" - skipping ndbcluster, mysqld not compiled with ndbcluster"); - $opt_skip_ndbcluster= 2; - return; + if ($opt_skip_ndbcluster) + { + mtr_report(" - skipping ndbcluster(--skip-ndbcluster)"); + return; + } + + if (!$ndbcluster_supported) + { + # MySQL Cluster tree, but mysqld was not compiled with + # ndbcluster -> fail unless --skip-ndbcluster was used + mtr_error("This is MySQL Cluster but mysqld does not " . + "support ndbcluster. Use --skip-ndbcluster to " . + "force mtr to run without it."); + } + + # mysqld was compiled with ndbcluster -> auto enable } + else + { + # Not a MySQL Cluster tree + if (!$ndbcluster_supported) + { + if ($opt_include_ndbcluster) + { + mtr_error("Could not detect ndbcluster support ". + "requested with --include-ndbcluster"); + } + + # Silently skip, mysqld was compiled without ndbcluster + # which is the default case + return; + } - mtr_report(" - using ndbcluster when necessary, mysqld supports it"); + if ($opt_skip_ndbcluster) + { + # Compiled with ndbcluster but ndbcluster skipped + mtr_report(" - skipping ndbcluster(--skip-ndbcluster)"); + return; + } + + + # Not a MySQL Cluster tree, enable ndbcluster + # if --include-ndbcluster was used + if ($opt_include_ndbcluster) + { + # enable ndbcluster + } + else + { + mtr_report(" - skipping ndbcluster(disabled by default)"); + return; + } + } + mtr_report(" - enabling ndbcluster"); + $ndbcluster_enabled= 1; + # Add MySQL Cluster test suites + $DEFAULT_SUITES.=",ndb,ndb_binlog,rpl_ndb,ndb_rpl,ndb_memcache"; return; } @@ -4748,6 +4774,7 @@ sub extract_warning_lines ($$) { qr|Error: io_setup\(\) failed|, qr|Warning: io_setup\(\) failed|, qr|Warning: io_setup\(\) attempt|, + qr|setrlimit could not change the size of core files to 'infinity';|, ); my $matched_lines= []; diff --git a/mysql-test/r/bug13633383.result b/mysql-test/r/bug13633383.result index 89b522724f9..3b533f89df2 100644 --- a/mysql-test/r/bug13633383.result +++ b/mysql-test/r/bug13633383.result @@ -4,18 +4,18 @@ CREATE TABLE t1 ( `a` int(11) DEFAULT NULL, `col432` bit(8) DEFAULT NULL, -`col433` multipoint DEFAULT NULL, -`col434` polygon DEFAULT NULL, +`col433` geometry DEFAULT NULL, +`col434` geometry DEFAULT NULL, `col435` decimal(50,17) unsigned DEFAULT NULL, `col436` geometry NOT NULL, `col437` tinyblob NOT NULL, -`col438` multipolygon DEFAULT NULL, +`col438` geometry DEFAULT NULL, `col439` mediumblob NOT NULL, `col440` tinyblob NOT NULL, `col441` double unsigned DEFAULT NULL ); CREATE TABLE t2 ( -`a` multipoint DEFAULT NULL, +`a` geometry DEFAULT NULL, `col460` date DEFAULT NULL, `col461` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `col462` date NOT NULL, @@ -31,7 +31,7 @@ CREATE TABLE t3 ( `col579` bit(38) NOT NULL, `col580` varchar(93) NOT NULL, `col581` datetime DEFAULT NULL, -`col583` multipolygon DEFAULT NULL, +`col583` geometry DEFAULT NULL, `col584` bit(47) NOT NULL ); set session sort_buffer_size= 32768; diff --git a/mysql-test/r/cache_temporal_4265.result b/mysql-test/r/cache_temporal_4265.result new file mode 100644 index 00000000000..1b4b3c2c4aa --- /dev/null +++ b/mysql-test/r/cache_temporal_4265.result @@ -0,0 +1,10 @@ +create table t1 (a date); +insert t1 values ('2000-01-02'), ('2001-02-03'), ('2002-03-04'); +set debug_dbug='d,str_to_datetime_warn'; +select * from t1 where a > date_add('2000-01-01', interval 5 day); +a +2001-02-03 +2002-03-04 +Warnings: +Note 1003 2000-01-01 +drop table t1; diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result index 23417b16698..31f1d57f916 100644 --- a/mysql-test/r/cast.result +++ b/mysql-test/r/cast.result @@ -268,37 +268,37 @@ cast(010203101112.121314 as datetime) 0001-02-03 10:11:12 select cast(120010203101112.121314 as datetime); cast(120010203101112.121314 as datetime) -NULL +0000-00-00 00:00:00 Warnings: Warning 1292 Incorrect datetime value: '120010203101112.121314' select cast(cast(1.1 as decimal) as datetime); cast(cast(1.1 as decimal) as datetime) -NULL +0000-00-00 00:00:00 Warnings: Warning 1292 Incorrect datetime value: '1' select cast(cast(-1.1 as decimal) as datetime); cast(cast(-1.1 as decimal) as datetime) -NULL +0000-00-00 00:00:00 Warnings: Warning 1292 Incorrect datetime value: '-1' select cast('0' as date); cast('0' as date) -NULL +0000-00-00 Warnings: Warning 1292 Incorrect datetime value: '0' select cast('' as date); cast('' as date) -NULL +0000-00-00 Warnings: Warning 1292 Incorrect datetime value: '' select cast('0' as datetime); cast('0' as datetime) -NULL +0000-00-00 00:00:00 Warnings: Warning 1292 Incorrect datetime value: '0' select cast('' as datetime); cast('' as datetime) -NULL +0000-00-00 00:00:00 Warnings: Warning 1292 Incorrect datetime value: '' select cast('0' as time); @@ -306,7 +306,7 @@ cast('0' as time) 00:00:00 select cast('' as time); cast('' as time) -NULL +00:00:00 Warnings: Warning 1292 Truncated incorrect time value: '' select cast(NULL as DATE); @@ -323,13 +323,13 @@ cast(NULL as BINARY) NULL select cast(cast(120010203101112.121314 as double) as datetime); cast(cast(120010203101112.121314 as double) as datetime) -NULL +0000-00-00 00:00:00 select cast(cast(1.1 as double) as datetime); cast(cast(1.1 as double) as datetime) 0000-00-00 00:00:01 select cast(cast(-1.1 as double) as datetime); cast(cast(-1.1 as double) as datetime) -NULL +0000-00-00 00:00:00 explain extended select cast(10 as double(5,2)); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result index 7f69fd1a5a4..3bbd25cbbcc 100644 --- a/mysql-test/r/date_formats.result +++ b/mysql-test/r/date_formats.result @@ -521,7 +521,7 @@ TIME_FORMAT("25:00:00", '%l %p') 1 AM SELECT DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896); DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896) -NULL +1151414896 Warnings: Warning 1292 Incorrect datetime value: '%Y-%m-%d %H:%i:%s' select str_to_date('04 /30/2004', '%m /%d/%Y'); diff --git a/mysql-test/r/ddl_i18n_koi8r.result b/mysql-test/r/ddl_i18n_koi8r.result index 0d858424715..fbed2ac1565 100644 --- a/mysql-test/r/ddl_i18n_koi8r.result +++ b/mysql-test/r/ddl_i18n_koi8r.result @@ -734,7 +734,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p1`( +CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( INOUT ÐÁÒÁÍ1 CHAR(10), OUT ÐÁÒÁÍ2 CHAR(10)) BEGIN @@ -751,7 +751,7 @@ COLLATION(_utf8 'текÑÑ‚') AS c6, @@character_set_client AS c8; SET ÐÁÒÁÍ1 = 'a'; SET ÐÁÒÁÍ2 = 'b'; -END */;; +END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -768,7 +768,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p2`( +CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8) BEGIN @@ -785,7 +785,7 @@ COLLATION(_utf8 'текÑÑ‚') AS c6, @@character_set_client AS c8; SET ÐÁÒÁÍ1 = 'a'; SET ÐÁÒÁÍ2 = 'b'; -END */;; +END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -810,7 +810,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p3`( +CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( INOUT ÐÁÒÁÍ1 CHAR(10), OUT ÐÁÒÁÍ2 CHAR(10)) BEGIN @@ -827,7 +827,7 @@ COLLATION(_utf8 'текÑÑ‚') AS c6, @@character_set_client AS c8; SET ÐÁÒÁÍ1 = 'a'; SET ÐÁÒÁÍ2 = 'b'; -END */;; +END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -844,7 +844,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p4`( +CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8) BEGIN @@ -861,7 +861,7 @@ COLLATION(_utf8 'текÑÑ‚') AS c6, @@character_set_client AS c8; SET ÐÁÒÁÍ1 = 'a'; SET ÐÁÒÁÍ2 = 'b'; -END */;; +END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; diff --git a/mysql-test/r/ddl_i18n_utf8.result b/mysql-test/r/ddl_i18n_utf8.result index fb32d229040..98da459dafc 100644 --- a/mysql-test/r/ddl_i18n_utf8.result +++ b/mysql-test/r/ddl_i18n_utf8.result @@ -734,7 +734,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p1`( +CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( INOUT парам1 CHAR(10), OUT парам2 CHAR(10)) BEGIN @@ -751,7 +751,7 @@ COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, @@character_set_client AS c8; SET парам1 = 'a'; SET парам2 = 'b'; -END */;; +END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -768,7 +768,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p2`( +CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( INOUT парам1 CHAR(10) CHARACTER SET utf8, OUT парам2 CHAR(10) CHARACTER SET utf8) BEGIN @@ -785,7 +785,7 @@ COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, @@character_set_client AS c8; SET парам1 = 'a'; SET парам2 = 'b'; -END */;; +END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -810,7 +810,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p3`( +CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( INOUT парам1 CHAR(10), OUT парам2 CHAR(10)) BEGIN @@ -827,7 +827,7 @@ COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, @@character_set_client AS c8; SET парам1 = 'a'; SET парам2 = 'b'; -END */;; +END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -844,7 +844,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p4`( +CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( INOUT парам1 CHAR(10) CHARACTER SET utf8, OUT парам2 CHAR(10) CHARACTER SET utf8) BEGIN @@ -861,7 +861,7 @@ COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, @@character_set_client AS c8; SET парам1 = 'a'; SET парам2 = 'b'; -END */;; +END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index c6b8bf73a6f..363a4700ee6 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -441,3 +441,16 @@ ERROR 21000: Subquery returns more than 1 row DROP TABLE t1, t2; DROP VIEW v1, v2; set optimizer_switch=@save_derived_optimizer_switch; +create table t1 (n bigint(20) unsigned, d1 datetime, d2 datetime, key (d1)); +insert t1 values (2085,'2012-01-01 00:00:00','2013-01-01 00:00:00'); +insert t1 values (2084,'2012-02-01 00:00:00','2013-01-01 00:00:00'); +insert t1 values (2088,'2012-03-01 00:00:00','2013-01-01 00:00:00'); +select * from ( +select n, d1, d2, @result := 0 as result +from t1 +where d1 < '2012-12-12 12:12:12' and n in (2085, 2084) order by d2 asc +) as calculated_result; +n d1 d2 result +2085 2012-01-01 00:00:00 2013-01-01 00:00:00 0 +2084 2012-02-01 00:00:00 2013-01-01 00:00:00 0 +drop table t1; diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result index bce1da10e35..40420a15c25 100644 --- a/mysql-test/r/derived_view.result +++ b/mysql-test/r/derived_view.result @@ -2164,6 +2164,57 @@ a set optimizer_switch=@save3912_optimizer_switch; drop table t1, t2, t3; # +# MDEV-4209: equi-join on BLOB column from materialized view +# or derived table +# +set @save_optimizer_switch=@@optimizer_switch; +set optimizer_switch='derived_with_keys=on'; +CREATE TABLE t1 (c1 text, c2 int); +INSERT INTO t1 VALUES ('a',1), ('c',3), ('g',7), ('d',4), ('c',3); +CREATE TABLE t2 (c1 text, c2 int); +INSERT INTO t2 VALUES ('b',2), ('c',3); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +EXPLAIN EXTENDED +SELECT v1.c1, v1.c2 FROM v1, t2 WHERE v1.c1=t2.c1 AND v1.c2=t2.c2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.c2 2 100.00 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 +Warnings: +Note 1003 select `v1`.`c1` AS `c1`,`v1`.`c2` AS `c2` from `test`.`v1` join `test`.`t2` where ((`v1`.`c1` = `test`.`t2`.`c1`) and (`v1`.`c2` = `test`.`t2`.`c2`)) +SELECT v1.c1, v1.c2 FROM v1, t2 WHERE v1.c1=t2.c1 AND v1.c2=t2.c2; +c1 c2 +c 3 +c 3 +EXPLAIN EXTENDED +SELECT t2.c1, t2.c2 FROM (SELECT c1 g, MAX(c2) m FROM t1 GROUP BY c1) t, t2 +WHERE t.g=t2.c1 AND t.m=t2.c2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.c2 2 100.00 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Using temporary; Using filesort +Warnings: +Note 1003 select `test`.`t2`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from (select `test`.`t1`.`c1` AS `g`,max(`test`.`t1`.`c2`) AS `m` from `test`.`t1` group by `test`.`t1`.`c1`) `t` join `test`.`t2` where ((`t`.`g` = `test`.`t2`.`c1`) and (`t`.`m` = `test`.`t2`.`c2`)) +SELECT t2.c1, t2.c2 FROM (SELECT c1 g, MAX(c2) m FROM t1 GROUP BY c1) t, t2 +WHERE t.g=t2.c1 AND t.m=t2.c2; +c1 c2 +c 3 +EXPLAIN EXTENDED +SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 +Warnings: +Note 1003 select `v1`.`c1` AS `c1`,`v1`.`c2` AS `c2`,`test`.`t2`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`v1` join `test`.`t2` where (`v1`.`c1` = `test`.`t2`.`c1`) +SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1; +c1 c2 c1 c2 +c 3 c 3 +c 3 c 3 +DROP VIEW v1; +DROP TABLE t1,t2; +set optimizer_switch=@save_optimizer_switch; +# # end of 5.3 tests # set optimizer_switch=@exit_optimizer_switch; diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result index 925fb38a0f8..172179bd7f4 100644 --- a/mysql-test/r/dyncol.result +++ b/mysql-test/r/dyncol.result @@ -182,13 +182,13 @@ select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select cast(column_get(column_create(1,1212 AS unsigned int),1) as unsigned) AS `column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int)` +Note 1003 select column_get(column_create(1,1212 AS unsigned int),1 as unsigned) AS `column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int)` explain extended select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select cast(column_get(column_create(1,1212 AS unsigned int),1) as unsigned) AS `column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned)` +Note 1003 select column_get(column_create(1,1212 AS unsigned int),1 as unsigned) AS `column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned)` select column_get(column_create(1, 1212 AS decimal), 1 as unsigned int); column_get(column_create(1, 1212 AS decimal), 1 as unsigned int) 1212 @@ -261,13 +261,13 @@ select column_get(column_create(1, 1212 AS int), 1 as int); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select cast(column_get(column_create(1,1212 AS int),1) as signed) AS `column_get(column_create(1, 1212 AS int), 1 as int)` +Note 1003 select column_get(column_create(1,1212 AS int),1 as signed) AS `column_get(column_create(1, 1212 AS int), 1 as int)` explain extended select column_get(column_create(1, 1212 AS int), 1 as signed int); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select cast(column_get(column_create(1,1212 AS int),1) as signed) AS `column_get(column_create(1, 1212 AS int), 1 as signed int)` +Note 1003 select column_get(column_create(1,1212 AS int),1 as signed) AS `column_get(column_create(1, 1212 AS int), 1 as signed int)` select column_get(column_create(1, -1212 AS int), 1 as int); column_get(column_create(1, -1212 AS int), 1 as int) -1212 @@ -368,7 +368,7 @@ select column_get(column_create(1, "1212" AS char charset utf8), 1 as char chars id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select cast(column_get(column_create(1,'1212' AS char charset utf8 ),1) as char charset utf8) AS `column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8)` +Note 1003 select column_get(column_create(1,'1212' AS char charset utf8 ),1 as char charset utf8) AS `column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8)` select column_get(column_create(1, 1212 AS unsigned int), 1 as char charset utf8); column_get(column_create(1, 1212 AS unsigned int), 1 as char charset utf8) 1212 @@ -428,7 +428,7 @@ select column_get(column_create(1, "1212" AS char charset utf8), 1 as char chars id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select cast(column_get(column_create(1,'1212' AS char charset utf8 ),1) as char charset binary) AS `column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset binary)` +Note 1003 select column_get(column_create(1,'1212' AS char charset utf8 ),1 as char charset binary) AS `column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset binary)` # # column get real # @@ -440,13 +440,13 @@ select column_get(column_create(1, 1212.12 AS double), 1 as double); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select cast(column_get(column_create(1,1212.12 AS double),1) as double) AS `column_get(column_create(1, 1212.12 AS double), 1 as double)` +Note 1003 select column_get(column_create(1,1212.12 AS double),1 as double) AS `column_get(column_create(1, 1212.12 AS double), 1 as double)` explain extended select column_get(column_create(1, 1212.12 AS double), 1 as double(6,2)); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select cast(column_get(column_create(1,1212.12 AS double),1) as double(6,2)) AS `column_get(column_create(1, 1212.12 AS double), 1 as double(6,2))` +Note 1003 select column_get(column_create(1,1212.12 AS double),1 as double(6,2)) AS `column_get(column_create(1, 1212.12 AS double), 1 as double(6,2))` select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as double); column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as double) 1.8446744073709552e19 @@ -521,13 +521,13 @@ select column_get(column_create(1, 1212.12 AS double), 1 as decimal); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select cast(column_get(column_create(1,1212.12 AS double),1) as decimal(10,0)) AS `column_get(column_create(1, 1212.12 AS double), 1 as decimal)` +Note 1003 select column_get(column_create(1,1212.12 AS double),1 as decimal(10,0)) AS `column_get(column_create(1, 1212.12 AS double), 1 as decimal)` explain extended select column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2)); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select cast(column_get(column_create(1,1212.12 AS double),1) as decimal(6,2)) AS `column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2))` +Note 1003 select column_get(column_create(1,1212.12 AS double),1 as decimal(6,2)) AS `column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2))` select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal(20,0)); column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal(20,0)) 18446744073709551615 @@ -1336,6 +1336,77 @@ select hex(COLUMN_CREATE(0, 0.0 as decimal)); hex(COLUMN_CREATE(0, 0.0 as decimal)) 000100000004 # +# MDEV-4292: parse error when selecting on views using dynamic column +# +create table t1 (i int, d blob); +create view v1 as select i, column_get(d, 1 as binary) as a from t1; +select * from v1; +i a +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as char charset binary) AS `a` from `t1` latin1 latin1_swedish_ci +drop view v1; +create view v1 as select i, column_get(d, 1 as int) as a from t1; +select * from v1; +i a +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as signed) AS `a` from `t1` latin1 latin1_swedish_ci +drop view v1; +create view v1 as select i, column_get(d, 1 as unsigned int) as a from t1; +select * from v1; +i a +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as unsigned) AS `a` from `t1` latin1 latin1_swedish_ci +drop view v1; +create view v1 as select i, column_get(d, 1 as date) as a from t1; +select * from v1; +i a +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as date) AS `a` from `t1` latin1 latin1_swedish_ci +drop view v1; +create view v1 as select i, column_get(d, 1 as time) as a from t1; +select * from v1; +i a +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as time) AS `a` from `t1` latin1 latin1_swedish_ci +drop view v1; +create view v1 as select i, column_get(d, 1 as datetime) as a from t1; +select * from v1; +i a +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as datetime) AS `a` from `t1` latin1 latin1_swedish_ci +drop view v1; +create view v1 as select i, column_get(d, 1 as decimal) as a from t1; +select * from v1; +i a +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as decimal(10,0)) AS `a` from `t1` latin1 latin1_swedish_ci +drop view v1; +create view v1 as select i, column_get(d, 1 as double) as a from t1; +select * from v1; +i a +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as double) AS `a` from `t1` latin1 latin1_swedish_ci +drop view v1; +create view v1 as select i, column_get(d, 1 as char) as a from t1; +select * from v1; +i a +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as char charset latin1) AS `a` from `t1` latin1 latin1_swedish_ci +drop view v1; +drop table t1; +# +# end of 5.3 tests +# +# # test of symbolic names # # creation test (names) diff --git a/mysql-test/r/func_date_add.result b/mysql-test/r/func_date_add.result index a7f2383848d..e8fbba786a4 100644 --- a/mysql-test/r/func_date_add.result +++ b/mysql-test/r/func_date_add.result @@ -96,3 +96,9 @@ b + interval a day 2002-02-04 drop table t1; End of 5.0 tests +create table t1 (a varchar(10)); +insert t1 values ('2000-12-03'),('2008-05-03'); +select * from t1 where case a when adddate( '2012-12-12', 7 ) then true end; +a +drop table t1; +End of 5.5 tests diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 65323257300..55afba245bd 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -1851,7 +1851,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 range a a 4 NULL 4 100.00 Using where; Using index; Using join buffer (flat, BNL join) 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = 2) and (`test`.`t2`.`a` = 1) and (`test`.`t1`.`a` < 10)) +Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`a` = 1) and (`test`.`t2`.`b` = 2) and (`test`.`t1`.`a` < 10)) SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT a,b FROM t2 WHERE b<5) and a<10; MAX(a) NULL @@ -2090,6 +2090,13 @@ set @@optimizer_switch=@save_optimizer_switch; # Cleanup for BUG#46680 # DROP TABLE IF EXISTS t1,t2,t3,empty1; +create table t1 (i int, d date); +insert into t1 values (1, '2008-10-02'), (2, '2010-12-12'); +select avg(export_set( 3, 'y', sha(i))), group_concat(d) from t1 group by d order by i; +avg(export_set( 3, 'y', sha(i))) group_concat(d) +0 2008-10-02 +0 2010-12-12 +drop table t1; # # Bug#52123 Assertion failed: aggregator == aggr->Aggrtype(), # file .\item_sum.cc, line 587 diff --git a/mysql-test/r/func_group_innodb.result b/mysql-test/r/func_group_innodb.result index 67ea44f187a..9489960d28c 100644 --- a/mysql-test/r/func_group_innodb.result +++ b/mysql-test/r/func_group_innodb.result @@ -217,7 +217,20 @@ SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date = member_id_to COUNT(*) 518491 2 DROP TABLE t1; -# End of test BUG#12713907 +# +# MDEV-4269: crash when grouping by values() +# +SELECT @@storage_engine INTO @old_engine; +set storage_engine=innodb; +create table y select 1 b; +select 1 from y group by b; +1 +1 +select 1 from y group by values(b); +1 +1 +drop table y; +SET storage_engine=@old_engine; # # Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN # diff --git a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result index fa3d37c08c2..1f20ddc6cbb 100644 --- a/mysql-test/r/func_sapdb.result +++ b/mysql-test/r/func_sapdb.result @@ -168,7 +168,7 @@ date("1997-12-31 23:59:59.000001") 1997-12-31 select date("1997-13-31 23:59:59.000001"); date("1997-13-31 23:59:59.000001") -NULL +0000-00-00 Warnings: Warning 1292 Incorrect datetime value: '1997-13-31 23:59:59.000001' select time("1997-12-31 23:59:59.000001"); @@ -176,7 +176,7 @@ time("1997-12-31 23:59:59.000001") 23:59:59.000001 select time("1997-12-31 25:59:59.000001"); time("1997-12-31 25:59:59.000001") -NULL +00:00:00 Warnings: Warning 1292 Truncated incorrect time value: '1997-12-31 25:59:59.000001' select microsecond("1997-12-31 23:59:59.000001"); diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 80729545902..16c0854241f 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -2634,6 +2634,31 @@ SELECT * FROM t1; a aaaaaaaaaaaaaa DROP TABLE t1; +SELECT SUBSTRING('1', DAY(FROM_UNIXTIME(-1))); +SUBSTRING('1', DAY(FROM_UNIXTIME(-1))) +NULL +SELECT LEFT('1', DAY(FROM_UNIXTIME(-1))); +LEFT('1', DAY(FROM_UNIXTIME(-1))) +NULL +SELECT RIGHT('1', DAY(FROM_UNIXTIME(-1))); +RIGHT('1', DAY(FROM_UNIXTIME(-1))) +NULL +SELECT REPEAT('1', DAY(FROM_UNIXTIME(-1))); +REPEAT('1', DAY(FROM_UNIXTIME(-1))) +NULL +SELECT RPAD('hi', DAY(FROM_UNIXTIME(-1)),'?'); +RPAD('hi', DAY(FROM_UNIXTIME(-1)),'?') +NULL +SELECT LPAD('hi', DAY(FROM_UNIXTIME(-1)),'?'); +LPAD('hi', DAY(FROM_UNIXTIME(-1)),'?') +NULL +create table t1 (i int); +insert into t1 values (null),(8); +select group_concat( i ), make_set( i, 'a', 'b' ) field from t1 group by field; +group_concat( i ) field +NULL NULL +8 +drop table t1; End of 5.1 tests Start of 5.4 tests SELECT format(12345678901234567890.123, 3); @@ -2864,9 +2889,6 @@ sha1('P'), Warnings: Warning 1292 Truncated incorrect DECIMAL value: '[.DC2.]' SET @@global.max_allowed_packet:= @tmp_max; -# -# End of 5.5 tests -# SELECT @tmp_max:= @@global.max_allowed_packet; @tmp_max:= @@global.max_allowed_packet 1048576 @@ -2880,3 +2902,15 @@ NULL Warnings: Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated SET @@global.max_allowed_packet:= @tmp_max; +# +# MDEV-4272: DIV operator crashes in Item_func_int_div::val_int +# (incorrect NULL value handling by convert) +# +create table t1(a int) select null; +select 1 div convert(a using utf8) from t1; +1 div convert(a using utf8) +NULL +drop table t1; +# +# End of 5.5 tests +# diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index dd4b73b0b05..e8526ae8f1f 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1781,7 +1781,7 @@ Warnings: Warning 1441 Datetime function: time field overflow select cast('131415.123e0' as time); cast('131415.123e0' as time) -NULL +00:00:00 Warnings: Warning 1292 Truncated incorrect time value: '131415.123e0' select cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04'; @@ -1801,12 +1801,12 @@ unix_timestamp(null) NULL select truncate(date('2010-40-10'), 6); truncate(date('2010-40-10'), 6) -NULL +0.000000 Warnings: Warning 1292 Incorrect datetime value: '2010-40-10' select extract(month from '2010-40-50'); extract(month from '2010-40-50') -NULL +0 Warnings: Warning 1292 Incorrect datetime value: '2010-40-50' select subtime('0000-00-10 10:10:10', '30 10:00:00'); @@ -1924,3 +1924,15 @@ microsecond('12:00:00.123456') microsecond('2009-12-31 23:59:59.000010') 123456 10 select now(258); ERROR 42000: Too big precision 258 specified for 'now'. Maximum is 6. +SELECT 1 FROM DUAL WHERE YEAR(TIMEDIFF(NULL, '12:12:12')); +1 +SELECT 1 FROM DUAL WHERE MONTH(TIMEDIFF(NULL, '12:12:12')); +1 +SELECT 1 FROM DUAL WHERE DAYOFMONTH(TIMEDIFF(NULL, '12:12:12')); +1 +SELECT 1 FROM DUAL WHERE HOUR(TIMEDIFF(NULL, '12:12:12')); +1 +SELECT 1 FROM DUAL WHERE MINUTE(TIMEDIFF(NULL, '12:12:12')); +1 +SELECT 1 FROM DUAL WHERE SECOND(TIMEDIFF(NULL, '12:12:12')); +1 diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result index 26787366358..c394aec8851 100644 --- a/mysql-test/r/gis-rtree.result +++ b/mysql-test/r/gis-rtree.result @@ -758,7 +758,7 @@ SPATIAL KEY(g) INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText('LineString(1 2, 2 4)')); drop table t1; CREATE TABLE t1 ( -line LINESTRING NOT NULL, +line GEOMETRY NOT NULL, kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po', name VARCHAR(32), SPATIAL KEY (line) @@ -1553,7 +1553,7 @@ End of 5.0 tests. # Bug #57323/11764487: myisam corruption with insert ignore # and invalid spatial data # -CREATE TABLE t1(a LINESTRING NOT NULL, b GEOMETRY NOT NULL, +CREATE TABLE t1(a POINT NOT NULL, b GEOMETRY NOT NULL, SPATIAL KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM; INSERT INTO t1 VALUES(GEOMFROMTEXT("point (0 0)"), GEOMFROMTEXT("point (1 1)")); INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=GEOMFROMTEXT("error"); diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 30385323502..eb9f1a57c32 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -406,20 +406,20 @@ FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second first second w c o e d t i r 120 120 1 1 0 1 0 1 1 0 120 121 0 0 1 0 0 0 1 0 -120 122 0 1 NULL 0 NULL 0 NULL 0 -120 123 0 1 NULL 0 NULL 0 NULL 0 +120 122 NULL NULL NULL NULL NULL NULL NULL NULL +120 123 NULL NULL NULL NULL NULL NULL NULL NULL 121 120 0 0 1 0 0 0 1 0 121 121 1 1 0 1 0 1 1 0 -121 122 0 1 NULL 0 NULL 0 NULL 0 -121 123 0 1 NULL 0 NULL 0 NULL 0 -122 120 1 0 NULL 0 NULL 0 NULL 0 -122 121 1 0 NULL 0 NULL 0 NULL 0 -122 122 1 1 NULL 1 NULL 0 NULL 0 -122 123 1 1 NULL 1 NULL 0 NULL 0 -123 120 1 0 NULL 0 NULL 0 NULL 0 -123 121 1 0 NULL 0 NULL 0 NULL 0 -123 122 1 1 NULL 1 NULL 0 NULL 0 -123 123 1 1 NULL 1 NULL 0 NULL 0 +121 122 NULL NULL NULL NULL NULL NULL NULL NULL +121 123 NULL NULL NULL NULL NULL NULL NULL NULL +122 120 NULL NULL NULL NULL NULL NULL NULL NULL +122 121 NULL NULL NULL NULL NULL NULL NULL NULL +122 122 NULL NULL NULL NULL NULL NULL NULL NULL +122 123 NULL NULL NULL NULL NULL NULL NULL NULL +123 120 NULL NULL NULL NULL NULL NULL NULL NULL +123 121 NULL NULL NULL NULL NULL NULL NULL NULL +123 122 NULL NULL NULL NULL NULL NULL NULL NULL +123 123 NULL NULL NULL NULL NULL NULL NULL NULL explain extended SELECT g1.fid as first, g2.fid as second, Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o, Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, @@ -1047,7 +1047,7 @@ SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000 SET @a=POLYFROMWKB(@a); SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; SET @a=POLYFROMWKB(@a); -create table t1(a polygon NOT NULL)engine=myisam; +create table t1(a geometry NOT NULL)engine=myisam; insert into t1 values (geomfromtext("point(0 1)")); insert into t1 values (geomfromtext("point(1 0)")); select * from (select polygon(t1.a) as p from t1 order by t1.a) d; @@ -1063,6 +1063,84 @@ create table t1(a char(32) not null) engine=myisam; create spatial index i on t1 (a); ERROR HY000: Incorrect arguments to SPATIAL INDEX drop table t1; +CREATE TABLE t0 (a BINARY(32) NOT NULL); +CREATE SPATIAL INDEX i on t0 (a); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +INSERT INTO t0 VALUES (1); +CREATE TABLE t1( +col0 BINARY NOT NULL, +col2 TIMESTAMP, +SPATIAL INDEX i1 (col0) +) ENGINE=MyISAM; +ERROR HY000: Incorrect arguments to SPATIAL INDEX +CREATE TABLE t1 ( +col0 BINARY NOT NULL, +col2 TIMESTAMP +) ENGINE=MyISAM; +CREATE SPATIAL INDEX idx0 ON t1(col0); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +ALTER TABLE t1 ADD SPATIAL INDEX i1 (col0); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +CREATE TABLE t2 ( +col0 INTEGER NOT NULL, +col1 POINT, +col2 POINT +); +CREATE SPATIAL INDEX idx0 ON t2 (col1, col2); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +CREATE TABLE t3 ( +col0 INTEGER NOT NULL, +col1 POINT, +col2 LINESTRING, +SPATIAL INDEX i1 (col1, col2) +); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +DROP TABLE t0, t1, t2; +# +# BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS +# +SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))); +ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))) +NULL +# +# BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN +# GEOMETRY FUNCTION ARGUMENTS +# +SELECT GEOMETRYCOLLECTION((SELECT @@OLD)); +ERROR 22007: Illegal non geometric '' value found during parsing +# +# MDEV-4252 geometry query crashes server +# +select astext(0x0100000000030000000100000000000010); +astext(0x0100000000030000000100000000000010) +NULL +select astext(st_centroid(0x0100000000030000000100000000000010)); +astext(st_centroid(0x0100000000030000000100000000000010)) +NULL +select astext(st_exteriorring(0x0100000000030000000100000000000010)); +astext(st_exteriorring(0x0100000000030000000100000000000010)) +NULL +select envelope(0x0100000000030000000100000000000010); +envelope(0x0100000000030000000100000000000010) +NULL +select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1); +geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1) +NULL +select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1); +geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1) +NULL +# +# MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy +# +SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) ))); +Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) ))) +NULL +# +# MDEV-4295 Server crashes in get_point on a query with Area, AsBinary, MultiPoint +# +SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2)))); +Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2)))) +NULL End of 5.1 tests select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))')); ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))')) @@ -1428,6 +1506,7 @@ WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1; count(*) 1 DROP DATABASE gis_ogs; +USE test; # # BUG #1043845 st_distance() results are incorrect depending on variable order # @@ -1451,20 +1530,23 @@ geomfromtext('LINESTRING(-95.9673005697771 36.13509598461, -95.9673057475387 36.1344478941074, -95.9673063519371 36. 0.008148695928146028 -USE test; # -# BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS +# MDEV-4310 geometry function equals hangs forever. # -SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))); -ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))) +create table t1(a geometry not null)engine=myisam; +insert into t1 values(geomfromtext("POINT(0 0)")); +insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)")); +insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)")); +select equals(`a`,convert(`a` using utf8)) from `t1`; +equals(`a`,convert(`a` using utf8)) +1 NULL -# -# BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN -# GEOMETRY FUNCTION ARGUMENTS -# -SELECT GEOMETRYCOLLECTION((SELECT @@OLD)); -ERROR 22007: Illegal non geometric '' value found during parsing -End of 5.1 tests +NULL +Warnings: +Warning 1300 Invalid utf8 character string: 'E043' +Warning 1300 Invalid utf8 character string: 'E043' +drop table t1; +End of 5.3 tests # # Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE # @@ -1491,4 +1573,11 @@ SELECT 1 FROM g1 WHERE a >= ANY (SELECT 1 FROM g1 WHERE a = geomfromtext('') OR a) ; 1 DROP TABLE g1; +# +# MDEV-3819 missing constraints for spatial column types +# +create table t1 (pt point); +insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))')); +ERROR 22007: Incorrect POINT value: 'POLYGON' for column 'pt' at row 1 +drop table t1; End of 5.5 tests diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 1f2bbc470dc..8ca2762b190 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -1946,6 +1946,250 @@ Warning 1292 Truncated incorrect INTEGER value: 'K' Warning 1292 Truncated incorrect INTEGER value: 'jxW<' DROP TABLE t1; SET SQL_BIG_TABLES=0; +# +# MDEV-641 LP:1002108 - Wrong result (or crash) from a query with duplicated field in the group list and a limit clause +# Bug#11761078: 53534: INCORRECT 'SELECT SQL_BIG_RESULT...' +# WITH GROUP BY ON DUPLICATED FIELDS +# +CREATE TABLE t1( +col1 int, +UNIQUE INDEX idx (col1)); +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10), +(11),(12),(13),(14),(15),(16),(17),(18),(19),(20); +EXPLAIN SELECT col1 AS field1, col1 AS field2 +FROM t1 GROUP BY field1, field2;; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL idx 5 NULL 20 Using index; Using temporary; Using filesort +FLUSH STATUS; +SELECT col1 AS field1, col1 AS field2 +FROM t1 GROUP BY field1, field2;; +field1 field2 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +10 10 +11 11 +12 12 +13 13 +14 14 +15 15 +16 16 +17 17 +18 18 +19 19 +20 20 +SHOW SESSION STATUS LIKE 'Sort_scan%'; +Variable_name Value +Sort_scan 1 +EXPLAIN SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2 +FROM t1 GROUP BY field1, field2;; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL idx 5 NULL 20 Using index; Using filesort +FLUSH STATUS; +SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2 +FROM t1 GROUP BY field1, field2;; +field1 field2 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +10 10 +11 11 +12 12 +13 13 +14 14 +15 15 +16 16 +17 17 +18 18 +19 19 +20 20 +SHOW SESSION STATUS LIKE 'Sort_scan%'; +Variable_name Value +Sort_scan 1 +CREATE VIEW v1 AS SELECT * FROM t1; +SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2 +FROM v1 +GROUP BY field1, field2; +field1 field2 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +10 10 +11 11 +12 12 +13 13 +14 14 +15 15 +16 16 +17 17 +18 18 +19 19 +20 20 +SELECT SQL_BIG_RESULT tbl1.col1 AS field1, tbl2.col1 AS field2 +FROM t1 as tbl1, t1 as tbl2 +GROUP BY field1, field2 +LIMIT 3; +field1 field2 +1 1 +1 2 +1 3 +explain +select col1 f1, col1 f2 from t1 order by f2, f1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL idx 5 NULL 20 Using index; Using filesort +select col1 f1, col1 f2 from t1 order by f2, f1; +f1 f2 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +10 10 +11 11 +12 12 +13 13 +14 14 +15 15 +16 16 +17 17 +18 18 +19 19 +20 20 +explain +select col1 f1, col1 f2 from t1 group by f2 order by f2, f1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range NULL idx 5 NULL 7 Using index for group-by; Using temporary; Using filesort +select col1 f1, col1 f2 from t1 group by f2 order by f2, f1; +f1 f2 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +10 10 +11 11 +12 12 +13 13 +14 14 +15 15 +16 16 +17 17 +18 18 +19 19 +20 20 +explain +select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL idx 5 NULL 20 Using index; Using temporary; Using filesort +select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1; +f1 f2 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +10 10 +11 11 +12 12 +13 13 +14 14 +15 15 +16 16 +17 17 +18 18 +19 19 +20 20 +CREATE TABLE t2( +col1 int, +col2 int, +UNIQUE INDEX idx (col1, col2)); +INSERT INTO t2(col1, col2) VALUES +(1,20),(2,19),(3,18),(4,17),(5,16),(6,15),(7,14),(8,13),(9,12),(10,11), +(11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1); +explain +select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index NULL idx 10 NULL 20 Using index; Using temporary; Using filesort +select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3; +f1 f2 f3 +1 20 1 +2 19 2 +3 18 3 +4 17 4 +5 16 5 +6 15 6 +7 14 7 +8 13 8 +9 12 9 +10 11 10 +11 10 11 +12 9 12 +13 8 13 +14 7 14 +15 6 15 +16 5 16 +17 4 17 +18 3 18 +19 2 19 +20 1 20 +explain +select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index NULL idx 10 NULL 20 Using index; Using filesort +select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3; +f1 f2 f3 +1 20 1 +2 19 2 +3 18 3 +4 17 4 +5 16 5 +6 15 6 +7 14 7 +8 13 8 +9 12 9 +10 11 10 +11 10 11 +12 9 12 +13 8 13 +14 7 14 +15 6 15 +16 5 16 +17 4 17 +18 3 18 +19 2 19 +20 1 20 +DROP VIEW v1; +DROP TABLE t1, t2; # End of 5.1 tests # # LP bug#694450 Wrong result with non-standard GROUP BY + ORDER BY diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result index d1faec7f758..cc7c9c4d364 100644 --- a/mysql-test/r/group_min_max.result +++ b/mysql-test/r/group_min_max.result @@ -1714,7 +1714,7 @@ explain extended select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 50.78 Using where; Using index Warnings: -Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`c` = 'i121') and (`test`.`t1`.`b` = 'a') and (`test`.`t1`.`a2` >= 'b')) +Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`b` = 'a') and (`test`.`t1`.`c` = 'i121') and (`test`.`t1`.`a2` >= 'b')) explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 Using where; Using index for group-by @@ -1731,7 +1731,7 @@ explain extended select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 50.61 Using where; Using index Warnings: -Note 1003 select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` = 'i121') and (`test`.`t2`.`b` = 'a') and (`test`.`t2`.`a2` >= 'b')) +Note 1003 select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`b` = 'a') and (`test`.`t2`.`c` = 'i121') and (`test`.`t2`.`a2` >= 'b')) explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by @@ -3187,6 +3187,106 @@ a b drop table t1; End of 5.1 tests # +# MDEV-765 lp:825075 - Wrong result with GROUP BY + multipart key + MIN/MAX loose scan +# +CREATE TABLE t1 (a varchar(1), b varchar(1), KEY (b,a)); +INSERT INTO t1 VALUES +('0',NULL),('9',NULL),('8','c'),('4','d'),('7','d'),(NULL,'f'), +('7','f'),('8','g'),(NULL,'j'); +explain +SELECT max(a) , b FROM t1 WHERE a IS NULL OR b = 'z' GROUP BY b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index b b 8 NULL 9 Using where; Using index +SELECT max(a) , b FROM t1 WHERE a IS NULL OR b = 'z' GROUP BY b; +max(a) b +NULL f +NULL j +explain +SELECT b, min(a) FROM t1 WHERE a = '7' OR b = 'z' GROUP BY b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index b b 8 NULL 9 Using where; Using index +SELECT b, min(a) FROM t1 WHERE a = '7' OR b = 'z' GROUP BY b; +b min(a) +d 7 +f 7 +explain +SELECT b, min(a) FROM t1 WHERE (a = b OR b = 'd' OR b is NULL) GROUP BY b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index b b 8 NULL 9 Using where; Using index +SELECT b, min(a) FROM t1 WHERE (a = b OR b = 'd' OR b is NULL) GROUP BY b; +b min(a) +NULL 0 +d 4 +explain +SELECT b, min(a) FROM t1 WHERE a > ('0' = b) AND b = 'z' GROUP BY b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref b b 4 const 1 Using where; Using index +SELECT b, min(a) FROM t1 WHERE a > ('0' = b) AND b = 'z' GROUP BY b; +b min(a) +explain +SELECT b, min(a) FROM t1 WHERE a > '0' AND (b < (a = '7')) GROUP BY b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 8 NULL 9 Using where; Using index +SELECT b, min(a) FROM t1 WHERE a > '0' AND (b < (a = '7')) GROUP BY b; +b min(a) +d 7 +f 7 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'c' +Warning 1292 Truncated incorrect DOUBLE value: 'd' +Warning 1292 Truncated incorrect DOUBLE value: 'd' +Warning 1292 Truncated incorrect DOUBLE value: 'f' +Warning 1292 Truncated incorrect DOUBLE value: 'g' +explain +SELECT b, min(a) FROM t1 WHERE (a > '0' AND (a > '1' OR b = 'd')) GROUP BY b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index b b 8 NULL 9 Using where; Using index +SELECT b, min(a) FROM t1 WHERE (a > '0' AND (a > '1' OR b = 'd')) GROUP BY b; +b min(a) +NULL 9 +c 8 +d 4 +f 7 +g 8 +drop table t1; +# +# MDEV-4140 Wrong result with GROUP BY + multipart key + MIN/MAX loose scan and a subquery +# +CREATE TABLE t1 (a int, b int, KEY (b, a)) ; +INSERT INTO t1 VALUES (0,99),(9,99),(4,0),(7,0),(99,0),(7,0),(8,0),(99,0),(1,0); +CREATE TABLE t2 (c int) ; +INSERT INTO t2 VALUES (0),(1); +EXPLAIN +SELECT MIN(a), b FROM t1 WHERE a > 0 GROUP BY b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range NULL b 10 NULL 10 Using where; Using index for group-by +SELECT MIN(a), b FROM t1 WHERE a > 0 GROUP BY b; +MIN(a) b +1 0 +9 99 +EXPLAIN +SELECT MIN(a), b FROM t1 WHERE a > ( SELECT c FROM t2 WHERE c = 0 ) GROUP BY b; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 range NULL b 10 NULL 10 Using where; Using index for group-by +2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +SELECT MIN(a), b FROM t1 WHERE a > ( SELECT c FROM t2 WHERE c = 0 ) GROUP BY b; +MIN(a) b +1 0 +9 99 +EXPLAIN +SELECT MIN(a), b FROM t1 WHERE a > ( SELECT min(c) FROM t2, t1 t1a, t1 t1b WHERE c = 0 ) GROUP BY b; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 index NULL b 10 NULL 9 Using where; Using index +2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY t1a index NULL b 10 NULL 9 Using index; Using join buffer (flat, BNL join) +2 SUBQUERY t1b index NULL b 10 NULL 9 Using index; Using join buffer (incremental, BNL join) +SELECT MIN(a), b FROM t1 WHERE a > ( SELECT min(c) FROM t2, t1 t1a, t1 t1b WHERE c = 0 ) GROUP BY b; +MIN(a) b +1 0 +9 99 +drop table t1, t2; +End of 5.3 tests +# # WL#3220 (Loose index scan for COUNT DISTINCT) # CREATE TABLE t1 (a INT, b INT, c INT, KEY (a,b)); diff --git a/mysql-test/r/group_min_max_innodb.result b/mysql-test/r/group_min_max_innodb.result index 0e7841e979d..320c4b2b750 100644 --- a/mysql-test/r/group_min_max_innodb.result +++ b/mysql-test/r/group_min_max_innodb.result @@ -70,7 +70,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index; Using temporary explain select distinct f1, f2 from t1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary +1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index drop table t1; create table t1(pk int primary key) engine=innodb; create view v1 as select pk from t1 where pk < 20; diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result index 5961a84cddc..a0a4fc42e2d 100644 --- a/mysql-test/r/having.result +++ b/mysql-test/r/having.result @@ -473,7 +473,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE table2 const PRIMARY PRIMARY 4 const 1 100.00 Using filesort 1 SIMPLE table1 ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: -Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = 9)) group by `test`.`table1`.`f1`,7 having ((7 = 8) and (`test`.`table1`.`f1` >= 6)) +Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where (`test`.`table1`.`f3` = 9) group by `test`.`table1`.`f1`,7 having ((7 = 8) and (`test`.`table1`.`f1` >= 6)) EXPLAIN EXTENDED SELECT table1.f1, table2.f2 FROM t1 AS table1 @@ -485,7 +485,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE table2 const PRIMARY PRIMARY 4 const 1 100.00 Using filesort 1 SIMPLE table1 ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: -Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = 9)) group by `test`.`table1`.`f1`,7 having (7 = 8) +Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where (`test`.`table1`.`f3` = 9) group by `test`.`table1`.`f1`,7 having (7 = 8) DROP TABLE t1; # # Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355 diff --git a/mysql-test/r/innodb_ext_key.result b/mysql-test/r/innodb_ext_key.result index 4e441245a39..0da4feaf26f 100644 --- a/mysql-test/r/innodb_ext_key.result +++ b/mysql-test/r/innodb_ext_key.result @@ -731,6 +731,7 @@ CREATE TABLE t2 (b int) ENGINE=MyISAM; INSERT INTO t1 (a) VALUES (4), (6); INSERT INTO t2 (b) VALUES (0), (8); set @save_optimizer_switch=@@optimizer_switch; +set @save_join_cache_level=@@join_cache_level; SET join_cache_level=3; SET optimizer_switch='join_cache_hashed=on'; SET optimizer_switch='join_cache_bka=on'; @@ -742,6 +743,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.a 2 Using where; Using join buffer (flat, BNLH join) SELECT * FROM t1, t2 WHERE b=a; a b +set join_cache_level=@save_join_cache_level; set optimizer_switch=@save_optimizer_switch; DROP TABLE t1,t2; # @@ -772,5 +774,97 @@ INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar') ON DUPLICATE KEY UPDATE c4 = VALUES(c4); set optimizer_switch=@save_optimizer_switch; DROP TABLE t1; +# +# Bug mdev-4220: using ref instead of eq_ref +# with extended_keys=on +# (performance regression introduced in the patch for mdev-3851) +# +set @save_optimizer_switch=@@optimizer_switch; +create table t1 (a int not null) engine=innodb; +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 ( +pk int primary key, a int not null, b int, unique(a) +)engine=innodb; +insert into t2 +select +A.a + 10 * B.a, A.a + 10 * B.a, A.a + 10 * B.a +from t1 A, t1 B; +set optimizer_switch='extended_keys=off'; +explain +select * from t1, t2 where t2.a=t1.a and t2.b < 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 +1 SIMPLE t2 eq_ref a a 4 test.t1.a 1 Using where +flush status; +select * from t1, t2 where t2.a=t1.a and t2.b < 2; +a pk a b +0 0 0 0 +1 1 1 1 +show status like 'handler_read%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 10 +Handler_read_last 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_deleted 0 +Handler_read_rnd_next 11 +set optimizer_switch='extended_keys=on'; +explain +select * from t1, t2 where t2.a=t1.a and t2.b < 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 +1 SIMPLE t2 eq_ref a a 4 test.t1.a 1 Using where +flush status; +select * from t1, t2 where t2.a=t1.a and t2.b < 2; +a pk a b +0 0 0 0 +1 1 1 1 +show status like 'handler_read%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 10 +Handler_read_last 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_deleted 0 +Handler_read_rnd_next 11 +drop table t1,t2; +create table t1(a int) engine=myisam; +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2(a int) engine=myisam; +insert into t2 select A.a + 10*B.a + 100*C.a from t1 A, t1 B, t1 C; +create table t3 ( +pk1 int not null, pk2 int not null, col1 int not null, col2 int not null) +engine=innodb; +insert into t3 select a,a,a,a from t2; +alter table t3 add primary key (pk1, pk2); +alter table t3 add key (col1, col2); +set optimizer_switch='extended_keys=off'; +explain +select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where +1 SIMPLE t3 ref col1 col1 8 test.t1.a,test.t1.a # Using index +explain +select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where +1 SIMPLE t3 ref PRIMARY,col1 PRIMARY 4 test.t1.a # Using where +set optimizer_switch='extended_keys=on'; +explain +select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where +1 SIMPLE t3 ref col1 col1 8 test.t1.a,test.t1.a # Using index +explain +select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where +1 SIMPLE t3 ref PRIMARY,col1 col1 12 test.t1.a,test.t1.a,test.t1.a # Using index +drop table t1,t2,t3; +set optimizer_switch=@save_optimizer_switch; set optimizer_switch=@save_ext_key_optimizer_switch; SET SESSION STORAGE_ENGINE=DEFAULT; diff --git a/mysql-test/r/join_cache.result b/mysql-test/r/join_cache.result index bb455f2b39a..618ce7e540b 100644 --- a/mysql-test/r/join_cache.result +++ b/mysql-test/r/join_cache.result @@ -5595,7 +5595,7 @@ DROP TABLE t1,t2,t3; # CREATE TABLE t1 ( col269 decimal(31,10) unsigned DEFAULT NULL, -col280 multipoint DEFAULT NULL, +col280 geometry DEFAULT NULL, col281 tinyint(1) DEFAULT NULL, col282 time NOT NULL, col284 datetime DEFAULT NULL, diff --git a/mysql-test/r/join_nested.result b/mysql-test/r/join_nested.result index dfb1a8c72d3..255714a7236 100644 --- a/mysql-test/r/join_nested.result +++ b/mysql-test/r/join_nested.result @@ -235,7 +235,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) 1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and (`test`.`t8`.`b` = `test`.`t7`.`b`))) where 1 +Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t7`.`b`) and (`test`.`t6`.`b` < 10))) where 1 SELECT t6.a,t6.b,t7.a,t7.b,t8.a,t8.b FROM (t6, t7) LEFT JOIN @@ -556,7 +556,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and ((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`))))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t7`.`b` = `test`.`t5`.`b`)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) where ((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`))) SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b, t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b FROM t0,t1 @@ -652,7 +652,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and ((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`))))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t7`.`b` = `test`.`t5`.`b`)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`))) SELECT t9.a,t9.b FROM t9; a b @@ -858,7 +858,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 2 100.00 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(((`test`.`t2`.`a` > 0) and (`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t3`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`b`) and (`test`.`t3`.`b` is not null))) where 1 +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t3`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t3`.`b` is not null))) where 1 SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b FROM (t3,t4) LEFT JOIN @@ -920,7 +920,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t2`.`a` > 0) and (`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and ((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`))))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t7`.`b` = `test`.`t5`.`b`)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`))) INSERT INTO t4 VALUES (-3,12,0), (-4,13,0), (-1,11,0), (-3,11,0), (-5,15,0); INSERT INTO t5 VALUES (-3,11,0), (-2,12,0), (-3,13,0), (-4,12,0); CREATE INDEX idx_b ON t4(b); @@ -972,7 +972,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and ((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`))))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0) and (`test`.`t7`.`b` = `test`.`t5`.`b`)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`))) INSERT INTO t8 VALUES (-3,12,0), (-1,14,0), (-5,15,0), (-1,11,0), (-4,13,0); CREATE INDEX idx_b ON t8(b); EXPLAIN EXTENDED @@ -1022,7 +1022,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and (`test`.`t8`.`a` >= 0) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0) and (`test`.`t7`.`b` = `test`.`t5`.`b`)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t8`.`a` >= 0) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`))) INSERT INTO t1 VALUES (-1,133,0), (-2,12,0), (-3,11,0), (-5,15,0); CREATE INDEX idx_b ON t1(b); CREATE INDEX idx_a ON t0(a); @@ -1073,7 +1073,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t7`.`b` = `test`.`t5`.`b`)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2) and (`test`.`t1`.`a` > 0))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2) and (`test`.`t1`.`a` > 0))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`))) SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b, t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b FROM t0,t1 @@ -1215,7 +1215,7 @@ EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL a 5 NULL 21 Using index 1 SIMPLE t3 index c c 5 NULL 6 Using where; Using index -1 SIMPLE t2 ref b b 5 test.t3.c 2 Using where; Using index +1 SIMPLE t2 ref b b 5 test.t3.c 2 Using index SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; a b c NULL 0 0 @@ -1286,7 +1286,7 @@ EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL a 5 NULL 21 Using index 1 SIMPLE t3 index c c 5 NULL 0 Using where; Using index -1 SIMPLE t2 ref b b 5 test.t3.c 2 Using where; Using index +1 SIMPLE t2 ref b b 5 test.t3.c 2 Using index SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; a b c NULL NULL NULL @@ -1843,7 +1843,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 ALL NULL NULL NULL NULL 1 100.00 Using where; Not exists 1 SIMPLE t4 ALL NULL NULL NULL NULL 0 0.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`b` AS `b` from `test`.`t1` left join (`test`.`t2` left join `test`.`t3` on(((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t3`.`b` = `test`.`t1`.`a`))) left join `test`.`t4` on((`test`.`t4`.`b` = `test`.`t3`.`a`))) on((`test`.`t2`.`a` = `test`.`t1`.`a`)) where isnull(`test`.`t3`.`a`) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`b` AS `b` from `test`.`t1` left join (`test`.`t2` left join `test`.`t3` on((`test`.`t3`.`b` = `test`.`t1`.`a`)) left join `test`.`t4` on((`test`.`t4`.`b` = `test`.`t3`.`a`))) on((`test`.`t2`.`a` = `test`.`t1`.`a`)) where isnull(`test`.`t3`.`a`) DROP TABLE t1,t2,t3,t4; SET optimizer_switch=@save_optimizer_switch; End of 5.0 tests diff --git a/mysql-test/r/join_nested_jcl6.result b/mysql-test/r/join_nested_jcl6.result index 69eb4532c73..c744df9e2fe 100644 --- a/mysql-test/r/join_nested_jcl6.result +++ b/mysql-test/r/join_nested_jcl6.result @@ -246,7 +246,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) 1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t7.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) Warnings: -Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and (`test`.`t8`.`b` = `test`.`t7`.`b`) and (`test`.`t7`.`b` is not null))) where 1 +Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t7`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t7`.`b` is not null))) where 1 SELECT t6.a,t6.b,t7.a,t7.b,t8.a,t8.b FROM (t6, t7) LEFT JOIN @@ -567,7 +567,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) where ((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`))) SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b, t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b FROM t0,t1 @@ -663,7 +663,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) 1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`))) SELECT t9.a,t9.b FROM t9; a b @@ -869,7 +869,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(((`test`.`t2`.`a` > 0) and (`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t3`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`b`) and (`test`.`t3`.`b` is not null))) where 1 +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t3`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t3`.`b` is not null))) where 1 SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b FROM (t3,t4) LEFT JOIN @@ -931,7 +931,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t2`.`a` > 0) and (`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`))) INSERT INTO t4 VALUES (-3,12,0), (-4,13,0), (-1,11,0), (-3,11,0), (-5,15,0); INSERT INTO t5 VALUES (-3,11,0), (-2,12,0), (-3,13,0), (-4,12,0); CREATE INDEX idx_b ON t4(b); @@ -983,7 +983,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`))) INSERT INTO t8 VALUES (-3,12,0), (-1,14,0), (-5,15,0), (-1,11,0), (-4,13,0); CREATE INDEX idx_b ON t8(b); EXPLAIN EXTENDED @@ -1033,7 +1033,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) 1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and (`test`.`t8`.`a` >= 0) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t8`.`a` >= 0) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`))) INSERT INTO t1 VALUES (-1,133,0), (-2,12,0), (-3,11,0), (-5,15,0); CREATE INDEX idx_b ON t1(b); CREATE INDEX idx_a ON t0(a); @@ -1082,9 +1082,9 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t5 ALL idx_b NULL NULL NULL 7 100.00 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t8 ref idx_b idx_b 5 test.t7.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t7`.`b` is not null)))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2) and (`test`.`t1`.`a` > 0))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2) and (`test`.`t1`.`a` > 0))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`))) SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b, t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b FROM t0,t1 @@ -1226,7 +1226,7 @@ EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL a 5 NULL 21 Using index 1 SIMPLE t3 index c c 5 NULL 6 Using where; Using index -1 SIMPLE t2 ref b b 5 test.t3.c 2 Using where; Using index +1 SIMPLE t2 ref b b 5 test.t3.c 2 Using index SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; a b c NULL 0 0 @@ -1297,7 +1297,7 @@ EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL a 5 NULL 21 Using index 1 SIMPLE t3 index c c 5 NULL 0 Using where; Using index -1 SIMPLE t2 ref b b 5 test.t3.c 2 Using where; Using index +1 SIMPLE t2 ref b b 5 test.t3.c 2 Using index SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; a b c NULL NULL NULL @@ -1854,7 +1854,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 test.t1.a 1 100.00 Using where; Not exists; Using join buffer (incremental, BNLH join) 1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t3.a 0 0.00 Using where; Using join buffer (incremental, BNLH join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`b` AS `b` from `test`.`t1` left join (`test`.`t2` left join `test`.`t3` on(((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t3`.`b` = `test`.`t1`.`a`))) left join `test`.`t4` on(((`test`.`t4`.`b` = `test`.`t3`.`a`) and (`test`.`t3`.`a` is not null)))) on((`test`.`t2`.`a` = `test`.`t1`.`a`)) where isnull(`test`.`t3`.`a`) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`b` AS `b` from `test`.`t1` left join (`test`.`t2` left join `test`.`t3` on((`test`.`t3`.`b` = `test`.`t1`.`a`)) left join `test`.`t4` on(((`test`.`t4`.`b` = `test`.`t3`.`a`) and (`test`.`t3`.`a` is not null)))) on((`test`.`t2`.`a` = `test`.`t1`.`a`)) where isnull(`test`.`t3`.`a`) DROP TABLE t1,t2,t3,t4; SET optimizer_switch=@save_optimizer_switch; End of 5.0 tests diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index fd2a948847c..c28887d4ff2 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -2008,7 +2008,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 100.00 1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 100.00 Using index Warnings: -Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where (1) order by 5 +Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where 1 order by 5 SELECT t1.pk FROM t2 JOIN t1 ON t2.pk = t1.a WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5 ORDER BY t1.pk; diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result index d891f5c49b2..4efb6126cba 100644 --- a/mysql-test/r/join_outer_jcl6.result +++ b/mysql-test/r/join_outer_jcl6.result @@ -2019,7 +2019,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 100.00 1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 100.00 Using index Warnings: -Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where (1) order by 5 +Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where 1 order by 5 SELECT t1.pk FROM t2 JOIN t1 ON t2.pk = t1.a WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5 ORDER BY t1.pk; diff --git a/mysql-test/r/keywords.result b/mysql-test/r/keywords.result index 58cb7430563..a1d8e40eae3 100644 --- a/mysql-test/r/keywords.result +++ b/mysql-test/r/keywords.result @@ -269,3 +269,9 @@ call p2(); DROP PROCEDURE p1; DROP PROCEDURE p2; DROP TABLE t1; +create table option (option int not null); +drop table option; +set option=1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '=1' at line 1 +set option option=1; +ERROR HY000: Unknown system variable 'option' diff --git a/mysql-test/r/mdev316.result b/mysql-test/r/mdev316.result index 43082769872..78272549e81 100644 --- a/mysql-test/r/mdev316.result +++ b/mysql-test/r/mdev316.result @@ -16,7 +16,7 @@ cast(convert(0x0030 using ucs2) as decimal(5.2)) cast(concat(convert(0x0030 usin 0 0 select cast(convert(_ucs2 0x0030 using latin1) as date), cast(concat(convert(_ucs2 0x0030 using latin1)) as date); cast(convert(_ucs2 0x0030 using latin1) as date) cast(concat(convert(_ucs2 0x0030 using latin1)) as date) -NULL NULL +0000-00-00 0000-00-00 Warnings: Warning 1292 Incorrect datetime value: '0' Warning 1292 Incorrect datetime value: '0' diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index b5c85555ed8..de376dc187d 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -580,25 +580,25 @@ select max(b) from t1 where a = 2; max(b) 1 drop table t3,t1,t2; -CREATE TABLE t1 (c1 INT NOT NULL); -CREATE TABLE t2 (c1 INT NOT NULL); -INSERT INTO t1 VALUES (1); -INSERT INTO t2 VALUES (2); -CREATE TEMPORARY TABLE t3 (c1 INT NOT NULL) ENGINE=MRG_MYISAM UNION=(t1,t2); -SELECT * FROM t3; -c1 +create table t1 (a int not null); +create table t2 (a int not null); +insert into t1 values (1); +insert into t2 values (2); +create temporary table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2); +select * from t3; +a 1 2 -CREATE TEMPORARY TABLE t4 (c1 INT NOT NULL); -CREATE TEMPORARY TABLE t5 (c1 INT NOT NULL); -INSERT INTO t4 VALUES (4); -INSERT INTO t5 VALUES (5); -CREATE TEMPORARY TABLE t6 (c1 INT NOT NULL) ENGINE=MRG_MYISAM UNION=(t4,t5); -SELECT * FROM t6; -c1 -4 -5 -DROP TABLE t6, t3, t1, t2, t4, t5; +create temporary table t4 (a int not null); +create temporary table t5 (a int not null); +insert into t4 values (1); +insert into t5 values (2); +create temporary table t6 (a int not null) ENGINE=MERGE UNION=(t4,t5); +select * from t6; +a +1 +2 +drop table t6, t3, t1, t2, t4, t5; create temporary table t1 (a int not null); create temporary table t2 (a int not null); insert into t1 values (1); @@ -996,11 +996,6 @@ m1 CREATE TABLE `m1` ( `a` int(11) DEFAULT NULL ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1, m1; -CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge; -SELECT MAX(a) FROM t1; -MAX(a) -NULL -DROP TABLE t1; CREATE TABLE t1(a INT); CREATE TABLE t2(a VARCHAR(10)); CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(t1, t2); @@ -1935,9 +1930,9 @@ ALTER TABLE t2 UNION=(t3,t1); SELECT * FROM t2; ERROR HY000: Table 't3' is differently defined or of non-MyISAM type or doesn't exist DROP TABLE t1, t2, t3; -CREATE TABLE t1 (c1 INT) ENGINE=MyISAM; -CREATE TABLE t2 (c1 INT) ENGINE=MyISAM; -CREATE TABLE t3 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2); +CREATE TABLE t1 (c1 INT) ENGINE= MyISAM; +CREATE TABLE t2 (c1 INT) ENGINE= MyISAM; +CREATE TABLE t3 (c1 INT) ENGINE= MRG_MYISAM UNION= (t1, t2); INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (2); SELECT * FROM t3; @@ -2400,6 +2395,142 @@ Table Op Msg_type Msg_text test.m1 repair note The storage engine for the table doesn't support repair DROP TABLE m1, t1; End of 5.1 tests +# +# MDEV-4277: Crash inside mi_killed_in_mariadb() with myisammrg +# +create table t1 (a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 ( i int ) engine=myisam; +insert into t2 values (1),(2); +create table t3 (a int, b int, filler char(100), key(a), key(b)) engine=myisam; +create table t4 like t3; +insert into t3 +select A.a+10*B.a+100*C.a, +A.a+10*B.a+100*C.a, +'filler-data-FILLER-DATA-qqq' +from t1 A, t1 B, t1 C where C.a < 5; +insert into t4 +select A.a+10*B.a+100*C.a, +A.a+10*B.a+100*C.a, +'filler-data-FILLER-DATA-qqq' +from t1 A, t1 B, t1 C where C.a >= 5; +create table t5 like t3; +alter table t5 engine=merge; +alter table t5 union(t3, t4); +update t5 set b=999, a=999 where b>950; +explain +select * from t2, t5 where t5.a=999 and t5.b=999; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 +1 SIMPLE t5 index_merge a,b a,b 5,5 NULL 6 Using intersect(a,b); Using where; Using join buffer (flat, BNL join) +select * from t2, t5 where t5.a=999 and t5.b=999; +i a b filler +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +1 999 999 filler-data-FILLER-DATA-qqq +2 999 999 filler-data-FILLER-DATA-qqq +drop table t5; +drop table t1,t2,t3,t4; +End of 5.3 tests +CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge; +SELECT MAX(a) FROM t1; +MAX(a) +NULL +DROP TABLE t1; # # An additional test case for Bug#27430 Crash in subquery code # when in PS and table DDL changed after PREPARE diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index e991326cdce..7386af13e2c 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -689,6 +689,58 @@ DROP VIEW v1; DROP FUNCTION f1; DROP TABLE t1; # +# MDEV-4123: Incorrect results after multi-table update or +# assertion `!table || (!table->read_set || +# bitmap_is_set(table->read_set, field_index))' failure +# +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 ( +id int(10) unsigned NOT NULL, +level tinyint(3) unsigned NOT NULL, +PRIMARY KEY (id) +); +INSERT INTO t1 VALUES (2519583,1); +DROP TABLE IF EXISTS t2; +Warnings: +Note 1051 Unknown table 't2' +CREATE TABLE t2 ( +club_id int(11) NOT NULL DEFAULT '0', +profile_id int(11) NOT NULL DEFAULT '0', +member_level_id int(11) NOT NULL DEFAULT '0', +PRIMARY KEY (profile_id,club_id) +); +INSERT INTO t2 VALUES (2,2519583,12); +DROP TABLE IF EXISTS t3; +Warnings: +Note 1051 Unknown table 't3' +CREATE TABLE t3 ( +member_level_id int(11) unsigned NOT NULL DEFAULT '0', +map_level int(11) unsigned NOT NULL DEFAULT '0', +map_status int(11) unsigned NOT NULL DEFAULT '0', +PRIMARY KEY (member_level_id) +); +INSERT INTO t3 VALUES (12,12,1); +CREATE +VIEW v1 AS +select club_id,profile_id, +map_level AS member_level_id,map_status AS member_status +from (t2 tc join t3 map +on(((tc.member_level_id = map.member_level_id) and +(club_id = 2)))); +select level, count(*) as cnt from t1 group by level; +level cnt +1 1 +UPDATE t1 c LEFT JOIN v1 t ON (c.id = t.profile_id AND t.club_id = 2) +SET c.level = IF (t.member_status IS NULL, 1, IF (t.member_status = 1, 2,3)); +select level, count(*) as cnt from t1 group by level; +level cnt +2 1 +drop view v1; +drop table t1,t2,t3; +end of tests +# # BUG#57373: Multi update+InnoDB reports ER_KEY_NOT_FOUND if a # table is updated twice # @@ -742,3 +794,4 @@ SELECT * FROM t2; col_int_key pk_1 pk_2 col_int 1 7 11 4 DROP TABLE t1,t2; +end of 5.5 tests diff --git a/mysql-test/r/myisam-metadata.result b/mysql-test/r/myisam-metadata.result new file mode 100644 index 00000000000..5192253d5d1 --- /dev/null +++ b/mysql-test/r/myisam-metadata.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +id INT PRIMARY KEY, +a VARCHAR(100), +INDEX(a) +) ENGINE=MyISAM; +ALTER TABLE t1 DISABLE KEYS; +ALTER TABLE t1 ENABLE KEYS; +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 MyISAM 10 Dynamic 100000 27 # # # 0 NULL # # # latin1_swedish_ci NULL +DROP TABLE t1; diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 6c0826775ad..1460467a91a 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -2291,19 +2291,19 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 TRANSACTIONAL=1 drop table t1; CREATE TABLE t1 (line LINESTRING NOT NULL) engine=myisam; -INSERT INTO t1 VALUES (GeomFromText("POINT(0 0)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(0 0)")); checksum table t1; Table Checksum -test.t1 326284887 +test.t1 310616673 CREATE TABLE t2 (line LINESTRING NOT NULL) engine=myisam; -INSERT INTO t2 VALUES (GeomFromText("POINT(0 0)")); +INSERT INTO t2 VALUES (GeomFromText("LINESTRING(0 0)")); checksum table t2; Table Checksum -test.t2 326284887 +test.t2 310616673 CREATE TABLE t3 select * from t1; checksum table t3; Table Checksum -test.t3 326284887 +test.t3 310616673 drop table t1,t2,t3; create table t1 (a1 int,a2 int,a3 int,a4 int,a5 int,a6 int,a7 int,a8 int,a9 int,a10 int,a11 int,a12 int,a13 int,a14 int,a15 int,a16 int,a17 int,a18 int,a19 int,a20 int,a21 int,a22 int,a23 int,a24 int,a25 int,a26 int,a27 int,a28 int,a29 int,a30 int,a31 int,a32 int, key(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32)) engine=myisam; @@ -2337,25 +2337,6 @@ h+0 d + 0 e g + 0 1 1 3 0 1 1 4 0 DROP TABLE t1; -# -# Test of BUG#35570 CHECKSUM TABLE unreliable if LINESTRING field -# (same content / differen checksum) -# -CREATE TABLE t1 (line LINESTRING NOT NULL) engine=myisam; -INSERT INTO t1 VALUES (GeomFromText("POINT(0 0)")); -checksum table t1; -Table Checksum -test.t1 326284887 -CREATE TABLE t2 (line LINESTRING NOT NULL) engine=myisam; -INSERT INTO t2 VALUES (GeomFromText("POINT(0 0)")); -checksum table t2; -Table Checksum -test.t2 326284887 -CREATE TABLE t3 select * from t1; -checksum table t3; -Table Checksum -test.t3 326284887 -drop table t1,t2,t3; CREATE TABLE t1(a INT, b CHAR(10), KEY(a), KEY(b)); INSERT INTO t1 VALUES(1,'0'),(2,'0'),(3,'0'),(4,'0'),(5,'0'), (6,'0'),(7,'0'); diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index e0670f7d643..4d2ac25a0eb 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -513,5 +513,7 @@ create database `aa``bb````cc`; DATABASE() aa`bb``cc drop database `aa``bb````cc`; +a +>>\ndelimiter\n<< End of tests diff --git a/mysql-test/r/mysqlbinlog-innodb.result b/mysql-test/r/mysqlbinlog-innodb.result index 41d15bc32d3..a5865fe4fac 100644 --- a/mysql-test/r/mysqlbinlog-innodb.result +++ b/mysql-test/r/mysqlbinlog-innodb.result @@ -19,6 +19,7 @@ a 1 2 FLUSH LOGS; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -50,6 +51,8 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -81,5 +84,6 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; DROP DATABASE test2; DROP TABLE t1; diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 255b0679244..5c297284e06 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -14,6 +14,7 @@ insert into t1 values ("Alas"); flush logs; --- Local -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -95,8 +96,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- Broken LOAD DATA -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -131,8 +134,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- --database -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -186,8 +191,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- --start-position -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -213,8 +220,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- Remote -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -296,8 +305,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- Broken LOAD DATA -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -332,8 +343,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- --database -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -387,8 +400,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- --start-position -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -414,8 +429,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- reading stdin -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -435,6 +452,8 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -453,6 +472,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; drop table t1,t2; flush logs; flush logs; @@ -495,6 +515,7 @@ call p1(); drop procedure p1; call p1(); ERROR 42000: PROCEDURE test.p1 does not exist +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -517,6 +538,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; call p1(); 1 1 @@ -545,6 +567,7 @@ C3BF D0AA drop table t1; flush logs; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -634,6 +657,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; CREATE TABLE t1 (c1 CHAR(10)); FLUSH LOGS; INSERT INTO t1 VALUES ('0123456789'); @@ -721,6 +745,7 @@ RESET MASTER; FLUSH LOGS; # # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified exists +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -772,8 +797,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified does not exist +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -806,8 +833,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # # Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database specified exists +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -846,8 +875,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # # Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database specified does not exist +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -873,6 +904,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; End of 5.0 tests End of 5.1 tests # Expect deprecation warning. diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index ef8bcea3649..da96d843273 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -2791,8 +2791,8 @@ UNLOCK TABLES; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11) -RETURN a+b */;; +CREATE DEFINER=`root`@`localhost` FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11) +RETURN a+b ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -2808,11 +2808,11 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `bug9056_func2`(f1 char binary) RETURNS char(1) CHARSET latin1 +CREATE DEFINER=`root`@`localhost` FUNCTION `bug9056_func2`(f1 char binary) RETURNS char(1) CHARSET latin1 begin set f1= concat( 'hello', f1 ); return f1; -end */;; +end ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -2828,8 +2828,8 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50020 DEFINER="root"@"localhost"*/ /*!50003 PROCEDURE "a'b"() -select 1 */;; +CREATE DEFINER="root"@"localhost" PROCEDURE "a'b"() +select 1 ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -2845,8 +2845,8 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT) -BEGIN SELECT a+b INTO c; end */;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT) +BEGIN SELECT a+b INTO c; end ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -2862,10 +2862,10 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `bug9056_proc2`(OUT a INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `bug9056_proc2`(OUT a INT) BEGIN select sum(id) from t1 into a; -END */;; +END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -3851,8 +3851,8 @@ create procedure mysqldump_test_db.sp1() select 'hello'; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50020 DEFINER=`user1`@`%`*/ /*!50003 PROCEDURE `sp1`() -select 'hello' */;; +CREATE DEFINER=`user1`@`%` PROCEDURE `sp1`() +select 'hello' ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index ec7fd798d4c..f4d473c00d5 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -2235,9 +2235,10 @@ INSERT INTO t1 VALUES (1, '2009-01-01'), (2, NULL); # test with an invalid date, which lead to item->null_value is set. EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-99' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +1 SIMPLE t1 p20090401 ALL NULL NULL NULL NULL 2 Using where Warnings: Warning 1292 Incorrect datetime value: '2009-04-99' +Warning 1292 Incorrect datetime value: '2009-04-99' DROP TABLE t1; CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, diff --git a/mysql-test/r/plugin_auth.result b/mysql-test/r/plugin_auth.result index f8ebf65c0c5..356ac76962a 100644 --- a/mysql-test/r/plugin_auth.result +++ b/mysql-test/r/plugin_auth.result @@ -224,7 +224,7 @@ NULL # in connection plug_con SELECT @@LOCAL.external_user; @@LOCAL.external_user -'plug'@'%' +plug_dest # in connection default ## cleanup DROP USER plug; diff --git a/mysql-test/r/plugin_auth_qa_2.result b/mysql-test/r/plugin_auth_qa_2.result index f300ea332cb..aa3a59b4f25 100644 --- a/mysql-test/r/plugin_auth_qa_2.result +++ b/mysql-test/r/plugin_auth_qa_2.result @@ -44,7 +44,7 @@ SELECT @@external_user; NULL exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 current_user() user() @@local.proxy_user @@local.external_user -authenticated_as@% user_name@localhost 'qa_test_2_user'@'%' 'qa_test_2_user'@'%' +authenticated_as@% user_name@localhost 'qa_test_2_user'@'%' externaluser SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; user plugin authentication_string authenticated_as @@ -60,7 +60,7 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_3_dest identified by 'dest_pas GRANT PROXY ON qa_test_3_dest TO qa_test_3_user; exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_3_user --password=qa_test_3_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 current_user() user() @@local.proxy_user @@local.external_user -qa_test_3_dest@% qa_test_3_user@localhost 'qa_test_3_user'@'%' 'qa_test_3_user'@'%' +qa_test_3_dest@% qa_test_3_user@localhost 'qa_test_3_user'@'%' qa_test_3_dest DROP USER qa_test_3_user; DROP USER qa_test_3_dest; === Assign too low values for *length, which should have no effect ==== @@ -70,7 +70,7 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_4_dest identified by 'dest_pas GRANT PROXY ON qa_test_4_dest TO qa_test_4_user; exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_4_user --password=qa_test_4_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 current_user() user() @@local.proxy_user @@local.external_user -qa_test_4_dest@% qa_test_4_user@localhost 'qa_test_4_user'@'%' 'qa_test_4_user'@'%' +qa_test_4_dest@% qa_test_4_user@localhost 'qa_test_4_user'@'%' qa_test_4_dest DROP USER qa_test_4_user; DROP USER qa_test_4_dest; === Assign empty string especially to authenticated_as (in plugin) ==== diff --git a/mysql-test/r/plugin_auth_qa_3.result b/mysql-test/r/plugin_auth_qa_3.result index 656975aca30..dd4fb76ff8d 100644 --- a/mysql-test/r/plugin_auth_qa_3.result +++ b/mysql-test/r/plugin_auth_qa_3.result @@ -4,7 +4,7 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_pa GRANT PROXY ON qa_test_11_dest TO qa_test_11_user; exec MYSQL --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 current_user() user() @@local.proxy_user @@local.external_user -qa_test_11_dest@% qa_test_11_user@localhost 'qa_test_11_user'@'%' 'qa_test_11_user'@'%' +qa_test_11_dest@% qa_test_11_user@localhost 'qa_test_11_user'@'%' NULL exec MYSQL --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 ERROR 1045 (28000): Access denied for user 'qa_test_2_user'@'localhost' (using password: NO) DROP USER qa_test_11_user, qa_test_11_dest; diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result index 80934a4e01f..f94c958a1be 100644 --- a/mysql-test/r/row.result +++ b/mysql-test/r/row.result @@ -405,7 +405,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 100.00 Using index 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 12 test.t1.a,const,const 1 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = 1) and (`test`.`t2`.`b` = 2) and (`test`.`t2`.`a` = `test`.`t1`.`a`)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t2`.`b` = 2) and (`test`.`t2`.`c` = 1)) SELECT * FROM t1,t2 WHERE (t2.a,(t2.b,t2.c))=(t1.a,(2,1)); a b a b c 1 1 1 2 1 @@ -415,7 +415,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 100.00 Using index 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 12 test.t1.a,const,const 1 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = 1) and (`test`.`t2`.`b` = 2) and (`test`.`t2`.`a` = `test`.`t1`.`a`)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t2`.`b` = 2) and (`test`.`t2`.`c` = 1)) SELECT * FROM t1,t2 WHERE t2.a=t1.a AND (t2.b,t2.c)=(2,1); a b a b c 1 1 1 2 1 diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 378b20829f3..3d16d37c5f1 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -5302,4 +5302,24 @@ INSERT INTO t2 VALUES (3),(4); SELECT * FROM t1, t2 WHERE a=3 AND a=b; a b drop table t1,t2; +# +# Bug mdev-4250: wrong transformation of WHERE condition with OR +# +CREATE TABLE t1 (pk int PRIMARY KEY, a int); +INSERT INTO t1 VALUES (3,0), (2,0), (4,1), (5,0), (1,0); +SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0; +pk a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Note 1003 select 2 AS `pk`,0 AS `a` from `test`.`t1` where ((0 <> 0)) +DROP TABLE t1; +SELECT * FROM mysql.time_zone +WHERE ( NOT (Use_leap_seconds <= Use_leap_seconds AND Time_zone_id != 1) +AND Time_zone_id = Time_zone_id +OR Time_zone_id <> Time_zone_id ) +AND Use_leap_seconds <> 'N'; +Time_zone_id Use_leap_seconds End of 5.3 tests diff --git a/mysql-test/r/select_jcl6.result b/mysql-test/r/select_jcl6.result index b5c6f89b87b..467f940c85d 100644 --- a/mysql-test/r/select_jcl6.result +++ b/mysql-test/r/select_jcl6.result @@ -5313,6 +5313,26 @@ INSERT INTO t2 VALUES (3),(4); SELECT * FROM t1, t2 WHERE a=3 AND a=b; a b drop table t1,t2; +# +# Bug mdev-4250: wrong transformation of WHERE condition with OR +# +CREATE TABLE t1 (pk int PRIMARY KEY, a int); +INSERT INTO t1 VALUES (3,0), (2,0), (4,1), (5,0), (1,0); +SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0; +pk a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Note 1003 select 2 AS `pk`,0 AS `a` from `test`.`t1` where ((0 <> 0)) +DROP TABLE t1; +SELECT * FROM mysql.time_zone +WHERE ( NOT (Use_leap_seconds <= Use_leap_seconds AND Time_zone_id != 1) +AND Time_zone_id = Time_zone_id +OR Time_zone_id <> Time_zone_id ) +AND Use_leap_seconds <> 'N'; +Time_zone_id Use_leap_seconds End of 5.3 tests set join_cache_level=default; show variables like 'join_cache_level'; diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result index 378b20829f3..3d16d37c5f1 100644 --- a/mysql-test/r/select_pkeycache.result +++ b/mysql-test/r/select_pkeycache.result @@ -5302,4 +5302,24 @@ INSERT INTO t2 VALUES (3),(4); SELECT * FROM t1, t2 WHERE a=3 AND a=b; a b drop table t1,t2; +# +# Bug mdev-4250: wrong transformation of WHERE condition with OR +# +CREATE TABLE t1 (pk int PRIMARY KEY, a int); +INSERT INTO t1 VALUES (3,0), (2,0), (4,1), (5,0), (1,0); +SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0; +pk a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Note 1003 select 2 AS `pk`,0 AS `a` from `test`.`t1` where ((0 <> 0)) +DROP TABLE t1; +SELECT * FROM mysql.time_zone +WHERE ( NOT (Use_leap_seconds <= Use_leap_seconds AND Time_zone_id != 1) +AND Time_zone_id = Time_zone_id +OR Time_zone_id <> Time_zone_id ) +AND Use_leap_seconds <> 'N'; +Time_zone_id Use_leap_seconds End of 5.3 tests diff --git a/mysql-test/r/str_to_datetime_457.result b/mysql-test/r/str_to_datetime_457.result index 4fd0d00691c..630be9ffbaa 100644 --- a/mysql-test/r/str_to_datetime_457.result +++ b/mysql-test/r/str_to_datetime_457.result @@ -12,12 +12,12 @@ Warning 1292 Truncated incorrect datetime value: '2012103123595912' Warning 1292 Truncated incorrect datetime value: '20121031235959123' select cast(0 as date), cast('0000-00-00' as date), cast('0' as date); cast(0 as date) cast('0000-00-00' as date) cast('0' as date) -0000-00-00 0000-00-00 NULL +0000-00-00 0000-00-00 0000-00-00 Warnings: Warning 1292 Incorrect datetime value: '0' select extract(hour from '100000:02:03'), extract(hour from '100000:02:03 '); extract(hour from '100000:02:03') extract(hour from '100000:02:03 ') -NULL NULL +0 0 Warnings: Warning 1292 Truncated incorrect time value: '100000:02:03' Warning 1292 Truncated incorrect time value: '100000:02:03 ' diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 5f9376bba89..96a20a3ea27 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -1457,7 +1457,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) 1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t3`.`a` = `test`.`t1`.`b`)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` = `test`.`t2`.`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)); @@ -1500,7 +1500,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 index a a 5 NULL 3 100.00 Using where; Using index 1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` = `test`.`t3`.`a`)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and (`test`.`t1`.`a` = `test`.`t2`.`a`)) insert into t1 values (3,31); select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a @@ -2973,7 +2973,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`flag` = 'N')) +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where (`test`.`t2`.`flag` = 'N') explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result index ed07578fa17..1a33fb0c6a3 100644 --- a/mysql-test/r/subselect3.result +++ b/mysql-test/r/subselect3.result @@ -314,7 +314,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 index_subquery idx idx 5 func 4 100.00 Using where; Full scan on NULL key Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on idx checking NULL where ((`test`.`t1`.`oref` = `test`.`t2`.`oref`) and trigcond(trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`ie1`) or isnull(`test`.`t1`.`ie1`)))) and trigcond(trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`ie2`) or isnull(`test`.`t1`.`ie2`))))) having (trigcond(<is_not_null_test>(`test`.`t1`.`ie1`)) and trigcond(<is_not_null_test>(`test`.`t1`.`ie2`))))))) AS `Z` from `test`.`t2` where ((`test`.`t2`.`b` = 10) and (`test`.`t2`.`a` = 10)) +Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on idx checking NULL where ((`test`.`t1`.`oref` = `test`.`t2`.`oref`) and trigcond(trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`ie1`) or isnull(`test`.`t1`.`ie1`)))) and trigcond(trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`ie2`) or isnull(`test`.`t1`.`ie2`))))) having (trigcond(<is_not_null_test>(`test`.`t1`.`ie1`)) and trigcond(<is_not_null_test>(`test`.`t1`.`ie2`))))))) AS `Z` from `test`.`t2` where ((`test`.`t2`.`a` = 10) and (`test`.`t2`.`b` = 10)) drop table t1, t2; create table t1 (oref char(4), grp int, ie int); insert into t1 (oref, grp, ie) values @@ -1416,7 +1416,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY c eq_ref PRIMARY PRIMARY 4 test.cona.idContact 1 100.00 Using where 1 PRIMARY a eq_ref PRIMARY PRIMARY 4 test.c.idObj 1 100.00 Using index; End temporary Warnings: -Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where ((`test`.`c`.`idContact` = `test`.`cona`.`idContact`) and (`test`.`a`.`idIndividual` = `test`.`c`.`idObj`) and (`test`.`cona`.`postalStripped` = 'T2H3B2')) +Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where ((`test`.`cona`.`postalStripped` = 'T2H3B2') and (`test`.`a`.`idIndividual` = `test`.`c`.`idObj`) and (`test`.`c`.`idContact` = `test`.`cona`.`idContact`)) set @@optimizer_switch=@save_optimizer_switch; drop table t1,t2,t3; # diff --git a/mysql-test/r/subselect3_jcl6.result b/mysql-test/r/subselect3_jcl6.result index 4f85f0faaab..5bae1453a5e 100644 --- a/mysql-test/r/subselect3_jcl6.result +++ b/mysql-test/r/subselect3_jcl6.result @@ -324,7 +324,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 index_subquery idx idx 5 func 4 100.00 Using where; Full scan on NULL key Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on idx checking NULL where ((`test`.`t1`.`oref` = `test`.`t2`.`oref`) and trigcond(trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`ie1`) or isnull(`test`.`t1`.`ie1`)))) and trigcond(trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`ie2`) or isnull(`test`.`t1`.`ie2`))))) having (trigcond(<is_not_null_test>(`test`.`t1`.`ie1`)) and trigcond(<is_not_null_test>(`test`.`t1`.`ie2`))))))) AS `Z` from `test`.`t2` where ((`test`.`t2`.`b` = 10) and (`test`.`t2`.`a` = 10)) +Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on idx checking NULL where ((`test`.`t1`.`oref` = `test`.`t2`.`oref`) and trigcond(trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`ie1`) or isnull(`test`.`t1`.`ie1`)))) and trigcond(trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`ie2`) or isnull(`test`.`t1`.`ie2`))))) having (trigcond(<is_not_null_test>(`test`.`t1`.`ie1`)) and trigcond(<is_not_null_test>(`test`.`t1`.`ie2`))))))) AS `Z` from `test`.`t2` where ((`test`.`t2`.`a` = 10) and (`test`.`t2`.`b` = 10)) drop table t1, t2; create table t1 (oref char(4), grp int, ie int); insert into t1 (oref, grp, ie) values @@ -1426,7 +1426,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY c eq_ref PRIMARY PRIMARY 4 test.cona.idContact 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan 1 PRIMARY a eq_ref PRIMARY PRIMARY 4 test.c.idObj 1 100.00 Using index; End temporary Warnings: -Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where ((`test`.`c`.`idContact` = `test`.`cona`.`idContact`) and (`test`.`a`.`idIndividual` = `test`.`c`.`idObj`) and (`test`.`cona`.`postalStripped` = 'T2H3B2')) +Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where ((`test`.`cona`.`postalStripped` = 'T2H3B2') and (`test`.`a`.`idIndividual` = `test`.`c`.`idObj`) and (`test`.`c`.`idContact` = `test`.`cona`.`idContact`)) set @@optimizer_switch=@save_optimizer_switch; drop table t1,t2,t3; # diff --git a/mysql-test/r/subselect_exists2in.result b/mysql-test/r/subselect_exists2in.result index dc229146a90..efbbe08cede 100644 --- a/mysql-test/r/subselect_exists2in.result +++ b/mysql-test/r/subselect_exists2in.result @@ -387,7 +387,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a1' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` semi join (`test`.`t3`) where ((`test`.`t1`.`a1` = `test`.`t3`.`b1`) and (`test`.`t1`.`a` = `test`.`t3`.`b`)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` semi join (`test`.`t3`) where ((`test`.`t1`.`a` = `test`.`t3`.`b`) and (`test`.`t1`.`a1` = `test`.`t3`.`b1`)) -- EXIST to IN then IN to EXISTS set optimizer_switch='exists_to_in=on,in_to_exists=on,semijoin=off,materialization=off,subquery_cache=off'; SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1); diff --git a/mysql-test/r/subselect_exists_to_in.result b/mysql-test/r/subselect_exists_to_in.result index b680e7623f5..b639fc7eca0 100644 --- a/mysql-test/r/subselect_exists_to_in.result +++ b/mysql-test/r/subselect_exists_to_in.result @@ -1461,7 +1461,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) 1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t3`.`a` = `test`.`t1`.`b`)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` = `test`.`t2`.`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)); @@ -1504,7 +1504,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 index a a 5 NULL 3 100.00 Using where; Using index 1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` = `test`.`t3`.`a`)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and (`test`.`t1`.`a` = `test`.`t2`.`a`)) insert into t1 values (3,31); select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a @@ -2978,7 +2978,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`flag` = 'N')) +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where (`test`.`t2`.`flag` = 'N') explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result index 9bb26e8a6e0..53334dbc32b 100644 --- a/mysql-test/r/subselect_mat.result +++ b/mysql-test/r/subselect_mat.result @@ -1896,7 +1896,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (select max(`test`.`t2`.`c`) from `test`.`t2`) join `test`.`t1` where ((`test`.`t1`.`a` = `<subquery2>`.`MAX(c)`) and (`test`.`t1`.`b` = 7) and (<cache>(isnull(`<subquery2>`.`MAX(c)`)) or (`<subquery2>`.`MAX(c)` = 7))) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (select max(`test`.`t2`.`c`) from `test`.`t2`) join `test`.`t1` where ((`test`.`t1`.`b` = 7) and (`test`.`t1`.`a` = `<subquery2>`.`MAX(c)`) and (<cache>(isnull(`<subquery2>`.`MAX(c)`)) or (`<subquery2>`.`MAX(c)` = 7))) SELECT * FROM t1 WHERE a IN (SELECT MAX(c) FROM t2) AND b=7 AND (a IS NULL OR a=b); a b diff --git a/mysql-test/r/subselect_mat_cost_bugs.result b/mysql-test/r/subselect_mat_cost_bugs.result index 8c95c8637aa..24640154c59 100644 --- a/mysql-test/r/subselect_mat_cost_bugs.result +++ b/mysql-test/r/subselect_mat_cost_bugs.result @@ -100,7 +100,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 index c3 c3 9 NULL 2 100.00 Using where; Using index; Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t1.pk' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` where <expr_cache><`test`.`t1`.`c1`,`test`.`t1`.`pk`>(<in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t1a`.`c1` from `test`.`t1b` join `test`.`t2` left join `test`.`t1a` on((2 and (`test`.`t1a`.`c2` = `test`.`t1b`.`pk`))) where ((`test`.`t1`.`pk` <> 0) and (<cache>(`test`.`t1`.`c1`) = `test`.`t1a`.`c1`) and (`test`.`t2`.`c3` = `test`.`t1b`.`c4`))))) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` where <expr_cache><`test`.`t1`.`c1`,`test`.`t1`.`pk`>(<in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t1a`.`c1` from `test`.`t1b` join `test`.`t2` left join `test`.`t1a` on(((`test`.`t1a`.`c2` = `test`.`t1b`.`pk`) and 2)) where ((`test`.`t1`.`pk` <> 0) and (<cache>(`test`.`t1`.`c1`) = `test`.`t1a`.`c1`) and (`test`.`t2`.`c3` = `test`.`t1b`.`c4`))))) SELECT pk FROM t1 WHERE c1 IN diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result index ba3b8e791d2..8a5016d47ee 100644 --- a/mysql-test/r/subselect_no_mat.result +++ b/mysql-test/r/subselect_no_mat.result @@ -1464,7 +1464,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) 1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t3`.`a` = `test`.`t1`.`b`)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` = `test`.`t2`.`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)); @@ -1507,7 +1507,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 index a a 5 NULL 3 100.00 Using where; Using index 1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` = `test`.`t3`.`a`)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and (`test`.`t1`.`a` = `test`.`t2`.`a`)) insert into t1 values (3,31); select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a @@ -2979,7 +2979,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 1 PRIMARY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`two` = `test`.`t1`.`two`) and (`test`.`t2`.`one` = `test`.`t1`.`one`) and (`test`.`t2`.`flag` = 'N')) +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`flag` = 'N') and (`test`.`t2`.`one` = `test`.`t1`.`one`) and (`test`.`t2`.`two` = `test`.`t1`.`two`)) explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result index a75c6dc5966..b53405ad8bd 100644 --- a/mysql-test/r/subselect_no_scache.result +++ b/mysql-test/r/subselect_no_scache.result @@ -1463,7 +1463,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) 1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t3`.`a` = `test`.`t1`.`b`)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` = `test`.`t2`.`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)); @@ -1506,7 +1506,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 index a a 5 NULL 3 100.00 Using where; Using index 1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` = `test`.`t3`.`a`)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and (`test`.`t1`.`a` = `test`.`t2`.`a`)) insert into t1 values (3,31); select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a @@ -2979,7 +2979,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`flag` = 'N')) +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where (`test`.`t2`.`flag` = 'N') explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result index d9fa9853da5..a4e4922474e 100644 --- a/mysql-test/r/subselect_sj.result +++ b/mysql-test/r/subselect_sj.result @@ -74,7 +74,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t10 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using where 1 PRIMARY t12 eq_ref PRIMARY PRIMARY 4 test.t10.a 1 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t10`.`pk` = `test`.`t1`.`a`) and (`test`.`t12`.`pk` = `test`.`t10`.`a`)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t12`.`pk` = `test`.`t10`.`a`) and (`test`.`t10`.`pk` = `test`.`t1`.`a`)) subqueries within outer joins go into ON expr. explAin extended select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); @@ -84,7 +84,7 @@ id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA 1 PRIMARY B ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on((<in_optimizer>(`test`.`B`.`A`,`test`.`B`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`B`.`A` in <temporAry tABle> on distinct_key where ((`test`.`B`.`A` = `<suBquery2>`.`pk`))))) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where 1 +Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`A`.`A` = `test`.`t1`.`A`) And <in_optimizer>(`test`.`B`.`A`,`test`.`B`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`B`.`A` in <temporAry tABle> on distinct_key where ((`test`.`B`.`A` = `<suBquery2>`.`pk`))))))) where 1 t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" explAin extended select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); @@ -93,7 +93,7 @@ id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA 1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on((<in_optimizer>(`test`.`t2`.`A`,`test`.`t2`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`t2`.`A` in <temporAry tABle> on distinct_key where ((`test`.`t2`.`A` = `<suBquery2>`.`pk`))))) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where 1 +Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(((`test`.`t2`.`A` = `test`.`t1`.`A`) And <in_optimizer>(`test`.`t1`.`A`,`test`.`t1`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`t1`.`A` in <temporAry tABle> on distinct_key where ((`test`.`t1`.`A` = `<suBquery2>`.`pk`))))))) where 1 we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09, @@ -501,7 +501,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t0.pk 1 100.00 Using where 1 PRIMARY t2 ref vkey vkey 4 test.t1.vnokey 2 100.00 Using index; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t0`.`vkey` AS `vkey` from `test`.`t0` `t1` semi join (`test`.`t0` `t2`) join `test`.`t0` where ((`test`.`t2`.`vkey` = `test`.`t1`.`vnokey`) and (`test`.`t1`.`pk` = `test`.`t0`.`pk`)) +Note 1003 select `test`.`t0`.`vkey` AS `vkey` from `test`.`t0` `t1` semi join (`test`.`t0` `t2`) join `test`.`t0` where ((`test`.`t1`.`pk` = `test`.`t0`.`pk`) and (`test`.`t2`.`vkey` = `test`.`t1`.`vnokey`)) SELECT vkey FROM t0 WHERE pk IN (SELECT t1.pk FROM t0 t1 JOIN t0 t2 ON t2.vkey = t1.vnokey); vkey @@ -814,7 +814,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`c` = `test`.`t1`.`c`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`c` = `test`.`t1`.`c`) and (`test`.`t2`.`pk` > 0)) SELECT pk FROM t1 WHERE (b, c) IN (SELECT b, c FROM t2 WHERE pk > 0); pk 1 @@ -824,7 +824,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`d` = `test`.`t1`.`d`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`d` = `test`.`t1`.`d`) and (`test`.`t2`.`pk` > 0)) SELECT pk FROM t1 WHERE (b, d) IN (SELECT b, d FROM t2 WHERE pk > 0); pk 2 @@ -833,7 +833,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`e` = `test`.`t1`.`e`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`e` = `test`.`t1`.`e`) and (`test`.`t2`.`pk` > 0)) SELECT pk FROM t1 WHERE (b, e) IN (SELECT b, e FROM t2 WHERE pk > 0); pk 1 @@ -843,7 +843,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`f` = `test`.`t1`.`f`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`f` = `test`.`t1`.`f`) and (`test`.`t2`.`pk` > 0)) SELECT pk FROM t1 WHERE (b, f) IN (SELECT b, f FROM t2 WHERE pk > 0); pk 1 @@ -853,7 +853,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`g` = `test`.`t1`.`g`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`g` = `test`.`t1`.`g`) and (`test`.`t2`.`pk` > 0)) SELECT pk FROM t1 WHERE (b, g) IN (SELECT b, g FROM t2 WHERE pk > 0); pk 1 @@ -863,7 +863,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`h` = `test`.`t1`.`h`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`h` = `test`.`t1`.`h`) and (`test`.`t2`.`pk` > 0)) SELECT pk FROM t1 WHERE (b, h) IN (SELECT b, h FROM t2 WHERE pk > 0); pk 1 @@ -873,7 +873,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`i` = `test`.`t1`.`i`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`i` = `test`.`t1`.`i`) and (`test`.`t2`.`pk` > 0)) SELECT pk FROM t1 WHERE (b, i) IN (SELECT b, i FROM t2 WHERE pk > 0); pk 1 @@ -883,7 +883,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`j` = `test`.`t1`.`j`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`j` = `test`.`t1`.`j`) and (`test`.`t2`.`pk` > 0)) SELECT pk FROM t1 WHERE (b, j) IN (SELECT b, j FROM t2 WHERE pk > 0); pk 1 @@ -893,7 +893,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`k` = `test`.`t1`.`k`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`k` = `test`.`t1`.`k`) and (`test`.`t2`.`pk` > 0)) SELECT pk FROM t1 WHERE (b, k) IN (SELECT b, k FROM t2 WHERE pk > 0); pk 1 @@ -1994,7 +1994,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) 1 PRIMARY t3 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t2`.`f3` AS `f3`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` semi join (`test`.`t4`) join `test`.`t2` join `test`.`t3` where ((`test`.`t1`.`f2` = `test`.`t2`.`f2`) and (`test`.`t3`.`f1` = `test`.`t1`.`f1`) and (`test`.`t4`.`f2` = `test`.`t2`.`f3`)) +Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t2`.`f3` AS `f3`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` semi join (`test`.`t4`) join `test`.`t2` join `test`.`t3` where ((`test`.`t4`.`f2` = `test`.`t2`.`f3`) and (`test`.`t3`.`f1` = `test`.`t1`.`f1`) and (`test`.`t1`.`f2` = `test`.`t2`.`f2`)) SELECT * FROM t1 NATURAL LEFT JOIN (t2, t3) WHERE t2.f3 IN (SELECT * FROM t4); f1 f2 f3 f3 2 0 0 0 diff --git a/mysql-test/r/subselect_sj2.result b/mysql-test/r/subselect_sj2.result index 97e36cd705c..c4b9933ae07 100644 --- a/mysql-test/r/subselect_sj2.result +++ b/mysql-test/r/subselect_sj2.result @@ -456,7 +456,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2) Warnings: Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where ((`test`.`t1`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`a` = `test`.`t0`.`a`)) +Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where ((`test`.`t2`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`b` = `test`.`t2`.`b`)) update t1 set a=3, b=11 where a=4; update t2 set b=11 where a=3; select * from t0 where t0.a in diff --git a/mysql-test/r/subselect_sj2_jcl6.result b/mysql-test/r/subselect_sj2_jcl6.result index e4030b8138b..d9b9815133c 100644 --- a/mysql-test/r/subselect_sj2_jcl6.result +++ b/mysql-test/r/subselect_sj2_jcl6.result @@ -468,7 +468,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2); Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan Warnings: Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where ((`test`.`t1`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`a` = `test`.`t0`.`a`)) +Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where ((`test`.`t2`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`b` = `test`.`t2`.`b`)) update t1 set a=3, b=11 where a=4; update t2 set b=11 where a=3; # Not anymore: diff --git a/mysql-test/r/subselect_sj2_mat.result b/mysql-test/r/subselect_sj2_mat.result index f69befc8608..c91ee67a717 100644 --- a/mysql-test/r/subselect_sj2_mat.result +++ b/mysql-test/r/subselect_sj2_mat.result @@ -458,7 +458,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2) Warnings: Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where ((`test`.`t1`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`a` = `test`.`t0`.`a`)) +Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where ((`test`.`t2`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`b` = `test`.`t2`.`b`)) update t1 set a=3, b=11 where a=4; update t2 set b=11 where a=3; select * from t0 where t0.a in @@ -1124,3 +1124,267 @@ AND ( 6 ) IN ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay DROP TABLE t1, t2; set max_join_size= @tmp_906385; +# +# mdev-3995: Wrong result for semijoin with materialization +# +set @save_optimizer_switch=@@optimizer_switch; +CREATE TABLE t1 ( +cat_id int(10) unsigned NOT NULL, +PRIMARY KEY (cat_id) +) ENGINE=MyISAM; +INSERT INTO t1 VALUES +(709411),(709412),(709413),(709414),(709416),(709417),(709418),(709419),(709421),(709422), +(709424),(709425),(709427),(709428),(709429),(709431),(709432),(709433),(709434),(709435), +(709438),(709439),(709441),(709442),(709443),(709444),(709445),(709446),(709447),(709450), +(709451),(709454),(709455),(709456),(709457),(709459),(709460),(709461),(709462),(709463), +(709464),(709465),(709467),(709469),(709470),(709471),(709472),(709473),(709474),(709475), +(709476),(709477),(709478),(709479),(709480),(709481),(709483),(709484),(709485),(709487), +(709490),(709491),(709492),(709493),(709494),(709495),(709496),(709497),(709498),(709499), +(709500),(709501),(709502),(709503),(709504),(709505),(709506),(709507),(709509),(709510), +(709511),(709512),(709513),(709514),(709515),(709516),(709517),(709518),(709519),(709520), +(709521),(709522),(709523),(709524),(709525),(709526),(709527),(709528),(709529),(709530), +(709531),(709532),(709533),(709534),(709535),(709536),(709537),(709538),(709539),(709540), +(709541),(709542),(709543),(709544),(709545),(709546),(709548),(709549),(709551),(709552), +(709553),(709555),(709556),(709557),(709558),(709559),(709560),(709561),(709562),(709563), +(709564),(709565),(709566),(709567),(709568),(709569),(709570),(709571),(709572),(709573), +(709574),(709575),(709576),(709577),(709578),(709579),(709580),(709581),(709582),(709583), +(709584),(709585),(709586),(709587),(709588),(709590),(709591),(709592),(709593),(709594), +(709595),(709596),(709597),(709598),(709600),(709601),(709602),(709603),(709604),(709605), +(709606),(709608),(709609),(709610),(709611),(709612),(709613),(709614),(709615),(709616), +(709617),(709618),(709619),(709620),(709621),(709622),(709623),(709624),(709625),(709626), +(709627),(709628),(709629),(709630),(709631),(709632),(709633),(709634),(709635),(709637), +(709638),(709639),(709640),(709641),(709642),(709643),(709644),(709645),(709646),(709649), +(709650),(709651),(709652),(709653),(709654),(709655),(709656),(709657),(709658),(709659); +CREATE TABLE t2 ( +cat_id int(10) NOT NULL, +KEY cat_id (cat_id) +) ENGINE=MyISAM; +INSERT INTO t2 VALUES +(708742),(708755),(708759),(708761),(708766),(708769),(708796),(708798),(708824),(708825), +(708838),(708844),(708861),(708882),(708887),(708889),(708890),(709586),(709626); +CREATE TABLE t3 ( +sack_id int(10) unsigned NOT NULL, +kit_id tinyint(3) unsigned NOT NULL DEFAULT '0', +cat_id int(10) unsigned NOT NULL, +PRIMARY KEY (sack_id,kit_id,cat_id) +) ENGINE=MyISAM; +INSERT INTO t3 VALUES +(33479,6,708523),(33479,6,708632),(33479,6,709085),(33479,6,709586),(33479,6,709626); +CREATE TABLE t4 ( +cat_id int(10) unsigned NOT NULL, +KEY cat_id (cat_id) +) ENGINE=MyISAM; +INSERT INTO t4 (cat_id) SELECT cat_id from t2; +set optimizer_switch='materialization=off'; +EXPLAIN +SELECT count(*) FROM t1, t3 +WHERE t1.cat_id = t3.cat_id AND +t3.cat_id IN (SELECT cat_id FROM t2) AND +t3.sack_id = 33479 AND t3.kit_id = 6; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t3 ref PRIMARY PRIMARY 5 const,const 4 Using index +1 PRIMARY t2 ref cat_id cat_id 4 test.t3.cat_id 2 Using where; Using index; FirstMatch(t3) +1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.cat_id 1 Using where; Using index +SELECT count(*) FROM t1, t3 +WHERE t1.cat_id = t3.cat_id AND +t3.cat_id IN (SELECT cat_id FROM t2) AND +t3.sack_id = 33479 AND t3.kit_id = 6; +count(*) +2 +set optimizer_switch='materialization=on'; +EXPLAIN +SELECT count(*) FROM t1, t3 +WHERE t1.cat_id = t3.cat_id AND +t3.cat_id IN (SELECT cat_id FROM t4) AND +t3.sack_id = 33479 AND t3.kit_id = 6; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t3 ref PRIMARY PRIMARY 5 const,const 4 Using index +1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t3.cat_id 1 Using index +2 MATERIALIZED t4 index cat_id cat_id 4 NULL 19 Using index +SELECT count(*) FROM t1, t3 +WHERE t1.cat_id = t3.cat_id AND +t3.cat_id IN (SELECT cat_id FROM t4) AND +t3.sack_id = 33479 AND t3.kit_id = 6; +count(*) +2 +EXPLAIN +SELECT count(*) FROM t1, t3 +WHERE t1.cat_id = t3.cat_id AND +t3.cat_id IN (SELECT cat_id FROM t2) AND +t3.sack_id = 33479 AND t3.kit_id = 6; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t3 ref PRIMARY PRIMARY 5 const,const 4 Using index +1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 Using where +1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t3.cat_id 1 Using index +2 MATERIALIZED t2 index cat_id cat_id 4 NULL 19 Using index +SELECT count(*) FROM t1, t3 +WHERE t1.cat_id = t3.cat_id AND +t3.cat_id IN (SELECT cat_id FROM t2) AND +t3.sack_id = 33479 AND t3.kit_id = 6; +count(*) +2 +DROP TABLE t1,t2,t3,t4; +set optimizer_switch=@save_optimizer_switch; +# +# mdev-3913: LEFT JOIN with materialized multi-table IN subquery in WHERE +# +set @save_optimizer_switch=@@optimizer_switch; +CREATE TABLE t1 (a1 char(1), b1 char(1), index idx(b1,a1)); +INSERT INTO t1 VALUES ('f','c'),('d','m'),('g','y'); +INSERT INTO t1 VALUES ('f','c'),('d','m'),('g','y'); +CREATE TABLE t2 (a2 char(1), b2 char(1)); +INSERT INTO t2 VALUES ('y','y'),('y','y'),('w','w'); +CREATE TABLE t3 (a3 int); +INSERT INTO t3 VALUES (8),(6); +CREATE TABLE t4 (a4 char(1), b4 char(1)); +INSERT INTO t4 VALUES ('y','y'),('y','y'),('w','w'); +set optimizer_switch='materialization=off'; +EXPLAIN EXTENDED +SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 ) +WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Start temporary +1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t1 ref idx idx 2 test.t4.a4 1 100.00 Using index; End temporary +1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +Warnings: +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on((`test`.`t2`.`a2` = `test`.`t4`.`a4`)) where ((`test`.`t4`.`b4` = `test`.`t4`.`a4`) and (`test`.`t1`.`b1` = `test`.`t4`.`a4`)) +SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 ) +WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4); +a1 b1 a2 b2 +g y y y +g y y y +g y y y +g y y y +set optimizer_switch='materialization=on'; +EXPLAIN EXTENDED +SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 ) +WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 100.00 +1 PRIMARY t1 ref idx idx 2 test.t4.a4 1 100.00 Using index +1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t4 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +Warnings: +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(((`test`.`t1`.`b1` = `test`.`t4`.`a4`) and (`test`.`t2`.`a2` = `test`.`t4`.`a4`))) where ((`test`.`t4`.`b4` = `test`.`t4`.`a4`) and (`test`.`t1`.`b1` = `test`.`t4`.`a4`)) +SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 ) +WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4); +a1 b1 a2 b2 +g y y y +g y y y +g y y y +g y y y +DROP TABLE t1,t2,t3,t4; +set optimizer_switch=@save_optimizer_switch; +# +# mdev-4172: LEFT JOIN with materialized multi-table IN subquery in WHERE +# and OR in ON condition +# +set @save_optimizer_switch=@@optimizer_switch; +CREATE TABLE t1 (a1 int, c1 varchar(1)); +INSERT t1 VALUES (7,'v'), (3,'y'); +CREATE TABLE t2 (c2 varchar(1)); +INSERT INTO t2 VALUES ('y'), ('y'); +CREATE TABLE t3 (c3 varchar(1)); +INSERT INTO t3 VALUES +('j'), ('v'), ('c'), ('m'), ('d'), +('d'), ('y'), ('t'), ('d'), ('s'); +CREATE TABLE t4 (a4 int, c4 varchar(1)); +INSERT INTO t4 SELECT * FROM t1; +set optimizer_switch='materialization=off'; +EXPLAIN EXTENDED +SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z') +WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t3 ALL NULL NULL NULL NULL 10 100.00 Using where; End temporary; Using join buffer (flat, BNL join) +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +Warnings: +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(((`test`.`t2`.`c2` = `test`.`t1`.`c1`) or (`test`.`t1`.`c1` > 'z'))) where ((`test`.`t4`.`c4` = `test`.`t1`.`c1`) and (`test`.`t3`.`c3` = `test`.`t1`.`c1`)) +SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z') +WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4); +a1 c1 c2 +3 y y +3 y y +7 v NULL +set optimizer_switch='materialization=on'; +EXPLAIN EXTENDED +SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z') +WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t4 ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t3 ALL NULL NULL NULL NULL 10 100.00 Using where; Using join buffer (flat, BNL join) +Warnings: +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(((`test`.`t2`.`c2` = `test`.`t1`.`c1`) or (`test`.`t1`.`c1` > 'z'))) where (`test`.`t3`.`c3` = `test`.`t4`.`c4`) +SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z') +WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4); +a1 c1 c2 +3 y y +3 y y +7 v NULL +DROP TABLE t1,t2,t3,t4; +set optimizer_switch=@save_optimizer_switch; +# +# mdev-4177: materialization of a subquery whose WHERE condition is OR +# formula with two disjucts such that the second one is always false +# +set @save_optimizer_switch=@@optimizer_switch; +set @save_join_cache_level=@@join_cache_level; +CREATE TABLE t1 (i1 int) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1), (7), (4), (8), (4); +CREATE TABLE t2 (i2 int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (7), (5); +CREATE TABLE t3 (i3 int) ENGINE=MyISAM; +INSERT INTO t3 VALUES (7), (2), (9); +set join_cache_level=3; +set optimizer_switch='materialization=off,semijoin=off'; +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using where +2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY t3 hash_ALL NULL #hash#$hj 5 func 3 100.00 Using where; Using join buffer (flat, BNLH join) +Warnings: +Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` where <expr_cache><`test`.`t1`.`i1`>(<in_optimizer>(`test`.`t1`.`i1`,<exists>(select `test`.`t3`.`i3` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (<cache>(`test`.`t1`.`i1`) = `test`.`t3`.`i3`))))) +SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2); +i1 +7 +set optimizer_switch='materialization=on,semijoin=on'; +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 100.00 +1 PRIMARY t1 hash_ALL NULL #hash#$hj 5 test.t2.i2 5 100.00 Using where; Using join buffer (flat, BNLH join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 Using where +2 MATERIALIZED t3 hash_ALL NULL #hash#$hj 5 test.t2.i2 3 100.00 Using where; Using join buffer (flat, BNLH join) +Warnings: +Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (`test`.`t1`.`i1` = `test`.`t2`.`i2`)) +SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2); +i1 +7 +EXPLAIN EXTENDED +SELECT * FROM t1 +WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 0 AND i3 = i2 OR 1=2); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 100.00 +1 PRIMARY t1 hash_ALL NULL #hash#$hj 5 test.t2.i2 5 100.00 Using where; Using join buffer (flat, BNLH join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 Using where +2 MATERIALIZED t3 hash_ALL NULL #hash#$hj 5 test.t2.i2 3 100.00 Using where; Using join buffer (flat, BNLH join) +Warnings: +Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (`test`.`t1`.`i1` = `test`.`t2`.`i2`) and (`test`.`t3`.`i3` > 0)) +SELECT * FROM t1 +WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 0 AND i3 = i2 OR 1=2); +i1 +7 +SELECT * FROM t1 +WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 7 AND i3 = i2 OR 1=2); +i1 +DROP TABLE t1,t2,t3; +set join_cache_level= @save_join_cache_level; +set optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result index 1ca8b44a0b8..4e67c1cc01c 100644 --- a/mysql-test/r/subselect_sj_jcl6.result +++ b/mysql-test/r/subselect_sj_jcl6.result @@ -87,7 +87,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t10 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan 1 PRIMARY t12 eq_ref PRIMARY PRIMARY 4 test.t10.a 1 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t10`.`pk` = `test`.`t1`.`a`) and (`test`.`t12`.`pk` = `test`.`t10`.`a`)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t12`.`pk` = `test`.`t10`.`a`) and (`test`.`t10`.`pk` = `test`.`t1`.`a`)) subqueries within outer joins go into ON expr. explAin extended select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); @@ -97,7 +97,7 @@ id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA 1 PRIMARY B ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (incrementAl, BNL join) 2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on((<in_optimizer>(`test`.`B`.`A`,`test`.`B`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`B`.`A` in <temporAry tABle> on distinct_key where ((`test`.`B`.`A` = `<suBquery2>`.`pk`))))) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where 1 +Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`A`.`A` = `test`.`t1`.`A`) And <in_optimizer>(`test`.`B`.`A`,`test`.`B`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`B`.`A` in <temporAry tABle> on distinct_key where ((`test`.`B`.`A` = `<suBquery2>`.`pk`))))))) where 1 t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" explAin extended select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); @@ -106,7 +106,7 @@ id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA 1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (flAt, BNL join) 2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on((<in_optimizer>(`test`.`t2`.`A`,`test`.`t2`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`t2`.`A` in <temporAry tABle> on distinct_key where ((`test`.`t2`.`A` = `<suBquery2>`.`pk`))))) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where 1 +Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(((`test`.`t2`.`A` = `test`.`t1`.`A`) And <in_optimizer>(`test`.`t1`.`A`,`test`.`t1`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`t1`.`A` in <temporAry tABle> on distinct_key where ((`test`.`t1`.`A` = `<suBquery2>`.`pk`))))))) where 1 we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09, @@ -514,7 +514,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t0.pk 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan 1 PRIMARY t2 ref vkey vkey 4 test.t1.vnokey 2 100.00 Using index; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t0`.`vkey` AS `vkey` from `test`.`t0` `t1` semi join (`test`.`t0` `t2`) join `test`.`t0` where ((`test`.`t2`.`vkey` = `test`.`t1`.`vnokey`) and (`test`.`t1`.`pk` = `test`.`t0`.`pk`)) +Note 1003 select `test`.`t0`.`vkey` AS `vkey` from `test`.`t0` `t1` semi join (`test`.`t0` `t2`) join `test`.`t0` where ((`test`.`t1`.`pk` = `test`.`t0`.`pk`) and (`test`.`t2`.`vkey` = `test`.`t1`.`vnokey`)) SELECT vkey FROM t0 WHERE pk IN (SELECT t1.pk FROM t0 t1 JOIN t0 t2 ON t2.vkey = t1.vnokey); vkey @@ -827,7 +827,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`c` = `test`.`t1`.`c`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`c` = `test`.`t1`.`c`) and (`test`.`t2`.`pk` > 0)) SELECT pk FROM t1 WHERE (b, c) IN (SELECT b, c FROM t2 WHERE pk > 0); pk 1 @@ -837,7 +837,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`d` = `test`.`t1`.`d`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`d` = `test`.`t1`.`d`) and (`test`.`t2`.`pk` > 0)) SELECT pk FROM t1 WHERE (b, d) IN (SELECT b, d FROM t2 WHERE pk > 0); pk 2 @@ -846,7 +846,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`e` = `test`.`t1`.`e`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`e` = `test`.`t1`.`e`) and (`test`.`t2`.`pk` > 0)) SELECT pk FROM t1 WHERE (b, e) IN (SELECT b, e FROM t2 WHERE pk > 0); pk 1 @@ -856,7 +856,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`f` = `test`.`t1`.`f`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`f` = `test`.`t1`.`f`) and (`test`.`t2`.`pk` > 0)) SELECT pk FROM t1 WHERE (b, f) IN (SELECT b, f FROM t2 WHERE pk > 0); pk 1 @@ -866,7 +866,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`g` = `test`.`t1`.`g`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`g` = `test`.`t1`.`g`) and (`test`.`t2`.`pk` > 0)) SELECT pk FROM t1 WHERE (b, g) IN (SELECT b, g FROM t2 WHERE pk > 0); pk 1 @@ -876,7 +876,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`h` = `test`.`t1`.`h`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`h` = `test`.`t1`.`h`) and (`test`.`t2`.`pk` > 0)) SELECT pk FROM t1 WHERE (b, h) IN (SELECT b, h FROM t2 WHERE pk > 0); pk 1 @@ -886,7 +886,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`i` = `test`.`t1`.`i`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`i` = `test`.`t1`.`i`) and (`test`.`t2`.`pk` > 0)) SELECT pk FROM t1 WHERE (b, i) IN (SELECT b, i FROM t2 WHERE pk > 0); pk 1 @@ -896,7 +896,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`j` = `test`.`t1`.`j`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`j` = `test`.`t1`.`j`) and (`test`.`t2`.`pk` > 0)) SELECT pk FROM t1 WHERE (b, j) IN (SELECT b, j FROM t2 WHERE pk > 0); pk 1 @@ -906,7 +906,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`k` = `test`.`t1`.`k`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`k` = `test`.`t1`.`k`) and (`test`.`t2`.`pk` > 0)) SELECT pk FROM t1 WHERE (b, k) IN (SELECT b, k FROM t2 WHERE pk > 0); pk 1 @@ -2008,7 +2008,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (incremental, BNL join) 2 MATERIALIZED t4 index f2 f2 5 NULL 2 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t2`.`f3` AS `f3`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` semi join (`test`.`t4`) join `test`.`t2` join `test`.`t3` where ((`test`.`t1`.`f2` = `test`.`t2`.`f2`) and (`test`.`t3`.`f1` = `test`.`t1`.`f1`)) +Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t2`.`f3` AS `f3`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` semi join (`test`.`t4`) join `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`f1` = `test`.`t1`.`f1`) and (`test`.`t1`.`f2` = `test`.`t2`.`f2`)) SELECT * FROM t1 NATURAL LEFT JOIN (t2, t3) WHERE t2.f3 IN (SELECT * FROM t4); f1 f2 f3 f3 2 0 0 0 diff --git a/mysql-test/r/subselect_sj_mat.result b/mysql-test/r/subselect_sj_mat.result index f8598a3864d..549282c9dbe 100644 --- a/mysql-test/r/subselect_sj_mat.result +++ b/mysql-test/r/subselect_sj_mat.result @@ -86,7 +86,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1`,min(`test`.`t2`.`b2`) from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1`) join `test`.`t1` where ((`<subquery2>`.`min(b2)` = `test`.`t1`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1`.`a1`)) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1`,min(`test`.`t2`.`b2`) from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1`) join `test`.`t1` where ((`<subquery2>`.`b1` = `test`.`t1`.`a1`) and (`<subquery2>`.`min(b2)` = `test`.`t1`.`a2`)) select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1); a1 a2 1 - 01 2 - 01 @@ -120,7 +120,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2i index it2i1,it2i2,it2i3 it2i3 # NULL 5 40.00 Using where; Using index; LooseScan 1 PRIMARY t1i ref _it1_idx _it1_idx # _ref_ 1 100.00 Warnings: -Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) where ((`test`.`t1i`.`a2` = `test`.`t2i`.`b2`) and (`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` > '0')) +Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) where ((`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t1i`.`a2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b1` > '0')) select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0'); a1 a2 1 - 01 2 - 01 @@ -132,7 +132,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <subquery2> eq_ref distinct_key # # # 1 100.00 # 2 MATERIALIZED t2i range it2i1,it2i3 # # # 3 100.00 # Warnings: -Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1i` where ((`<subquery2>`.`max(b2)` = `test`.`t1i`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1i`.`a1`)) +Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1i` where ((`<subquery2>`.`b1` = `test`.`t1i`.`a1`) and (`<subquery2>`.`max(b2)` = `test`.`t1i`.`a2`)) select * from t1i where (a1, a2) in (select b1, max(b2) from t2i where b1 > '0' group by b1); a1 a2 1 - 01 2 - 01 @@ -144,7 +144,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <subquery2> eq_ref distinct_key # # # 1 100.00 # 2 MATERIALIZED t2i range it2i1,it2i3 # # # 3 100.00 # Warnings: -Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1i` where ((`<subquery2>`.`min(b2)` = `test`.`t1i`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1i`.`a1`)) +Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1i` where ((`<subquery2>`.`b1` = `test`.`t1i`.`a1`) and (`<subquery2>`.`min(b2)` = `test`.`t1i`.`a2`)) select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); a1 a2 1 - 01 2 - 01 @@ -156,7 +156,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00 2 MATERIALIZED t2i range NULL it2i3 9 NULL 3 100.00 Using index for group-by Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` group by `test`.`t2i`.`b1`) join `test`.`t1` where ((`<subquery2>`.`max(b2)` = `test`.`t1`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1`.`a1`)) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` group by `test`.`t2i`.`b1`) join `test`.`t1` where ((`<subquery2>`.`b1` = `test`.`t1`.`a1`) and (`<subquery2>`.`max(b2)` = `test`.`t1`.`a2`)) select * from t1 where (a1, a2) in (select b1, max(b2) from t2i group by b1); a1 a2 1 - 01 2 - 01 @@ -188,7 +188,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00 2 MATERIALIZED t2i range it2i1,it2i3 it2i3 18 NULL 3 100.00 Using where; Using index for group-by Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1` where ((`<subquery2>`.`min(b2)` = `test`.`t1`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1`.`a1`)) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1` where ((`<subquery2>`.`b1` = `test`.`t1`.`a1`) and (`<subquery2>`.`min(b2)` = `test`.`t1`.`a2`)) select * from t1 where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); a1 a2 1 - 01 2 - 01 @@ -236,7 +236,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` order by `test`.`t2`.`b1`,`test`.`t2`.`b2`) join `test`.`t1` where ((`<subquery2>`.`b2` = `test`.`t1`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1`.`a1`)) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` order by `test`.`t2`.`b1`,`test`.`t2`.`b2`) join `test`.`t1` where ((`<subquery2>`.`b1` = `test`.`t1`.`a1`) and (`<subquery2>`.`b2` = `test`.`t1`.`a2`)) select * from t1 where (a1, a2) in (select b1, b2 from t2 order by b1, b2); a1 a2 1 - 01 2 - 01 @@ -248,7 +248,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1i.a1,test.t1i.a2 1 100.00 2 MATERIALIZED t2i index NULL it2i3 18 NULL 5 100.00 Using index Warnings: -Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` order by `test`.`t2i`.`b1`,`test`.`t2i`.`b2`) join `test`.`t1i` where ((`<subquery2>`.`b2` = `test`.`t1i`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1i`.`a1`)) +Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` order by `test`.`t2i`.`b1`,`test`.`t2i`.`b2`) join `test`.`t1i` where ((`<subquery2>`.`b1` = `test`.`t1i`.`a1`) and (`<subquery2>`.`b2` = `test`.`t1i`.`a2`)) select * from t1i where (a1, a2) in (select b1, b2 from t2i order by b1, b2); a1 a2 1 - 01 2 - 01 @@ -305,7 +305,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 MATERIALIZED t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 80.00 Using where; Using index; Using join buffer (flat, BNL join) 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2`.`b1` > '0') and (`test`.`t3`.`c2` > '0')) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (`test`.`t2`.`b1` > '0') and (`test`.`t3`.`c2` > '0')) select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0') and (a1, a2) in (select c1, c2 from t3 @@ -324,7 +324,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3i ref it3i1,it3i2,it3i3 # # # 1 100.00 # 1 PRIMARY t2i ref it2i1,it2i2,it2i3 # # # 2 100.00 # Warnings: -Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where ((`test`.`t1i`.`a2` = `test`.`t2i`.`b2`) and (`test`.`t3i`.`c2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b2` = `test`.`t2i`.`b2`) and (`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t3i`.`c1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` > '0') and (`test`.`t2i`.`b2` > '0')) +Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where ((`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t3i`.`c1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` = `test`.`t2i`.`b1`) and (`test`.`t1i`.`a2` = `test`.`t2i`.`b2`) and (`test`.`t3i`.`c2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b1` > '0') and (`test`.`t2i`.`b2` > '0')) select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and (a1, a2) in (select c1, c2 from t3i @@ -349,7 +349,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where 3 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (<expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery3>`.`c2`)))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))) and (`test`.`t3`.`c2` > '0')) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (<expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery3>`.`c2`)))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))) and (`test`.`t3`.`c2` > '0')) select * from t1 where (a1, a2) in (select b1, b2 from t2 where b2 in (select c2 from t3 where c2 LIKE '%02') or @@ -375,7 +375,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t3a ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where ((`test`.`t2i`.`b2` = `test`.`t3c`.`c2`) and (`test`.`t2`.`b2` = `test`.`t1`.`a2`) and (`test`.`t2i`.`b1` = `test`.`t3c`.`c1`) and (`test`.`t2`.`b1` = `test`.`t1`.`a1`) and (<expr_cache><`test`.`t2`.`b2`,`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t2`.`b2`,<exists>(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))) and (`test`.`t3c`.`c2` > '0')) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where ((`test`.`t2i`.`b1` = `test`.`t3c`.`c1`) and (`test`.`t2`.`b1` = `test`.`t1`.`a1`) and (`test`.`t2i`.`b2` = `test`.`t3c`.`c2`) and (`test`.`t2`.`b2` = `test`.`t1`.`a2`) and (<expr_cache><`test`.`t2`.`b2`,`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t2`.`b2`,<exists>(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))) and (`test`.`t3c`.`c2` > '0')) select * from t1 where (a1, a2) in (select b1, b2 from t2 where b2 in (select c2 from t3 t3a where c1 = a1) or @@ -413,7 +413,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 7 UNION t2i ref it2i1,it2i2,it2i3 # # # 2 100.00 # NULL UNION RESULT <union1,7> ALL NULL # # # NULL NULL # Warnings: -Note 1003 (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (<expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery3>`.`c2`)))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))) and (`test`.`t3`.`c2` > '0'))) union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where ((`test`.`t1i`.`a2` = `test`.`t2i`.`b2`) and (`test`.`t3i`.`c2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b2` = `test`.`t2i`.`b2`) and (`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t3i`.`c1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` > '0') and (`test`.`t2i`.`b2` > '0'))) +Note 1003 (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (<expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery3>`.`c2`)))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))) and (`test`.`t3`.`c2` > '0'))) union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where ((`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t3i`.`c1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` = `test`.`t2i`.`b1`) and (`test`.`t1i`.`a2` = `test`.`t2i`.`b2`) and (`test`.`t3i`.`c2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b1` > '0') and (`test`.`t2i`.`b2` > '0'))) (select * from t1 where (a1, a2) in (select b1, b2 from t2 where b2 in (select c2 from t3 where c2 LIKE '%02') or @@ -443,7 +443,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))))) and (`test`.`t3`.`c2` > '0')) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))))) and (`test`.`t3`.`c2` > '0')) select * from t1 where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and (a1, a2) in (select c1, c2 from t3 @@ -467,7 +467,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) join `test`.`t3` where ((`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (`test`.`t3`.`c1` = `test`.`t1`.`a1`) and (`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))))) and (`test`.`t3`.`c2` > '0')) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) join `test`.`t3` where ((`test`.`t3`.`c1` = `test`.`t1`.`a1`) and (`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))))) and (`test`.`t3`.`c2` > '0')) select * from t1, t3 where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and (c1, c2) in (select c1, c2 from t3 @@ -513,7 +513,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a2' of SELECT #6 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where ((`test`.`t2i`.`b2` = `test`.`t1`.`a2`) and (`test`.`t3c`.`c2` = `test`.`t1`.`a2`) and (`test`.`t2`.`b2` = `test`.`t1`.`a2`) and (`test`.`t2i`.`b1` = `test`.`t1`.`a1`) and (`test`.`t3c`.`c1` = `test`.`t1`.`a1`) and (`test`.`t2`.`b1` = `test`.`t1`.`a1`) and (<expr_cache><`test`.`t2`.`b2`,`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t2`.`b2`,<exists>(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`)))))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where ((`test`.`t2i`.`b1` = `test`.`t1`.`a1`) and (`test`.`t3c`.`c1` = `test`.`t1`.`a1`) and (`test`.`t2`.`b1` = `test`.`t1`.`a1`) and (`test`.`t2i`.`b2` = `test`.`t1`.`a2`) and (`test`.`t3c`.`c2` = `test`.`t1`.`a2`) and (`test`.`t2`.`b2` = `test`.`t1`.`a2`) and (<expr_cache><`test`.`t2`.`b2`,`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t2`.`b2`,<exists>(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`)))))))) explain extended select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01'); id select_type table type possible_keys key key_len ref rows filtered Extra @@ -633,7 +633,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: -Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` semi join (`test`.`t2_16`) where ((`test`.`t2_16`.`b2` = `test`.`t1_16`.`a2`) and (`test`.`t2_16`.`b1` = `test`.`t1_16`.`a1`) and (`test`.`t1_16`.`a1` > '0')) +Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` semi join (`test`.`t2_16`) where ((`test`.`t2_16`.`b1` = `test`.`t1_16`.`a1`) and (`test`.`t2_16`.`b2` = `test`.`t1_16`.`a2`) and (`test`.`t1_16`.`a1` > '0')) select left(a1,7), left(a2,7) from t1_16 where (a1,a2) in (select b1, b2 from t2_16 where b1 > '0'); @@ -700,7 +700,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) 1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; End temporary; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t2_16` join `test`.`t2` join `test`.`t1_16`) where ((`test`.`t2_16`.`b2` = `test`.`t1_16`.`a2`) and (`test`.`t2_16`.`b1` = `test`.`t1_16`.`a1`) and (`test`.`t2`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2`.`b2` = substr(`test`.`t1_16`.`a2`,1,6)) and (`test`.`t3`.`c2` > '0') and (concat(`test`.`t1`.`a1`,'x') = left(`test`.`t1_16`.`a1`,8))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t2_16` join `test`.`t2` join `test`.`t1_16`) where ((`test`.`t2`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2_16`.`b1` = `test`.`t1_16`.`a1`) and (`test`.`t2_16`.`b2` = `test`.`t1_16`.`a2`) and (`test`.`t2`.`b2` = substr(`test`.`t1_16`.`a2`,1,6)) and (`test`.`t3`.`c2` > '0') and (concat(`test`.`t1`.`a1`,'x') = left(`test`.`t1_16`.`a1`,8))) drop table t1_16, t2_16, t3_16; set @blob_len = 512; set @suffix_len = @blob_len - @prefix_len; @@ -748,7 +748,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: -Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` semi join (`test`.`t2_512`) where ((`test`.`t2_512`.`b2` = `test`.`t1_512`.`a2`) and (`test`.`t2_512`.`b1` = `test`.`t1_512`.`a1`) and (`test`.`t1_512`.`a1` > '0')) +Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` semi join (`test`.`t2_512`) where ((`test`.`t2_512`.`b1` = `test`.`t1_512`.`a1`) and (`test`.`t2_512`.`b2` = `test`.`t1_512`.`a2`) and (`test`.`t1_512`.`a1` > '0')) select left(a1,7), left(a2,7) from t1_512 where (a1,a2) in (select b1, b2 from t2_512 where b1 > '0'); @@ -844,7 +844,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: -Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` semi join (`test`.`t2_1024`) where ((`test`.`t2_1024`.`b2` = `test`.`t1_1024`.`a2`) and (`test`.`t2_1024`.`b1` = `test`.`t1_1024`.`a1`) and (`test`.`t1_1024`.`a1` > '0')) +Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` semi join (`test`.`t2_1024`) where ((`test`.`t2_1024`.`b1` = `test`.`t1_1024`.`a1`) and (`test`.`t2_1024`.`b2` = `test`.`t1_1024`.`a2`) and (`test`.`t1_1024`.`a1` > '0')) select left(a1,7), left(a2,7) from t1_1024 where (a1,a2) in (select b1, b2 from t2_1024 where b1 > '0'); @@ -939,7 +939,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: -Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` semi join (`test`.`t2_1025`) where ((`test`.`t2_1025`.`b2` = `test`.`t1_1025`.`a2`) and (`test`.`t2_1025`.`b1` = `test`.`t1_1025`.`a1`) and (`test`.`t1_1025`.`a1` > '0')) +Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` semi join (`test`.`t2_1025`) where ((`test`.`t2_1025`.`b1` = `test`.`t1_1025`.`a1`) and (`test`.`t2_1025`.`b2` = `test`.`t1_1025`.`a2`) and (`test`.`t1_1025`.`a1` > '0')) select left(a1,7), left(a2,7) from t1_1025 where (a1,a2) in (select b1, b2 from t2_1025 where b1 > '0'); @@ -1027,7 +1027,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1bb ALL NULL NULL NULL NULL 3 100.00 1 PRIMARY t2bb ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: -Note 1003 select conv(`test`.`t1bb`.`a1`,10,2) AS `bin(a1)`,`test`.`t1bb`.`a2` AS `a2` from `test`.`t1bb` semi join (`test`.`t2bb`) where ((`test`.`t2bb`.`b2` = `test`.`t1bb`.`a2`) and (`test`.`t2bb`.`b1` = `test`.`t1bb`.`a1`)) +Note 1003 select conv(`test`.`t1bb`.`a1`,10,2) AS `bin(a1)`,`test`.`t1bb`.`a2` AS `a2` from `test`.`t1bb` semi join (`test`.`t2bb`) where ((`test`.`t2bb`.`b1` = `test`.`t1bb`.`a1`) and (`test`.`t2bb`.`b2` = `test`.`t1bb`.`a2`)) select bin(a1), a2 from t1bb where (a1, a2) in (select b1, b2 from t2bb); @@ -1934,7 +1934,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (select max(`test`.`t2`.`c`) from `test`.`t2`) join `test`.`t1` where ((`test`.`t1`.`a` = `<subquery2>`.`MAX(c)`) and (`test`.`t1`.`b` = 7) and (<cache>(isnull(`<subquery2>`.`MAX(c)`)) or (`<subquery2>`.`MAX(c)` = 7))) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (select max(`test`.`t2`.`c`) from `test`.`t2`) join `test`.`t1` where ((`test`.`t1`.`b` = 7) and (`test`.`t1`.`a` = `<subquery2>`.`MAX(c)`) and (<cache>(isnull(`<subquery2>`.`MAX(c)`)) or (`<subquery2>`.`MAX(c)` = 7))) SELECT * FROM t1 WHERE a IN (SELECT MAX(c) FROM t2) AND b=7 AND (a IS NULL OR a=b); a b diff --git a/mysql-test/r/temporal_scale_4283.result b/mysql-test/r/temporal_scale_4283.result new file mode 100644 index 00000000000..685a6192a97 --- /dev/null +++ b/mysql-test/r/temporal_scale_4283.result @@ -0,0 +1,12 @@ +create table t1 (a int); +insert into t1 values (4),(8); +select distinct 100 mod timestampadd( week, a, '2002-05-20' ) from t1; +100 mod timestampadd( week, a, '2002-05-20' ) +100 +drop table t1; +create table t1 (i int); +insert into t1 values (2),(4); +select distinct convert_tz( '2001-03-21', 'utc', 'met' ) mod i from t1; +convert_tz( '2001-03-21', 'utc', 'met' ) mod i +0 +drop table t1; diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 8a85cd53b2a..2d4a290751f 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -136,7 +136,7 @@ select @d:=1311; 1311 select year(@d), month(@d), day(@d), cast(@d as date); year(@d) month(@d) day(@d) cast(@d as date) -NULL NULL NULL NULL +0 0 0 0000-00-00 Warnings: Warning 1292 Incorrect datetime value: '1311' Warning 1292 Incorrect datetime value: '1311' diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index 811fbacaf59..05cdcf7e256 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -573,7 +573,7 @@ CAST('NULL' AS DATE) < CAST('2008-01-01' AS DATE) n7, CAST('2008-01-01' AS DATE) < CAST('NULL' AS DATE) n8, CAST('NULL' AS DATE) < CAST('NULL' AS DATE) n9; n1 n2 n3 n4 n5 n6 n7 n8 n9 -0 0 1 NULL NULL NULL NULL NULL NULL +0 0 1 1 1 0 1 0 0 Warnings: Warning 1292 Incorrect datetime value: 'NULL' Warning 1292 Incorrect datetime value: 'NULL' @@ -585,6 +585,8 @@ Warning 1292 Incorrect datetime value: 'NULL' Warning 1292 Incorrect datetime value: 'NULL' Warning 1292 Incorrect datetime value: 'NULL' Warning 1292 Incorrect datetime value: 'NULL' +Warning 1292 Incorrect datetime value: 'NULL' +Warning 1292 Incorrect datetime value: 'NULL' End of 5.0 tests set @org_mode=@@sql_mode; create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03'); @@ -651,6 +653,19 @@ SELECT * FROM t1; dt1 DROP TABLE t1; End of 5.1 tests +create table t1 (d date, t time) engine=myisam; +insert into t1 values ('2000-12-03','22:55:23'),('2008-05-03','10:19:31'); +select case when d = '2012-12-12' then d else t end as cond, group_concat( d ) from t1 group by cond; +cond group_concat( d ) +0000-00-00 00:00:00 2000-12-03 +0000-00-00 00:00:00 2008-05-03 +Warnings: +Warning 1292 Incorrect datetime value: '22:55:23' +Warning 1292 Incorrect datetime value: '10:19:31' +Warning 1292 Incorrect datetime value: '22:55:23' +Warning 1292 Incorrect datetime value: '10:19:31' +drop table t1; +End of 5.3 tests # # Start of 5.5 tests # diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result index 813f912c5af..d373d14c089 100644 --- a/mysql-test/r/type_enum.result +++ b/mysql-test/r/type_enum.result @@ -1854,3 +1854,18 @@ a DROP TABLE t1; End of 5.1 tests +# +# MDEV-4241: Assertion failure: scale >= 0 && precision > 0 && +# scale <= precision in decimal_bin_size +# +CREATE TABLE t1 ( +f1 enum('1','2','3','4','5') +) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +SELECT AVG(f1) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def AVG(f1) 246 7 6 Y 32896 4 63 +AVG(f1) +1.5000 +drop table t1; +End of 5.3 tests diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result index 68d2364986d..ae4bd68a435 100644 --- a/mysql-test/r/user_var-binlog.result +++ b/mysql-test/r/user_var-binlog.result @@ -18,6 +18,7 @@ master-bin.000001 # User var # # @`var2`=_binary 0x61 COLLATE binary master-bin.000001 # Query # # use `test`; insert into t1 values (@var1),(@var2) master-bin.000001 # Query # # COMMIT flush logs; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -56,4 +57,5 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; drop table t1; diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 6cbbe934bde..78ed5bb65d5 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -461,8 +461,42 @@ GROUP BY @b:=(SELECT COUNT(*) > t2.a); @a:=MIN(t1.a) 1 DROP TABLE t1; +SET @bug12408412=1; +SELECT GROUP_CONCAT(@bug12408412 ORDER BY 1) INTO @bug12408412; End of 5.1 tests -DROP TABLE IF EXISTS t1; +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (0); +SELECT DISTINCT POW(COUNT(*), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 ON @a)) +AS b FROM t1 GROUP BY a; +b +1 +SELECT @a; +@a +1 +DROP TABLE t1; +CREATE TABLE t1(f1 INT, f2 INT); +INSERT INTO t1 VALUES (1,2),(2,3),(3,1); +CREATE TABLE t2(a INT); +INSERT INTO t2 VALUES (1); +SET @var=NULL; +SELECT @var:=(SELECT f2 FROM t2 WHERE @var) FROM t1 GROUP BY f1 ORDER BY f2 DESC +LIMIT 1; +@var:=(SELECT f2 FROM t2 WHERE @var) +NULL +SELECT @var; +@var +NULL +DROP TABLE t1, t2; +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (0),(1),(3); +SELECT DISTINCT POW(COUNT(distinct a), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 ON @a limit 1)) AS b FROM t1 GROUP BY a; +b +1 +SELECT @a; +@a +1 +DROP TABLE t1; +End of 5.2 tests CREATE TABLE t1(f1 INT AUTO_INCREMENT, PRIMARY KEY(f1)); INSERT INTO t1 SET f1 = NULL ; SET @aux = NULL ; @@ -530,9 +564,9 @@ SELECT @a; @a 1 DROP TABLE t1; +End of 5.5 tests # # Check that used memory extends if we set a variable # set @var= repeat('a',20000); 1 -End of 5.5 tests diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 8f32ca1f566..576752f65c9 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -1423,7 +1423,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join `test`.`t2` on(((`test`.`t1`.`a` = `test`.`t3`.`a`) and (`test`.`t2`.`a` = `test`.`t3`.`a`)))) on((`test`.`t1`.`a` = `test`.`t3`.`a`)) where 1 +Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join `test`.`t2` on((`test`.`t2`.`a` = `test`.`t3`.`a`))) on((`test`.`t1`.`a` = `test`.`t3`.`a`)) where 1 create view v1 (a) as select a from t1; create view v2 (a) as select a from t2; create view v4 (a,b) as select v1.a as a, v2.a as b from v1 left join v2 on (v1.a=v2.a); @@ -1438,7 +1438,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join (`test`.`t2`) on(((`test`.`t1`.`a` = `test`.`t3`.`a`) and (`test`.`t2`.`a` = `test`.`t3`.`a`)))) on((`test`.`t1`.`a` = `test`.`t3`.`a`)) where 1 +Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join (`test`.`t2`) on((`test`.`t2`.`a` = `test`.`t3`.`a`))) on((`test`.`t1`.`a` = `test`.`t3`.`a`)) where 1 prepare stmt1 from "select * from t3 left join v4 on (t3.a = v4.a);"; execute stmt1; a a b diff --git a/mysql-test/suite/binlog/r/binlog_base64_flag.result b/mysql-test/suite/binlog/r/binlog_base64_flag.result index f84995cac3b..26eab9f141d 100644 --- a/mysql-test/suite/binlog/r/binlog_base64_flag.result +++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result @@ -29,6 +29,7 @@ a 1 3 ==== Test --base64-output=never on a binlog with row events ==== +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -51,6 +52,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; ==== Test non-matching FD event and Row event ==== BINLOG ' 4CdYRw8BAAAAYgAAAGYAAAAAAAQANS4xLjE1LW5kYi02LjEuMjQtZGVidWctbG9nAAAAAAAAAAAA diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result index bf65bab602d..9824707a8c0 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result @@ -15,6 +15,7 @@ set timestamp=@a+1; insert into t1 values(null, "f"); --- Local -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -85,8 +86,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- offset -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -154,8 +157,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- start-position -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -203,8 +208,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- stop-position -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -245,8 +252,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- start and stop positions --- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -271,8 +280,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- start-datetime -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -320,8 +331,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- stop-datetime -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -362,9 +375,11 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- Local with 2 binlogs on command line -- flush logs; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -456,8 +471,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- offset -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -546,8 +563,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- start-position -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -616,8 +635,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- stop-position -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -701,8 +722,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- start-datetime -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -771,8 +794,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- stop-datetime -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -813,8 +838,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- Remote -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -885,8 +912,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- offset -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -954,8 +983,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- start-position -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -1002,8 +1033,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- stop-position -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -1044,8 +1077,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- start and stop positions --- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -1069,8 +1104,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- start-datetime -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -1118,8 +1155,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- stop-datetime -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -1160,8 +1199,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- Remote with 2 binlogs on command line -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -1253,8 +1294,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- offset -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -1343,8 +1386,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- start-position -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -1412,8 +1457,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- stop-position -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -1486,8 +1533,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- start-datetime -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -1556,8 +1605,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- stop-datetime -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -1598,8 +1649,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- to-last-log -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -1680,6 +1733,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- end of test -- drop table t1; diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result index 8f481b25251..4fcb0fca9c0 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result @@ -328,6 +328,7 @@ INSERT INTO t2 SET b=1; UPDATE t1, t2 SET t1.a=10, t2.a=20; DROP TABLE t1,t2; flush logs; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -4137,3 +4138,4 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result index 3227ad3d661..dd09a398922 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result @@ -2245,6 +2245,7 @@ FLUSH LOGS; # # Call mysqlbinlog to display the log file contents. # +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -3788,6 +3789,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # # Cleanup. # @@ -3870,6 +3872,7 @@ FLUSH LOGS; # # Call mysqlbinlog to display the log file contents. # +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -4081,6 +4084,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # # Cleanup. # @@ -4239,6 +4243,7 @@ FLUSH LOGS; # # Call mysqlbinlog to display the log file contents. # +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -4752,6 +4757,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # # Cleanup. # @@ -4802,6 +4808,7 @@ FLUSH LOGS; # # Call mysqlbinlog to display the log file contents. # +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -4861,6 +4868,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # # Cleanup. # diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result index 8338e48459a..66f4cce5f05 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result @@ -2245,6 +2245,7 @@ FLUSH LOGS; # # Call mysqlbinlog to display the log file contents. # +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -3810,6 +3811,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # # Cleanup. # @@ -3892,6 +3894,7 @@ FLUSH LOGS; # # Call mysqlbinlog to display the log file contents. # +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -4109,6 +4112,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # # Cleanup. # @@ -4267,6 +4271,7 @@ FLUSH LOGS; # # Call mysqlbinlog to display the log file contents. # +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -4790,6 +4795,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # # Cleanup. # @@ -4840,6 +4846,7 @@ FLUSH LOGS; # # Call mysqlbinlog to display the log file contents. # +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -4901,6 +4908,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # # Cleanup. # diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result index f2f1ed00431..fc356a9ace3 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result @@ -124,6 +124,7 @@ FLUSH LOGS; # # Call mysqlbinlog to display the log file contents. # +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -465,6 +466,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # # Cleanup. # diff --git a/mysql-test/suite/binlog/r/binlog_row_annotate.result b/mysql-test/suite/binlog/r/binlog_row_annotate.result index 8b9ccee7a93..5df4a0af16f 100644 --- a/mysql-test/suite/binlog/r/binlog_row_annotate.result +++ b/mysql-test/suite/binlog/r/binlog_row_annotate.result @@ -61,6 +61,7 @@ master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 # - INSERT INTO test2.t2 VALUES (1), (2), (3) # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map) ##################################################################################### +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -283,12 +284,14 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # ##################################################################################### # mysqlbinlog --database=test1 # The following Annotate should appear in this output: # - DELETE test1.t1, test2.t2 FROM <...> ##################################################################################### +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -430,11 +433,13 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # ##################################################################################### # mysqlbinlog --skip-annotate-row-events # No Annotates should appear in this output ##################################################################################### +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -643,6 +648,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # ##################################################################################### # mysqlbinlog --read-from-remote-server @@ -653,6 +659,7 @@ ROLLBACK /* added by mysqlbinlog */; # - INSERT INTO test2.t2 VALUES (1), (2), (3) # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map) ##################################################################################### +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -875,12 +882,14 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # ##################################################################################### # mysqlbinlog --read-from-remote-server --database=test1 # The following Annotate should appear in this output: # - DELETE test1.t1, test2.t2 FROM <...> ##################################################################################### +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -1022,11 +1031,13 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # ##################################################################################### # mysqlbinlog --read-from-remote-server --skip-annotate-row-events # No Annotates should appear in this output ##################################################################################### +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -1230,3 +1241,4 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; diff --git a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result index f0519a9d724..f5d19d08a29 100644 --- a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result +++ b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result @@ -10,6 +10,7 @@ master-bin.000001 # Table_map # # table_id: # (test.t2) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT flush logs; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -32,4 +33,5 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; drop table t2; diff --git a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result index f2dedaa633a..6973985e6c3 100644 --- a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result +++ b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result @@ -28,6 +28,7 @@ flush logs; # --rewrite-db = test1->new_test1 # --rewrite-db = test3->new_test3 # +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -217,6 +218,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; # # mysqlbinlog output # --base64-output = decode-rows @@ -224,6 +226,7 @@ ROLLBACK /* added by mysqlbinlog */; # --rewrite-db = test3->new_test3 # --read-from-remote-server # +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -413,6 +416,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; DROP DATABASE test1; DROP DATABASE test2; DROP DATABASE test3; diff --git a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result index 3207b9c2180..3a5c3ac4b02 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result +++ b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result @@ -10,6 +10,7 @@ master-bin.000001 # User var # # @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ master-bin.000001 # Query # # use `test`; insert into t2 values (@v) master-bin.000001 # Query # # COMMIT flush logs; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -37,4 +38,5 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; drop table t2; diff --git a/mysql-test/suite/engines/funcs/disabled.def b/mysql-test/suite/engines/funcs/disabled.def index 2d8ea2d4ff8..c43b0c92bc9 100644 --- a/mysql-test/suite/engines/funcs/disabled.def +++ b/mysql-test/suite/engines/funcs/disabled.def @@ -70,7 +70,6 @@ rpl_replicate_ignore_db : Result Difference Due To Change In .inc file rpl000017 : Result Difference Due To Change In .inc file rpl_skip_error : Result Difference Due To Change In .inc file -rpl_row_until : Test Present in rpl suite as well . Test Fails table with t2 table not found. rpl_loaddata_s : Test Present in rpl suite as well . Test Fails due to bin log truncation. rpl_log_pos : Test Present in rpl suite as well . Test Fails due to bin log truncation. rpl_row_NOW : Result Difference Due To Change In .inc file @@ -96,4 +95,3 @@ rpl_relayspace : Result Difference Due To Change In .inc file rpl_row_inexist_tbl : Result Difference Due To Change In .inc file rpl_sp : Result Difference Due To Change In .inc file rpl_rbr_to_sbr : Result Difference Due To Change In .inc file -rpl_row_until : Test Timesout diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_until.result b/mysql-test/suite/engines/funcs/r/rpl_row_until.result index d8637578ecc..5629f5c8cdd 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_until.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_until.result @@ -1,212 +1,60 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -stop slave; -create table t1(n int not null auto_increment primary key); -insert into t1 values (1),(2),(3),(4); -drop table t1; -create table t2(n int not null auto_increment primary key); -insert into t2 values (1),(2); -insert into t2 values (3),(4); -drop table t2; -start slave until master_log_file='master-bin.000001', master_log_pos=311; -select * from t1; +include/master-slave.inc +[connection master] +CREATE TABLE t1(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2),(3),(4); +DROP TABLE t1; +CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY); +INSERT INTO t2 VALUES (1),(2); +INSERT INTO t2 VALUES (3),(4); +DROP TABLE t2; +include/stop_slave.inc +RESET SLAVE; +START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1 +include/wait_for_slave_sql_to_stop.inc +SELECT * FROM t1; n 1 2 3 4 -show slave status; -Slave_IO_State # -Master_Host 127.0.0.1 -Master_User root -Master_Port MASTER_MYPORT -Connect_Retry 1 -Master_Log_File master-bin.000001 -Read_Master_Log_Pos # -Relay_Log_File slave-relay-bin.000004 -Relay_Log_Pos # -Relay_Master_Log_File master-bin.000001 -Slave_IO_Running # -Slave_SQL_Running No -Replicate_Do_DB -Replicate_Ignore_DB -Replicate_Do_Table -Replicate_Ignore_Table -Replicate_Wild_Do_Table -Replicate_Wild_Ignore_Table -Last_Errno 0 -Last_Error -Skip_Counter 0 -Exec_Master_Log_Pos # -Relay_Log_Space # -Until_Condition Master -Until_Log_File master-bin.000001 -Until_Log_Pos 311 -Master_SSL_Allowed No -Master_SSL_CA_File -Master_SSL_CA_Path -Master_SSL_Cert -Master_SSL_Cipher -Master_SSL_Key -Seconds_Behind_Master # -Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 -Last_IO_Error -Last_SQL_Errno 0 -Last_SQL_Error -Replicate_Ignore_Server_Ids -Master_Server_Id 1 -start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291; -select * from t1; -n 1 -n 2 -n 3 -n 4 -show slave status; -Slave_IO_State # -Master_Host 127.0.0.1 -Master_User root -Master_Port MASTER_MYPORT -Connect_Retry 1 -Master_Log_File master-bin.000001 -Read_Master_Log_Pos # -Relay_Log_File slave-relay-bin.000004 -Relay_Log_Pos # -Relay_Master_Log_File master-bin.000001 -Slave_IO_Running # -Slave_SQL_Running No -Replicate_Do_DB -Replicate_Ignore_DB -Replicate_Do_Table -Replicate_Ignore_Table -Replicate_Wild_Do_Table -Replicate_Wild_Ignore_Table -Last_Errno 0 -Last_Error -Skip_Counter 0 -Exec_Master_Log_Pos # -Relay_Log_Space # -Until_Condition Master -Until_Log_File master-no-such-bin.000001 -Until_Log_Pos 291 -Master_SSL_Allowed No -Master_SSL_CA_File -Master_SSL_CA_Path -Master_SSL_Cert -Master_SSL_Cipher -Master_SSL_Key -Seconds_Behind_Master # -Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 -Last_IO_Error -Last_SQL_Errno 0 -Last_SQL_Error -Replicate_Ignore_Server_Ids -Master_Server_Id 1 -start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728; -select * from t2; -show slave status; -Slave_IO_State # -Master_Host 127.0.0.1 -Master_User root -Master_Port MASTER_MYPORT -Connect_Retry 1 -Master_Log_File master-bin.000001 -Read_Master_Log_Pos # -Relay_Log_File slave-relay-bin.000004 -Relay_Log_Pos # -Relay_Master_Log_File master-bin.000001 -Slave_IO_Running # -Slave_SQL_Running No -Replicate_Do_DB -Replicate_Ignore_DB -Replicate_Do_Table -Replicate_Ignore_Table -Replicate_Wild_Do_Table -Replicate_Wild_Ignore_Table -Last_Errno 0 -Last_Error -Skip_Counter 0 -Exec_Master_Log_Pos # -Relay_Log_Space # -Until_Condition Relay -Until_Log_File slave-relay-bin.000004 -Until_Log_Pos 728 -Master_SSL_Allowed No -Master_SSL_CA_File -Master_SSL_CA_Path -Master_SSL_Cert -Master_SSL_Cipher -Master_SSL_Key -Seconds_Behind_Master # -Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 -Last_IO_Error -Last_SQL_Errno 0 -Last_SQL_Error -Replicate_Ignore_Server_Ids -Master_Server_Id 1 -start slave; -stop slave; -start slave until master_log_file='master-bin.000001', master_log_pos=740; -show slave status; -Slave_IO_State # -Master_Host 127.0.0.1 -Master_User root -Master_Port MASTER_MYPORT -Connect_Retry 1 -Master_Log_File master-bin.000001 -Read_Master_Log_Pos # -Relay_Log_File slave-relay-bin.000004 -Relay_Log_Pos # -Relay_Master_Log_File master-bin.000001 -Slave_IO_Running Yes -Slave_SQL_Running No -Replicate_Do_DB -Replicate_Ignore_DB -Replicate_Do_Table -Replicate_Ignore_Table -Replicate_Wild_Do_Table -Replicate_Wild_Ignore_Table -Last_Errno 0 -Last_Error -Skip_Counter 0 -Exec_Master_Log_Pos # -Relay_Log_Space # -Until_Condition Master -Until_Log_File master-bin.000001 -Until_Log_Pos 740 -Master_SSL_Allowed No -Master_SSL_CA_File -Master_SSL_CA_Path -Master_SSL_Cert -Master_SSL_Cipher -Master_SSL_Key -Seconds_Behind_Master # -Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 -Last_IO_Error -Last_SQL_Errno 0 -Last_SQL_Error -Replicate_Ignore_Server_Ids -Master_Server_Id 1 -start slave until master_log_file='master-bin', master_log_pos=561; +include/check_slave_param.inc [Exec_Master_Log_Pos] +START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS; +include/wait_for_slave_sql_to_stop.inc +SELECT * FROM t1; +n +1 +2 +3 +4 +include/check_slave_param.inc [Exec_Master_Log_Pos] +START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2 +include/wait_for_slave_sql_to_stop.inc +SELECT * FROM t2; +n +1 +2 +include/check_slave_param.inc [Exec_Master_Log_Pos] +START SLAVE; +include/wait_for_slave_to_start.inc +include/stop_slave.inc +START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2 +include/wait_for_slave_param.inc [Until_Log_Pos] +include/wait_for_slave_sql_to_stop.inc +include/check_slave_param.inc [Exec_Master_Log_Pos] +START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=MASTER_LOG_POS; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL -start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12; +START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS, RELAY_LOG_POS=RELAY_LOG_POS; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL -start slave until master_log_file='master-bin.000001'; +START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001'; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL -start slave until relay_log_file='slave-relay-bin.000002'; +START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009'; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL -start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561; +START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=MASTER_LOG_POS; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL -start slave sql_thread; -start slave until master_log_file='master-bin.000001', master_log_pos=740; +START SLAVE; +START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS; Warnings: -Level Note -Code 1254 -Message Slave is already running +Note 1254 Slave is already running +include/stop_slave.inc +RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_until.test b/mysql-test/suite/engines/funcs/t/rpl_row_until.test index ccd9ce11637..bf38bd487ea 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_until.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_until.test @@ -2,90 +2,126 @@ -- source include/have_binlog_format_row.inc -- source include/master-slave.inc -# Test is dependent on binlog positions +# Note: The test is dependent on binlog positions -# prepare version for substitutions -let $VERSION=`select version()`; +# Create some events on master +connection master; +CREATE TABLE t1(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2),(3),(4); +DROP TABLE t1; +# Save master log position for query DROP TABLE t1 +save_master_pos; +let $master_pos_drop_t1= query_get_value(SHOW BINLOG EVENTS, Pos, 7); +let $master_log_file= query_get_value(SHOW BINLOG EVENTS, Log_name, 7); -# stop slave before he will start replication also sync with master -# for avoiding undetermenistic behaviour +CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY); +# Save master log position for query CREATE TABLE t2 save_master_pos; -connection slave; -sync_with_master; -stop slave; +let $master_pos_create_t2= query_get_value(SHOW BINLOG EVENTS, Pos, 8); + +INSERT INTO t2 VALUES (1),(2); +save_master_pos; +# Save master log position for query INSERT INTO t2 VALUES (1),(2); +let $master_pos_insert1_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 12); +sync_slave_with_master; + +# Save relay log position for query INSERT INTO t2 VALUES (1),(2); +let $relay_pos_insert1_t2= query_get_value(show slave status, Relay_Log_Pos, 1); connection master; -# create some events on master -create table t1(n int not null auto_increment primary key); -insert into t1 values (1),(2),(3),(4); -drop table t1; -create table t2(n int not null auto_increment primary key); -insert into t2 values (1),(2); -insert into t2 values (3),(4); -drop table t2; - -# try to replicate all queries until drop of t1 +INSERT INTO t2 VALUES (3),(4); +DROP TABLE t2; +# Save master log position for query INSERT INTO t2 VALUES (1),(2); +let $master_pos_drop_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 17); +sync_slave_with_master; + +--source include/stop_slave.inc +# Reset slave. +RESET SLAVE; +--disable_query_log +eval CHANGE MASTER TO MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT; +--enable_query_log + +# Try to replicate all queries until drop of t1 connection slave; -start slave until master_log_file='master-bin.000001', master_log_pos=311; -sleep 2; -wait_for_slave_to_stop; -# here table should be still not deleted -select * from t1; ---vertical_results ---replace_result $MASTER_MYPORT MASTER_MYPORT ---replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 # -show slave status; - -# this should fail right after start -start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291; +echo START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=master_pos_drop_t1; +--disable_query_log +eval START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_drop_t1; +--enable_query_log +--source include/wait_for_slave_sql_to_stop.inc + +# Here table should be still not deleted +SELECT * FROM t1; +--let $slave_param= Exec_Master_Log_Pos +--let $slave_param_value= $master_pos_drop_t1 +--source include/check_slave_param.inc + +# This should fail right after start +--replace_result 291 MASTER_LOG_POS +START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291; +--source include/wait_for_slave_sql_to_stop.inc # again this table should be still not deleted -select * from t1; -sleep 2; -wait_for_slave_to_stop; ---vertical_results ---replace_result $MASTER_MYPORT MASTER_MYPORT ---replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 # -show slave status; - -# try replicate all up to and not including the second insert to t2; -start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728; -sleep 2; -wait_for_slave_to_stop; -select * from t2; ---vertical_results ---replace_result $MASTER_MYPORT MASTER_MYPORT ---replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 # -show slave status; +SELECT * FROM t1; + +--let $slave_param= Exec_Master_Log_Pos +--let $slave_param_value= $master_pos_drop_t1 +--source include/check_slave_param.inc + +# Try replicate all up to and not including the second insert to t2; +echo START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2; +--disable_query_log +eval START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=$relay_pos_insert1_t2; +--enable_query_log +--source include/wait_for_slave_sql_to_stop.inc +SELECT * FROM t2; + +--let $slave_param= Exec_Master_Log_Pos +--let $slave_param_value= $master_pos_insert1_t2 +--source include/check_slave_param.inc # clean up -start slave; +START SLAVE; +--source include/wait_for_slave_to_start.inc connection master; -save_master_pos; -connection slave; -sync_with_master; -stop slave; +sync_slave_with_master; +--source include/stop_slave.inc -# this should stop immediately as we are already there -start slave until master_log_file='master-bin.000001', master_log_pos=740; -sleep 2; -wait_for_slave_to_stop; +# This should stop immediately as we are already there +echo START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=master_pos_create_t2; +--disable_query_log +eval START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_create_t2; +--enable_query_log +let $slave_param= Until_Log_Pos; +let $slave_param_value= $master_pos_create_t2; +--source include/wait_for_slave_param.inc +--source include/wait_for_slave_sql_to_stop.inc # here the sql slave thread should be stopped ---vertical_results ---replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004 ---replace_column 1 # 7 # 9 # 22 # 23 # 33 # -show slave status; +--let $slave_param= Exec_Master_Log_Pos +--let $slave_param_value= $master_pos_drop_t2 +--source include/check_slave_param.inc #testing various error conditions +--replace_result 561 MASTER_LOG_POS --error 1277 -start slave until master_log_file='master-bin', master_log_pos=561; +START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=561; +--replace_result 561 MASTER_LOG_POS 12 RELAY_LOG_POS --error 1277 -start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12; +START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=561, RELAY_LOG_POS=12; --error 1277 -start slave until master_log_file='master-bin.000001'; +START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001'; --error 1277 -start slave until relay_log_file='slave-relay-bin.000002'; +START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009'; +--replace_result 561 MASTER_LOG_POS --error 1277 -start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561; +START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=561; # Warning should be given for second command -start slave sql_thread; -start slave until master_log_file='master-bin.000001', master_log_pos=740; +START SLAVE; +--replace_result 740 MASTER_LOG_POS +START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740; + +--source include/stop_slave.inc +# Clear slave IO error. +RESET SLAVE; + +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result index 179d0cd814e..f9cdbb13d61 100644 --- a/mysql-test/suite/funcs_1/r/storedproc.result +++ b/mysql-test/suite/funcs_1/r/storedproc.result @@ -2490,8 +2490,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp SELECT * from t1 where f2=f1' at line 1 CREATE PROCEDURE option() SELECT * from t1 where f2=f1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'option() -SELECT * from t1 where f2=f1' at line 1 +DROP PROCEDURE option; CREATE PROCEDURE optionally() SELECT * from t1 where f2=f1; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'optionally() @@ -8548,8 +8547,6 @@ CREATE PROCEDURE sp1() BEGIN declare option char; END// -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'option char; -END' at line 3 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1() BEGIN @@ -10773,11 +10770,7 @@ BEGIN declare option condition for sqlstate '02000'; declare exit handler for option set @var2 = 1; END// -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'option condition for sqlstate '02000'; -declare exit handler for option set @var2' at line 3 DROP PROCEDURE IF EXISTS sp1; -Warnings: -Note 1305 PROCEDURE db_storedproc.sp1 does not exist CREATE PROCEDURE sp1( ) BEGIN declare optionally condition for sqlstate '02000'; @@ -12957,7 +12950,7 @@ CREATE PROCEDURE sp1( ) BEGIN declare option handler for sqlstate '02000' set @var2 = 1; END// -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'option handler for sqlstate '02000' set @var2 = 1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'handler for sqlstate '02000' set @var2 = 1; END' at line 3 DROP PROCEDURE IF EXISTS sp1; Warnings: diff --git a/mysql-test/suite/funcs_1/t/storedproc.test b/mysql-test/suite/funcs_1/t/storedproc.test index 3bd3199da4e..69406a57a00 100644 --- a/mysql-test/suite/funcs_1/t/storedproc.test +++ b/mysql-test/suite/funcs_1/t/storedproc.test @@ -1507,9 +1507,9 @@ CREATE PROCEDURE on() CREATE PROCEDURE optimize() SELECT * from t1 where f2=f1; ---error ER_PARSE_ERROR CREATE PROCEDURE option() SELECT * from t1 where f2=f1; +DROP PROCEDURE option; --error ER_PARSE_ERROR CREATE PROCEDURE optionally() @@ -10171,7 +10171,6 @@ DROP PROCEDURE IF EXISTS sp1; --enable_warnings delimiter //; ---error ER_PARSE_ERROR CREATE PROCEDURE sp1() BEGIN declare option char; @@ -12755,7 +12754,6 @@ delimiter ;// DROP PROCEDURE IF EXISTS sp1; delimiter //; ---error ER_PARSE_ERROR CREATE PROCEDURE sp1( ) BEGIN declare option condition for sqlstate '02000'; diff --git a/mysql-test/suite/heap/heap.result b/mysql-test/suite/heap/heap.result index ff6b217bcce..0142cfa66b0 100644 --- a/mysql-test/suite/heap/heap.result +++ b/mysql-test/suite/heap/heap.result @@ -738,6 +738,26 @@ SELECT c2 FROM t1; c2 0 DROP TABLE t1; +CREATE TABLE t1 ( +id int(11) NOT NULL AUTO_INCREMENT, +color enum('GREEN', 'WHITE') DEFAULT NULL, +ts int, +PRIMARY KEY (id), +KEY color (color) USING HASH +) ENGINE=MEMORY DEFAULT CHARSET=utf8; +INSERT INTO t1 VALUES("1","GREEN",1); +INSERT INTO t1 VALUES("2","GREEN",1); +INSERT INTO t1 VALUES("3","GREEN",1); +INSERT INTO t1 VALUES("4","GREEN",1); +INSERT INTO t1 VALUES("5","GREEN",1); +INSERT INTO t1 VALUES("6","GREEN",1); +DELETE FROM t1 WHERE id = 1; +INSERT INTO t1 VALUES("7","GREEN", 2); +DELETE FROM t1 WHERE ts = 1 AND color = 'GREEN'; +SELECT * from t1; +id color ts +7 GREEN 2 +DROP TABLE t1; CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=100; insert into t1 values(1); select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; diff --git a/mysql-test/suite/heap/heap.test b/mysql-test/suite/heap/heap.test index a421304d6d8..ef2527beeb0 100644 --- a/mysql-test/suite/heap/heap.test +++ b/mysql-test/suite/heap/heap.test @@ -487,6 +487,32 @@ SELECT c2 FROM t1; DROP TABLE t1; # +# BUG#51763 Can't delete rows from MEMORY table with HASH key +# + +CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + color enum('GREEN', 'WHITE') DEFAULT NULL, + ts int, + PRIMARY KEY (id), + KEY color (color) USING HASH +) ENGINE=MEMORY DEFAULT CHARSET=utf8; + +INSERT INTO t1 VALUES("1","GREEN",1); +INSERT INTO t1 VALUES("2","GREEN",1); +INSERT INTO t1 VALUES("3","GREEN",1); +INSERT INTO t1 VALUES("4","GREEN",1); +INSERT INTO t1 VALUES("5","GREEN",1); +INSERT INTO t1 VALUES("6","GREEN",1); +DELETE FROM t1 WHERE id = 1; +INSERT INTO t1 VALUES("7","GREEN", 2); +DELETE FROM t1 WHERE ts = 1 AND color = 'GREEN'; +SELECT * from t1; +DROP TABLE t1; + +# End of 5.1 tests + +# # Show that MIN_ROWS and MAX_ROWS have an effect on how data_length # and index_length are allocated. # Result is different for 32 / 64 bit machines as pointer lengths are different diff --git a/mysql-test/suite/innodb/disabled.def b/mysql-test/suite/innodb/disabled.def index 0e7cd067056..8cae44a3607 100644 --- a/mysql-test/suite/innodb/disabled.def +++ b/mysql-test/suite/innodb/disabled.def @@ -10,4 +10,3 @@ # ############################################################################## -innodb_bug12400341: variable innodb_trx_rseg_n_slots_debug is removed in MariaDB diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb/r/innodb-index.result index 0f004772153..4b032ebabb5 100644 --- a/mysql-test/suite/innodb/r/innodb-index.result +++ b/mysql-test/suite/innodb/r/innodb-index.result @@ -956,7 +956,7 @@ Table Op Msg_type Msg_text test.t1 check status OK explain select * from t1 where b like 'adfd%'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL b NULL NULL NULL 15 Using where +1 SIMPLE t1 range b b 769 NULL 11 Using where drop table t1; set global innodb_file_per_table=on; set global innodb_file_format='Barracuda'; diff --git a/mysql-test/suite/innodb/r/innodb_bug12400341.result b/mysql-test/suite/innodb/r/innodb_bug12400341.result index 551e94f5e77..02d609d8092 100644 --- a/mysql-test/suite/innodb/r/innodb_bug12400341.result +++ b/mysql-test/suite/innodb/r/innodb_bug12400341.result @@ -15,7 +15,7 @@ select count(*) from information_schema.processlist; count(*) 33 CREATE TABLE mysqltest.testtable (id int unsigned not null primary key) ENGINE=InnoDB; -ERROR HY000: Can't create table 'mysqltest.testtable' (errno: 177) +ERROR HY000: Can't create table 'mysqltest.testtable' (errno: 177 "Too many active concurrent transactions") select count(*) from information_schema.processlist; count(*) 33 diff --git a/mysql-test/suite/innodb/r/innodb_bug14147491.result b/mysql-test/suite/innodb/r/innodb_bug14147491.result new file mode 100644 index 00000000000..6279f85f676 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug14147491.result @@ -0,0 +1,17 @@ +CALL mtr.add_suppression("InnoDB: Error: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts"); +CALL mtr.add_suppression("InnoDB: Warning: database page corruption or a failed"); +# Create and populate the table to be corrupted +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB; +INSERT INTO t1 (b) VALUES ('corrupt me'); +INSERT INTO t1 (b) VALUES ('corrupt me'); +# Restart server to flush buffers +# Corrupt the table +Munged a string. +Munged a string. +# Write file to make mysql-test-run.pl expect crash and restart +SELECT * FROM t1; +ERROR HY000: Lost connection to MySQL server during query +# Turn on reconnect +# Wait for server to fully start +# Cleanup +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb_bug14676111.result b/mysql-test/suite/innodb/r/innodb_bug14676111.result new file mode 100644 index 00000000000..ebecd1d00cb --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug14676111.result @@ -0,0 +1,53 @@ +drop table if exists t1; +CREATE TABLE t1 (a int not null primary key) engine=InnoDB; +set global innodb_limit_optimistic_insert_debug = 2; +insert into t1 values (1); +insert into t1 values (5); +insert into t1 values (4); +insert into t1 values (3); +insert into t1 values (2); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; +DATA_LENGTH / 16384 +10.0000 +delete from t1 where a=4; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; +DATA_LENGTH / 16384 +8.0000 +delete from t1 where a=5; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; +DATA_LENGTH / 16384 +5.0000 +set global innodb_limit_optimistic_insert_debug = 10000; +delete from t1 where a=2; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; +DATA_LENGTH / 16384 +3.0000 +insert into t1 values (2); +delete from t1 where a=2; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; +DATA_LENGTH / 16384 +2.0000 +insert into t1 values (2); +delete from t1 where a=2; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; +DATA_LENGTH / 16384 +1.0000 +drop table t1; diff --git a/mysql-test/suite/innodb/r/innodb_bug47777.result b/mysql-test/suite/innodb/r/innodb_bug47777.result index fbba47edcfc..6625c400d84 100644 --- a/mysql-test/suite/innodb/r/innodb_bug47777.result +++ b/mysql-test/suite/innodb/r/innodb_bug47777.result @@ -3,11 +3,11 @@ insert into bug47777 values (geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)')); select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'); count(*) 1 -update bug47777 set c2=GeomFromText('POINT(1 1)'); +update bug47777 set c2=GeomFromText('linestring(1 1)'); select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'); count(*) 0 -select count(*) from bug47777 where c2 = GeomFromText('POINT(1 1)'); +select count(*) from bug47777 where c2 = GeomFromText('linestring(1 1)'); count(*) 1 drop table bug47777; diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result index be2b4b28f6a..b2df98bbfa6 100644 --- a/mysql-test/suite/innodb/r/innodb_mysql.result +++ b/mysql-test/suite/innodb/r/innodb_mysql.result @@ -343,7 +343,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index; Using temporary explain select distinct f1, f2 from t1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary +1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index drop table t1; CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20), INDEX (name)); diff --git a/mysql-test/suite/innodb/t/innodb-zip.test b/mysql-test/suite/innodb/t/innodb-zip.test index 7e2e2d1d3c9..67bcda7697e 100644 --- a/mysql-test/suite/innodb/t/innodb-zip.test +++ b/mysql-test/suite/innodb/t/innodb-zip.test @@ -1,9 +1,5 @@ -- source include/have_innodb.inc -if (`select plugin_auth_version <= "1.1.8-29.3" from information_schema.plugins where plugin_name='innodb'`) -{ - --skip Not fixed in XtraDB 1.1.8-29.3 or earlier -} let $per_table=`select @@innodb_file_per_table`; let $format=`select @@innodb_file_format`; diff --git a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test index db38b48facf..d57a52a2362 100644 --- a/mysql-test/suite/innodb/t/innodb.test +++ b/mysql-test/suite/innodb/t/innodb.test @@ -4,11 +4,6 @@ # .\sync\sync0sync.c line 324 # is fixed -if (`select plugin_auth_version <= "1.1.8-29.3" from information_schema.plugins where plugin_name='innodb'`) -{ - --skip Not fixed in XtraDB 1.1.8-29.3 or earlier -} - ####################################################################### # # # Please, DO NOT TOUCH this file as well as the innodb.result file. # diff --git a/mysql-test/suite/innodb/t/innodb_bug14147491-master.opt b/mysql-test/suite/innodb/t/innodb_bug14147491-master.opt new file mode 100644 index 00000000000..6b82baca147 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug14147491-master.opt @@ -0,0 +1 @@ +--innodb_file_per_table=1 --skip-stack-trace --skip-core-file diff --git a/mysql-test/suite/innodb/t/innodb_bug14147491.test b/mysql-test/suite/innodb/t/innodb_bug14147491.test new file mode 100644 index 00000000000..ee3519c53fc --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug14147491.test @@ -0,0 +1,75 @@ +# +# Test opening a corrupted table. +# + +# Don't test under valgrind, memory leaks will occur +source include/not_valgrind.inc; +# Avoid CrashReporter popup on Mac +source include/not_crashrep.inc; +# Don't test under embedded +source include/not_embedded.inc; +# Require InnoDB +source include/have_innodb.inc; + +CALL mtr.add_suppression("InnoDB: Error: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts"); +CALL mtr.add_suppression("InnoDB: Warning: database page corruption or a failed"); + +--echo # Create and populate the table to be corrupted +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB; +INSERT INTO t1 (b) VALUES ('corrupt me'); +--disable_query_log +--let $i = 10 +while ($i) +{ + INSERT INTO t1 (b) VALUES (REPEAT('abcdefghijklmnopqrstuvwxyz', 100)); + dec $i; +} +--enable_query_log +INSERT INTO t1 (b) VALUES ('corrupt me'); + +--echo # Restart server to flush buffers +source include/restart_mysqld.inc; + +--echo # Corrupt the table +let $MYSQLD_DATADIR=`select @@datadir`; +let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd; + +perl; +use strict; +use warnings; +use Fcntl qw(:DEFAULT :seek); + +my $ibd_file = $ENV{'t1_IBD'}; + +my $chunk; +my $len; + +sysopen IBD_FILE, $ibd_file, O_RDWR || die "Unable to open $ibd_file"; + +while ($len = sysread IBD_FILE, $chunk, 1024) +{ + if ($chunk =~ s/corrupt me/korrupt me/) + { + print "Munged a string.\n"; + sysseek IBD_FILE, -$len, SEEK_CUR; + syswrite IBD_FILE, $chunk, $len; + } +} + +close IBD_FILE; +EOF + +--echo # Write file to make mysql-test-run.pl expect crash and restart +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect + +--error 2013 +SELECT * FROM t1; + +--echo # Turn on reconnect +--enable_reconnect + +--echo # Wait for server to fully start +--source include/wait_until_connected_again.inc + +--echo # Cleanup +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb_bug14676111.test b/mysql-test/suite/innodb/t/innodb_bug14676111.test new file mode 100644 index 00000000000..fadd111fdc9 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug14676111.test @@ -0,0 +1,128 @@ +# Test for bug #14676111: WRONG PAGE_LEVEL WRITTEN FOR UPPER THAN FATHER PAGE AT BTR_LIFT_PAGE_UP() + +-- source include/have_innodb.inc +-- source include/have_debug.inc + +if (`select count(*)=0 from information_schema.global_variables where variable_name = 'INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG'`) +{ + --skip Test requires InnoDB built with UNIV_DEBUG definition. +} + +--disable_query_log +set @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug; +--enable_query_log +--disable_warnings +drop table if exists t1; +--enable_warnings + +CREATE TABLE t1 (a int not null primary key) engine=InnoDB; + +let $wait_condition= + SELECT VARIABLE_VALUE < 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS + WHERE VARIABLE_NAME = 'INNODB_PURGE_TRX_ID_AGE'; + +# +# make 4 leveled straight tree +# +set global innodb_limit_optimistic_insert_debug = 2; +insert into t1 values (1); +insert into t1 values (5); +#current tree form +# (1, 5) + +insert into t1 values (4); +#records in a page is limited to 2 artificially. root rise occurs +#current tree form +# (1, 5) +#(1, 4) (5) + +insert into t1 values (3); +#current tree form +# (1, 5) +# (1, 4) (5) +#(1, 3) (4) (5) + +insert into t1 values (2); +#current tree form +# (1, 5) +# (1, 4) (5) +# (1, 3) (4) (5) +#(1, 2) (3) (4) (5) + +analyze table t1; +select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; + +delete from t1 where a=4; +--source include/wait_condition.inc +#deleting 1 record of 2 records don't cause merge artificially. +#current tree form +# (1, 5) +# (1) (5) +# (1, 3) (5) +#(1, 2) (3) (5) + +analyze table t1; +select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; + +delete from t1 where a=5; +--source include/wait_condition.inc +#deleting 1 record of 2 records don't cause merge artificially. +#current tree form +# (1) +# (1) +# (1, 3) <- lift up this level next, when deleting node ptr +#(1, 2) (3) <- merged next + +analyze table t1; +select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; + +# +# cause merge at level 0 +# + +#disable the artificial limitation of records in a page +set global innodb_limit_optimistic_insert_debug = 10000; +delete from t1 where a=2; +--source include/wait_condition.inc +#merge page occurs. and lift up occurs. +#current tree form +# (1) +# (1) +# (1, 3) + +analyze table t1; +select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; + +insert into t1 values (2); +#current tree form +# (1) +# (1) <- lift up this level next, because it is not root +# (1, 2, 3) + +delete from t1 where a=2; +--source include/wait_condition.inc +#current tree form +# (1) +# (1, 3) + +analyze table t1; +select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; + +insert into t1 values (2); +#current tree form +# (1) +# (1, 2, 3) <- lift up this level next, because the father is root + +delete from t1 where a=2; +--source include/wait_condition.inc +#current tree form +# (1, 3) + +analyze table t1; +select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; + +drop table t1; + +--disable_query_log +set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug; +--enable_query_log diff --git a/mysql-test/suite/innodb/t/innodb_bug47777.test b/mysql-test/suite/innodb/t/innodb_bug47777.test index d00509c3814..575d84b97e9 100644 --- a/mysql-test/suite/innodb/t/innodb_bug47777.test +++ b/mysql-test/suite/innodb/t/innodb_bug47777.test @@ -14,11 +14,11 @@ insert into bug47777 values (geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)')); select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'); # Update table bug47777 should be successful. -update bug47777 set c2=GeomFromText('POINT(1 1)'); +update bug47777 set c2=GeomFromText('linestring(1 1)'); # Verify the row get updated successfully. The original -# c2 value should be changed to GeomFromText('POINT(1 1)'). +# c2 value should be changed to GeomFromText('linestring(1 1)'). select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'); -select count(*) from bug47777 where c2 = GeomFromText('POINT(1 1)'); +select count(*) from bug47777 where c2 = GeomFromText('linestring(1 1)'); drop table bug47777; diff --git a/mysql-test/suite/innodb/t/innodb_bug53591.test b/mysql-test/suite/innodb/t/innodb_bug53591.test index f0ed4b93c32..9a1c2afbccb 100644 --- a/mysql-test/suite/innodb/t/innodb_bug53591.test +++ b/mysql-test/suite/innodb/t/innodb_bug53591.test @@ -1,9 +1,5 @@ --source include/have_innodb.inc -if (`select plugin_auth_version <= "1.1.8-29.3" from information_schema.plugins where plugin_name='innodb'`) -{ - --skip Not fixed in XtraDB 1.1.8-29.3 or earlier -} let $file_format=`select @@innodb_file_format`; let $file_per_table=`select @@innodb_file_per_table`; diff --git a/mysql-test/suite/innodb/t/innodb_prefix_index_liftedlimit.test b/mysql-test/suite/innodb/t/innodb_prefix_index_liftedlimit.test index 776f5dae517..d7540dff36d 100644 --- a/mysql-test/suite/innodb/t/innodb_prefix_index_liftedlimit.test +++ b/mysql-test/suite/innodb/t/innodb_prefix_index_liftedlimit.test @@ -14,10 +14,6 @@ # # ###################################################################### -if (`select plugin_auth_version <= "1.1.8-29.3" from information_schema.plugins where plugin_name='innodb'`) -{ - --skip Not fixed in XtraDB 1.1.8-29.3 or earlier -} # Save innodb variables let $innodb_file_format_orig=`select @@innodb_file_format`; diff --git a/mysql-test/suite/maria/maria-gis-rtree-dynamic.result b/mysql-test/suite/maria/maria-gis-rtree-dynamic.result index f4593f2f10a..ee7135c4851 100644 --- a/mysql-test/suite/maria/maria-gis-rtree-dynamic.result +++ b/mysql-test/suite/maria/maria-gis-rtree-dynamic.result @@ -766,35 +766,35 @@ SPATIAL KEY (line) ) row_format=dynamic; ALTER TABLE t1 DISABLE KEYS; INSERT INTO t1 (name, kind, line) VALUES -("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")), -("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")), -("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")), -("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")), -("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")), -("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")), -("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")), -("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")), -("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")), -("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")), -("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")), -("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")), -("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")), -("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")), -("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")), -("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")), -("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")), -("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")), -("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")), -("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")), -("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")), -("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")), -("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")), -("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")), -("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")), -("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")), -("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")), -("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")), -("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)")); +("Aadaouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")), +("Aadassiye", "pp", GeomFromText("LINESTRING(35.816667 36.216667)")), +("Aadbel", "pp", GeomFromText("LINESTRING(34.533333 36.100000)")), +("Aadchit", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")), +("Aadchite", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")), +("Aadchit el Qoussair", "pp", GeomFromText("LINESTRING(33.283333 35.483333)")), +("Aaddaye", "pp", GeomFromText("LINESTRING(36.716667 40.833333)")), +("'Aadeissa", "pp", GeomFromText("LINESTRING(32.823889 35.698889)")), +("Aaderup", "pp", GeomFromText("LINESTRING(55.216667 11.766667)")), +("Qalaat Aades", "pp", GeomFromText("LINESTRING(33.503333 35.377500)")), +("A ad'ino", "pp", GeomFromText("LINESTRING(54.812222 38.209167)")), +("Aadi Noia", "pp", GeomFromText("LINESTRING(13.800000 39.833333)")), +("Aad La Macta", "pp", GeomFromText("LINESTRING(35.779444 -0.129167)")), +("Aadland", "pp", GeomFromText("LINESTRING(60.366667 5.483333)")), +("Aadliye", "pp", GeomFromText("LINESTRING(33.366667 36.333333)")), +("Aadloun", "pp", GeomFromText("LINESTRING(33.403889 35.273889)")), +("Aadma", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")), +("Aadma Asundus", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")), +("Aadmoun", "pp", GeomFromText("LINESTRING(34.150000 35.650000)")), +("Aadneram", "pp", GeomFromText("LINESTRING(59.016667 6.933333)")), +("Aadneskaar", "pp", GeomFromText("LINESTRING(58.083333 6.983333)")), +("Aadorf", "pp", GeomFromText("LINESTRING(47.483333 8.900000)")), +("Aadorp", "pp", GeomFromText("LINESTRING(52.366667 6.633333)")), +("Aadouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")), +("Aadoui", "pp", GeomFromText("LINESTRING(34.450000 35.983333)")), +("Aadouiye", "pp", GeomFromText("LINESTRING(34.583333 36.183333)")), +("Aadouss", "pp", GeomFromText("LINESTRING(33.512500 35.601389)")), +("Aadra", "pp", GeomFromText("LINESTRING(33.616667 36.500000)")), +("Aadzi", "pp", GeomFromText("LINESTRING(38.100000 64.850000)")); 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)')); drop table t1; diff --git a/mysql-test/suite/maria/maria-gis-rtree-dynamic.test b/mysql-test/suite/maria/maria-gis-rtree-dynamic.test index 166c88cab36..668d393d0b8 100644 --- a/mysql-test/suite/maria/maria-gis-rtree-dynamic.test +++ b/mysql-test/suite/maria/maria-gis-rtree-dynamic.test @@ -135,35 +135,35 @@ CREATE TABLE t1 ( ALTER TABLE t1 DISABLE KEYS; INSERT INTO t1 (name, kind, line) VALUES - ("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")), - ("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")), - ("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")), - ("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")), - ("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")), - ("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")), - ("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")), - ("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")), - ("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")), - ("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")), - ("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")), - ("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")), - ("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")), - ("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")), - ("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")), - ("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")), - ("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")), - ("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")), - ("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")), - ("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")), - ("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")), - ("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")), - ("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")), - ("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")), - ("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")), - ("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")), - ("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")), - ("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")), - ("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)")); + ("Aadaouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")), + ("Aadassiye", "pp", GeomFromText("LINESTRING(35.816667 36.216667)")), + ("Aadbel", "pp", GeomFromText("LINESTRING(34.533333 36.100000)")), + ("Aadchit", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")), + ("Aadchite", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")), + ("Aadchit el Qoussair", "pp", GeomFromText("LINESTRING(33.283333 35.483333)")), + ("Aaddaye", "pp", GeomFromText("LINESTRING(36.716667 40.833333)")), + ("'Aadeissa", "pp", GeomFromText("LINESTRING(32.823889 35.698889)")), + ("Aaderup", "pp", GeomFromText("LINESTRING(55.216667 11.766667)")), + ("Qalaat Aades", "pp", GeomFromText("LINESTRING(33.503333 35.377500)")), + ("A ad'ino", "pp", GeomFromText("LINESTRING(54.812222 38.209167)")), + ("Aadi Noia", "pp", GeomFromText("LINESTRING(13.800000 39.833333)")), + ("Aad La Macta", "pp", GeomFromText("LINESTRING(35.779444 -0.129167)")), + ("Aadland", "pp", GeomFromText("LINESTRING(60.366667 5.483333)")), + ("Aadliye", "pp", GeomFromText("LINESTRING(33.366667 36.333333)")), + ("Aadloun", "pp", GeomFromText("LINESTRING(33.403889 35.273889)")), + ("Aadma", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")), + ("Aadma Asundus", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")), + ("Aadmoun", "pp", GeomFromText("LINESTRING(34.150000 35.650000)")), + ("Aadneram", "pp", GeomFromText("LINESTRING(59.016667 6.933333)")), + ("Aadneskaar", "pp", GeomFromText("LINESTRING(58.083333 6.983333)")), + ("Aadorf", "pp", GeomFromText("LINESTRING(47.483333 8.900000)")), + ("Aadorp", "pp", GeomFromText("LINESTRING(52.366667 6.633333)")), + ("Aadouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")), + ("Aadoui", "pp", GeomFromText("LINESTRING(34.450000 35.983333)")), + ("Aadouiye", "pp", GeomFromText("LINESTRING(34.583333 36.183333)")), + ("Aadouss", "pp", GeomFromText("LINESTRING(33.512500 35.601389)")), + ("Aadra", "pp", GeomFromText("LINESTRING(33.616667 36.500000)")), + ("Aadzi", "pp", GeomFromText("LINESTRING(38.100000 64.850000)")); 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)')); diff --git a/mysql-test/suite/maria/maria-gis-rtree-trans.result b/mysql-test/suite/maria/maria-gis-rtree-trans.result index c4e773c7e0a..dba56204172 100644 --- a/mysql-test/suite/maria/maria-gis-rtree-trans.result +++ b/mysql-test/suite/maria/maria-gis-rtree-trans.result @@ -766,35 +766,35 @@ SPATIAL KEY (line) ) transactional=1 row_format=page; ALTER TABLE t1 DISABLE KEYS; INSERT INTO t1 (name, kind, line) VALUES -("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")), -("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")), -("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")), -("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")), -("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")), -("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")), -("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")), -("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")), -("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")), -("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")), -("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")), -("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")), -("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")), -("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")), -("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")), -("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")), -("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")), -("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")), -("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")), -("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")), -("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")), -("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")), -("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")), -("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")), -("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")), -("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")), -("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")), -("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")), -("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)")); +("Aadaouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")), +("Aadassiye", "pp", GeomFromText("LINESTRING(35.816667 36.216667)")), +("Aadbel", "pp", GeomFromText("LINESTRING(34.533333 36.100000)")), +("Aadchit", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")), +("Aadchite", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")), +("Aadchit el Qoussair", "pp", GeomFromText("LINESTRING(33.283333 35.483333)")), +("Aaddaye", "pp", GeomFromText("LINESTRING(36.716667 40.833333)")), +("'Aadeissa", "pp", GeomFromText("LINESTRING(32.823889 35.698889)")), +("Aaderup", "pp", GeomFromText("LINESTRING(55.216667 11.766667)")), +("Qalaat Aades", "pp", GeomFromText("LINESTRING(33.503333 35.377500)")), +("A ad'ino", "pp", GeomFromText("LINESTRING(54.812222 38.209167)")), +("Aadi Noia", "pp", GeomFromText("LINESTRING(13.800000 39.833333)")), +("Aad La Macta", "pp", GeomFromText("LINESTRING(35.779444 -0.129167)")), +("Aadland", "pp", GeomFromText("LINESTRING(60.366667 5.483333)")), +("Aadliye", "pp", GeomFromText("LINESTRING(33.366667 36.333333)")), +("Aadloun", "pp", GeomFromText("LINESTRING(33.403889 35.273889)")), +("Aadma", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")), +("Aadma Asundus", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")), +("Aadmoun", "pp", GeomFromText("LINESTRING(34.150000 35.650000)")), +("Aadneram", "pp", GeomFromText("LINESTRING(59.016667 6.933333)")), +("Aadneskaar", "pp", GeomFromText("LINESTRING(58.083333 6.983333)")), +("Aadorf", "pp", GeomFromText("LINESTRING(47.483333 8.900000)")), +("Aadorp", "pp", GeomFromText("LINESTRING(52.366667 6.633333)")), +("Aadouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")), +("Aadoui", "pp", GeomFromText("LINESTRING(34.450000 35.983333)")), +("Aadouiye", "pp", GeomFromText("LINESTRING(34.583333 36.183333)")), +("Aadouss", "pp", GeomFromText("LINESTRING(33.512500 35.601389)")), +("Aadra", "pp", GeomFromText("LINESTRING(33.616667 36.500000)")), +("Aadzi", "pp", GeomFromText("LINESTRING(38.100000 64.850000)")); 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)')); drop table t1; diff --git a/mysql-test/suite/maria/maria-gis-rtree-trans.test b/mysql-test/suite/maria/maria-gis-rtree-trans.test index ec1573c3e29..73f129d8df9 100644 --- a/mysql-test/suite/maria/maria-gis-rtree-trans.test +++ b/mysql-test/suite/maria/maria-gis-rtree-trans.test @@ -138,35 +138,35 @@ CREATE TABLE t1 ( ALTER TABLE t1 DISABLE KEYS; INSERT INTO t1 (name, kind, line) VALUES - ("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")), - ("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")), - ("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")), - ("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")), - ("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")), - ("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")), - ("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")), - ("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")), - ("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")), - ("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")), - ("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")), - ("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")), - ("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")), - ("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")), - ("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")), - ("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")), - ("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")), - ("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")), - ("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")), - ("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")), - ("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")), - ("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")), - ("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")), - ("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")), - ("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")), - ("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")), - ("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")), - ("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")), - ("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)")); + ("Aadaouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")), + ("Aadassiye", "pp", GeomFromText("LINESTRING(35.816667 36.216667)")), + ("Aadbel", "pp", GeomFromText("LINESTRING(34.533333 36.100000)")), + ("Aadchit", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")), + ("Aadchite", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")), + ("Aadchit el Qoussair", "pp", GeomFromText("LINESTRING(33.283333 35.483333)")), + ("Aaddaye", "pp", GeomFromText("LINESTRING(36.716667 40.833333)")), + ("'Aadeissa", "pp", GeomFromText("LINESTRING(32.823889 35.698889)")), + ("Aaderup", "pp", GeomFromText("LINESTRING(55.216667 11.766667)")), + ("Qalaat Aades", "pp", GeomFromText("LINESTRING(33.503333 35.377500)")), + ("A ad'ino", "pp", GeomFromText("LINESTRING(54.812222 38.209167)")), + ("Aadi Noia", "pp", GeomFromText("LINESTRING(13.800000 39.833333)")), + ("Aad La Macta", "pp", GeomFromText("LINESTRING(35.779444 -0.129167)")), + ("Aadland", "pp", GeomFromText("LINESTRING(60.366667 5.483333)")), + ("Aadliye", "pp", GeomFromText("LINESTRING(33.366667 36.333333)")), + ("Aadloun", "pp", GeomFromText("LINESTRING(33.403889 35.273889)")), + ("Aadma", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")), + ("Aadma Asundus", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")), + ("Aadmoun", "pp", GeomFromText("LINESTRING(34.150000 35.650000)")), + ("Aadneram", "pp", GeomFromText("LINESTRING(59.016667 6.933333)")), + ("Aadneskaar", "pp", GeomFromText("LINESTRING(58.083333 6.983333)")), + ("Aadorf", "pp", GeomFromText("LINESTRING(47.483333 8.900000)")), + ("Aadorp", "pp", GeomFromText("LINESTRING(52.366667 6.633333)")), + ("Aadouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")), + ("Aadoui", "pp", GeomFromText("LINESTRING(34.450000 35.983333)")), + ("Aadouiye", "pp", GeomFromText("LINESTRING(34.583333 36.183333)")), + ("Aadouss", "pp", GeomFromText("LINESTRING(33.512500 35.601389)")), + ("Aadra", "pp", GeomFromText("LINESTRING(33.616667 36.500000)")), + ("Aadzi", "pp", GeomFromText("LINESTRING(38.100000 64.850000)")); 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)')); diff --git a/mysql-test/suite/maria/maria-gis-rtree.result b/mysql-test/suite/maria/maria-gis-rtree.result index 430f240d83e..1a7b08169dc 100644 --- a/mysql-test/suite/maria/maria-gis-rtree.result +++ b/mysql-test/suite/maria/maria-gis-rtree.result @@ -766,35 +766,35 @@ SPATIAL KEY (line) ) transactional=0 row_format=page; ALTER TABLE t1 DISABLE KEYS; INSERT INTO t1 (name, kind, line) VALUES -("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")), -("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")), -("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")), -("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")), -("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")), -("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")), -("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")), -("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")), -("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")), -("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")), -("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")), -("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")), -("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")), -("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")), -("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")), -("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")), -("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")), -("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")), -("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")), -("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")), -("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")), -("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")), -("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")), -("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")), -("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")), -("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")), -("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")), -("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")), -("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)")); +("Aadaouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")), +("Aadassiye", "pp", GeomFromText("LINESTRING(35.816667 36.216667)")), +("Aadbel", "pp", GeomFromText("LINESTRING(34.533333 36.100000)")), +("Aadchit", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")), +("Aadchite", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")), +("Aadchit el Qoussair", "pp", GeomFromText("LINESTRING(33.283333 35.483333)")), +("Aaddaye", "pp", GeomFromText("LINESTRING(36.716667 40.833333)")), +("'Aadeissa", "pp", GeomFromText("LINESTRING(32.823889 35.698889)")), +("Aaderup", "pp", GeomFromText("LINESTRING(55.216667 11.766667)")), +("Qalaat Aades", "pp", GeomFromText("LINESTRING(33.503333 35.377500)")), +("A ad'ino", "pp", GeomFromText("LINESTRING(54.812222 38.209167)")), +("Aadi Noia", "pp", GeomFromText("LINESTRING(13.800000 39.833333)")), +("Aad La Macta", "pp", GeomFromText("LINESTRING(35.779444 -0.129167)")), +("Aadland", "pp", GeomFromText("LINESTRING(60.366667 5.483333)")), +("Aadliye", "pp", GeomFromText("LINESTRING(33.366667 36.333333)")), +("Aadloun", "pp", GeomFromText("LINESTRING(33.403889 35.273889)")), +("Aadma", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")), +("Aadma Asundus", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")), +("Aadmoun", "pp", GeomFromText("LINESTRING(34.150000 35.650000)")), +("Aadneram", "pp", GeomFromText("LINESTRING(59.016667 6.933333)")), +("Aadneskaar", "pp", GeomFromText("LINESTRING(58.083333 6.983333)")), +("Aadorf", "pp", GeomFromText("LINESTRING(47.483333 8.900000)")), +("Aadorp", "pp", GeomFromText("LINESTRING(52.366667 6.633333)")), +("Aadouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")), +("Aadoui", "pp", GeomFromText("LINESTRING(34.450000 35.983333)")), +("Aadouiye", "pp", GeomFromText("LINESTRING(34.583333 36.183333)")), +("Aadouss", "pp", GeomFromText("LINESTRING(33.512500 35.601389)")), +("Aadra", "pp", GeomFromText("LINESTRING(33.616667 36.500000)")), +("Aadzi", "pp", GeomFromText("LINESTRING(38.100000 64.850000)")); 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)')); drop table t1; diff --git a/mysql-test/suite/maria/maria-gis-rtree.test b/mysql-test/suite/maria/maria-gis-rtree.test index beffbfc99fe..a3845adb7b9 100644 --- a/mysql-test/suite/maria/maria-gis-rtree.test +++ b/mysql-test/suite/maria/maria-gis-rtree.test @@ -135,35 +135,35 @@ CREATE TABLE t1 ( ALTER TABLE t1 DISABLE KEYS; INSERT INTO t1 (name, kind, line) VALUES - ("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")), - ("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")), - ("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")), - ("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")), - ("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")), - ("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")), - ("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")), - ("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")), - ("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")), - ("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")), - ("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")), - ("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")), - ("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")), - ("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")), - ("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")), - ("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")), - ("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")), - ("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")), - ("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")), - ("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")), - ("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")), - ("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")), - ("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")), - ("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")), - ("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")), - ("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")), - ("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")), - ("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")), - ("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)")); + ("Aadaouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")), + ("Aadassiye", "pp", GeomFromText("LINESTRING(35.816667 36.216667)")), + ("Aadbel", "pp", GeomFromText("LINESTRING(34.533333 36.100000)")), + ("Aadchit", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")), + ("Aadchite", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")), + ("Aadchit el Qoussair", "pp", GeomFromText("LINESTRING(33.283333 35.483333)")), + ("Aaddaye", "pp", GeomFromText("LINESTRING(36.716667 40.833333)")), + ("'Aadeissa", "pp", GeomFromText("LINESTRING(32.823889 35.698889)")), + ("Aaderup", "pp", GeomFromText("LINESTRING(55.216667 11.766667)")), + ("Qalaat Aades", "pp", GeomFromText("LINESTRING(33.503333 35.377500)")), + ("A ad'ino", "pp", GeomFromText("LINESTRING(54.812222 38.209167)")), + ("Aadi Noia", "pp", GeomFromText("LINESTRING(13.800000 39.833333)")), + ("Aad La Macta", "pp", GeomFromText("LINESTRING(35.779444 -0.129167)")), + ("Aadland", "pp", GeomFromText("LINESTRING(60.366667 5.483333)")), + ("Aadliye", "pp", GeomFromText("LINESTRING(33.366667 36.333333)")), + ("Aadloun", "pp", GeomFromText("LINESTRING(33.403889 35.273889)")), + ("Aadma", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")), + ("Aadma Asundus", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")), + ("Aadmoun", "pp", GeomFromText("LINESTRING(34.150000 35.650000)")), + ("Aadneram", "pp", GeomFromText("LINESTRING(59.016667 6.933333)")), + ("Aadneskaar", "pp", GeomFromText("LINESTRING(58.083333 6.983333)")), + ("Aadorf", "pp", GeomFromText("LINESTRING(47.483333 8.900000)")), + ("Aadorp", "pp", GeomFromText("LINESTRING(52.366667 6.633333)")), + ("Aadouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")), + ("Aadoui", "pp", GeomFromText("LINESTRING(34.450000 35.983333)")), + ("Aadouiye", "pp", GeomFromText("LINESTRING(34.583333 36.183333)")), + ("Aadouss", "pp", GeomFromText("LINESTRING(33.512500 35.601389)")), + ("Aadra", "pp", GeomFromText("LINESTRING(33.616667 36.500000)")), + ("Aadzi", "pp", GeomFromText("LINESTRING(38.100000 64.850000)")); 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)')); diff --git a/mysql-test/suite/maria/maria-recovery-rtree-ft.result b/mysql-test/suite/maria/maria-recovery-rtree-ft.result index 030421ae06a..5c6c791d8f6 100644 --- a/mysql-test/suite/maria/maria-recovery-rtree-ft.result +++ b/mysql-test/suite/maria/maria-recovery-rtree-ft.result @@ -4,7 +4,7 @@ create database mysqltest; use mysqltest; * shut down mysqld, removed logs, restarted it CREATE TABLE t1 ( -line LINESTRING NOT NULL, +line POINT NOT NULL, kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po', name VARCHAR(32) ,SPATIAL key (line) diff --git a/mysql-test/suite/maria/maria-recovery-rtree-ft.test b/mysql-test/suite/maria/maria-recovery-rtree-ft.test index 11050ad676a..7112c00e5b7 100644 --- a/mysql-test/suite/maria/maria-recovery-rtree-ft.test +++ b/mysql-test/suite/maria/maria-recovery-rtree-ft.test @@ -31,7 +31,7 @@ use mysqltest; let $mms_tables=2; CREATE TABLE t1 ( - line LINESTRING NOT NULL, + line POINT NOT NULL, kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po', name VARCHAR(32) ,SPATIAL key (line) diff --git a/mysql-test/suite/maria/maria.result b/mysql-test/suite/maria/maria.result index 6efd87df786..a7e038675a9 100644 --- a/mysql-test/suite/maria/maria.result +++ b/mysql-test/suite/maria/maria.result @@ -2167,19 +2167,19 @@ t1 CREATE TABLE `t1` ( ) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 TRANSACTIONAL=1 drop table t1; CREATE TABLE t1 (line LINESTRING NOT NULL) engine=aria; -INSERT INTO t1 VALUES (GeomFromText("POINT(0 0)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(0 0)")); checksum table t1; Table Checksum -test.t1 326284887 +test.t1 310616673 CREATE TABLE t2 (line LINESTRING NOT NULL) engine=aria; -INSERT INTO t2 VALUES (GeomFromText("POINT(0 0)")); +INSERT INTO t2 VALUES (GeomFromText("LINESTRING(0 0)")); checksum table t2; Table Checksum -test.t2 326284887 +test.t2 310616673 CREATE TABLE t3 select * from t1; checksum table t3; Table Checksum -test.t3 326284887 +test.t3 310616673 drop table t1,t2,t3; End of 5.1 tests create table t2(a varchar(255),key(a))engine=aria row_format=dynamic transactional=0; diff --git a/mysql-test/suite/maria/maria.test b/mysql-test/suite/maria/maria.test index 6ebcf08d952..3fa7d755fe4 100644 --- a/mysql-test/suite/maria/maria.test +++ b/mysql-test/suite/maria/maria.test @@ -1437,10 +1437,10 @@ drop table t1; # CREATE TABLE t1 (line LINESTRING NOT NULL) engine=aria; -INSERT INTO t1 VALUES (GeomFromText("POINT(0 0)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(0 0)")); checksum table t1; CREATE TABLE t2 (line LINESTRING NOT NULL) engine=aria; -INSERT INTO t2 VALUES (GeomFromText("POINT(0 0)")); +INSERT INTO t2 VALUES (GeomFromText("LINESTRING(0 0)")); checksum table t2; CREATE TABLE t3 select * from t1; checksum table t3; diff --git a/mysql-test/suite/parts/r/partition_alter4_innodb.result b/mysql-test/suite/parts/r/partition_alter4_innodb.result index 5d3143e35bb..b0f340664b7 100644 --- a/mysql-test/suite/parts/r/partition_alter4_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter4_innodb.result @@ -37566,7 +37566,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION part_1; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -38026,7 +38026,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION part_1; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -38497,7 +38497,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION part_1; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -38969,7 +38969,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION part_1; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -39435,7 +39435,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION part_1; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -39907,7 +39907,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION part_1; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -40384,7 +40384,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION part_1; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -40859,7 +40859,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION part_1; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -41324,7 +41324,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -41784,7 +41784,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -42255,7 +42255,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -42727,7 +42727,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -43193,7 +43193,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -43665,7 +43665,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -44142,7 +44142,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -44617,7 +44617,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -52582,7 +52582,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION ALL; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -53042,7 +53042,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION ALL; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -53513,7 +53513,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION ALL; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -53985,7 +53985,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION ALL; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -54451,7 +54451,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION ALL; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -54923,7 +54923,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION ALL; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -55400,7 +55400,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION ALL; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template @@ -55875,7 +55875,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1; ALTER TABLE t1 OPTIMIZE PARTITION ALL; Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template diff --git a/mysql-test/suite/perfschema/r/start_server_no_waits_history.result b/mysql-test/suite/perfschema/r/start_server_no_waits_history.result new file mode 100644 index 00000000000..e89b15e524a --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_waits_history.result @@ -0,0 +1,63 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.performance_timers; +count(*) +5 +select count(*) from performance_schema.setup_consumers; +count(*) +8 +select count(*) > 0 from performance_schema.setup_instruments; +count(*) > 0 +1 +select count(*) from performance_schema.setup_timers; +count(*) +1 +select * from performance_schema.cond_instances; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.mutex_instances; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_timers; +select * from performance_schema.threads; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 0 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 10000 +performance_schema_max_rwlock_classes 30 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_events_waits_history_size"; +Variable_name Value +performance_schema_events_waits_history_size 0 +select count(*) from performance_schema.events_waits_history; +count(*) +0 +truncate table performance_schema.events_waits_history; diff --git a/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result new file mode 100644 index 00000000000..98172539625 --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result @@ -0,0 +1,63 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.performance_timers; +count(*) +5 +select count(*) from performance_schema.setup_consumers; +count(*) +8 +select count(*) > 0 from performance_schema.setup_instruments; +count(*) > 0 +1 +select count(*) from performance_schema.setup_timers; +count(*) +1 +select * from performance_schema.cond_instances; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.mutex_instances; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_timers; +select * from performance_schema.threads; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 0 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 10000 +performance_schema_max_rwlock_classes 30 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_events_waits_history_long_size"; +Variable_name Value +performance_schema_events_waits_history_long_size 0 +select count(*) from performance_schema.events_waits_history_long; +count(*) +0 +truncate table performance_schema.events_waits_history_long; diff --git a/mysql-test/suite/perfschema/r/start_server_nothing.result b/mysql-test/suite/perfschema/r/start_server_nothing.result new file mode 100644 index 00000000000..0933b18306b --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_nothing.result @@ -0,0 +1,122 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.performance_timers; +count(*) +5 +select count(*) from performance_schema.setup_consumers; +count(*) +8 +select count(*) > 0 from performance_schema.setup_instruments; +count(*) > 0 +0 +select count(*) from performance_schema.setup_timers; +count(*) +1 +select * from performance_schema.cond_instances; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.mutex_instances; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_timers; +select * from performance_schema.threads; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 0 +performance_schema_events_waits_history_size 0 +performance_schema_max_cond_classes 0 +performance_schema_max_cond_instances 0 +performance_schema_max_file_classes 0 +performance_schema_max_file_handles 0 +performance_schema_max_file_instances 0 +performance_schema_max_mutex_classes 0 +performance_schema_max_mutex_instances 0 +performance_schema_max_rwlock_classes 0 +performance_schema_max_rwlock_instances 0 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 +performance_schema_max_thread_classes 0 +performance_schema_max_thread_instances 0 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 0 +performance_schema_events_waits_history_size 0 +performance_schema_max_cond_classes 0 +performance_schema_max_cond_instances 0 +performance_schema_max_file_classes 0 +performance_schema_max_file_handles 0 +performance_schema_max_file_instances 0 +performance_schema_max_mutex_classes 0 +performance_schema_max_mutex_instances 0 +performance_schema_max_rwlock_classes 0 +performance_schema_max_rwlock_instances 0 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 +performance_schema_max_thread_classes 0 +performance_schema_max_thread_instances 0 +select * from performance_schema.setup_instruments; +NAME ENABLED TIMED +select TIMER_NAME from performance_schema.performance_timers; +TIMER_NAME +CYCLE +NANOSECOND +MICROSECOND +MILLISECOND +TICK +select * from performance_schema.setup_consumers; +NAME ENABLED +events_waits_current YES +events_waits_history YES +events_waits_history_long YES +events_waits_summary_by_thread_by_event_name YES +events_waits_summary_by_event_name YES +events_waits_summary_by_instance YES +file_summary_by_event_name YES +file_summary_by_instance YES +select NAME from performance_schema.setup_timers; +NAME +wait +select * from performance_schema.cond_instances; +NAME OBJECT_INSTANCE_BEGIN +select * from performance_schema.events_waits_current; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +select * from performance_schema.events_waits_history; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +select * from performance_schema.events_waits_history_long; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +select * from performance_schema.events_waits_summary_by_instance; +EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +THREAD_ID EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +select * from performance_schema.events_waits_summary_global_by_event_name; +EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +select * from performance_schema.file_instances; +FILE_NAME EVENT_NAME OPEN_COUNT +select * from performance_schema.file_summary_by_event_name; +EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE +select * from performance_schema.file_summary_by_instance; +FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE +select * from performance_schema.mutex_instances; +NAME OBJECT_INSTANCE_BEGIN LOCKED_BY_THREAD_ID +select * from performance_schema.rwlock_instances; +NAME OBJECT_INSTANCE_BEGIN WRITE_LOCKED_BY_THREAD_ID READ_LOCKED_BY_COUNT +select * from performance_schema.threads; +THREAD_ID PROCESSLIST_ID NAME diff --git a/mysql-test/suite/perfschema/t/start_server_no_waits_history-master.opt b/mysql-test/suite/perfschema/t/start_server_no_waits_history-master.opt new file mode 100644 index 00000000000..334f805e2d5 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_waits_history-master.opt @@ -0,0 +1,2 @@ +--loose-enable-performance-schema +--loose-performance_schema_events_waits_history_size=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_waits_history.test b/mysql-test/suite/perfschema/t/start_server_no_waits_history.test new file mode 100644 index 00000000000..2ee7dba2526 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_waits_history.test @@ -0,0 +1,14 @@ +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect no history +show variables like "performance_schema_events_waits_history_size"; +select count(*) from performance_schema.events_waits_history; + +# Valid operation, edge case +truncate table performance_schema.events_waits_history; + diff --git a/mysql-test/suite/perfschema/t/start_server_no_waits_history_long-master.opt b/mysql-test/suite/perfschema/t/start_server_no_waits_history_long-master.opt new file mode 100644 index 00000000000..ca6699f8111 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_waits_history_long-master.opt @@ -0,0 +1,2 @@ +--loose-enable-performance-schema +--loose-performance_schema_events_waits_history_long_size=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_waits_history_long.test b/mysql-test/suite/perfschema/t/start_server_no_waits_history_long.test new file mode 100644 index 00000000000..e393304a94d --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_waits_history_long.test @@ -0,0 +1,14 @@ +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect no history long +show variables like "performance_schema_events_waits_history_long_size"; +select count(*) from performance_schema.events_waits_history_long; + +# Valid operation, edge case +truncate table performance_schema.events_waits_history_long; + diff --git a/mysql-test/suite/perfschema/t/start_server_nothing-master.opt b/mysql-test/suite/perfschema/t/start_server_nothing-master.opt new file mode 100644 index 00000000000..529d3a1703b --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_nothing-master.opt @@ -0,0 +1,19 @@ +--loose-enable-performance-schema + +--loose-performance_schema_events_waits_history_long_size=0 +--loose-performance_schema_events_waits_history_size=0 + +--loose-performance_schema_max_mutex_classes=0 +--loose-performance_schema_max_rwlock_classes=0 +--loose-performance_schema_max_cond_classes=0 +--loose-performance_schema_max_file_classes=0 +--loose-performance_schema_max_thread_classes=0 + +--loose-performance_schema_max_mutex_instances=0 +--loose-performance_schema_max_rwlock_instances=0 +--loose-performance_schema_max_cond_instances=0 +--loose-performance_schema_max_file_instances=0 +--loose-performance_schema_max_thread_instances=0 + +--loose-performance_schema_max_file_handles=0 + diff --git a/mysql-test/suite/perfschema/t/start_server_nothing.test b/mysql-test/suite/perfschema/t/start_server_nothing.test new file mode 100644 index 00000000000..b2deae35ba6 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_nothing.test @@ -0,0 +1,30 @@ +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +show variables like "performance_schema%"; + +# Not empty +select * from performance_schema.setup_instruments; +select TIMER_NAME from performance_schema.performance_timers; +select * from performance_schema.setup_consumers; +select NAME from performance_schema.setup_timers; + +# All empty +select * from performance_schema.cond_instances; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.mutex_instances; +select * from performance_schema.rwlock_instances; +select * from performance_schema.threads; + diff --git a/mysql-test/suite/plugins/r/audit_null_debug.result b/mysql-test/suite/plugins/r/audit_null_debug.result index 2b5fa291f24..86a22135852 100644 --- a/mysql-test/suite/plugins/r/audit_null_debug.result +++ b/mysql-test/suite/plugins/r/audit_null_debug.result @@ -1,4 +1,4 @@ -call mtr.add_suppression("mysql/plugin.MYI"); +call mtr.add_suppression("Incorrect key file for table.*mysql.plugin.MYI"); SET debug_dbug='+d,myisam_pretend_crashed_table_on_usage'; install plugin audit_null soname 'adt_null'; ERROR HY000: Incorrect key file for table './mysql/plugin.MYI'; try to repair it diff --git a/mysql-test/suite/plugins/r/auth_v0100.result b/mysql-test/suite/plugins/r/auth_v0100.result new file mode 100644 index 00000000000..53affc94947 --- /dev/null +++ b/mysql-test/suite/plugins/r/auth_v0100.result @@ -0,0 +1,18 @@ +install soname 'auth_0x0100'; +select plugin_name, plugin_type_version from information_schema.plugins where plugin_type='authentication' order by plugin_name; +plugin_name plugin_type_version +auth_0x0100 1.0 +mysql_native_password 2.0 +mysql_old_password 2.0 +create user tt identified via auth_0x0100; +grant select on test.* to zzzzzzzzzzzzzzzz; +connect(localhost,tt,,test,MASTER_MYPORT,MASTER_MYSOCK); +ERROR 28000: Access denied for user 'tt'@'localhost' (using password: YES) +grant proxy on zzzzzzzzzzzzzzzz to tt; +select user(), current_user(), @@external_user; +user() tt@localhost +current_user() zzzzzzzzzzzzzzzz@% +@@external_user oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo. +drop user tt; +drop user zzzzzzzzzzzzzzzz; +uninstall plugin auth_0x0100; diff --git a/mysql-test/suite/plugins/r/qc_info.result b/mysql-test/suite/plugins/r/qc_info.result new file mode 100644 index 00000000000..3e967d55f43 --- /dev/null +++ b/mysql-test/suite/plugins/r/qc_info.result @@ -0,0 +1,15 @@ +set global query_cache_size=1355776; +create table t1 (a int not null); +insert into t1 values (1),(2),(3); +select * from t1; +a +1 +2 +3 +select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info; +statement_schema statement_text result_blocks_count result_blocks_size +test select * from t1 1 512 +drop table t1; +select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info; +statement_schema statement_text result_blocks_count result_blocks_size +set global query_cache_size= default; diff --git a/mysql-test/suite/plugins/r/qc_info_priv.result b/mysql-test/suite/plugins/r/qc_info_priv.result new file mode 100644 index 00000000000..c723eca1ec0 --- /dev/null +++ b/mysql-test/suite/plugins/r/qc_info_priv.result @@ -0,0 +1,23 @@ +set global query_cache_size=1355776; +create table t1 (a int not null); +insert into t1 values (1),(2),(3); +select * from t1; +a +1 +2 +3 +select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info; +statement_schema statement_text result_blocks_count result_blocks_size +test select * from t1 1 512 +create user mysqltest; +select a from t1; +a +1 +2 +3 +select count(*) from information_schema.query_cache_info; +count(*) +0 +drop user mysqltest; +drop table t1; +set global query_cache_size= default; diff --git a/mysql-test/suite/plugins/t/audit_null_debug.test b/mysql-test/suite/plugins/t/audit_null_debug.test index d9e6cad5524..bd0495843db 100644 --- a/mysql-test/suite/plugins/t/audit_null_debug.test +++ b/mysql-test/suite/plugins/t/audit_null_debug.test @@ -5,19 +5,21 @@ if (!$ADT_NULL_SO) { skip No NULL_AUDIT plugin; } -call mtr.add_suppression("mysql/plugin.MYI"); +call mtr.add_suppression("Incorrect key file for table.*mysql.plugin.MYI"); # # MySQL BUG#14485479 - INSTALL AUDIT PLUGIN HANGS IF WE TRY TO DISABLE AND ENABLED DURING DDL OPERATION # (a.k.a. audit event caused by the table access during audit plugin initialization) # SET debug_dbug='+d,myisam_pretend_crashed_table_on_usage'; +--replace_result \\ / --error 126 install plugin audit_null soname 'adt_null'; SET debug_dbug='-d,myisam_pretend_crashed_table_on_usage'; install plugin audit_null soname 'adt_null'; SET debug_dbug='+d,myisam_pretend_crashed_table_on_usage'; +--replace_result \\ / --error 126 uninstall plugin audit_null; SET debug_dbug='-d,myisam_pretend_crashed_table_on_usage'; diff --git a/mysql-test/suite/plugins/t/auth_v0100.test b/mysql-test/suite/plugins/t/auth_v0100.test new file mode 100644 index 00000000000..3cf93ba67f2 --- /dev/null +++ b/mysql-test/suite/plugins/t/auth_v0100.test @@ -0,0 +1,26 @@ +--source include/not_embedded.inc + +if (!$AUTH_0X0100_SO) { + skip No auth_0x0100 plugin; +} + +install soname 'auth_0x0100'; + +select plugin_name, plugin_type_version from information_schema.plugins where plugin_type='authentication' order by plugin_name; + +create user tt identified via auth_0x0100; +grant select on test.* to zzzzzzzzzzzzzzzz; + +--replace_result $MASTER_MYSOCK MASTER_MYSOCK $MASTER_MYPORT MASTER_MYPORT +--error ER_ACCESS_DENIED_ERROR +connect (c0,localhost,tt); + +grant proxy on zzzzzzzzzzzzzzzz to tt; +connect (c1,localhost,tt); +connection c1; + +--query_vertical select user(), current_user(), @@external_user +connection default; +drop user tt; +drop user zzzzzzzzzzzzzzzz; +uninstall plugin auth_0x0100; diff --git a/mysql-test/suite/plugins/t/qc_info.test b/mysql-test/suite/plugins/t/qc_info.test new file mode 100644 index 00000000000..fc6c9d5af3a --- /dev/null +++ b/mysql-test/suite/plugins/t/qc_info.test @@ -0,0 +1,8 @@ +--source qc_info_init.inc + +drop table t1; +# the query was invalidated +select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info; + +set global query_cache_size= default; + diff --git a/mysql-test/suite/plugins/t/qc_info_init.inc b/mysql-test/suite/plugins/t/qc_info_init.inc new file mode 100644 index 00000000000..9422bd7f141 --- /dev/null +++ b/mysql-test/suite/plugins/t/qc_info_init.inc @@ -0,0 +1,12 @@ +if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'query_cache_info' and plugin_status='active'`) +{ + --skip QUERY_CACHE_INFO plugin is not active +} + +set global query_cache_size=1355776; + +create table t1 (a int not null); +insert into t1 values (1),(2),(3); +select * from t1; +select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info; + diff --git a/mysql-test/suite/plugins/t/qc_info_init.opt b/mysql-test/suite/plugins/t/qc_info_init.opt new file mode 100644 index 00000000000..663de4da7d7 --- /dev/null +++ b/mysql-test/suite/plugins/t/qc_info_init.opt @@ -0,0 +1,2 @@ +--loose-query_cache_info +--plugin-load=$QUERY_CACHE_INFO_SO diff --git a/mysql-test/suite/plugins/t/qc_info_priv.test b/mysql-test/suite/plugins/t/qc_info_priv.test new file mode 100644 index 00000000000..31c394107c1 --- /dev/null +++ b/mysql-test/suite/plugins/t/qc_info_priv.test @@ -0,0 +1,15 @@ +--source include/not_embedded.inc +--source qc_info_init.inc + +# try an unprivileged user +create user mysqltest; +connect (conn1,localhost,mysqltest,,); +connection conn1; +select a from t1; +select count(*) from information_schema.query_cache_info; +connection default; +drop user mysqltest; +drop table t1; + +set global query_cache_size= default; + diff --git a/mysql-test/suite/rpl/disabled.def b/mysql-test/suite/rpl/disabled.def index a45fdb47ae6..9eb5f57c7be 100644 --- a/mysql-test/suite/rpl/disabled.def +++ b/mysql-test/suite/rpl/disabled.def @@ -13,5 +13,4 @@ rpl_row_create_table : Bug#11759274 2010-02-27 andrei failed different way than earlier with bug#45576 rpl_spec_variables : BUG#11755836 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock -rpl_row_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out rpl_stm_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out diff --git a/mysql-test/suite/rpl/r/replace.result b/mysql-test/suite/rpl/r/replace.result new file mode 100644 index 00000000000..855c54ef8fa --- /dev/null +++ b/mysql-test/suite/rpl/r/replace.result @@ -0,0 +1,22 @@ +include/master-slave.inc +[connection master] +drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (pr_id int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, pr_page int(11) NOT NULL, pr_type varbinary(60) NOT NULL, test int, UNIQUE KEY pr_pagetype (pr_page,pr_type)) ENGINE=myisam AUTO_INCREMENT=136; +insert into t1 (pr_page, pr_type, test) values(1,"one",0),(2,"two",0); +select * from t1; +pr_id pr_page pr_type test +136 1 one 0 +137 2 two 0 +replace into t1 (pr_page, pr_type,test) values(1,"one",2); +select * from t1; +pr_id pr_page pr_type test +138 1 one 2 +137 2 two 0 +select * from t1; +pr_id pr_page pr_type test +138 1 one 2 +137 2 two 0 +drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_bug31076.result b/mysql-test/suite/rpl/r/rpl_bug31076.result index 1cf8b87f68d..e09960e848e 100644 --- a/mysql-test/suite/rpl/r/rpl_bug31076.result +++ b/mysql-test/suite/rpl/r/rpl_bug31076.result @@ -35,6 +35,7 @@ KEY `event_id` (`event_id`), KEY `visit_id` (`visit_id`), KEY `data` (`data`) ) ENGINE=MyISAM AUTO_INCREMENT=33900731 DEFAULT CHARSET=latin1; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; BINLOG ' @@ -47,6 +48,7 @@ Bk3vRhe0AQAAWgAAABEMyQkQAJlXFwIAAAEABv/AIE4AvvVDAQZN70YAK0Rvd25sb2Fkcy9NeVNR TC00LjEvbXlzcWwtNC4xLjEyYS13aW4zMi56aXBPaAIC '/*!*/; SET INSERT_ID=21231039/*!*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; use track/*!*/; SET TIMESTAMP=1190087942/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; diff --git a/mysql-test/suite/rpl/r/rpl_hrtime.result b/mysql-test/suite/rpl/r/rpl_hrtime.result index fbe4ba28409..e03257b8901 100644 --- a/mysql-test/suite/rpl/r/rpl_hrtime.result +++ b/mysql-test/suite/rpl/r/rpl_hrtime.result @@ -26,6 +26,7 @@ a b c 0000-00-00 00:00:00.0000 0 2022-02-02 02:02:02.65 drop table t1; include/rpl_end.inc +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -95,3 +96,4 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; diff --git a/mysql-test/suite/rpl/r/rpl_mdev382.result b/mysql-test/suite/rpl/r/rpl_mdev382.result index bbc57006d0d..f904561b722 100644 --- a/mysql-test/suite/rpl/r/rpl_mdev382.result +++ b/mysql-test/suite/rpl/r/rpl_mdev382.result @@ -154,6 +154,7 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=# master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/f\'le.txt' INTO TABLE `db1``; select 'oops!'`.`t``1` FIELDS TERMINATED BY ',' ENCLOSED BY '\'' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a``1`, `b``2`) SET `c``3`= concat('|', "b""a'z", "!") ;file_id=# master-bin.000001 # Query # # COMMIT +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -197,6 +198,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; SELECT * FROM `db1``; select 'oops!'`.`t``1`; a`1 b`2 c`3 fo\o bar |b"a'z! @@ -246,6 +248,7 @@ master-bin.000001 # User var # # @```c`=-123450123456789012345678901234567890123 master-bin.000001 # User var # # @```d```=_latin1 0x78787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878 COLLATE latin1_swedish_ci master-bin.000001 # Query # # use `db1``; select 'oops!'`; INSERT INTO t1 VALUES (@`a``1`+1, @`a``2`*100, @`a``3`-1, @`a``4`-1, @`b```/2, @```c`, substr(@```d```, 2, 98)) master-bin.000001 # Query # # COMMIT +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -291,6 +294,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; SELECT * FROM `db1``; select 'oops!'`.t1 ORDER BY a1; a1 a2 a3 a4 b c d -9223372036854775808 42 9223372036854775807 18446744073709551615 -1.234560123456789e125 -1234501234567890123456789012345678901234567890123456789.0123456789 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx @@ -337,6 +341,7 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Query # # BEGIN master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES(1) master-bin.000002 # Query # # COMMIT +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -363,5 +368,6 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; DROP TABLE t1; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_report_port.result b/mysql-test/suite/rpl/r/rpl_report_port.result index 6a9ac341780..2f422c8b577 100644 --- a/mysql-test/suite/rpl/r/rpl_report_port.result +++ b/mysql-test/suite/rpl/r/rpl_report_port.result @@ -2,10 +2,12 @@ include/master-slave.inc [connection master] include/rpl_restart_server.inc [server_number=2 parameters: --report-port=9000] include/start_slave.inc +include/wait_for_slave_param.inc [Slave_IO_State] [Slave restarted with the report-port set to some value] include/assert.inc [The value shown for the slave's port number is user specified port number which is the value set for report-port.] include/rpl_restart_server.inc [server_number=2] include/start_slave.inc +include/wait_for_slave_param.inc [Slave_IO_State] [Slave restarted with the report-port set to the value of slave's port number] include/assert.inc [The default value shown for the slave's port number is the actual port number of the slave.] include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result index 1a4d5c7574d..1489af830cc 100644 --- a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result +++ b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result @@ -150,6 +150,7 @@ c1 c3 c4 c5 5 2006-02-22 00:00:00 Tested in Texas 11 --- Test 2 position test -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -170,8 +171,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- Test 3 First Remote test -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -201,6 +204,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- Test 4 Second Remote test -- DROP TABLE t1; @@ -274,6 +278,7 @@ c1 c3 c4 c5 5 2006-02-22 00:00:00 Tested in Texas 11 --- Test 5 LOAD DATA -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -281,8 +286,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- Test 6 reading stdin -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -312,8 +319,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- Test 7 reading stdin w/position -- +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -334,6 +343,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- Test 8 switch internal charset -- stop slave; diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result index 8a2a88a8c90..2f5052f0180 100644 --- a/mysql-test/suite/rpl/r/rpl_sp.result +++ b/mysql-test/suite/rpl/r/rpl_sp.result @@ -652,6 +652,7 @@ show function status like '%mysqltestbug36570%'; Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation test mysqltestbug36570_f1 FUNCTION root@localhost t t DEFINER latin1 latin1_swedish_ci latin1_swedish_ci flush logs; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -1178,6 +1179,7 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; use test; drop procedure mysqltestbug36570_p1; drop procedure ` mysqltestbug36570_p2`; diff --git a/mysql-test/suite/rpl/r/semisync_memleak_4066.result b/mysql-test/suite/rpl/r/semisync_memleak_4066.result new file mode 100644 index 00000000000..c0dd9f0c993 --- /dev/null +++ b/mysql-test/suite/rpl/r/semisync_memleak_4066.result @@ -0,0 +1,6 @@ +include/master-slave.inc +[connection master] +INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so'; +CREATE TEMPORARY TABLE tmp (i INT); +include/rpl_end.inc +uninstall plugin rpl_semi_sync_master; diff --git a/mysql-test/suite/rpl/t/replace.test b/mysql-test/suite/rpl/t/replace.test new file mode 100644 index 00000000000..36afda0d927 --- /dev/null +++ b/mysql-test/suite/rpl/t/replace.test @@ -0,0 +1,24 @@ +# +# Test of REPLACE with replication +# + +source include/master-slave.inc; + +# +# Test of doing replace on unique key on table with auto_increment +# + +drop table if exists t1; +CREATE TABLE t1 (pr_id int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, pr_page int(11) NOT NULL, pr_type varbinary(60) NOT NULL, test int, UNIQUE KEY pr_pagetype (pr_page,pr_type)) ENGINE=myisam AUTO_INCREMENT=136; +insert into t1 (pr_page, pr_type, test) values(1,"one",0),(2,"two",0); +select * from t1; +replace into t1 (pr_page, pr_type,test) values(1,"one",2); +select * from t1; +sync_slave_with_master; +connection slave; +select * from t1; +connection master; +drop table t1; + +# End of 5.5 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_bug31076.test b/mysql-test/suite/rpl/t/rpl_bug31076.test index 028ca32636a..4e9517fbf2a 100644 --- a/mysql-test/suite/rpl/t/rpl_bug31076.test +++ b/mysql-test/suite/rpl/t/rpl_bug31076.test @@ -40,6 +40,7 @@ CREATE TABLE `visits_events` ( KEY `data` (`data`) ) ENGINE=MyISAM AUTO_INCREMENT=33900731 DEFAULT CHARSET=latin1; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; --delimiter /*!*/; @@ -119,6 +120,7 @@ SET INSERT_ID=21231039/*!*/; # 9c90ded 2d 63 6f 6e 6e 65 63 74 6f 72 2d 6a 61 76 61 2d |.connector.java.| # 9c90dfd 33 2e 30 2e 31 37 2d 67 61 2e 7a 69 70 |3.0.17.ga.zip| # Query thread_id=28278824 exec_time=0 error_code=0 +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; use track/*!*/; SET TIMESTAMP=1190087942/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; diff --git a/mysql-test/suite/rpl/t/rpl_report_port.test b/mysql-test/suite/rpl/t/rpl_report_port.test index 12c34ce01b1..6e728a678ad 100644 --- a/mysql-test/suite/rpl/t/rpl_report_port.test +++ b/mysql-test/suite/rpl/t/rpl_report_port.test @@ -32,6 +32,9 @@ connection master; connection slave; --source include/start_slave.inc +--let $slave_param= Slave_IO_State +--let $slave_param_value= Waiting for master to send event +--source include/wait_for_slave_param.inc --echo [Slave restarted with the report-port set to some value] connection master; @@ -52,6 +55,9 @@ connection master; connection slave; --source include/start_slave.inc +--let $slave_param= Slave_IO_State +--let $slave_param_value= Waiting for master to send event +--source include/wait_for_slave_param.inc connection master; sync_slave_with_master; diff --git a/mysql-test/suite/rpl/t/rpl_rotate_purge_deadlock.test b/mysql-test/suite/rpl/t/rpl_rotate_purge_deadlock.test index a63844b451c..6db4e2bea04 100644 --- a/mysql-test/suite/rpl/t/rpl_rotate_purge_deadlock.test +++ b/mysql-test/suite/rpl/t/rpl_rotate_purge_deadlock.test @@ -1,10 +1,10 @@ # # Bug#11763573 - 56299: MUTEX DEADLOCK WITH COM_BINLOG_DUMP, BINLOG PURGE, AND PROCESSLIST/KILL # -source include/master-slave.inc; source include/have_debug_sync.inc; source include/have_binlog_format_row.inc; source include/have_innodb.inc; +source include/master-slave.inc; # # Testing that execution of two concurrent INSERTing connections both diff --git a/mysql-test/suite/rpl/t/rpl_row_until.test b/mysql-test/suite/rpl/t/rpl_row_until.test index b861bb8c8ec..55fefb3aafa 100644 --- a/mysql-test/suite/rpl/t/rpl_row_until.test +++ b/mysql-test/suite/rpl/t/rpl_row_until.test @@ -13,8 +13,8 @@ let $master_pos_drop_t1= query_get_value(SHOW MASTER STATUS, Position, 1); DROP TABLE t1; # Save master log position for query DROP TABLE t1 save_master_pos; -let $master_pos_drop_t1= query_get_value(SHOW BINLOG EVENTS, Pos, 7); -let $master_log_file= query_get_value(SHOW BINLOG EVENTS, Log_name, 7); +let $master_pos_drop_t1= query_get_value(SHOW BINLOG EVENTS, Pos, 8); +let $master_log_file= query_get_value(SHOW BINLOG EVENTS, Log_name, 8); # Save master log position for query CREATE TABLE t2 let $master_pos_create_t2= query_get_value(SHOW MASTER STATUS, Position, 1); diff --git a/mysql-test/suite/rpl/t/semisync_memleak_4066.test b/mysql-test/suite/rpl/t/semisync_memleak_4066.test new file mode 100644 index 00000000000..687af883936 --- /dev/null +++ b/mysql-test/suite/rpl/t/semisync_memleak_4066.test @@ -0,0 +1,19 @@ +# +# MDEV-4066 semisync_master + temporary tables causes memory leaks +# +source include/have_semisync_plugin.inc; +source include/have_binlog_format_row.inc; +source include/master-slave.inc; + +connection master; + +--replace_result .dll .so +eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_SO'; + +--connect (con1,localhost,root,,) +CREATE TEMPORARY TABLE tmp (i INT); +--disconnect con1 + +source include/rpl_end.inc; +uninstall plugin rpl_semi_sync_master; + diff --git a/mysql-test/suite/storage_engine/1st.result b/mysql-test/suite/storage_engine/1st.result index 6b686c2b2b4..192a8f8f39b 100644 --- a/mysql-test/suite/storage_engine/1st.result +++ b/mysql-test/suite/storage_engine/1st.result @@ -4,7 +4,7 @@ SHOW CREATE TABLE t1; SHOW COLUMNS IN t1; INSERT INTO t1 VALUES (1,'a'); INSERT INTO t1 (a,b) VALUES (2,'b'); -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 2 b diff --git a/mysql-test/suite/storage_engine/1st.test b/mysql-test/suite/storage_engine/1st.test index af7a4503948..c9ebd8b75e4 100644 --- a/mysql-test/suite/storage_engine/1st.test +++ b/mysql-test/suite/storage_engine/1st.test @@ -14,7 +14,7 @@ # - CREATE TABLE .. (column1 <column options>, column2 <column options>) ENGINE=<storage_engine>; # - INSERT INTO TABLE .. VALUES (val1,val2); # - DROP TABLE .. -# - SELECT * FROM .. +# - SELECT a,b FROM .. # - SHOW CREATE TABLE .. # - SHOW COLUMNS IN ... # @@ -62,10 +62,10 @@ if (!$mysql_errname) --source unexpected_result.inc } - SELECT * FROM t1; + SELECT a,b FROM t1; if ($mysql_errname) { - --let $functionality = SELECT * FROM .. + --let $functionality = SELECT a,b FROM .. --source unexpected_result.inc } diff --git a/mysql-test/suite/storage_engine/alter_table.result b/mysql-test/suite/storage_engine/alter_table.result index 6d868a27a36..09696e0e6b6 100644 --- a/mysql-test/suite/storage_engine/alter_table.result +++ b/mysql-test/suite/storage_engine/alter_table.result @@ -105,7 +105,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 -SELECT * FROM t1; +SELECT a,b FROM t1; a b 2 2 4 3 diff --git a/mysql-test/suite/storage_engine/alter_table.test b/mysql-test/suite/storage_engine/alter_table.test index 023d8927e16..f99792f5766 100644 --- a/mysql-test/suite/storage_engine/alter_table.test +++ b/mysql-test/suite/storage_engine/alter_table.test @@ -111,7 +111,7 @@ SHOW CREATE TABLE t1; --source alter_table.inc --source mask_engine.inc SHOW CREATE TABLE t1; -SELECT * FROM t1; +SELECT a,b FROM t1; DROP TABLE t1; # Character set, collate diff --git a/mysql-test/suite/storage_engine/alter_tablespace.result b/mysql-test/suite/storage_engine/alter_tablespace.result index 5d8709b2357..71ef910b222 100644 --- a/mysql-test/suite/storage_engine/alter_tablespace.result +++ b/mysql-test/suite/storage_engine/alter_tablespace.result @@ -4,15 +4,15 @@ ALTER TABLE t1 DISCARD TABLESPACE; DROP TABLE t1; CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; INSERT INTO t1 (a) VALUES (1),(2); -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 ALTER TABLE t1 DISCARD TABLESPACE; -SELECT * FROM t1; +SELECT a FROM t1; ERROR HY000: Got error -1 from storage engine ALTER TABLE t1 IMPORT TABLESPACE; -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 diff --git a/mysql-test/suite/storage_engine/alter_tablespace.test b/mysql-test/suite/storage_engine/alter_tablespace.test index 6c429bb98ea..508639c7dc5 100644 --- a/mysql-test/suite/storage_engine/alter_tablespace.test +++ b/mysql-test/suite/storage_engine/alter_tablespace.test @@ -30,7 +30,7 @@ if (!$mysql_errname) --source create_table.inc INSERT INTO t1 (a) VALUES (1),(2); --sorted_result - SELECT * FROM t1; + SELECT a FROM t1; # http://dev.mysql.com/doc/mysql-enterprise-backup/3.5/en/partial.restoring.single.html # To get a "clean" backup we need to either use innobackup, or to monitor show engine innodb status, @@ -64,7 +64,7 @@ EOF --source alter_table.inc --let $error_codes = ER_GET_ERRNO - SELECT * FROM t1; + SELECT a FROM t1; --source check_errors.inc if ($mysql_errname != ER_GET_ERRNO) { @@ -76,7 +76,7 @@ EOF --let $alter_definition = IMPORT TABLESPACE --source alter_table.inc --sorted_result - SELECT * FROM t1; + SELECT a FROM t1; # Adding a warning suppression based on what InnoDB currently does # when it attempts to access a table without an *.ibd file diff --git a/mysql-test/suite/storage_engine/autoinc_secondary.result b/mysql-test/suite/storage_engine/autoinc_secondary.result index ad2b43bc6fe..28b0a406fff 100644 --- a/mysql-test/suite/storage_engine/autoinc_secondary.result +++ b/mysql-test/suite/storage_engine/autoinc_secondary.result @@ -4,7 +4,7 @@ INSERT INTO t1 (b) VALUES ('a'),('b'),('b'),('c'),('a'); SELECT LAST_INSERT_ID(); LAST_INSERT_ID() 1 -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 2 b @@ -17,7 +17,7 @@ INSERT INTO t1 (a) VALUES ('a'),('b'),('b'),('c'),('a'); SELECT LAST_INSERT_ID(); LAST_INSERT_ID() 1 -SELECT * FROM t1; +SELECT a,b FROM t1; a b a 1 a 2 @@ -30,7 +30,7 @@ INSERT INTO t1 (a) VALUES ('a'),('b'),('b'),('c'),('a'); SELECT LAST_INSERT_ID(); LAST_INSERT_ID() 1 -SELECT * FROM t1; +SELECT a,b FROM t1; a b a 1 a 5 diff --git a/mysql-test/suite/storage_engine/autoinc_secondary.test b/mysql-test/suite/storage_engine/autoinc_secondary.test index 8b95f1d859e..25fc0f7cfa1 100644 --- a/mysql-test/suite/storage_engine/autoinc_secondary.test +++ b/mysql-test/suite/storage_engine/autoinc_secondary.test @@ -25,7 +25,7 @@ if (!$mysql_errname) INSERT INTO t1 (b) VALUES ('a'),('b'),('b'),('c'),('a'); SELECT LAST_INSERT_ID(); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; DROP TABLE t1; } @@ -45,7 +45,7 @@ if (!$mysql_errname) INSERT INTO t1 (a) VALUES ('a'),('b'),('b'),('c'),('a'); SELECT LAST_INSERT_ID(); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; DROP TABLE t1; } @@ -65,7 +65,7 @@ if (!$mysql_errname) INSERT INTO t1 (a) VALUES ('a'),('b'),('b'),('c'),('a'); SELECT LAST_INSERT_ID(); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; DROP TABLE t1; } diff --git a/mysql-test/suite/storage_engine/autoinc_vars.result b/mysql-test/suite/storage_engine/autoinc_vars.result index a9fd8c8d06c..aca21dfd1c4 100644 --- a/mysql-test/suite/storage_engine/autoinc_vars.result +++ b/mysql-test/suite/storage_engine/autoinc_vars.result @@ -5,7 +5,7 @@ INSERT INTO t1 (a,b) VALUES (NULL,'a'),(NULL,'b'),(NULL,'c'); SELECT LAST_INSERT_ID(); LAST_INSERT_ID() 1 -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 2 b @@ -15,7 +15,7 @@ INSERT INTO t1 (a,b) VALUES (NULL,'d'),(NULL,'e'),(NULL,'f'); SELECT LAST_INSERT_ID(); LAST_INSERT_ID() 200 -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 2 b @@ -28,7 +28,7 @@ INSERT INTO t1 (a,b) VALUES (NULL,'g'),(NULL,'h'),(NULL,'i'); SELECT LAST_INSERT_ID(); LAST_INSERT_ID() 850 -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 2 b @@ -48,6 +48,6 @@ ERROR 22003: Out of range value for column 'a' at row 1 SELECT LAST_INSERT_ID(); LAST_INSERT_ID() 850 -SELECT * FROM t1; +SELECT a FROM t1; a DROP TABLE t1; diff --git a/mysql-test/suite/storage_engine/autoinc_vars.test b/mysql-test/suite/storage_engine/autoinc_vars.test index ceafcd7138f..b154fd794d0 100644 --- a/mysql-test/suite/storage_engine/autoinc_vars.test +++ b/mysql-test/suite/storage_engine/autoinc_vars.test @@ -25,7 +25,7 @@ if (!$mysql_errname) INSERT INTO t1 (a,b) VALUES (NULL,'a'),(NULL,'b'),(NULL,'c'); SELECT LAST_INSERT_ID(); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; # auto_increment_increment @@ -34,13 +34,13 @@ if (!$mysql_errname) INSERT INTO t1 (a,b) VALUES (NULL,'d'),(NULL,'e'),(NULL,'f'); SELECT LAST_INSERT_ID(); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; SET auto_increment_increment = 50; INSERT INTO t1 (a,b) VALUES (NULL,'g'),(NULL,'h'),(NULL,'i'); SELECT LAST_INSERT_ID(); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; DROP TABLE t1; } @@ -60,7 +60,7 @@ if (!$mysql_errname) INSERT INTO t1 (a) VALUES (NULL); SELECT LAST_INSERT_ID(); --sorted_result - SELECT * FROM t1; + SELECT a FROM t1; DROP TABLE t1; } diff --git a/mysql-test/suite/storage_engine/autoincrement.result b/mysql-test/suite/storage_engine/autoincrement.result index bc51a2a82af..44cb8650441 100644 --- a/mysql-test/suite/storage_engine/autoincrement.result +++ b/mysql-test/suite/storage_engine/autoincrement.result @@ -8,7 +8,7 @@ t1 CREATE TABLE `t1` ( KEY `a` (`a`) ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT INTO t1 (b) VALUES ('a'),('b'); -SELECT * FROM t1 ORDER BY a; +SELECT a,b FROM t1 ORDER BY a; a b 1 a 2 b @@ -16,7 +16,7 @@ SELECT LAST_INSERT_ID(); LAST_INSERT_ID() 1 INSERT INTO t1 (a,b) VALUES (NULL,'c'),(0,'d'); -SELECT * FROM t1 ORDER BY a; +SELECT a,b FROM t1 ORDER BY a; a b 1 a 2 b @@ -27,7 +27,7 @@ LAST_INSERT_ID() 3 SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; INSERT INTO t1 (a,b) VALUES (NULL,'e'); -SELECT * FROM t1 ORDER BY a; +SELECT a,b FROM t1 ORDER BY a; a b 1 a 2 b @@ -38,7 +38,7 @@ SELECT LAST_INSERT_ID(); LAST_INSERT_ID() 5 INSERT INTO t1 (a,b) VALUES (0,'f'); -SELECT * FROM t1 ORDER BY a; +SELECT a,b FROM t1 ORDER BY a; a b 0 f 1 a @@ -61,7 +61,7 @@ SHOW TABLE STATUS FROM test LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment t1 # # # # # # # # # 8 # # # # # # # INSERT INTO t1 (a,b) VALUES (NULL,'i'),(9,'j'); -SELECT * FROM t1 ORDER BY a; +SELECT a,b FROM t1 ORDER BY a; a b 0 f 1 a @@ -84,7 +84,7 @@ SHOW TABLE STATUS FROM test LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment t1 # # # # # # # # # 21 # # # # # # # INSERT INTO t1 (a,b) VALUES (NULL,'l'); -SELECT * FROM t1 ORDER BY a; +SELECT a,b FROM t1 ORDER BY a; a b 0 f 1 a @@ -105,7 +105,7 @@ SHOW TABLE STATUS FROM test LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment t1 # # # # # # # # # 22 # # # # # # # INSERT INTO t1 (a,b) VALUES (-5,'m'); -SELECT * FROM t1 ORDER BY a; +SELECT a,b FROM t1 ORDER BY a; a b -5 m 0 f @@ -123,7 +123,7 @@ a b DROP TABLE t1; CREATE TABLE t1 (a <INT_COLUMN> AUTO_INCREMENT, b <CHAR_COLUMN>, <CUSTOM_INDEX>(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> AUTO_INCREMENT = 100; INSERT INTO t1 (a,b) VALUES (NULL,'a'),(NULL,'b'); -SELECT * FROM t1; +SELECT a,b FROM t1; a b 100 a 101 b diff --git a/mysql-test/suite/storage_engine/autoincrement.test b/mysql-test/suite/storage_engine/autoincrement.test index fb07ea55c57..ddb0ab1b464 100644 --- a/mysql-test/suite/storage_engine/autoincrement.test +++ b/mysql-test/suite/storage_engine/autoincrement.test @@ -26,22 +26,22 @@ if (!$mysql_errname) # Automatic values INSERT INTO t1 (b) VALUES ('a'),('b'); - SELECT * FROM t1 ORDER BY a; + SELECT a,b FROM t1 ORDER BY a; SELECT LAST_INSERT_ID(); INSERT INTO t1 (a,b) VALUES (NULL,'c'),(0,'d'); - SELECT * FROM t1 ORDER BY a; + SELECT a,b FROM t1 ORDER BY a; SELECT LAST_INSERT_ID(); let $sql_mode = `SELECT @@sql_mode`; SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; INSERT INTO t1 (a,b) VALUES (NULL,'e'); - SELECT * FROM t1 ORDER BY a; + SELECT a,b FROM t1 ORDER BY a; SELECT LAST_INSERT_ID(); INSERT INTO t1 (a,b) VALUES (0,'f'); - SELECT * FROM t1 ORDER BY a; + SELECT a,b FROM t1 ORDER BY a; SELECT LAST_INSERT_ID(); --replace_result $sql_mode <INITIAL_SQL_MODE> @@ -63,7 +63,7 @@ if (!$mysql_errname) INSERT INTO t1 (a,b) VALUES (NULL,'i'),(9,'j'); - SELECT * FROM t1 ORDER BY a; + SELECT a,b FROM t1 ORDER BY a; SELECT LAST_INSERT_ID(); --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # @@ -77,7 +77,7 @@ if (!$mysql_errname) SHOW TABLE STATUS FROM test LIKE 't1'; INSERT INTO t1 (a,b) VALUES (NULL,'l'); - SELECT * FROM t1 ORDER BY a; + SELECT a,b FROM t1 ORDER BY a; SELECT LAST_INSERT_ID(); --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # @@ -87,7 +87,7 @@ if (!$mysql_errname) # but won't check what happens to the sequence after that, since the behavior is undefined INSERT INTO t1 (a,b) VALUES (-5,'m'); - SELECT * FROM t1 ORDER BY a; + SELECT a,b FROM t1 ORDER BY a; DROP TABLE t1; } @@ -106,7 +106,7 @@ if (!$mysql_errname) { INSERT INTO t1 (a,b) VALUES (NULL,'a'),(NULL,'b'); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; SELECT LAST_INSERT_ID(); DROP TABLE t1; } diff --git a/mysql-test/suite/storage_engine/col_opt_default.result b/mysql-test/suite/storage_engine/col_opt_default.result index 2d0a8508b99..d1f3e9d98c6 100644 --- a/mysql-test/suite/storage_engine/col_opt_default.result +++ b/mysql-test/suite/storage_engine/col_opt_default.result @@ -4,7 +4,7 @@ SHOW COLUMNS IN t1; Field Type Null Key Default Extra a int(11) # 0 INSERT INTO t1 (a) VALUES (1); -SELECT * FROM t1; +SELECT a FROM t1; a 1 ALTER TABLE t1 ADD COLUMN b <CHAR_COLUMN> DEFAULT ''; @@ -13,7 +13,7 @@ Field Type Null Key Default Extra a int(11) # 0 b char(8) # INSERT INTO t1 (b) VALUES ('a'); -SELECT * FROM t1; +SELECT a,b FROM t1; a b 0 a 1 diff --git a/mysql-test/suite/storage_engine/col_opt_default.test b/mysql-test/suite/storage_engine/col_opt_default.test index f59daef37fc..3b28def76db 100644 --- a/mysql-test/suite/storage_engine/col_opt_default.test +++ b/mysql-test/suite/storage_engine/col_opt_default.test @@ -25,7 +25,7 @@ if (!$mysql_errname) INSERT INTO t1 (a) VALUES (1); --sorted_result - SELECT * FROM t1; + SELECT a FROM t1; --let $alter_definition = ADD COLUMN b $char_col DEFAULT '' --source alter_table.inc @@ -41,7 +41,7 @@ if (!$mysql_errname) INSERT INTO t1 (b) VALUES ('a'); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; } DROP TABLE t1; } diff --git a/mysql-test/suite/storage_engine/col_opt_not_null.result b/mysql-test/suite/storage_engine/col_opt_not_null.result index 49b834efc26..18508e98e8c 100644 --- a/mysql-test/suite/storage_engine/col_opt_not_null.result +++ b/mysql-test/suite/storage_engine/col_opt_not_null.result @@ -15,20 +15,20 @@ b0 binary(0) # # # # b1 binary(1) # # # # b20 binary(20) # # # # b255 binary(255) # # # # -INSERT INTO t1 VALUES ('','','','',''); -INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.'); +INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('','','','',''); +INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.'); SELECT HEX(b), HEX(b0), HEX(b1), HEX(b20), HEX(b255) FROM t1; HEX(b) HEX(b0) HEX(b1) HEX(b20) HEX(b255) 00 00 0000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 61 62 616263646566676869206B6C6D6E6F7071727374 4372656174696E6720616E2061727469636C6520666F7220746865204B6E6F776C65646765626173652069732073696D696C617220746F2061736B696E67207175657374696F6E732E2046697273742C206E6176696761746520746F207468652063617465676F727920776865726520796F75206665656C207468652061727469636C652073686F756C642062652E204F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C726561647920657869737420776869636820776F756C6420776F726B2E00000000000000000000000000000000000000000000000000000000000000 -INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256)); +INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256)); Warnings: Warning 1265 Data truncated for column 'b' at row 1 Warning 1265 Data truncated for column 'b0' at row 1 Warning 1265 Data truncated for column 'b1' at row 1 Warning 1265 Data truncated for column 'b20' at row 1 Warning 1265 Data truncated for column 'b255' at row 1 -INSERT INTO t1 SELECT b255, b255, b255, b255, CONCAT(b255,b255) FROM t1; +INSERT INTO t1 (b,b0,b1,b20,b255) SELECT b255, b255, b255, b255, CONCAT(b255,b255) FROM t1; Warnings: Warning 1265 Data truncated for column 'b' at row 1 Warning 1265 Data truncated for column 'b0' at row 1 @@ -237,29 +237,29 @@ a bit(1) # # # b bit(20) # # # c bit(64) # # # d bit(1) # # # -INSERT INTO t1 VALUES (0,POW(2,20)-1,b'1111111111111111111111111111111111111111111111111111111111111111',1); +INSERT INTO t1 (a,b,c,d) VALUES (0,POW(2,20)-1,b'1111111111111111111111111111111111111111111111111111111111111111',1); SELECT BIN(a), HEX(b), c+0 FROM t1 WHERE d>0; BIN(a) HEX(b) c+0 0 FFFFF 18446744073709551615 -INSERT INTO t1 VALUES (1,0,-1,0); +INSERT INTO t1 (a,b,c,d) VALUES (1,0,-1,0); SELECT a+0, b+0, c+0 FROM t1 WHERE d<100; a+0 b+0 c+0 0 1048575 18446744073709551615 1 0 18446744073709551615 -INSERT INTO t1 VALUES (b'1', 'f', 0xFF, 0x0); +INSERT INTO t1 (a,b,c,d) VALUES (b'1', 'f', 0xFF, 0x0); SELECT a+0, b+0, c+0 FROM t1 WHERE d IN (0, 2); a+0 b+0 c+0 1 0 18446744073709551615 1 102 255 -INSERT INTO t1 VALUES (0x10,0,0,1); +INSERT INTO t1 (a,b,c,d) VALUES (0x10,0,0,1); Warnings: Warning 1264 Out of range value for column 'a' at row 1 -SELECT * FROM t1; +SELECT a,b,c,d FROM t1; a b c d -INSERT INTO t1 VALUES (0x01,0,0x10000000000000000,0); +INSERT INTO t1 (a,b,c,d) VALUES (0x01,0,0x10000000000000000,0); Warnings: Warning 1264 Out of range value for column 'c' at row 1 -SELECT * FROM t1; +SELECT a,b,c,d FROM t1; a b c d DROP TABLE t1; CREATE TABLE t1 (a BIT(65) <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; @@ -319,7 +319,7 @@ b17m longblob # # # t tinyblob # # # m mediumblob # # # l longblob # # # -INSERT INTO t1 VALUES +INSERT INTO t1 (b,b0,b1,b300,bm,b70k,b17m,t,m,l) VALUES ('','','','','','','','','',''), ('a','b','c','d','e','f','g','h','i','j'), ('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'), @@ -330,7 +330,7 @@ LENGTH(b) LENGTH(b0) LENGTH(b1) LENGTH(b300) LENGTH(bm) LENGTH(b70k) LENGTH(b17m 1 1 1 1 1 1 1 1 1 1 5 5 5 5 5 5 5 5 5 6 65535 65535 255 65535 65535 1048576 2097152 255 1048576 2097152 -INSERT INTO t1 VALUES +INSERT INTO t1 (b,b0,b1,b300,bm,b70k,b17m,t,m,l) VALUES ( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) ); Warnings: Warning 1265 Data truncated for column 'b' at row 1 @@ -392,23 +392,23 @@ SHOW COLUMNS IN t1; Field Type Null Key Default Extra b1 tinyint(1) # # # b2 tinyint(1) # # # -INSERT INTO t1 VALUES (1,TRUE); -SELECT * FROM t1; +INSERT INTO t1 (b1,b2) VALUES (1,TRUE); +SELECT b1,b2 FROM t1; b1 b2 1 1 -INSERT INTO t1 VALUES (FALSE,0); -SELECT * FROM t1; +INSERT INTO t1 (b1,b2) VALUES (FALSE,0); +SELECT b1,b2 FROM t1; b1 b2 0 0 1 1 -INSERT INTO t1 VALUES (2,3); -SELECT * FROM t1; +INSERT INTO t1 (b1,b2) VALUES (2,3); +SELECT b1,b2 FROM t1; b1 b2 0 0 1 1 2 3 -INSERT INTO t1 VALUES (-1,-2); -SELECT * FROM t1; +INSERT INTO t1 (b1,b2) VALUES (-1,-2); +SELECT b1,b2 FROM t1; b1 b2 -1 -2 0 0 @@ -420,28 +420,28 @@ false false true true true true true true -SELECT * FROM t1 WHERE b1 = TRUE; +SELECT b1,b2 FROM t1 WHERE b1 = TRUE; b1 b2 1 1 -SELECT * FROM t1 WHERE b2 = FALSE; +SELECT b1,b2 FROM t1 WHERE b2 = FALSE; b1 b2 0 0 -INSERT INTO t1 VALUES ('a','b'); +INSERT INTO t1 (b1,b2) VALUES ('a','b'); Warnings: Warning 1366 Incorrect integer value: 'a' for column 'b1' at row 1 Warning 1366 Incorrect integer value: 'b' for column 'b2' at row 1 -SELECT * FROM t1; +SELECT b1,b2 FROM t1; b1 b2 -1 -2 0 0 0 0 1 1 2 3 -INSERT INTO t1 VALUES (128,-129); +INSERT INTO t1 (b1,b2) VALUES (128,-129); Warnings: Warning 1264 Out of range value for column 'b1' at row 1 Warning 1264 Out of range value for column 'b2' at row 1 -SELECT * FROM t1; +SELECT b1,b2 FROM t1; b1 b2 -1 -2 0 0 @@ -499,20 +499,20 @@ c0 char(0) # # # c1 char(1) # # # c20 char(20) # # # c255 char(255) # # # -INSERT INTO t1 VALUES ('','','','',''); -INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.'); -SELECT * FROM t1; +INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('','','','',''); +INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.'); +SELECT c,c0,c1,c20,c255 FROM t1; c c0 c1 c20 c255 a b abcdefghi klmnopqrst Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn't already exist which would work. -INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256)); +INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256)); Warnings: Warning 1265 Data truncated for column 'c' at row 1 Warning 1265 Data truncated for column 'c0' at row 1 Warning 1265 Data truncated for column 'c1' at row 1 Warning 1265 Data truncated for column 'c20' at row 1 Warning 1265 Data truncated for column 'c255' at row 1 -INSERT INTO t1 SELECT c255, c255, c255, c255, CONCAT(c255,c1) FROM t1; +INSERT INTO t1 (c,c0,c1,c20,c255) SELECT c255, c255, c255, c255, CONCAT(c255,c1) FROM t1; Warnings: Warning 1265 Data truncated for column 'c' at row 2 Warning 1265 Data truncated for column 'c0' at row 2 @@ -523,7 +523,7 @@ Warning 1265 Data truncated for column 'c0' at row 3 Warning 1265 Data truncated for column 'c1' at row 3 Warning 1265 Data truncated for column 'c20' at row 3 Warning 1265 Data truncated for column 'c255' at row 3 -SELECT * FROM t1; +SELECT c,c0,c1,c20,c255 FROM t1; c c0 c1 c20 c255 @@ -625,7 +625,7 @@ INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','y','Once there, double check that * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. '); -SELECT * FROM t1; +SELECT v0,v1,v64,v65000 FROM t1; v0 v1 v64 v65000 @@ -751,18 +751,18 @@ y year(4) # # # y4 year(4) # # # y2 year(2) # # # SET @tm = '2012-04-09 05:27:00'; -INSERT INTO t1 VALUES +INSERT INTO t1 (d,dt,ts,t,y,y4,y2) VALUES ('1000-01-01', '1000-01-01 00:00:00', FROM_UNIXTIME(1), '-838:59:59', '1901', '1901', '00'), ('9999-12-31', '9999-12-31 23:59:59', FROM_UNIXTIME(2147483647), '838:59:59', '2155', '2155', '99'), ('0000-00-00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '00:00:00', '0', '0', '0'), (DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm),YEAR(@tm),YEAR(@tm)); -SELECT * FROM t1; +SELECT d,dt,ts,t,y,y4,y2 FROM t1; d dt ts t y y4 y2 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00 1000-01-01 1000-01-01 00:00:00 1970-01-01 03:00:01 -838:59:59 1901 1901 00 2012-04-09 2012-04-09 05:27:00 2012-04-09 05:27:00 05:27:00 2012 2012 12 9999-12-31 9999-12-31 23:59:59 2038-01-19 07:14:07 838:59:59 2155 2155 99 -INSERT INTO t1 VALUES +INSERT INTO t1 (d,dt,ts,t,y,y4,y2) VALUES ('999-13-32', '999-11-31 00:00:00', '0', '-839:00:00', '1900', '1900', '-1' ); Warnings: Warning 1265 Data truncated for column 'd' at row 1 @@ -772,7 +772,7 @@ Warning 1264 Out of range value for column 't' at row 1 Warning 1264 Out of range value for column 'y' at row 1 Warning 1264 Out of range value for column 'y4' at row 1 Warning 1264 Out of range value for column 'y2' at row 1 -SELECT * FROM t1; +SELECT d,dt,ts,t,y,y4,y2 FROM t1; d dt ts t y y4 y2 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 -838:59:59 0000 0000 00 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00 @@ -853,7 +853,7 @@ SHOW COLUMNS IN t1; Field Type Null Key Default Extra c timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP INSERT INTO t1 (c) VALUES (NULL); -SELECT * FROM t1; +SELECT c FROM t1; c <TIMESTAMP> DROP TABLE t1; @@ -959,17 +959,17 @@ Field Type Null Key Default Extra a enum('') # # # b enum('test1','test2','test3','test4','test5') # # # c enum('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') # # # -INSERT INTO t1 VALUES ('','test2','4'),('',5,2); -SELECT * FROM t1; +INSERT INTO t1 (a,b,c) VALUES ('','test2','4'),('',5,2); +SELECT a,b,c FROM t1; a b c test2 4 test5 2 -INSERT INTO t1 VALUES (0,'test6',-1); +INSERT INTO t1 (a,b,c) VALUES (0,'test6',-1); Warnings: Warning 1265 Data truncated for column 'a' at row 1 Warning 1265 Data truncated for column 'b' at row 1 Warning 1265 Data truncated for column 'c' at row 1 -SELECT * FROM t1; +SELECT a,b,c FROM t1; a b c test2 4 @@ -984,14 +984,14 @@ a enum('') # # # b enum('test1','test2','test3','test4','test5') # # # c enum('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') # # # e enum('a','A') # # # -INSERT INTO t1 VALUES ('','test3','75','A'); -SELECT * FROM t1; +INSERT INTO t1 (a,b,c,e) VALUES ('','test3','75','A'); +SELECT a,b,c,e FROM t1; a b c e a test2 4 a test3 75 a test5 2 a -SELECT * FROM t1 WHERE b='test2' OR a != ''; +SELECT a,b,c,e FROM t1 WHERE b='test2' OR a != ''; a b c e test2 4 a DROP TABLE t1; @@ -1050,30 +1050,30 @@ n0_0 decimal(10,0) # # # n1 decimal(1,0) # # # n20_4 decimal(20,4) # # # n65_4 decimal(65,4) # # # -INSERT INTO t1 VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807); -INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0); -INSERT INTO t1 VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999); -SELECT * FROM t1; +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (0,0,0,0,0,0,0,0,0,0); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999); +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -INSERT INTO t1 VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807); -INSERT INTO t1 VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999); -SELECT * FROM t1; +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999); +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 -100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000 -9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -SELECT * FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 -100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000 -9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -INSERT INTO t1 SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 ); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 ); Warnings: Warning 1264 Out of range value for column 'd' at row 1 Warning 1264 Out of range value for column 'd0' at row 1 @@ -1084,7 +1084,7 @@ Warning 1264 Out of range value for column 'n' at row 1 Warning 1264 Out of range value for column 'n0_0' at row 1 Warning 1264 Out of range value for column 'n1' at row 1 Warning 1264 Out of range value for column 'n20_4' at row 1 -SELECT * FROM t1; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 -100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000 -9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999 @@ -1092,7 +1092,7 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -INSERT INTO t1 VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999); Warnings: Warning 1264 Out of range value for column 'd' at row 1 Warning 1264 Out of range value for column 'd0' at row 1 @@ -1104,7 +1104,7 @@ Warning 1264 Out of range value for column 'n0_0' at row 1 Warning 1264 Out of range value for column 'n1' at row 1 Warning 1264 Out of range value for column 'n20_4' at row 1 Warning 1264 Out of range value for column 'n65_4' at row 1 -SELECT * FROM t1; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 -100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000 -9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999 @@ -1113,7 +1113,7 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -INSERT INTO t1 VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111); Warnings: Note 1265 Data truncated for column 'd' at row 1 Note 1265 Data truncated for column 'd0' at row 1 @@ -1125,7 +1125,7 @@ Note 1265 Data truncated for column 'n0_0' at row 1 Note 1265 Data truncated for column 'n1' at row 1 Note 1265 Data truncated for column 'n20_4' at row 1 Note 1265 Data truncated for column 'n65_4' at row 1 -SELECT * FROM t1; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 -100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000 -9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999 @@ -1229,8 +1229,8 @@ d1_0 double(1,0) # # # d10_10 double(10,10) # # # d53 double(53,0) # # # d53_10 double(53,10) # # # -INSERT INTO t1 VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999); -SELECT * FROM t1; +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999); +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 12345.1 d 11111111.111 d10_10 0.0123456789 @@ -1241,8 +1241,8 @@ f0 12345.1 f20_3 56789.988 f23_0 123457000 r1_1 0.9 -INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0); -INSERT INTO t1 VALUES ( +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (0,0,0,0,0,0,0,0,0,0); +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES ( 99999999999999999999999999999999999999, 99999999999999999999999999999999999999.9999999999999999, 0.9, @@ -1257,7 +1257,7 @@ INSERT INTO t1 VALUES ( Warnings: Warning 1264 Out of range value for column 'd53' at row 1 Warning 1264 Out of range value for column 'd53_10' at row 1 -SELECT * FROM t1; +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 12345.1 d 0 d 11111111.111 @@ -1288,8 +1288,8 @@ f23_0 1e38 r1_1 0.0 r1_1 0.9 r1_1 0.9 -INSERT INTO t1 VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999); -SELECT * FROM t1; +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999); +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 12345.1 d -1e60 d 0 @@ -1341,7 +1341,7 @@ MAX(f0) 9.999999680285692e37 MAX(f20_3) 99999998430674940.000 MAX(f23_0) 9.999999680285692e37 MAX(r1_1) 0.9 -INSERT INTO t1 SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1; +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1; Warnings: Warning 1264 Out of range value for column 'f' at row 1 Warning 1264 Out of range value for column 'f0' at row 1 @@ -1349,7 +1349,7 @@ Warning 1264 Out of range value for column 'r1_1' at row 1 Warning 1264 Out of range value for column 'f23_0' at row 1 Warning 1264 Out of range value for column 'f20_3' at row 1 Warning 1264 Out of range value for column 'd1_0' at row 1 -SELECT * FROM t1; +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 12345.1 d -1e60 d 0 @@ -1400,7 +1400,7 @@ r1_1 0.0 r1_1 0.9 r1_1 0.9 r1_1 0.9 -INSERT INTO t1 VALUES ( +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES ( 999999999999999999999999999999999999999, 999999999999999999999999999999999999999.9999999999999999, 1.9, @@ -1423,7 +1423,7 @@ Warning 1264 Out of range value for column 'd1_0' at row 1 Warning 1264 Out of range value for column 'd10_10' at row 1 Warning 1264 Out of range value for column 'd53' at row 1 Warning 1264 Out of range value for column 'd53_10' at row 1 -SELECT * FROM t1; +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 12345.1 d -1e60 d 0 @@ -1594,16 +1594,16 @@ b bigint(20) # # # b0 bigint(20) # # # b1 bigint(1) # # # b20 bigint(20) # # # -INSERT INTO t1 VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); -INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); -INSERT INTO t1 VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807); -SELECT * FROM t1; +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807); +SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1; i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807 -INSERT INTO t1 VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808); -INSERT INTO t1 VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615); Warnings: Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'i0' at row 1 @@ -1625,14 +1625,14 @@ Warning 1264 Out of range value for column 'b' at row 1 Warning 1264 Out of range value for column 'b0' at row 1 Warning 1264 Out of range value for column 'b1' at row 1 Warning 1264 Out of range value for column 'b20' at row 1 -SELECT * FROM t1; +SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1; i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20 -2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807 2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807 -INSERT INTO t1 VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809); Warnings: Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'i0' at row 1 @@ -1654,7 +1654,7 @@ Warning 1264 Out of range value for column 'b' at row 1 Warning 1264 Out of range value for column 'b0' at row 1 Warning 1264 Out of range value for column 'b1' at row 1 Warning 1264 Out of range value for column 'b20' at row 1 -INSERT INTO t1 VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616); Warnings: Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'i0' at row 1 @@ -1676,7 +1676,7 @@ Warning 1264 Out of range value for column 'b' at row 1 Warning 1264 Out of range value for column 'b0' at row 1 Warning 1264 Out of range value for column 'b1' at row 1 Warning 1264 Out of range value for column 'b20' at row 1 -INSERT INTO t1 SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615); Warnings: Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'i0' at row 1 @@ -1742,7 +1742,7 @@ Warning 1264 Out of range value for column 'm' at row 4 Warning 1264 Out of range value for column 'm0' at row 4 Warning 1264 Out of range value for column 'm1' at row 4 Warning 1264 Out of range value for column 'm20' at row 4 -SELECT * FROM t1; +SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1; i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20 -2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808 -2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808 @@ -1912,22 +1912,22 @@ Field Type Null Key Default Extra a set('') # # # b set('test1','test2','test3','test4','test5') # # # c set('01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50''51','52','53','54','55','56','57','58','59','60','61','62','63','64') # # # -INSERT INTO t1 VALUES +INSERT INTO t1 (a,b,c) VALUES ('','test2,test3','01,34,44,,23'), ('',5,2), (',','test4,test2',''); Warnings: Warning 1265 Data truncated for column 'c' at row 1 -SELECT * FROM t1; +SELECT a,b,c FROM t1; a b c test1,test3 02 test2,test3 01,23,34,44 test2,test4 -INSERT INTO t1 VALUES (0,'test6',-1); +INSERT INTO t1 (a,b,c) VALUES (0,'test6',-1); Warnings: Warning 1265 Data truncated for column 'b' at row 1 Warning 1265 Data truncated for column 'c' at row 1 -SELECT * FROM t1; +SELECT a,b,c FROM t1; a b c 01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50'51,52,53,54,55,56,57,58,59,60,61,62,63,64 test1,test3 02 @@ -1945,7 +1945,7 @@ c set('01','02','03','04','05','06','07','08','09','10','11','12','13','14','15' e set('a','A') # # # ALTER TABLE t1 ADD COLUMN f SET('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i') <CUSTOM_COL_OPTIONS> NOT NULL; ERROR HY000: Too many strings for column f and SET -SELECT * FROM t1 WHERE FIND_IN_SET('test2',b)>0 OR a != ''; +SELECT a,b,c,e FROM t1 WHERE FIND_IN_SET('test2',b)>0 OR a != ''; a b c e test2,test3 01,23,34,44 test2,test4 @@ -2005,7 +2005,7 @@ t17m longtext # # # tt tinytext # # # m mediumtext # # # l longtext # # # -INSERT INTO t1 VALUES +INSERT INTO t1 (t,t0,t1,t300,tm,t70k,t17m,tt,m,l) VALUES ('','','','','','','','','',''), ('a','b','c','d','e','f','g','h','i','j'), ('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'), @@ -2016,7 +2016,7 @@ LENGTH(t) LENGTH(t0) LENGTH(t1) LENGTH(t300) LENGTH(tm) LENGTH(t70k) LENGTH(t17m 1 1 1 1 1 1 1 1 1 1 5 5 5 5 5 5 5 5 5 6 65535 65535 255 65535 65535 1048576 1048576 255 1048576 1048576 -INSERT INTO t1 VALUES +INSERT INTO t1 (t,t0,t1,t300,tm,t70k,t17m,tt,m,l) VALUES ( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) ); Warnings: Warning 1265 Data truncated for column 't' at row 1 diff --git a/mysql-test/suite/storage_engine/col_opt_not_null.test b/mysql-test/suite/storage_engine/col_opt_not_null.test index 2cd0e909536..1ec00621518 100644 --- a/mysql-test/suite/storage_engine/col_opt_not_null.test +++ b/mysql-test/suite/storage_engine/col_opt_not_null.test @@ -144,7 +144,7 @@ if (!$mysql_errname) } --replace_regex /[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2} [[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}/<TIMESTAMP>/ - SELECT * FROM t1; + SELECT c FROM t1; DROP TABLE t1; } diff --git a/mysql-test/suite/storage_engine/col_opt_null.result b/mysql-test/suite/storage_engine/col_opt_null.result index ebcb91d0c5f..45982faed61 100644 --- a/mysql-test/suite/storage_engine/col_opt_null.result +++ b/mysql-test/suite/storage_engine/col_opt_null.result @@ -15,20 +15,20 @@ b0 binary(0) # # # # b1 binary(1) # # # # b20 binary(20) # # # # b255 binary(255) # # # # -INSERT INTO t1 VALUES ('','','','',''); -INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.'); +INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('','','','',''); +INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.'); SELECT HEX(b), HEX(b0), HEX(b1), HEX(b20), HEX(b255) FROM t1; HEX(b) HEX(b0) HEX(b1) HEX(b20) HEX(b255) 00 00 0000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 61 62 616263646566676869206B6C6D6E6F7071727374 4372656174696E6720616E2061727469636C6520666F7220746865204B6E6F776C65646765626173652069732073696D696C617220746F2061736B696E67207175657374696F6E732E2046697273742C206E6176696761746520746F207468652063617465676F727920776865726520796F75206665656C207468652061727469636C652073686F756C642062652E204F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C726561647920657869737420776869636820776F756C6420776F726B2E00000000000000000000000000000000000000000000000000000000000000 -INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256)); +INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256)); Warnings: Warning 1265 Data truncated for column 'b' at row 1 Warning 1265 Data truncated for column 'b0' at row 1 Warning 1265 Data truncated for column 'b1' at row 1 Warning 1265 Data truncated for column 'b20' at row 1 Warning 1265 Data truncated for column 'b255' at row 1 -INSERT INTO t1 SELECT b255, b255, b255, b255, CONCAT(b255,b255) FROM t1; +INSERT INTO t1 (b,b0,b1,b20,b255) SELECT b255, b255, b255, b255, CONCAT(b255,b255) FROM t1; Warnings: Warning 1265 Data truncated for column 'b' at row 1 Warning 1265 Data truncated for column 'b0' at row 1 @@ -229,29 +229,29 @@ a bit(1) # # # b bit(20) # # # c bit(64) # # # d bit(1) # # # -INSERT INTO t1 VALUES (0,POW(2,20)-1,b'1111111111111111111111111111111111111111111111111111111111111111',1); +INSERT INTO t1 (a,b,c,d) VALUES (0,POW(2,20)-1,b'1111111111111111111111111111111111111111111111111111111111111111',1); SELECT BIN(a), HEX(b), c+0 FROM t1 WHERE d>0; BIN(a) HEX(b) c+0 0 FFFFF 18446744073709551615 -INSERT INTO t1 VALUES (1,0,-1,0); +INSERT INTO t1 (a,b,c,d) VALUES (1,0,-1,0); SELECT a+0, b+0, c+0 FROM t1 WHERE d<100; a+0 b+0 c+0 0 1048575 18446744073709551615 1 0 18446744073709551615 -INSERT INTO t1 VALUES (b'1', 'f', 0xFF, 0x0); +INSERT INTO t1 (a,b,c,d) VALUES (b'1', 'f', 0xFF, 0x0); SELECT a+0, b+0, c+0 FROM t1 WHERE d IN (0, 2); a+0 b+0 c+0 1 0 18446744073709551615 1 102 255 -INSERT INTO t1 VALUES (0x10,0,0,1); +INSERT INTO t1 (a,b,c,d) VALUES (0x10,0,0,1); Warnings: Warning 1264 Out of range value for column 'a' at row 1 -SELECT * FROM t1; +SELECT a,b,c,d FROM t1; a b c d -INSERT INTO t1 VALUES (0x01,0,0x10000000000000000,0); +INSERT INTO t1 (a,b,c,d) VALUES (0x01,0,0x10000000000000000,0); Warnings: Warning 1264 Out of range value for column 'c' at row 1 -SELECT * FROM t1; +SELECT a,b,c,d FROM t1; a b c d DROP TABLE t1; CREATE TABLE t1 (a BIT(65) <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; @@ -307,7 +307,7 @@ b17m longblob # # # t tinyblob # # # m mediumblob # # # l longblob # # # -INSERT INTO t1 VALUES +INSERT INTO t1 (b,b0,b1,b300,bm,b70k,b17m,t,m,l) VALUES ('','','','','','','','','',''), ('a','b','c','d','e','f','g','h','i','j'), ('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'), @@ -318,7 +318,7 @@ LENGTH(b) LENGTH(b0) LENGTH(b1) LENGTH(b300) LENGTH(bm) LENGTH(b70k) LENGTH(b17m 1 1 1 1 1 1 1 1 1 1 5 5 5 5 5 5 5 5 5 6 65535 65535 255 65535 65535 1048576 2097152 255 1048576 2097152 -INSERT INTO t1 VALUES +INSERT INTO t1 (b,b0,b1,b300,bm,b70k,b17m,t,m,l) VALUES ( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) ); Warnings: Warning 1265 Data truncated for column 'b' at row 1 @@ -388,23 +388,23 @@ SHOW COLUMNS IN t1; Field Type Null Key Default Extra b1 tinyint(1) # # # b2 tinyint(1) # # # -INSERT INTO t1 VALUES (1,TRUE); -SELECT * FROM t1; +INSERT INTO t1 (b1,b2) VALUES (1,TRUE); +SELECT b1,b2 FROM t1; b1 b2 1 1 -INSERT INTO t1 VALUES (FALSE,0); -SELECT * FROM t1; +INSERT INTO t1 (b1,b2) VALUES (FALSE,0); +SELECT b1,b2 FROM t1; b1 b2 0 0 1 1 -INSERT INTO t1 VALUES (2,3); -SELECT * FROM t1; +INSERT INTO t1 (b1,b2) VALUES (2,3); +SELECT b1,b2 FROM t1; b1 b2 0 0 1 1 2 3 -INSERT INTO t1 VALUES (-1,-2); -SELECT * FROM t1; +INSERT INTO t1 (b1,b2) VALUES (-1,-2); +SELECT b1,b2 FROM t1; b1 b2 -1 -2 0 0 @@ -416,28 +416,28 @@ false false true true true true true true -SELECT * FROM t1 WHERE b1 = TRUE; +SELECT b1,b2 FROM t1 WHERE b1 = TRUE; b1 b2 1 1 -SELECT * FROM t1 WHERE b2 = FALSE; +SELECT b1,b2 FROM t1 WHERE b2 = FALSE; b1 b2 0 0 -INSERT INTO t1 VALUES ('a','b'); +INSERT INTO t1 (b1,b2) VALUES ('a','b'); Warnings: Warning 1366 Incorrect integer value: 'a' for column 'b1' at row 1 Warning 1366 Incorrect integer value: 'b' for column 'b2' at row 1 -SELECT * FROM t1; +SELECT b1,b2 FROM t1; b1 b2 -1 -2 0 0 0 0 1 1 2 3 -INSERT INTO t1 VALUES (128,-129); +INSERT INTO t1 (b1,b2) VALUES (128,-129); Warnings: Warning 1264 Out of range value for column 'b1' at row 1 Warning 1264 Out of range value for column 'b2' at row 1 -SELECT * FROM t1; +SELECT b1,b2 FROM t1; b1 b2 -1 -2 0 0 @@ -491,20 +491,20 @@ c0 char(0) # # # c1 char(1) # # # c20 char(20) # # # c255 char(255) # # # -INSERT INTO t1 VALUES ('','','','',''); -INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.'); -SELECT * FROM t1; +INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('','','','',''); +INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.'); +SELECT c,c0,c1,c20,c255 FROM t1; c c0 c1 c20 c255 a b abcdefghi klmnopqrst Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn't already exist which would work. -INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256)); +INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256)); Warnings: Warning 1265 Data truncated for column 'c' at row 1 Warning 1265 Data truncated for column 'c0' at row 1 Warning 1265 Data truncated for column 'c1' at row 1 Warning 1265 Data truncated for column 'c20' at row 1 Warning 1265 Data truncated for column 'c255' at row 1 -INSERT INTO t1 SELECT c255, c255, c255, c255, CONCAT(c255,c1) FROM t1; +INSERT INTO t1 (c,c0,c1,c20,c255) SELECT c255, c255, c255, c255, CONCAT(c255,c1) FROM t1; Warnings: Warning 1265 Data truncated for column 'c' at row 2 Warning 1265 Data truncated for column 'c0' at row 2 @@ -515,7 +515,7 @@ Warning 1265 Data truncated for column 'c0' at row 3 Warning 1265 Data truncated for column 'c1' at row 3 Warning 1265 Data truncated for column 'c20' at row 3 Warning 1265 Data truncated for column 'c255' at row 3 -SELECT * FROM t1; +SELECT c,c0,c1,c20,c255 FROM t1; c c0 c1 c20 c255 @@ -613,7 +613,7 @@ INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','y','Once there, double check that * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. '); -SELECT * FROM t1; +SELECT v0,v1,v64,v65000 FROM t1; v0 v1 v64 v65000 @@ -735,18 +735,18 @@ y year(4) # # # y4 year(4) # # # y2 year(2) # # # SET @tm = '2012-04-09 05:27:00'; -INSERT INTO t1 VALUES +INSERT INTO t1 (d,dt,ts,t,y,y4,y2) VALUES ('1000-01-01', '1000-01-01 00:00:00', FROM_UNIXTIME(1), '-838:59:59', '1901', '1901', '00'), ('9999-12-31', '9999-12-31 23:59:59', FROM_UNIXTIME(2147483647), '838:59:59', '2155', '2155', '99'), ('0000-00-00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '00:00:00', '0', '0', '0'), (DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm),YEAR(@tm),YEAR(@tm)); -SELECT * FROM t1; +SELECT d,dt,ts,t,y,y4,y2 FROM t1; d dt ts t y y4 y2 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00 1000-01-01 1000-01-01 00:00:00 1970-01-01 03:00:01 -838:59:59 1901 1901 00 2012-04-09 2012-04-09 05:27:00 2012-04-09 05:27:00 05:27:00 2012 2012 12 9999-12-31 9999-12-31 23:59:59 2038-01-19 07:14:07 838:59:59 2155 2155 99 -INSERT INTO t1 VALUES +INSERT INTO t1 (d,dt,ts,t,y,y4,y2) VALUES ('999-13-32', '999-11-31 00:00:00', '0', '-839:00:00', '1900', '1900', '-1' ); Warnings: Warning 1265 Data truncated for column 'd' at row 1 @@ -756,7 +756,7 @@ Warning 1264 Out of range value for column 't' at row 1 Warning 1264 Out of range value for column 'y' at row 1 Warning 1264 Out of range value for column 'y4' at row 1 Warning 1264 Out of range value for column 'y2' at row 1 -SELECT * FROM t1; +SELECT d,dt,ts,t,y,y4,y2 FROM t1; d dt ts t y y4 y2 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 -838:59:59 0000 0000 00 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00 @@ -927,17 +927,17 @@ Field Type Null Key Default Extra a enum('') # # # b enum('test1','test2','test3','test4','test5') # # # c enum('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') # # # -INSERT INTO t1 VALUES ('','test2','4'),('',5,2); -SELECT * FROM t1; +INSERT INTO t1 (a,b,c) VALUES ('','test2','4'),('',5,2); +SELECT a,b,c FROM t1; a b c test2 4 test5 2 -INSERT INTO t1 VALUES (0,'test6',-1); +INSERT INTO t1 (a,b,c) VALUES (0,'test6',-1); Warnings: Warning 1265 Data truncated for column 'a' at row 1 Warning 1265 Data truncated for column 'b' at row 1 Warning 1265 Data truncated for column 'c' at row 1 -SELECT * FROM t1; +SELECT a,b,c FROM t1; a b c test2 4 @@ -952,14 +952,14 @@ a enum('') # # # b enum('test1','test2','test3','test4','test5') # # # c enum('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') # # # e enum('a','A') # # # -INSERT INTO t1 VALUES ('','test3','75','A'); -SELECT * FROM t1; +INSERT INTO t1 (a,b,c,e) VALUES ('','test3','75','A'); +SELECT a,b,c,e FROM t1; a b c e NULL test2 4 NULL test3 75 a test5 2 NULL -SELECT * FROM t1 WHERE b='test2' OR a != ''; +SELECT a,b,c,e FROM t1 WHERE b='test2' OR a != ''; a b c e test2 4 NULL DROP TABLE t1; @@ -1014,30 +1014,30 @@ n0_0 decimal(10,0) # # # n1 decimal(1,0) # # # n20_4 decimal(20,4) # # # n65_4 decimal(65,4) # # # -INSERT INTO t1 VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807); -INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0); -INSERT INTO t1 VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999); -SELECT * FROM t1; +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (0,0,0,0,0,0,0,0,0,0); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999); +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -INSERT INTO t1 VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807); -INSERT INTO t1 VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999); -SELECT * FROM t1; +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999); +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 -100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000 -9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -SELECT * FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 -100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000 -9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -INSERT INTO t1 SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 ); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 ); Warnings: Warning 1264 Out of range value for column 'd' at row 1 Warning 1264 Out of range value for column 'd0' at row 1 @@ -1048,7 +1048,7 @@ Warning 1264 Out of range value for column 'n' at row 1 Warning 1264 Out of range value for column 'n0_0' at row 1 Warning 1264 Out of range value for column 'n1' at row 1 Warning 1264 Out of range value for column 'n20_4' at row 1 -SELECT * FROM t1; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 -100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000 -9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999 @@ -1056,7 +1056,7 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -INSERT INTO t1 VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999); Warnings: Warning 1264 Out of range value for column 'd' at row 1 Warning 1264 Out of range value for column 'd0' at row 1 @@ -1068,7 +1068,7 @@ Warning 1264 Out of range value for column 'n0_0' at row 1 Warning 1264 Out of range value for column 'n1' at row 1 Warning 1264 Out of range value for column 'n20_4' at row 1 Warning 1264 Out of range value for column 'n65_4' at row 1 -SELECT * FROM t1; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 -100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000 -9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999 @@ -1077,7 +1077,7 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -INSERT INTO t1 VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111); Warnings: Note 1265 Data truncated for column 'd' at row 1 Note 1265 Data truncated for column 'd0' at row 1 @@ -1089,7 +1089,7 @@ Note 1265 Data truncated for column 'n0_0' at row 1 Note 1265 Data truncated for column 'n1' at row 1 Note 1265 Data truncated for column 'n20_4' at row 1 Note 1265 Data truncated for column 'n65_4' at row 1 -SELECT * FROM t1; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 -100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000 -9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999 @@ -1183,8 +1183,8 @@ d1_0 double(1,0) # # # d10_10 double(10,10) # # # d53 double(53,0) # # # d53_10 double(53,10) # # # -INSERT INTO t1 VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999); -SELECT * FROM t1; +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999); +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 12345.1 d 11111111.111 d10_10 0.0123456789 @@ -1195,8 +1195,8 @@ f0 12345.1 f20_3 56789.988 f23_0 123457000 r1_1 0.9 -INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0); -INSERT INTO t1 VALUES ( +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (0,0,0,0,0,0,0,0,0,0); +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES ( 99999999999999999999999999999999999999, 99999999999999999999999999999999999999.9999999999999999, 0.9, @@ -1211,7 +1211,7 @@ INSERT INTO t1 VALUES ( Warnings: Warning 1264 Out of range value for column 'd53' at row 1 Warning 1264 Out of range value for column 'd53_10' at row 1 -SELECT * FROM t1; +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 12345.1 d 0 d 11111111.111 @@ -1242,8 +1242,8 @@ f23_0 1e38 r1_1 0.0 r1_1 0.9 r1_1 0.9 -INSERT INTO t1 VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999); -SELECT * FROM t1; +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999); +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 12345.1 d -1e60 d 0 @@ -1295,7 +1295,7 @@ MAX(f0) 9.999999680285692e37 MAX(f20_3) 99999998430674940.000 MAX(f23_0) 9.999999680285692e37 MAX(r1_1) 0.9 -INSERT INTO t1 SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1; +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1; Warnings: Warning 1264 Out of range value for column 'f' at row 1 Warning 1264 Out of range value for column 'f0' at row 1 @@ -1303,7 +1303,7 @@ Warning 1264 Out of range value for column 'r1_1' at row 1 Warning 1264 Out of range value for column 'f23_0' at row 1 Warning 1264 Out of range value for column 'f20_3' at row 1 Warning 1264 Out of range value for column 'd1_0' at row 1 -SELECT * FROM t1; +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 12345.1 d -1e60 d 0 @@ -1354,7 +1354,7 @@ r1_1 0.0 r1_1 0.9 r1_1 0.9 r1_1 0.9 -INSERT INTO t1 VALUES ( +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES ( 999999999999999999999999999999999999999, 999999999999999999999999999999999999999.9999999999999999, 1.9, @@ -1377,7 +1377,7 @@ Warning 1264 Out of range value for column 'd1_0' at row 1 Warning 1264 Out of range value for column 'd10_10' at row 1 Warning 1264 Out of range value for column 'd53' at row 1 Warning 1264 Out of range value for column 'd53_10' at row 1 -SELECT * FROM t1; +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 12345.1 d -1e60 d 0 @@ -1540,16 +1540,16 @@ b bigint(20) # # # b0 bigint(20) # # # b1 bigint(1) # # # b20 bigint(20) # # # -INSERT INTO t1 VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); -INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); -INSERT INTO t1 VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807); -SELECT * FROM t1; +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807); +SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1; i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807 -INSERT INTO t1 VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808); -INSERT INTO t1 VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615); Warnings: Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'i0' at row 1 @@ -1571,14 +1571,14 @@ Warning 1264 Out of range value for column 'b' at row 1 Warning 1264 Out of range value for column 'b0' at row 1 Warning 1264 Out of range value for column 'b1' at row 1 Warning 1264 Out of range value for column 'b20' at row 1 -SELECT * FROM t1; +SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1; i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20 -2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807 2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807 -INSERT INTO t1 VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809); Warnings: Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'i0' at row 1 @@ -1600,7 +1600,7 @@ Warning 1264 Out of range value for column 'b' at row 1 Warning 1264 Out of range value for column 'b0' at row 1 Warning 1264 Out of range value for column 'b1' at row 1 Warning 1264 Out of range value for column 'b20' at row 1 -INSERT INTO t1 VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616); Warnings: Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'i0' at row 1 @@ -1622,7 +1622,7 @@ Warning 1264 Out of range value for column 'b' at row 1 Warning 1264 Out of range value for column 'b0' at row 1 Warning 1264 Out of range value for column 'b1' at row 1 Warning 1264 Out of range value for column 'b20' at row 1 -INSERT INTO t1 SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615); Warnings: Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'i0' at row 1 @@ -1688,7 +1688,7 @@ Warning 1264 Out of range value for column 'm' at row 4 Warning 1264 Out of range value for column 'm0' at row 4 Warning 1264 Out of range value for column 'm1' at row 4 Warning 1264 Out of range value for column 'm20' at row 4 -SELECT * FROM t1; +SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1; i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20 -2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808 -2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808 @@ -1838,22 +1838,22 @@ Field Type Null Key Default Extra a set('') # # # b set('test1','test2','test3','test4','test5') # # # c set('01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50''51','52','53','54','55','56','57','58','59','60','61','62','63','64') # # # -INSERT INTO t1 VALUES +INSERT INTO t1 (a,b,c) VALUES ('','test2,test3','01,34,44,,23'), ('',5,2), (',','test4,test2',''); Warnings: Warning 1265 Data truncated for column 'c' at row 1 -SELECT * FROM t1; +SELECT a,b,c FROM t1; a b c test1,test3 02 test2,test3 01,23,34,44 test2,test4 -INSERT INTO t1 VALUES (0,'test6',-1); +INSERT INTO t1 (a,b,c) VALUES (0,'test6',-1); Warnings: Warning 1265 Data truncated for column 'b' at row 1 Warning 1265 Data truncated for column 'c' at row 1 -SELECT * FROM t1; +SELECT a,b,c FROM t1; a b c 01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50'51,52,53,54,55,56,57,58,59,60,61,62,63,64 test1,test3 02 @@ -1871,7 +1871,7 @@ c set('01','02','03','04','05','06','07','08','09','10','11','12','13','14','15' e set('a','A') # # # ALTER TABLE t1 ADD COLUMN f SET('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i') <CUSTOM_COL_OPTIONS> NULL; ERROR HY000: Too many strings for column f and SET -SELECT * FROM t1 WHERE FIND_IN_SET('test2',b)>0 OR a != ''; +SELECT a,b,c,e FROM t1 WHERE FIND_IN_SET('test2',b)>0 OR a != ''; a b c e test2,test3 01,23,34,44 NULL test2,test4 NULL @@ -1927,7 +1927,7 @@ t17m longtext # # # tt tinytext # # # m mediumtext # # # l longtext # # # -INSERT INTO t1 VALUES +INSERT INTO t1 (t,t0,t1,t300,tm,t70k,t17m,tt,m,l) VALUES ('','','','','','','','','',''), ('a','b','c','d','e','f','g','h','i','j'), ('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'), @@ -1938,7 +1938,7 @@ LENGTH(t) LENGTH(t0) LENGTH(t1) LENGTH(t300) LENGTH(tm) LENGTH(t70k) LENGTH(t17m 1 1 1 1 1 1 1 1 1 1 5 5 5 5 5 5 5 5 5 6 65535 65535 255 65535 65535 1048576 1048576 255 1048576 1048576 -INSERT INTO t1 VALUES +INSERT INTO t1 (t,t0,t1,t300,tm,t70k,t17m,tt,m,l) VALUES ( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) ); Warnings: Warning 1265 Data truncated for column 't' at row 1 diff --git a/mysql-test/suite/storage_engine/col_opt_unsigned.result b/mysql-test/suite/storage_engine/col_opt_unsigned.result index a68aa48ee79..7b5274525ce 100644 --- a/mysql-test/suite/storage_engine/col_opt_unsigned.result +++ b/mysql-test/suite/storage_engine/col_opt_unsigned.result @@ -25,15 +25,15 @@ n0_0 decimal(10,0) unsigned # # # n1 decimal(1,0) unsigned # # # n20_4 decimal(20,4) unsigned # # # n65_4 decimal(65,4) unsigned # # # -INSERT INTO t1 VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807); -INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0); -INSERT INTO t1 VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999); -SELECT * FROM t1; +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (0,0,0,0,0,0,0,0,0,0); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999); +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -INSERT INTO t1 VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807); Warnings: Warning 1264 Out of range value for column 'd' at row 1 Warning 1264 Out of range value for column 'd0' at row 1 @@ -45,7 +45,7 @@ Warning 1264 Out of range value for column 'n0_0' at row 1 Warning 1264 Out of range value for column 'n1' at row 1 Warning 1264 Out of range value for column 'n20_4' at row 1 Warning 1264 Out of range value for column 'n65_4' at row 1 -INSERT INTO t1 VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999); Warnings: Warning 1264 Out of range value for column 'd' at row 1 Warning 1264 Out of range value for column 'd0' at row 1 @@ -57,20 +57,20 @@ Warning 1264 Out of range value for column 'n0_0' at row 1 Warning 1264 Out of range value for column 'n1' at row 1 Warning 1264 Out of range value for column 'n20_4' at row 1 Warning 1264 Out of range value for column 'n65_4' at row 1 -SELECT * FROM t1; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -SELECT * FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -INSERT INTO t1 SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 ); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 ); Warnings: Warning 1264 Out of range value for column 'd' at row 1 Warning 1264 Out of range value for column 'd0' at row 1 @@ -81,7 +81,7 @@ Warning 1264 Out of range value for column 'n' at row 1 Warning 1264 Out of range value for column 'n0_0' at row 1 Warning 1264 Out of range value for column 'n1' at row 1 Warning 1264 Out of range value for column 'n20_4' at row 1 -SELECT * FROM t1; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 @@ -89,7 +89,7 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -INSERT INTO t1 VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999); Warnings: Warning 1264 Out of range value for column 'd' at row 1 Warning 1264 Out of range value for column 'd0' at row 1 @@ -101,7 +101,7 @@ Warning 1264 Out of range value for column 'n0_0' at row 1 Warning 1264 Out of range value for column 'n1' at row 1 Warning 1264 Out of range value for column 'n20_4' at row 1 Warning 1264 Out of range value for column 'n65_4' at row 1 -SELECT * FROM t1; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 @@ -110,7 +110,7 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -INSERT INTO t1 VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111); Warnings: Note 1265 Data truncated for column 'd' at row 1 Note 1265 Data truncated for column 'd0' at row 1 @@ -122,7 +122,7 @@ Note 1265 Data truncated for column 'n0_0' at row 1 Note 1265 Data truncated for column 'n1' at row 1 Note 1265 Data truncated for column 'n20_4' at row 1 Note 1265 Data truncated for column 'n65_4' at row 1 -SELECT * FROM t1; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 @@ -152,7 +152,7 @@ Warning 1264 Out of range value for column 'b' at row 1 INSERT INTO t1 (a,b) VALUES (-100,100); Warnings: Warning 1264 Out of range value for column 'a' at row 1 -SELECT * FROM t1; +SELECT a,b FROM t1; a b 0 100 1 0 @@ -184,8 +184,8 @@ d1_0 double(1,0) unsigned # # # d10_10 double(10,10) unsigned # # # d53 double(53,0) unsigned # # # d53_10 double(53,10) unsigned # # # -INSERT INTO t1 VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999); -SELECT * FROM t1; +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999); +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 12345.1 d 11111111.111 d10_10 0.0123456789 @@ -196,8 +196,8 @@ f0 12345.1 f20_3 56789.988 f23_0 123457000 r1_1 0.9 -INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0); -INSERT INTO t1 VALUES ( +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (0,0,0,0,0,0,0,0,0,0); +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES ( 99999999999999999999999999999999999999, 99999999999999999999999999999999999999.9999999999999999, 0.9, @@ -212,7 +212,7 @@ INSERT INTO t1 VALUES ( Warnings: Warning 1264 Out of range value for column 'd53' at row 1 Warning 1264 Out of range value for column 'd53_10' at row 1 -SELECT * FROM t1; +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 12345.1 d 0 d 11111111.111 @@ -243,7 +243,7 @@ f23_0 1e38 r1_1 0.0 r1_1 0.9 r1_1 0.9 -INSERT INTO t1 VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999); +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999); Warnings: Warning 1264 Out of range value for column 'f' at row 1 Warning 1264 Out of range value for column 'f0' at row 1 @@ -255,7 +255,7 @@ Warning 1264 Out of range value for column 'd1_0' at row 1 Warning 1264 Out of range value for column 'd10_10' at row 1 Warning 1264 Out of range value for column 'd53' at row 1 Warning 1264 Out of range value for column 'd53_10' at row 1 -SELECT * FROM t1; +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 12345.1 d 0 d 0 @@ -307,7 +307,7 @@ MAX(f0) 9.999999680285692e37 MAX(f20_3) 99999998430674940.000 MAX(f23_0) 9.999999680285692e37 MAX(r1_1) 0.9 -INSERT INTO t1 SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1; +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1; Warnings: Warning 1264 Out of range value for column 'f' at row 1 Warning 1264 Out of range value for column 'f0' at row 1 @@ -315,7 +315,7 @@ Warning 1264 Out of range value for column 'r1_1' at row 1 Warning 1264 Out of range value for column 'f23_0' at row 1 Warning 1264 Out of range value for column 'f20_3' at row 1 Warning 1264 Out of range value for column 'd1_0' at row 1 -SELECT * FROM t1; +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 12345.1 d 0 d 0 @@ -366,7 +366,7 @@ r1_1 0.0 r1_1 0.9 r1_1 0.9 r1_1 0.9 -INSERT INTO t1 VALUES ( +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES ( 999999999999999999999999999999999999999, 999999999999999999999999999999999999999.9999999999999999, 1.9, @@ -389,7 +389,7 @@ Warning 1264 Out of range value for column 'd1_0' at row 1 Warning 1264 Out of range value for column 'd10_10' at row 1 Warning 1264 Out of range value for column 'd53' at row 1 Warning 1264 Out of range value for column 'd53_10' at row 1 -SELECT * FROM t1; +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 12345.1 d 0 d 0 @@ -470,7 +470,7 @@ Warning 1264 Out of range value for column 'b' at row 1 INSERT INTO t1 (a,b) VALUES (-100,100); Warnings: Warning 1264 Out of range value for column 'a' at row 1 -SELECT * FROM t1; +SELECT a,b FROM t1; a b 0 100 1 0 @@ -522,15 +522,15 @@ b bigint(20) unsigned # # # b0 bigint(20) unsigned # # # b1 bigint(1) unsigned # # # b20 bigint(20) unsigned # # # -INSERT INTO t1 VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); -INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); -INSERT INTO t1 VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807); -SELECT * FROM t1; +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807); +SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1; i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807 -INSERT INTO t1 VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808); Warnings: Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'i0' at row 1 @@ -552,15 +552,15 @@ Warning 1264 Out of range value for column 'b' at row 1 Warning 1264 Out of range value for column 'b0' at row 1 Warning 1264 Out of range value for column 'b1' at row 1 Warning 1264 Out of range value for column 'b20' at row 1 -INSERT INTO t1 VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615); -SELECT * FROM t1; +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615); +SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1; i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807 4294967295 4294967295 4294967295 4294967295 255 255 255 255 65535 65535 65535 65535 16777215 16777215 16777215 16777215 18446744073709551615 18446744073709551615 18446744073709551615 18446744073709551615 -INSERT INTO t1 VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809); Warnings: Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'i0' at row 1 @@ -582,7 +582,7 @@ Warning 1264 Out of range value for column 'b' at row 1 Warning 1264 Out of range value for column 'b0' at row 1 Warning 1264 Out of range value for column 'b1' at row 1 Warning 1264 Out of range value for column 'b20' at row 1 -INSERT INTO t1 VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616); Warnings: Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'i0' at row 1 @@ -604,7 +604,7 @@ Warning 1264 Out of range value for column 'b' at row 1 Warning 1264 Out of range value for column 'b0' at row 1 Warning 1264 Out of range value for column 'b1' at row 1 Warning 1264 Out of range value for column 'b20' at row 1 -INSERT INTO t1 SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615); Warnings: Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'i0' at row 1 @@ -654,7 +654,7 @@ Warning 1264 Out of range value for column 'm' at row 3 Warning 1264 Out of range value for column 'm0' at row 3 Warning 1264 Out of range value for column 'm1' at row 3 Warning 1264 Out of range value for column 'm20' at row 3 -SELECT * FROM t1; +SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1; i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 @@ -690,7 +690,7 @@ Warning 1264 Out of range value for column 's' at row 1 Warning 1264 Out of range value for column 'm' at row 1 Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'b' at row 1 -SELECT * FROM t1; +SELECT t,s,m,i,b FROM t1; t s m i b 0 0 0 0 0 255 65535 16777215 4294967295 18446744073709551615 diff --git a/mysql-test/suite/storage_engine/col_opt_unsigned.test b/mysql-test/suite/storage_engine/col_opt_unsigned.test index e9d4566de7f..62b7b29a507 100644 --- a/mysql-test/suite/storage_engine/col_opt_unsigned.test +++ b/mysql-test/suite/storage_engine/col_opt_unsigned.test @@ -29,7 +29,7 @@ if (!$mysql_errname) INSERT INTO t1 (a,b) VALUES (1.0,-1.0); INSERT INTO t1 (a,b) VALUES (-100,100); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; DROP TABLE t1; } @@ -56,7 +56,7 @@ if (!$mysql_errname) INSERT INTO t1 (a,b) VALUES (1.0,-1.0); INSERT INTO t1 (a,b) VALUES (-100,100); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; DROP TABLE t1; } @@ -86,7 +86,7 @@ if (!$mysql_errname) INSERT INTO t1 (t,s,m,i,b) VALUES (255,65535,16777215,4294967295,18446744073709551615); INSERT INTO t1 (t,s,m,i,b) VALUES (-1,-1,-1,-1,-1); --sorted_result - SELECT * FROM t1; + SELECT t,s,m,i,b FROM t1; DROP TABLE t1; } diff --git a/mysql-test/suite/storage_engine/col_opt_zerofill.result b/mysql-test/suite/storage_engine/col_opt_zerofill.result index c2445c5bbc7..a35ce4bfe66 100644 --- a/mysql-test/suite/storage_engine/col_opt_zerofill.result +++ b/mysql-test/suite/storage_engine/col_opt_zerofill.result @@ -25,15 +25,15 @@ n0_0 decimal(10,0) unsigned zerofill # # # n1 decimal(1,0) unsigned zerofill # # # n20_4 decimal(20,4) unsigned zerofill # # # n65_4 decimal(65,4) unsigned zerofill # # # -INSERT INTO t1 VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807); -INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0); -INSERT INTO t1 VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999); -SELECT * FROM t1; +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (0,0,0,0,0,0,0,0,0,0); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999); +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000 0000000100 0000123456 0.3 00040000.25 00000000000000000000000000000000123456789123456789.1000100000 0000001024 0000007000 8 0000000000999999.9000 0000000000000000000000000000000000000000009223372036854775807.0000 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -INSERT INTO t1 VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807); Warnings: Warning 1264 Out of range value for column 'd' at row 1 Warning 1264 Out of range value for column 'd0' at row 1 @@ -45,7 +45,7 @@ Warning 1264 Out of range value for column 'n0_0' at row 1 Warning 1264 Out of range value for column 'n1' at row 1 Warning 1264 Out of range value for column 'n20_4' at row 1 Warning 1264 Out of range value for column 'n65_4' at row 1 -INSERT INTO t1 VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999); Warnings: Warning 1264 Out of range value for column 'd' at row 1 Warning 1264 Out of range value for column 'd0' at row 1 @@ -57,20 +57,20 @@ Warning 1264 Out of range value for column 'n0_0' at row 1 Warning 1264 Out of range value for column 'n1' at row 1 Warning 1264 Out of range value for column 'n20_4' at row 1 Warning 1264 Out of range value for column 'n65_4' at row 1 -SELECT * FROM t1; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000 0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000 0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000 0000000100 0000123456 0.3 00040000.25 00000000000000000000000000000000123456789123456789.1000100000 0000001024 0000007000 8 0000000000999999.9000 0000000000000000000000000000000000000000009223372036854775807.0000 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -SELECT * FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000 0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000 0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -INSERT INTO t1 SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 ); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 ); Warnings: Warning 1264 Out of range value for column 'd' at row 1 Warning 1264 Out of range value for column 'd0' at row 1 @@ -81,7 +81,7 @@ Warning 1264 Out of range value for column 'n' at row 1 Warning 1264 Out of range value for column 'n0_0' at row 1 Warning 1264 Out of range value for column 'n1' at row 1 Warning 1264 Out of range value for column 'n20_4' at row 1 -SELECT * FROM t1; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000 0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000 @@ -89,7 +89,7 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 0000000100 0000123456 0.3 00040000.25 00000000000000000000000000000000123456789123456789.1000100000 0000001024 0000007000 8 0000000000999999.9000 0000000000000000000000000000000000000000009223372036854775807.0000 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -INSERT INTO t1 VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999); Warnings: Warning 1264 Out of range value for column 'd' at row 1 Warning 1264 Out of range value for column 'd0' at row 1 @@ -101,7 +101,7 @@ Warning 1264 Out of range value for column 'n0_0' at row 1 Warning 1264 Out of range value for column 'n1' at row 1 Warning 1264 Out of range value for column 'n20_4' at row 1 Warning 1264 Out of range value for column 'n65_4' at row 1 -SELECT * FROM t1; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000 0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000 @@ -110,7 +110,7 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -INSERT INTO t1 VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111); Warnings: Note 1265 Data truncated for column 'd' at row 1 Note 1265 Data truncated for column 'd0' at row 1 @@ -122,7 +122,7 @@ Note 1265 Data truncated for column 'n0_0' at row 1 Note 1265 Data truncated for column 'n1' at row 1 Note 1265 Data truncated for column 'n20_4' at row 1 Note 1265 Data truncated for column 'n65_4' at row 1 -SELECT * FROM t1; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000 0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000 @@ -149,7 +149,7 @@ b decimal(10,0) unsigned zerofill # # # # INSERT INTO t1 (a,b) VALUES (1.1,1234); Warnings: Note 1265 Data truncated for column 'a' at row 1 -SELECT * FROM t1; +SELECT a,b FROM t1; a b 0000000001 0000001234 DROP TABLE t1; @@ -180,8 +180,8 @@ d1_0 double(1,0) unsigned zerofill # # # d10_10 double(10,10) unsigned zerofill # # # d53 double(53,0) unsigned zerofill # # # d53_10 double(53,10) unsigned zerofill # # # -INSERT INTO t1 VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999); -SELECT * FROM t1; +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999); +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 0000012345.1 d 000000000011111111.111 d10_10 0.0123456789 @@ -192,8 +192,8 @@ f0 0000012345.1 f20_3 0000000000056789.988 f23_0 000123457000 r1_1 0.9 -INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0); -INSERT INTO t1 VALUES ( +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (0,0,0,0,0,0,0,0,0,0); +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES ( 99999999999999999999999999999999999999, 99999999999999999999999999999999999999.9999999999999999, 0.9, @@ -208,7 +208,7 @@ INSERT INTO t1 VALUES ( Warnings: Warning 1264 Out of range value for column 'd53' at row 1 Warning 1264 Out of range value for column 'd53_10' at row 1 -SELECT * FROM t1; +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 0000012345.1 d 0000000000000000000000 d 0000000000000000001e81 @@ -239,7 +239,7 @@ f23_0 000123457000 r1_1 0.0 r1_1 0.9 r1_1 0.9 -INSERT INTO t1 VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999); +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999); Warnings: Warning 1264 Out of range value for column 'f' at row 1 Warning 1264 Out of range value for column 'f0' at row 1 @@ -251,7 +251,7 @@ Warning 1264 Out of range value for column 'd1_0' at row 1 Warning 1264 Out of range value for column 'd10_10' at row 1 Warning 1264 Out of range value for column 'd53' at row 1 Warning 1264 Out of range value for column 'd53_10' at row 1 -SELECT * FROM t1; +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 0000012345.1 d 0000000000000000000000 d 0000000000000000000000 @@ -303,7 +303,7 @@ MAX(f0) 9.999999680285692e37 MAX(f20_3) 99999998430674940.000 MAX(f23_0) 9.999999680285692e37 MAX(r1_1) 0.9 -INSERT INTO t1 SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1; +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1; Warnings: Warning 1264 Out of range value for column 'f' at row 1 Warning 1264 Out of range value for column 'f0' at row 1 @@ -311,7 +311,7 @@ Warning 1264 Out of range value for column 'r1_1' at row 1 Warning 1264 Out of range value for column 'f23_0' at row 1 Warning 1264 Out of range value for column 'f20_3' at row 1 Warning 1264 Out of range value for column 'd1_0' at row 1 -SELECT * FROM t1; +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 0000012345.1 d 0000000000000000000000 d 0000000000000000000000 @@ -362,7 +362,7 @@ r1_1 0.0 r1_1 0.9 r1_1 0.9 r1_1 0.9 -INSERT INTO t1 VALUES ( +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES ( 999999999999999999999999999999999999999, 999999999999999999999999999999999999999.9999999999999999, 1.9, @@ -385,7 +385,7 @@ Warning 1264 Out of range value for column 'd1_0' at row 1 Warning 1264 Out of range value for column 'd10_10' at row 1 Warning 1264 Out of range value for column 'd53' at row 1 Warning 1264 Out of range value for column 'd53_10' at row 1 -SELECT * FROM t1; +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 0000012345.1 d 0000000000000000000000 d 0000000000000000000000 @@ -461,7 +461,7 @@ Field Type Null Key Default Extra a double unsigned zerofill # # # # b float unsigned zerofill # # # # INSERT INTO t1 (a,b) VALUES (1,1234.5); -SELECT * FROM t1; +SELECT a,b FROM t1; a b 0000000000000000000001 0000001234.5 DROP TABLE t1; @@ -512,15 +512,15 @@ b bigint(20) unsigned zerofill # # # b0 bigint(20) unsigned zerofill # # # b1 bigint(1) unsigned zerofill # # # b20 bigint(20) unsigned zerofill # # # -INSERT INTO t1 VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); -INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); -INSERT INTO t1 VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807); -SELECT * FROM t1; +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807); +SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1; i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20 0000000000 0000000000 0 00000000000000000000 000 000 0 00000000000000000000 00000 00000 0 00000000000000000000 00000000 00000000 0 00000000000000000000 00000000000000000000 00000000000000000000 0 00000000000000000000 0000000001 0000000002 3 00000000000000000004 005 006 7 00000000000000000008 00009 00010 11 00000000000000000012 00000013 00000014 15 00000000000000000016 00000000000000000017 00000000000000000018 19 00000000000000000020 2147483647 2147483647 2147483647 00000000002147483647 127 127 127 00000000000000000127 32767 32767 32767 00000000000000032767 08388607 08388607 8388607 00000000000008388607 09223372036854775807 09223372036854775807 9223372036854775807 09223372036854775807 -INSERT INTO t1 VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808); Warnings: Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'i0' at row 1 @@ -542,15 +542,15 @@ Warning 1264 Out of range value for column 'b' at row 1 Warning 1264 Out of range value for column 'b0' at row 1 Warning 1264 Out of range value for column 'b1' at row 1 Warning 1264 Out of range value for column 'b20' at row 1 -INSERT INTO t1 VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615); -SELECT * FROM t1; +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615); +SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1; i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20 0000000000 0000000000 0 00000000000000000000 000 000 0 00000000000000000000 00000 00000 0 00000000000000000000 00000000 00000000 0 00000000000000000000 00000000000000000000 00000000000000000000 0 00000000000000000000 0000000000 0000000000 0 00000000000000000000 000 000 0 00000000000000000000 00000 00000 0 00000000000000000000 00000000 00000000 0 00000000000000000000 00000000000000000000 00000000000000000000 0 00000000000000000000 0000000001 0000000002 3 00000000000000000004 005 006 7 00000000000000000008 00009 00010 11 00000000000000000012 00000013 00000014 15 00000000000000000016 00000000000000000017 00000000000000000018 19 00000000000000000020 2147483647 2147483647 2147483647 00000000002147483647 127 127 127 00000000000000000127 32767 32767 32767 00000000000000032767 08388607 08388607 8388607 00000000000008388607 09223372036854775807 09223372036854775807 9223372036854775807 09223372036854775807 4294967295 4294967295 4294967295 00000000004294967295 255 255 255 00000000000000000255 65535 65535 65535 00000000000000065535 16777215 16777215 16777215 00000000000016777215 18446744073709551615 18446744073709551615 18446744073709551615 18446744073709551615 -INSERT INTO t1 VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809); Warnings: Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'i0' at row 1 @@ -572,7 +572,7 @@ Warning 1264 Out of range value for column 'b' at row 1 Warning 1264 Out of range value for column 'b0' at row 1 Warning 1264 Out of range value for column 'b1' at row 1 Warning 1264 Out of range value for column 'b20' at row 1 -INSERT INTO t1 VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616); Warnings: Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'i0' at row 1 @@ -594,7 +594,7 @@ Warning 1264 Out of range value for column 'b' at row 1 Warning 1264 Out of range value for column 'b0' at row 1 Warning 1264 Out of range value for column 'b1' at row 1 Warning 1264 Out of range value for column 'b20' at row 1 -INSERT INTO t1 SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615); Warnings: Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'i0' at row 1 @@ -644,7 +644,7 @@ Warning 1264 Out of range value for column 'm' at row 3 Warning 1264 Out of range value for column 'm0' at row 3 Warning 1264 Out of range value for column 'm1' at row 3 Warning 1264 Out of range value for column 'm20' at row 3 -SELECT * FROM t1; +SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1; i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20 0000000000 0000000000 0 00000000000000000000 000 000 0 00000000000000000000 00000 00000 0 00000000000000000000 00000000 00000000 0 00000000000000000000 00000000000000000000 00000000000000000000 0 00000000000000000000 0000000000 0000000000 0 00000000000000000000 000 000 0 00000000000000000000 00000 00000 0 00000000000000000000 00000000 00000000 0 00000000000000000000 00000000000000000000 00000000000000000000 0 00000000000000000000 @@ -673,7 +673,7 @@ m mediumint(8) unsigned zerofill # # # # i int(10) unsigned zerofill # # # # b bigint(20) unsigned zerofill # # # # INSERT INTO t1 (t,s,m,i,b) VALUES (1,10,100,1000,0); -SELECT * FROM t1; +SELECT t,s,m,i,b FROM t1; t s m i b 001 00010 00000100 0000001000 00000000000000000000 DROP TABLE t1; diff --git a/mysql-test/suite/storage_engine/col_opt_zerofill.test b/mysql-test/suite/storage_engine/col_opt_zerofill.test index 83b7dcf28c1..0dc1c243673 100644 --- a/mysql-test/suite/storage_engine/col_opt_zerofill.test +++ b/mysql-test/suite/storage_engine/col_opt_zerofill.test @@ -27,7 +27,7 @@ if (!$mysql_errname) SHOW COLUMNS IN t1; INSERT INTO t1 (a,b) VALUES (1.1,1234); - SELECT * FROM t1; + SELECT a,b FROM t1; DROP TABLE t1; } @@ -52,7 +52,7 @@ if (!$mysql_errname) SHOW COLUMNS IN t1; INSERT INTO t1 (a,b) VALUES (1,1234.5); - SELECT * FROM t1; + SELECT a,b FROM t1; DROP TABLE t1; } @@ -80,7 +80,7 @@ if (!$mysql_errname) SHOW COLUMNS IN t1; INSERT INTO t1 (t,s,m,i,b) VALUES (1,10,100,1000,0); - SELECT * FROM t1; + SELECT t,s,m,i,b FROM t1; DROP TABLE t1; } diff --git a/mysql-test/suite/storage_engine/delete.result b/mysql-test/suite/storage_engine/delete.result index 1d84516c86a..d7125a344b7 100644 --- a/mysql-test/suite/storage_engine/delete.result +++ b/mysql-test/suite/storage_engine/delete.result @@ -3,7 +3,7 @@ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTO INSERT INTO t1 (a,b) VALUES (10000,'foobar'),(1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'); INSERT INTO t1 (a,b) SELECT a, b FROM t1; DELETE FROM t1 WHERE b IN ('c'); -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 1 a @@ -16,7 +16,7 @@ a b 5 e 5 e DELETE FROM t1 WHERE a < 0 OR b = 'a'; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 10000 foobar 10000 foobar @@ -27,7 +27,7 @@ a b 5 e 5 e DELETE FROM t1 WHERE a <= 4 ORDER BY b DESC LIMIT 1; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 10000 foobar 10000 foobar @@ -38,7 +38,7 @@ a b 5 e CREATE TABLE t2 (c <CHAR_COLUMN>, d <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; INSERT INTO t2 (c,d) SELECT b, a FROM t1; -SELECT * FROM t2; +SELECT c,d FROM t2; c d b 2 b 2 @@ -48,7 +48,7 @@ e 5 foobar 10000 foobar 10000 DELETE t2.* FROM t1, t2 WHERE c < b AND a + d != 1; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 10000 foobar 10000 foobar @@ -57,21 +57,21 @@ a b 4 d 5 e 5 e -SELECT * FROM t2; +SELECT c,d FROM t2; c d foobar 10000 foobar 10000 DELETE FROM t2, t1.* USING t2, t1 WHERE c = 'foobar' and b = c; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 2 b 2 b 4 d 5 e 5 e -SELECT * FROM t2; +SELECT c,d FROM t2; c d DELETE FROM t1; -SELECT * FROM t1; +SELECT a,b FROM t1; a b DROP TABLE t1, t2; diff --git a/mysql-test/suite/storage_engine/delete.test b/mysql-test/suite/storage_engine/delete.test index 802093e2977..e210ec3d17c 100644 --- a/mysql-test/suite/storage_engine/delete.test +++ b/mysql-test/suite/storage_engine/delete.test @@ -25,16 +25,16 @@ if ($mysql_errname) --source unexpected_result.inc } --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; DELETE FROM t1 WHERE a < 0 OR b = 'a'; --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; # ORDER BY and LIMIT DELETE FROM t1 WHERE a <= 4 ORDER BY b DESC LIMIT 1; --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; # Multi-table DELETE @@ -43,23 +43,23 @@ SELECT * FROM t1; --source create_table.inc INSERT INTO t2 (c,d) SELECT b, a FROM t1; --sorted_result -SELECT * FROM t2; +SELECT c,d FROM t2; DELETE t2.* FROM t1, t2 WHERE c < b AND a + d != 1; --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; --sorted_result -SELECT * FROM t2; +SELECT c,d FROM t2; DELETE FROM t2, t1.* USING t2, t1 WHERE c = 'foobar' and b = c; --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; --sorted_result -SELECT * FROM t2; +SELECT c,d FROM t2; DELETE FROM t1; --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; # Cleanup DROP TABLE t1, t2; diff --git a/mysql-test/suite/storage_engine/delete_ignore.result b/mysql-test/suite/storage_engine/delete_ignore.result index a15c338ea04..aedac761d99 100644 --- a/mysql-test/suite/storage_engine/delete_ignore.result +++ b/mysql-test/suite/storage_engine/delete_ignore.result @@ -4,7 +4,7 @@ INSERT INTO t1 (a,b) VALUES (10000,'foobar'),(1,'a'),(2,'b'),(3,'c'),(4,'d'),(5, INSERT INTO t1 (a,b) SELECT a, b FROM t1; CREATE TABLE t2 (c <CHAR_COLUMN>, d <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; INSERT INTO t2 (c,d) SELECT b, a FROM t1; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 1 a @@ -18,7 +18,7 @@ a b 4 d 5 e 5 e -SELECT * FROM t2; +SELECT c,d FROM t2; c d a 1 a 1 @@ -33,7 +33,7 @@ e 5 foobar 10000 foobar 10000 DELETE IGNORE FROM t1 WHERE b IS NOT NULL ORDER BY a LIMIT 1; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 10000 foobar @@ -49,10 +49,10 @@ a b DELETE IGNORE t1.*, t2.* FROM t1, t2 WHERE c < b OR a != ( SELECT 1 UNION SELECT 2 ); Warnings: Warning 1242 Subquery returns more than 1 row -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a -SELECT * FROM t2; +SELECT c,d FROM t2; c d foobar 10000 foobar 10000 diff --git a/mysql-test/suite/storage_engine/delete_ignore.test b/mysql-test/suite/storage_engine/delete_ignore.test index fa98ec92029..c1b1926db45 100644 --- a/mysql-test/suite/storage_engine/delete_ignore.test +++ b/mysql-test/suite/storage_engine/delete_ignore.test @@ -18,9 +18,9 @@ INSERT INTO t1 (a,b) SELECT a, b FROM t1; --source create_table.inc INSERT INTO t2 (c,d) SELECT b, a FROM t1; --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; --sorted_result -SELECT * FROM t2; +SELECT c,d FROM t2; DELETE IGNORE FROM t1 WHERE b IS NOT NULL ORDER BY a LIMIT 1; if ($mysql_errname) @@ -29,13 +29,13 @@ if ($mysql_errname) --source unexpected_result.inc } --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; DELETE IGNORE t1.*, t2.* FROM t1, t2 WHERE c < b OR a != ( SELECT 1 UNION SELECT 2 ); --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; --sorted_result -SELECT * FROM t2; +SELECT c,d FROM t2; # Cleanup DROP TABLE t1, t2; diff --git a/mysql-test/suite/storage_engine/delete_low_prio.result b/mysql-test/suite/storage_engine/delete_low_prio.result index be334612a2b..89d08db5450 100644 --- a/mysql-test/suite/storage_engine/delete_low_prio.result +++ b/mysql-test/suite/storage_engine/delete_low_prio.result @@ -17,7 +17,7 @@ SLEEP(1) 0 0 connection default; -SELECT * FROM t1; +SELECT a,b FROM t1; a b INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); connection con1; @@ -34,7 +34,7 @@ SLEEP(1) 0 0 connection default; -SELECT * FROM t1; +SELECT a,b FROM t1; a b INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); SET LOW_PRIORITY_UPDATES = 1; @@ -52,7 +52,7 @@ SLEEP(1) 0 0 connection default; -SELECT * FROM t1; +SELECT a,b FROM t1; a b disconnect con1; disconnect con2; diff --git a/mysql-test/suite/storage_engine/delete_low_prio.test b/mysql-test/suite/storage_engine/delete_low_prio.test index 34677df5373..f79a055dabe 100644 --- a/mysql-test/suite/storage_engine/delete_low_prio.test +++ b/mysql-test/suite/storage_engine/delete_low_prio.test @@ -73,7 +73,7 @@ if ($found) --connection default --reap --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); @@ -113,7 +113,7 @@ if ($found) --connection default --reap --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); SET LOW_PRIORITY_UPDATES = 1; @@ -148,7 +148,7 @@ if ($found) --connection default --reap --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; --disconnect con1 --disconnect con2 diff --git a/mysql-test/suite/storage_engine/delete_quick.result b/mysql-test/suite/storage_engine/delete_quick.result index 30d4841b51f..7166bcde96c 100644 --- a/mysql-test/suite/storage_engine/delete_quick.result +++ b/mysql-test/suite/storage_engine/delete_quick.result @@ -2,24 +2,24 @@ DROP TABLE IF EXISTS t1,t2; CREATE TABLE t1 (a <INT_COLUMN>, <CUSTOM_INDEX> (a), b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'); DELETE QUICK FROM t1 WHERE a = 1 OR b > 'foo'; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 2 b 3 c 4 d 5 e CREATE TABLE t2 (c <CHAR_COLUMN>, d <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -INSERT INTO t2 SELECT b, a FROM t1; -SELECT * FROM t2; +INSERT INTO t2 (c,d) SELECT b, a FROM t1; +SELECT c,d FROM t2; c d b 2 c 3 d 4 e 5 DELETE QUICK FROM t2, t1.* USING t2, t1 WHERE c IS NULL OR a = d; -SELECT * FROM t1; +SELECT a,b FROM t1; a b -SELECT * FROM t2; +SELECT c,d FROM t2; c d DROP TABLE t2; DROP TABLE t1; diff --git a/mysql-test/suite/storage_engine/delete_quick.test b/mysql-test/suite/storage_engine/delete_quick.test index 3b37096de4f..f96fedfd9c5 100644 --- a/mysql-test/suite/storage_engine/delete_quick.test +++ b/mysql-test/suite/storage_engine/delete_quick.test @@ -30,20 +30,20 @@ if (!$mysql_errname) if (!$mysql_errname) { --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; --let $create_definition = c $char_col, d $int_col --let $table_name = t2 --source create_table.inc - INSERT INTO t2 SELECT b, a FROM t1; + INSERT INTO t2 (c,d) SELECT b, a FROM t1; --sorted_result - SELECT * FROM t2; + SELECT c,d FROM t2; DELETE QUICK FROM t2, t1.* USING t2, t1 WHERE c IS NULL OR a = d; --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; --sorted_result - SELECT * FROM t2; + SELECT c,d FROM t2; DROP TABLE t2; } DROP TABLE t1; diff --git a/mysql-test/suite/storage_engine/delete_with_keys.result b/mysql-test/suite/storage_engine/delete_with_keys.result index 6622cc1fb64..e968451b2e2 100644 --- a/mysql-test/suite/storage_engine/delete_with_keys.result +++ b/mysql-test/suite/storage_engine/delete_with_keys.result @@ -3,7 +3,7 @@ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (b)) ENGINE=<ST INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'x'),(7,'y'),(8,'z'); DELETE FROM t1 WHERE b > 'y'; DELETE FROM t1 WHERE a=2; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 3 c @@ -17,7 +17,7 @@ CREATE TABLE t1 (a <INT_COLUMN> PRIMARY KEY, b <CHAR_COLUMN>) ENGINE=<STORAGE_EN INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'x'),(7,'y'),(8,'z'); DELETE FROM t1 WHERE b > 'y'; DELETE FROM t1 WHERE a=2; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 3 c @@ -30,7 +30,7 @@ DROP TABLE t1; CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>, c <INT_COLUMN>, <CUSTOM_INDEX>(a), <CUSTOM_INDEX>(b)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; INSERT INTO t1 (a,b,c) VALUES (1,2,3),(4,5,6),(7,8,9); DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1; -SELECT * FROM t1; +SELECT a,b,c FROM t1; a b c 1 2 3 4 5 6 diff --git a/mysql-test/suite/storage_engine/delete_with_keys.test b/mysql-test/suite/storage_engine/delete_with_keys.test index 274801b6d0e..cda0da0653f 100644 --- a/mysql-test/suite/storage_engine/delete_with_keys.test +++ b/mysql-test/suite/storage_engine/delete_with_keys.test @@ -29,7 +29,7 @@ if (!$mysql_errname) DELETE FROM t1 WHERE a=2; --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; DELETE FROM t1; } DROP TABLE t1; @@ -49,7 +49,7 @@ if (!$mysql_errname) DELETE FROM t1 WHERE a=2; --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; DELETE FROM t1; DROP TABLE t1; } @@ -66,7 +66,7 @@ if (!$mysql_errname) INSERT INTO t1 (a,b,c) VALUES (1,2,3),(4,5,6),(7,8,9); DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1; --sorted_result - SELECT * FROM t1; + SELECT a,b,c FROM t1; DROP TABLE t1; } diff --git a/mysql-test/suite/storage_engine/foreign_keys.result b/mysql-test/suite/storage_engine/foreign_keys.result index 5374e78d9b1..6c4a3406811 100644 --- a/mysql-test/suite/storage_engine/foreign_keys.result +++ b/mysql-test/suite/storage_engine/foreign_keys.result @@ -26,11 +26,11 @@ ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fail DELETE FROM t1 WHERE a=2; ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) DELETE FROM t2 WHERE a=2; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 c 2 d -SELECT * FROM t2; +SELECT a,b FROM t2; a b 1 a DROP TABLE t1; @@ -54,7 +54,7 @@ ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (` INSERT INTO t1 (a,b) VALUES (3,'a'),(4,'a'); INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(4,'e'),(3,'a'); UPDATE t1 SET a=a+1; -SELECT * FROM t2; +SELECT a,b FROM t2; a b 5 a 5 a @@ -63,7 +63,7 @@ a b 5 d 5 e DELETE FROM t1 WHERE b='a' LIMIT 2; -SELECT * FROM t2; +SELECT a,b FROM t2; a b TRUNCATE TABLE t1; ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`t1` (`a`)) diff --git a/mysql-test/suite/storage_engine/foreign_keys.test b/mysql-test/suite/storage_engine/foreign_keys.test index 643ca8bf6b1..cbadc4c950d 100644 --- a/mysql-test/suite/storage_engine/foreign_keys.test +++ b/mysql-test/suite/storage_engine/foreign_keys.test @@ -73,8 +73,9 @@ if (!$mysql_errname) DELETE FROM t2 WHERE a=2; --sorted_result - SELECT * FROM t1; - SELECT * FROM t2; + SELECT a,b FROM t1; + --sorted_result + SELECT a,b FROM t2; --let $error_codes = ER_ROW_IS_REFERENCED DROP TABLE t1; @@ -119,7 +120,7 @@ if (!$mysql_errname) --source unexpected_result.inc } --sorted_result - SELECT * FROM t2; + SELECT a,b FROM t2; DELETE FROM t1 WHERE b='a' LIMIT 2; if ($mysql_errname) @@ -128,7 +129,7 @@ if (!$mysql_errname) --source unexpected_result.inc } --sorted_result - SELECT * FROM t2; + SELECT a,b FROM t2; --let $error_codes = ER_TRUNCATE_ILLEGAL_FK TRUNCATE TABLE t1; diff --git a/mysql-test/suite/storage_engine/insert.result b/mysql-test/suite/storage_engine/insert.result index a07a6e8d9a4..2dfe20cb822 100644 --- a/mysql-test/suite/storage_engine/insert.result +++ b/mysql-test/suite/storage_engine/insert.result @@ -1,7 +1,7 @@ DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; INSERT INTO t1 VALUES (100,'foobar'),(1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'); -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 100 foobar @@ -10,7 +10,7 @@ a b 4 d 5 e INSERT t1 VALUE (10,'foo'),(11,'abc'); -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 10 foo @@ -21,7 +21,7 @@ a b 4 d 5 e INSERT INTO t1 (b,a) VALUES ('test',0); -SELECT * FROM t1; +SELECT a,b FROM t1; a b 0 test 1 a @@ -33,7 +33,7 @@ a b 4 d 5 e INSERT INTO t1 VALUES (DEFAULT,DEFAULT); -SELECT * FROM t1; +SELECT a,b FROM t1; a b 0 test 1 a @@ -46,7 +46,7 @@ a b 5 e NULL NULL INSERT t1 (a) VALUE (10),(20); -SELECT * FROM t1; +SELECT a,b FROM t1; a b 0 test 1 a @@ -61,7 +61,7 @@ a b 5 e NULL NULL INSERT INTO t1 SET a = 11, b = 'f'; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 0 test 1 a @@ -77,7 +77,7 @@ a b 5 e NULL NULL INSERT t1 SET b = DEFAULT; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 0 test 1 a @@ -94,9 +94,9 @@ a b NULL NULL NULL NULL CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -INSERT INTO t2 SELECT * FROM t1; +INSERT INTO t2 SELECT a,b FROM t1; INSERT INTO t1 (a) SELECT a FROM t2 WHERE b = 'foo'; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 0 test 1 a @@ -113,8 +113,8 @@ a b 5 e NULL NULL NULL NULL -INSERT t1 SELECT * FROM t1; -SELECT * FROM t1; +INSERT t1 (a,b) SELECT a,b FROM t1; +SELECT a,b FROM t1; a b 0 test 0 test diff --git a/mysql-test/suite/storage_engine/insert.test b/mysql-test/suite/storage_engine/insert.test index d9076219eb0..1f780eba71f 100644 --- a/mysql-test/suite/storage_engine/insert.test +++ b/mysql-test/suite/storage_engine/insert.test @@ -22,40 +22,40 @@ if ($mysql_errname) --source unexpected_result.inc } --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; INSERT t1 VALUE (10,'foo'),(11,'abc'); --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; INSERT INTO t1 (b,a) VALUES ('test',0); --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; INSERT INTO t1 VALUES (DEFAULT,DEFAULT); --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; INSERT t1 (a) VALUE (10),(20); --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; # INSERT [INTO] .. SET INSERT INTO t1 SET a = 11, b = 'f'; --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; INSERT t1 SET b = DEFAULT; --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; # INSERT .. SELECT --let $table_name = t2 --source create_table.inc -INSERT INTO t2 SELECT * FROM t1; +INSERT INTO t2 SELECT a,b FROM t1; if ($mysql_errname) { --let $functionality = INSERT .. SELECT @@ -65,11 +65,11 @@ if ($mysql_errname) INSERT INTO t1 (a) SELECT a FROM t2 WHERE b = 'foo'; --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; -INSERT t1 SELECT * FROM t1; +INSERT t1 (a,b) SELECT a,b FROM t1; --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; # Cleanup DROP TABLE t1, t2; diff --git a/mysql-test/suite/storage_engine/insert_delayed.result b/mysql-test/suite/storage_engine/insert_delayed.result index 98e149bdf96..528003d8923 100644 --- a/mysql-test/suite/storage_engine/insert_delayed.result +++ b/mysql-test/suite/storage_engine/insert_delayed.result @@ -6,17 +6,17 @@ connect con0,localhost,root,,; SET lock_wait_timeout = 1; INSERT DELAYED INTO t1 (a,b) VALUES (3,'c'); INSERT DELAYED INTO t1 SET a=4, b='d'; -INSERT DELAYED INTO t1 SELECT 5, 'e'; +INSERT DELAYED INTO t1 (a,b) SELECT 5, 'e'; ERROR HY000: Lock wait timeout exceeded; try restarting transaction disconnect con0; connection default; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 f 2 b UNLOCK TABLES; FLUSH TABLES; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 f 2 b diff --git a/mysql-test/suite/storage_engine/insert_delayed.test b/mysql-test/suite/storage_engine/insert_delayed.test index 7c3c4eec768..ca8bf7eddbb 100644 --- a/mysql-test/suite/storage_engine/insert_delayed.test +++ b/mysql-test/suite/storage_engine/insert_delayed.test @@ -41,16 +41,16 @@ if (!$mysql_errname) INSERT DELAYED INTO t1 SET a=4, b='d'; # DELAYED is ignored with INSERT .. SELECT --let $error_codes = ER_LOCK_WAIT_TIMEOUT - INSERT DELAYED INTO t1 SELECT 5, 'e'; + INSERT DELAYED INTO t1 (a,b) SELECT 5, 'e'; --source check_errors.inc --disconnect con0 --connection default - SELECT * FROM t1; + SELECT a,b FROM t1; } UNLOCK TABLES; FLUSH TABLES; -SELECT * FROM t1; +SELECT a,b FROM t1; # Cleanup DROP TABLE t1; diff --git a/mysql-test/suite/storage_engine/insert_high_prio.result b/mysql-test/suite/storage_engine/insert_high_prio.result index 66378564ff7..4f5a3a443cd 100644 --- a/mysql-test/suite/storage_engine/insert_high_prio.result +++ b/mysql-test/suite/storage_engine/insert_high_prio.result @@ -26,7 +26,7 @@ SLEEP(1) 0 0 connection con0; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 f 2 b @@ -50,7 +50,7 @@ SLEEP(1) 0 0 connection con0; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 f 2 b diff --git a/mysql-test/suite/storage_engine/insert_high_prio.test b/mysql-test/suite/storage_engine/insert_high_prio.test index 819e996d468..558e95a6cdf 100644 --- a/mysql-test/suite/storage_engine/insert_high_prio.test +++ b/mysql-test/suite/storage_engine/insert_high_prio.test @@ -80,7 +80,7 @@ if ($found) --connection con0 --reap --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; DROP TABLE t1; @@ -122,7 +122,7 @@ if ($found) --connection con0 --reap --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; --disconnect con1 --disconnect con2 diff --git a/mysql-test/suite/storage_engine/insert_low_prio.result b/mysql-test/suite/storage_engine/insert_low_prio.result index 561b6296380..1a74a82ea23 100644 --- a/mysql-test/suite/storage_engine/insert_low_prio.result +++ b/mysql-test/suite/storage_engine/insert_low_prio.result @@ -25,7 +25,7 @@ SLEEP(1) 0 0 connection con0; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 f 2 b diff --git a/mysql-test/suite/storage_engine/insert_low_prio.test b/mysql-test/suite/storage_engine/insert_low_prio.test index 30f47833162..ed30d106016 100644 --- a/mysql-test/suite/storage_engine/insert_low_prio.test +++ b/mysql-test/suite/storage_engine/insert_low_prio.test @@ -76,7 +76,7 @@ if ($found) --connection con0 --reap --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; --disconnect con0 --disconnect con1 diff --git a/mysql-test/suite/storage_engine/insert_with_keys.result b/mysql-test/suite/storage_engine/insert_with_keys.result index db7439c4dbf..39e42b306d2 100644 --- a/mysql-test/suite/storage_engine/insert_with_keys.result +++ b/mysql-test/suite/storage_engine/insert_with_keys.result @@ -5,7 +5,7 @@ INSERT INTO t1 (a,b) VALUES (100,'a'), (6,'f'); INSERT INTO t1 (a,b) VALUES (30,'m'),(29,'n'); INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z'); INSERT INTO t1 (a,b) VALUES (3,'a'),(0,''); -SELECT * FROM t1; +SELECT a,b FROM t1; a b 0 1 a @@ -34,7 +34,7 @@ ERROR 23000: Duplicate entry '3' for key 'a' # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). # If you got a difference in error message, just add it to rdiff file INSERT INTO t1 (a,b) VALUES (0,''); -SELECT * FROM t1; +SELECT a,b FROM t1; a b 0 1 a @@ -50,7 +50,7 @@ INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z'); Warnings: Warning 1062 Duplicate entry '1' for key 'a' INSERT INTO t1 (a,b) VALUES (3,'a'),(4,'d') ON DUPLICATE KEY UPDATE a = a+10; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 0 1 a @@ -73,7 +73,7 @@ INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z'); ERROR 23000: Duplicate entry '1-a' for key 'a' # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). # If you got a difference in error message, just add it to rdiff file -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 100 a @@ -90,7 +90,7 @@ INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z'); Warnings: Warning 1062 Duplicate entry '1-a' for key 'a' INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z') ON DUPLICATE KEY UPDATE a = a+VALUES(a); -SELECT * FROM t1; +SELECT a,b FROM t1; a b 100 a 100 b @@ -122,7 +122,7 @@ ERROR 23000: Duplicate entry '3' for key 'PRIMARY' # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). # If you got a difference in error message, just add it to rdiff file INSERT INTO t1 (a,b) VALUES (0,''); -SELECT * FROM t1; +SELECT a,b FROM t1; a b 0 1 a @@ -138,7 +138,7 @@ INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z'); Warnings: Warning 1062 Duplicate entry '1' for key 'PRIMARY' INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z') ON DUPLICATE KEY UPDATE b = CONCAT(b,b); -SELECT * FROM t1; +SELECT a,b FROM t1; a b 0 1 aa diff --git a/mysql-test/suite/storage_engine/insert_with_keys.test b/mysql-test/suite/storage_engine/insert_with_keys.test index 1959b55c707..c44b6c712e0 100644 --- a/mysql-test/suite/storage_engine/insert_with_keys.test +++ b/mysql-test/suite/storage_engine/insert_with_keys.test @@ -24,7 +24,7 @@ if (!$mysql_errname) INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z'); INSERT INTO t1 (a,b) VALUES (3,'a'),(0,''); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; DROP TABLE t1; } @@ -49,7 +49,7 @@ if (!$mysql_errname) --source check_errors.inc INSERT INTO t1 (a,b) VALUES (0,''); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z'); if ($mysql_errname) @@ -63,7 +63,7 @@ if (!$mysql_errname) } --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; DROP TABLE t1; } @@ -86,12 +86,12 @@ if (!$mysql_errname) INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z'); --source check_errors.inc --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z'); INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z') ON DUPLICATE KEY UPDATE a = a+VALUES(a); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY INSERT INTO t1 (a,b) VALUES (101,'x'),(101,'x'); @@ -120,7 +120,7 @@ if (!$mysql_errname) --source check_errors.inc INSERT INTO t1 (a,b) VALUES (0,''); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z'); if ($mysql_errname) @@ -134,7 +134,7 @@ if (!$mysql_errname) --source unexpected_result.inc } --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; DROP TABLE t1; } diff --git a/mysql-test/suite/storage_engine/loaddata.result b/mysql-test/suite/storage_engine/loaddata.result index 85608cdc32a..2b25435fa7a 100644 --- a/mysql-test/suite/storage_engine/loaddata.result +++ b/mysql-test/suite/storage_engine/loaddata.result @@ -1,8 +1,8 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; LOAD DATA INFILE '<DATADIR>/se_loaddata.dat' INTO TABLE t1 -FIELDS TERMINATED BY ','; -SELECT * FROM t1; +FIELDS TERMINATED BY ',' (a,b); +SELECT a,b FROM t1; a b 1 foo 2 bar @@ -10,8 +10,8 @@ a b 4 abc LOAD DATA LOCAL INFILE '<DATADIR>/se_loaddata.dat' INTO TABLE t1 CHARACTER SET utf8 COLUMNS TERMINATED BY ',' - ESCAPED BY '/'; -SELECT * FROM t1; + ESCAPED BY '/' (a,b); +SELECT a,b FROM t1; a b 1 foo 1 foo @@ -21,46 +21,66 @@ a b 3 4 abc 4 abc +LOAD DATA LOCAL INFILE '<DATADIR>/se_loaddata.dat' INTO TABLE t1 +FIELDS TERMINATED BY ';' + (a) SET b='loaded'; +Warnings: +Warning 1262 Row 1 was truncated; it contained more data than there were input columns +Warning 1262 Row 2 was truncated; it contained more data than there were input columns +Warning 1262 Row 3 was truncated; it contained more data than there were input columns +SELECT a,b FROM t1; +a b +0 loaded +1 foo +1 foo +102 loaded +2 bar +2 bar +3 +3 +4 abc +4 abc +5 loaded LOAD DATA INFILE '<DATADIR>/se_loaddata.dat' INTO TABLE t1 FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '''' LINES STARTING BY 'prefix:' -IGNORE 2 LINES -(a,b); +IGNORE 2 LINES (a,b); Warnings: Warning 1262 Row 2 was truncated; it contained more data than there were input columns -SELECT * FROM t1; +SELECT a,b FROM t1; a b 0 +0 loaded 1 foo 1 foo 100 foo +102 loaded 2 bar 2 bar 3 3 4 abc 4 abc +5 loaded 7 test -LOAD DATA LOCAL INFILE '<DATADIR>/se_loaddata.dat' INTO TABLE t1 -FIELDS TERMINATED BY ';' - (a) SET b='loaded'; -Warnings: -Warning 1262 Row 1 was truncated; it contained more data than there were input columns -Warning 1262 Row 2 was truncated; it contained more data than there were input columns -Warning 1262 Row 3 was truncated; it contained more data than there were input columns -SELECT * FROM t1; +LOAD DATA INFILE '<DATADIR>/se_loaddata.dat' INTO TABLE t1; +SELECT a,b FROM t1; a b 0 0 loaded 1 foo 1 foo +1 foo 100 foo 102 loaded 2 bar 2 bar +2 bar 3 3 +3 +4 abc 4 abc 4 abc 5 loaded diff --git a/mysql-test/suite/storage_engine/loaddata.test b/mysql-test/suite/storage_engine/loaddata.test index c413184af00..5a708626c74 100644 --- a/mysql-test/suite/storage_engine/loaddata.test +++ b/mysql-test/suite/storage_engine/loaddata.test @@ -22,23 +22,40 @@ EOF --replace_result $datadir <DATADIR> eval LOAD DATA INFILE '$datadir/se_loaddata.dat' INTO TABLE t1 - FIELDS TERMINATED BY ','; + FIELDS TERMINATED BY ',' (a,b); if ($mysql_errname) { --source unexpected_result.inc + --remove_file $datadir/se_loaddata.dat } if (!$mysql_errname) { --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; --replace_result $datadir <DATADIR> eval LOAD DATA LOCAL INFILE '$datadir/se_loaddata.dat' INTO TABLE t1 CHARACTER SET utf8 COLUMNS TERMINATED BY ',' - ESCAPED BY '/'; + ESCAPED BY '/' (a,b); + --sorted_result + SELECT a,b FROM t1; + + --remove_file $datadir/se_loaddata.dat + --write_file $datadir/se_loaddata.dat +5;YYY; +102;'zzz'; +0;'test'; +EOF + + --replace_result $datadir <DATADIR> + eval + LOAD DATA LOCAL INFILE '$datadir/se_loaddata.dat' INTO TABLE t1 + FIELDS TERMINATED BY ';' + (a) SET b='loaded'; + --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; --remove_file $datadir/se_loaddata.dat --write_file $datadir/se_loaddata.dat @@ -57,31 +74,30 @@ EOF FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '''' LINES STARTING BY 'prefix:' - IGNORE 2 LINES - (a,b); + IGNORE 2 LINES (a,b); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; --remove_file $datadir/se_loaddata.dat --write_file $datadir/se_loaddata.dat -5;YYY; -102;'zzz'; -0;'test'; +1 foo +2 bar +3 +4 abc EOF --replace_result $datadir <DATADIR> eval - LOAD DATA LOCAL INFILE '$datadir/se_loaddata.dat' INTO TABLE t1 - FIELDS TERMINATED BY ';' - (a) SET b='loaded'; - + LOAD DATA INFILE '$datadir/se_loaddata.dat' INTO TABLE t1; --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; + + --remove_file $datadir/se_loaddata.dat + } # Cleanup ---remove_file $datadir/se_loaddata.dat DROP TABLE t1; --source cleanup_engine.inc diff --git a/mysql-test/suite/storage_engine/lock.result b/mysql-test/suite/storage_engine/lock.result index 73573381110..f20548da12b 100644 --- a/mysql-test/suite/storage_engine/lock.result +++ b/mysql-test/suite/storage_engine/lock.result @@ -12,7 +12,7 @@ id2 COUNT(DISTINCT id) 3 1 UPDATE t1 SET id=-1 WHERE id=1; connection con1; -SELECT * FROM t1; +SELECT id,id2 FROM t1; ERROR HY000: Lock wait timeout exceeded; try restarting transaction LOCK TABLE t1 READ; ERROR HY000: Lock wait timeout exceeded; try restarting transaction @@ -38,7 +38,7 @@ DROP TABLE IF EXISTS t2; UNLOCK TABLES; CREATE TABLE t2 (id <INT_COLUMN>, id2 <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; LOCK TABLE t1 WRITE, t2 WRITE; -INSERT INTO t2 SELECT * FROM t1; +INSERT INTO t2 (id,id2) SELECT id,id2 FROM t1; UPDATE t1 SET id=1 WHERE id=-1; DROP TABLE t1,t2; CREATE TABLE t1 (i1 <INT_COLUMN>, nr <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; @@ -105,7 +105,7 @@ LOCK TABLE t1 WRITE, t2 WRITE; CREATE TEMPORARY TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; FLUSH TABLE t1; DROP TEMPORARY TABLE t1; -SELECT * FROM t1; +SELECT a,b FROM t1; a b UNLOCK TABLES; DROP TABLE t1, t2; diff --git a/mysql-test/suite/storage_engine/lock.test b/mysql-test/suite/storage_engine/lock.test index 16872bdaa7d..7335f8d1d39 100644 --- a/mysql-test/suite/storage_engine/lock.test +++ b/mysql-test/suite/storage_engine/lock.test @@ -43,7 +43,7 @@ connection con1; # With WRITE lock held by connection 'default', # nobody else can access the table --let $error_codes = ER_LOCK_WAIT_TIMEOUT -SELECT * FROM t1; +SELECT id,id2 FROM t1; --source check_errors.inc --let $error_codes = ER_LOCK_WAIT_TIMEOUT LOCK TABLE t1 READ; @@ -94,7 +94,7 @@ UNLOCK TABLES; --let $create_definition = id $int_col, id2 $int_col --source create_table.inc LOCK TABLE t1 WRITE, t2 WRITE; -INSERT INTO t2 SELECT * FROM t1; +INSERT INTO t2 (id,id2) SELECT id,id2 FROM t1; UPDATE t1 SET id=1 WHERE id=-1; if ($mysql_errname) { @@ -232,7 +232,7 @@ LOCK TABLE t1 WRITE, t2 WRITE; --source create_table.inc FLUSH TABLE t1; DROP TEMPORARY TABLE t1; -SELECT * FROM t1; +SELECT a,b FROM t1; UNLOCK TABLES; DROP TABLE t1, t2; diff --git a/mysql-test/suite/storage_engine/parts/repair_table.result b/mysql-test/suite/storage_engine/parts/repair_table.result index b156df6d7dc..8b08ee15fd0 100644 --- a/mysql-test/suite/storage_engine/parts/repair_table.result +++ b/mysql-test/suite/storage_engine/parts/repair_table.result @@ -10,7 +10,7 @@ INSERT INTO t2 (a,b) SELECT a, b FROM t1; ALTER TABLE t1 REPAIR PARTITION p0; Table Op Msg_type Msg_text test.t1 repair status OK -INSERT INTO t1 VALUES (3,'c'); +INSERT INTO t1 (a,b) VALUES (3,'c'); ALTER TABLE t1 REPAIR PARTITION NO_WRITE_TO_BINLOG p0, p1; Table Op Msg_type Msg_text test.t1 repair status OK @@ -22,7 +22,7 @@ INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h'); ALTER TABLE t1 REPAIR PARTITION LOCAL ALL EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK -INSERT INTO t1 VALUES (10,'j'); +INSERT INTO t1 (a,b) VALUES (10,'j'); ALTER TABLE t1 REPAIR PARTITION p1 QUICK USE_FRM; Table Op Msg_type Msg_text test.t1 repair status OK @@ -76,7 +76,7 @@ Table Op Msg_type Msg_text test.t1 check Error Failed to read from the .par file test.t1 check Error Incorrect information in file: './test/t1.frm' test.t1 check error Corrupt -SELECT * FROM t1; +SELECT a,b FROM t1; ERROR HY000: Failed to read from the .par file # Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY). # If you got a difference in error message, just add it to rdiff file @@ -118,7 +118,7 @@ Table Op Msg_type Msg_text test.t1 check error Size of datafile is: 26 Should be: 39 test.t1 check error Partition p0 returned error test.t1 check error Corrupt -SELECT * FROM t1; +SELECT a,b FROM t1; a b 8 h 10 j @@ -142,7 +142,7 @@ test.t1 check error Record-count is not ok; is 3 Should be: 2 test.t1 check warning Found 3 key parts. Should be: 2 test.t1 check error Partition p0 returned error test.t1 check error Corrupt -SELECT * FROM t1; +SELECT a,b FROM t1; a b 8 h 10 j @@ -166,7 +166,7 @@ Table Op Msg_type Msg_text test.t1 check error Size of datafile is: 39 Should be: 52 test.t1 check error Partition p1 returned error test.t1 check error Corrupt -SELECT * FROM t1; +SELECT a,b FROM t1; a b 8 h 10 j @@ -193,7 +193,7 @@ test.t1 check error Record-count is not ok; is 4 Should be: 3 test.t1 check warning Found 4 key parts. Should be: 3 test.t1 check error Partition p1 returned error test.t1 check error Corrupt -SELECT * FROM t1; +SELECT a,b FROM t1; a b 8 h 10 j @@ -218,7 +218,7 @@ Restoring <DATADIR>/test/t1.par CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK -SELECT * FROM t1; +SELECT a,b FROM t1; a b 8 h 10 j diff --git a/mysql-test/suite/storage_engine/parts/repair_table.test b/mysql-test/suite/storage_engine/parts/repair_table.test index f77b2ef8de4..06be8de1f56 100644 --- a/mysql-test/suite/storage_engine/parts/repair_table.test +++ b/mysql-test/suite/storage_engine/parts/repair_table.test @@ -35,7 +35,7 @@ if (!$mysql_errname) let $alter_definition = REPAIR PARTITION p0; --source ../alter_table.inc - INSERT INTO t1 VALUES (3,'c'); + INSERT INTO t1 (a,b) VALUES (3,'c'); let $alter_definition = REPAIR PARTITION NO_WRITE_TO_BINLOG p0, p1; --source ../alter_table.inc @@ -57,7 +57,7 @@ if (!$mysql_errname) let $alter_definition = REPAIR PARTITION LOCAL ALL EXTENDED; --source ../alter_table.inc - INSERT INTO t1 VALUES (10,'j'); + INSERT INTO t1 (a,b) VALUES (10,'j'); let $alter_definition = REPAIR PARTITION p1 QUICK USE_FRM; --source ../alter_table.inc diff --git a/mysql-test/suite/storage_engine/parts/truncate_table.result b/mysql-test/suite/storage_engine/parts/truncate_table.result index e46f4c97de5..e3b18d57989 100644 --- a/mysql-test/suite/storage_engine/parts/truncate_table.result +++ b/mysql-test/suite/storage_engine/parts/truncate_table.result @@ -3,7 +3,7 @@ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTO TRUNCATE TABLE t1; INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c'); TRUNCATE TABLE t1; -SELECT * FROM t1; +SELECT a,b FROM t1; a b DROP TABLE t1; CREATE TABLE t1 (a <INT_COLUMN> KEY AUTO_INCREMENT, c <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; @@ -46,23 +46,23 @@ t1 CREATE TABLE `t1` ( ) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (a) PARTITIONS 2 */ -SELECT * FROM t1; +SELECT a,c FROM t1; a c 1 d DROP TABLE t1; CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g'); ALTER TABLE t1 TRUNCATE PARTITION p0; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 101 g 3 c -EXPLAIN PARTITIONS SELECT * FROM t1; +EXPLAIN PARTITIONS SELECT a,b FROM t1; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0,p1 # # # # # # INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c'); ALTER TABLE t1 TRUNCATE PARTITION ALL; -SELECT * FROM t1; +SELECT a,b FROM t1; a b DROP TABLE t1; diff --git a/mysql-test/suite/storage_engine/parts/truncate_table.test b/mysql-test/suite/storage_engine/parts/truncate_table.test index 20f316d5297..9d921f013f4 100644 --- a/mysql-test/suite/storage_engine/parts/truncate_table.test +++ b/mysql-test/suite/storage_engine/parts/truncate_table.test @@ -33,7 +33,7 @@ if (!$mysql_errname) INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c'); TRUNCATE TABLE t1; - SELECT * FROM t1; + SELECT a,b FROM t1; DROP TABLE t1; } @@ -64,7 +64,7 @@ if (!$mysql_errname) INSERT INTO t1 (c) VALUES ('d'); --source ../mask_engine.inc SHOW CREATE TABLE t1; - SELECT * FROM t1; + SELECT a,c FROM t1; DROP TABLE t1; } @@ -93,16 +93,16 @@ if (!$mysql_errname) } --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; --replace_column 5 # 6 # 7 # 8 # 9 # 10 # - EXPLAIN PARTITIONS SELECT * FROM t1; + EXPLAIN PARTITIONS SELECT a,b FROM t1; INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c'); let $alter_definition = TRUNCATE PARTITION ALL; --source ../alter_table.inc - SELECT * FROM t1; + SELECT a,b FROM t1; DROP TABLE t1; } diff --git a/mysql-test/suite/storage_engine/repair_table.inc b/mysql-test/suite/storage_engine/repair_table.inc index 83d2f02e20a..be3e5ba35c2 100644 --- a/mysql-test/suite/storage_engine/repair_table.inc +++ b/mysql-test/suite/storage_engine/repair_table.inc @@ -64,7 +64,7 @@ INSERT INTO t1 (a,b) VALUES (14,'n'); --source check_errors.inc CHECK TABLE t1; --let $error_codes = 0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY -SELECT * FROM t1; +SELECT a,b FROM t1; --source check_errors.inc --enable_warnings REPAIR TABLE t1; @@ -143,7 +143,7 @@ if ($have_default_index) EOF CHECK TABLE t1; --let $error_codes = 0,ER_NOT_KEYFILE,144 - SELECT * FROM t1; + SELECT a,b FROM t1; --source check_errors.inc } } diff --git a/mysql-test/suite/storage_engine/repair_table.result b/mysql-test/suite/storage_engine/repair_table.result index f1af943fd7b..a20b9be3ba1 100644 --- a/mysql-test/suite/storage_engine/repair_table.result +++ b/mysql-test/suite/storage_engine/repair_table.result @@ -46,7 +46,7 @@ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check Error Incorrect file format 't1' test.t1 check error Corrupt -SELECT * FROM t1; +SELECT a,b FROM t1; ERROR HY000: Incorrect file format 't1' # Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY). # If you got a difference in error message, just add it to rdiff file @@ -84,7 +84,7 @@ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check error Size of datafile is: 39 Should be: 65 test.t1 check error Corrupt -SELECT * FROM t1; +SELECT a,b FROM t1; ERROR HY000: Incorrect key file for table 't1'; try to repair it # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144). # If you got a difference in error message, just add it to rdiff file @@ -99,7 +99,7 @@ Table Op Msg_type Msg_text test.t1 check warning Table is marked as crashed and last repair failed test.t1 check error Size of datafile is: 39 Should be: 65 test.t1 check error Corrupt -SELECT * FROM t1; +SELECT a,b FROM t1; ERROR HY000: Table './test/t1' is marked as crashed and last (automatic?) repair failed # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144). # If you got a difference in error message, just add it to rdiff file diff --git a/mysql-test/suite/storage_engine/replace.result b/mysql-test/suite/storage_engine/replace.result index c8fbca8f534..85988c740b2 100644 --- a/mysql-test/suite/storage_engine/replace.result +++ b/mysql-test/suite/storage_engine/replace.result @@ -1,7 +1,7 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; REPLACE INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'); -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 2 b @@ -9,7 +9,7 @@ a b 4 d 5 e REPLACE t1 (a,b) VALUE (10,'foo'),(10,'foo'); -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 10 foo @@ -26,7 +26,7 @@ ERROR 23000: Duplicate entry '2' for key 'a' # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). # If you got a difference in error message, just add it to rdiff file REPLACE INTO t1 (a,b) VALUES (2,'d'); -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 2 d @@ -39,7 +39,7 @@ ERROR 23000: Duplicate entry 'b' for key 'PRIMARY' # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). # If you got a difference in error message, just add it to rdiff file REPLACE INTO t1 (a,b) VALUES (4,'b'); -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 3 c diff --git a/mysql-test/suite/storage_engine/replace.test b/mysql-test/suite/storage_engine/replace.test index 368ed62a300..0a00734abec 100644 --- a/mysql-test/suite/storage_engine/replace.test +++ b/mysql-test/suite/storage_engine/replace.test @@ -13,11 +13,11 @@ DROP TABLE IF EXISTS t1; REPLACE INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'); --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; REPLACE t1 (a,b) VALUE (10,'foo'),(10,'foo'); --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; DROP TABLE t1; @@ -37,7 +37,7 @@ if (!$mysql_errname) --source check_errors.inc REPLACE INTO t1 (a,b) VALUES (2,'d'); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; DROP TABLE t1; } @@ -58,7 +58,7 @@ if (!$mysql_errname) --source check_errors.inc REPLACE INTO t1 (a,b) VALUES (4,'b'); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; DROP TABLE t1; } diff --git a/mysql-test/suite/storage_engine/select.result b/mysql-test/suite/storage_engine/select.result index d2331f4d869..015ed80b771 100644 --- a/mysql-test/suite/storage_engine/select.result +++ b/mysql-test/suite/storage_engine/select.result @@ -144,7 +144,7 @@ a b a b 200 bar 200 bar 200 bar 200 bar 200 bar 200 bar -SELECT alias1.* FROM ( SELECT * FROM t1 ) alias1, t2 WHERE t2.a IN (100,200); +SELECT alias1.* FROM ( SELECT a,b FROM t1 ) alias1, t2 WHERE t2.a IN (100,200); a b 1 z 1 z @@ -233,7 +233,7 @@ SUM(t2.a) SELECT MIN(t2.a) FROM t1 RIGHT OUTER JOIN t2 USING (b,a); MIN(t2.a) 1 -SELECT alias.b FROM t1 NATURAL JOIN ( SELECT * FROM t1 ) alias WHERE b > ''; +SELECT alias.b FROM t1 NATURAL JOIN ( SELECT a,b FROM t1 ) alias WHERE b > ''; b bar bar @@ -247,7 +247,7 @@ z z z z -SELECT t2.b FROM ( SELECT * FROM t1 ) alias NATURAL LEFT JOIN t2 WHERE b IS NOT NULL; +SELECT t2.b FROM ( SELECT a,b FROM t1 ) alias NATURAL LEFT JOIN t2 WHERE b IS NOT NULL; b bar bar @@ -306,15 +306,15 @@ z z z z -SELECT ( SELECT MIN(a) FROM ( SELECT * FROM t1 ) alias1 ) AS min_a FROM t2; +SELECT ( SELECT MIN(a) FROM ( SELECT a,b FROM t1 ) alias1 ) AS min_a FROM t2; min_a 1 1 1 -SELECT * FROM t2 WHERE a = ( SELECT MIN(a) FROM t1 ); +SELECT a,b FROM t2 WHERE a = ( SELECT MIN(a) FROM t1 ); a b 1 z -SELECT * FROM t2 WHERE b LIKE ( SELECT b FROM t1 ORDER BY b LIMIT 1 ); +SELECT a,b FROM t2 WHERE b LIKE ( SELECT b FROM t1 ORDER BY b LIMIT 1 ); a b 200 bar SELECT t2.* FROM t1 t1_outer, t2 WHERE ( t1_outer.a, t2.b ) IN ( SELECT a, b FROM t2 WHERE a = t1_outer.a ); @@ -325,19 +325,19 @@ a b 100 foobar 200 bar 200 bar -SELECT * FROM t2 WHERE b = ANY ( SELECT b FROM t1 WHERE a > 1 ); +SELECT a,b FROM t2 WHERE b = ANY ( SELECT b FROM t1 WHERE a > 1 ); a b 100 foobar 200 bar -SELECT * FROM t2 WHERE b > ALL ( SELECT b FROM t1 WHERE b < 'foo' ); +SELECT a,b FROM t2 WHERE b > ALL ( SELECT b FROM t1 WHERE b < 'foo' ); a b 1 z 100 foobar -SELECT * FROM t1 WHERE ROW(a, b) = ( SELECT a, b FROM t2 ORDER BY a, b LIMIT 1 ); +SELECT a,b FROM t1 WHERE ROW(a, b) = ( SELECT a, b FROM t2 ORDER BY a, b LIMIT 1 ); a b 1 z 1 z -SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t2 WHERE t2.b > t1.b ); +SELECT a,b FROM t1 WHERE EXISTS ( SELECT a,b FROM t2 WHERE t2.b > t1.b ); a b 100 foobar 100 foobar @@ -371,12 +371,12 @@ a b 100 foobar 200 bar 200 bar -SELECT * FROM t1 UNION SELECT * FROM t2 UNION DISTINCT SELECT * FROM t1; +SELECT a,b FROM t1 UNION SELECT a,b FROM t2 UNION DISTINCT SELECT a,b FROM t1; a b 1 z 100 foobar 200 bar -SELECT * FROM t1 UNION SELECT * FROM t2 UNION ALL SELECT * FROM t1; +SELECT a,b FROM t1 UNION SELECT a,b FROM t2 UNION ALL SELECT a,b FROM t1; a b 1 z 1 z diff --git a/mysql-test/suite/storage_engine/select.test b/mysql-test/suite/storage_engine/select.test index 528fa64cfb2..34cfd99d344 100644 --- a/mysql-test/suite/storage_engine/select.test +++ b/mysql-test/suite/storage_engine/select.test @@ -108,7 +108,7 @@ SELECT t1_1.*, t2.* FROM t2, t1 AS t1_1, t1 AS t1_2 WHERE t1_1.a = t1_2.a AND t2.a = t1_1.a; --sorted_result -SELECT alias1.* FROM ( SELECT * FROM t1 ) alias1, t2 WHERE t2.a IN (100,200); +SELECT alias1.* FROM ( SELECT a,b FROM t1 ) alias1, t2 WHERE t2.a IN (100,200); --sorted_result SELECT t1.a FROM { OJ t1 LEFT OUTER JOIN t2 ON t1.a = t2.a+10 }; @@ -134,10 +134,10 @@ SELECT SUM(t2.a) FROM t1 RIGHT JOIN t2 ON t2.b = t1.b; SELECT MIN(t2.a) FROM t1 RIGHT OUTER JOIN t2 USING (b,a); --sorted_result -SELECT alias.b FROM t1 NATURAL JOIN ( SELECT * FROM t1 ) alias WHERE b > ''; +SELECT alias.b FROM t1 NATURAL JOIN ( SELECT a,b FROM t1 ) alias WHERE b > ''; --sorted_result -SELECT t2.b FROM ( SELECT * FROM t1 ) alias NATURAL LEFT JOIN t2 WHERE b IS NOT NULL; +SELECT t2.b FROM ( SELECT a,b FROM t1 ) alias NATURAL LEFT JOIN t2 WHERE b IS NOT NULL; --sorted_result SELECT t1.*, t2.* FROM t1 NATURAL LEFT OUTER JOIN t2; @@ -151,15 +151,15 @@ SELECT t1_2.b FROM t1 t1_1 NATURAL RIGHT OUTER JOIN t1 t1_2 INNER JOIN t2; # Subquery as scalar operand, subquery in the FROM clause --sorted_result -SELECT ( SELECT MIN(a) FROM ( SELECT * FROM t1 ) alias1 ) AS min_a FROM t2; +SELECT ( SELECT MIN(a) FROM ( SELECT a,b FROM t1 ) alias1 ) AS min_a FROM t2; # Comparison using subqueries --sorted_result -SELECT * FROM t2 WHERE a = ( SELECT MIN(a) FROM t1 ); +SELECT a,b FROM t2 WHERE a = ( SELECT MIN(a) FROM t1 ); --sorted_result -SELECT * FROM t2 WHERE b LIKE ( SELECT b FROM t1 ORDER BY b LIMIT 1 ); +SELECT a,b FROM t2 WHERE b LIKE ( SELECT b FROM t1 ORDER BY b LIMIT 1 ); # Subquery with IN, correlated subquery @@ -169,20 +169,20 @@ SELECT t2.* FROM t1 t1_outer, t2 WHERE ( t1_outer.a, t2.b ) IN ( SELECT a, b FRO # Subquery with ANY, ALL --sorted_result -SELECT * FROM t2 WHERE b = ANY ( SELECT b FROM t1 WHERE a > 1 ); +SELECT a,b FROM t2 WHERE b = ANY ( SELECT b FROM t1 WHERE a > 1 ); --sorted_result -SELECT * FROM t2 WHERE b > ALL ( SELECT b FROM t1 WHERE b < 'foo' ); +SELECT a,b FROM t2 WHERE b > ALL ( SELECT b FROM t1 WHERE b < 'foo' ); # Row subqueries --sorted_result -SELECT * FROM t1 WHERE ROW(a, b) = ( SELECT a, b FROM t2 ORDER BY a, b LIMIT 1 ); +SELECT a,b FROM t1 WHERE ROW(a, b) = ( SELECT a, b FROM t2 ORDER BY a, b LIMIT 1 ); # Subquery with EXISTS --sorted_result -SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t2 WHERE t2.b > t1.b ); +SELECT a,b FROM t1 WHERE EXISTS ( SELECT a,b FROM t2 WHERE t2.b > t1.b ); # Subquery in ORDER BY @@ -197,10 +197,10 @@ SELECT a, b FROM t1 HAVING a IN ( SELECT a FROM t2 WHERE b = t1.b ); # Union --sorted_result -SELECT * FROM t1 UNION SELECT * FROM t2 UNION DISTINCT SELECT * FROM t1; +SELECT a,b FROM t1 UNION SELECT a,b FROM t2 UNION DISTINCT SELECT a,b FROM t1; --sorted_result -SELECT * FROM t1 UNION SELECT * FROM t2 UNION ALL SELECT * FROM t1; +SELECT a,b FROM t1 UNION SELECT a,b FROM t2 UNION ALL SELECT a,b FROM t1; # Cleanup diff --git a/mysql-test/suite/storage_engine/select_high_prio.result b/mysql-test/suite/storage_engine/select_high_prio.result index b3b70df3731..10226ae0f39 100644 --- a/mysql-test/suite/storage_engine/select_high_prio.result +++ b/mysql-test/suite/storage_engine/select_high_prio.result @@ -12,7 +12,7 @@ LOCK TABLE t1 READ; connection con0; UPDATE t1 SET b = CONCAT(b,b); connection con2; -SELECT * FROM t1; +SELECT a,b FROM t1; connection con1; UNLOCK TABLES; connection con0; diff --git a/mysql-test/suite/storage_engine/select_high_prio.test b/mysql-test/suite/storage_engine/select_high_prio.test index 385752e8d4e..49cd91ebbfd 100644 --- a/mysql-test/suite/storage_engine/select_high_prio.test +++ b/mysql-test/suite/storage_engine/select_high_prio.test @@ -49,12 +49,12 @@ let $condition = LIKE 'Waiting for table%'; let $wait_timeout = 2; --source include/wait_show_condition.inc --send -SELECT * FROM t1; +SELECT a,b FROM t1; --connection con1 let $show_statement = SHOW PROCESSLIST; let $field = Info; -let $condition = = 'SELECT * FROM t1'; +let $condition = = 'SELECT a,b FROM t1'; let $wait_timeout = 2; --source include/wait_show_condition.inc if (!$found) diff --git a/mysql-test/suite/storage_engine/truncate_table.result b/mysql-test/suite/storage_engine/truncate_table.result index 0a774c4b8dd..d8dc5046442 100644 --- a/mysql-test/suite/storage_engine/truncate_table.result +++ b/mysql-test/suite/storage_engine/truncate_table.result @@ -3,7 +3,7 @@ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTO TRUNCATE TABLE t1; INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c'); TRUNCATE TABLE t1; -SELECT * FROM t1; +SELECT a,b FROM t1; a b DROP TABLE t1; CREATE TABLE t1 (a <INT_COLUMN> KEY AUTO_INCREMENT, c <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; @@ -22,7 +22,7 @@ INSERT INTO t1 (c) VALUES ('d'); SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment t1 # # # # # # # # # 2 # # # # # # # -SELECT * FROM t1; +SELECT a,c FROM t1; a c 1 d DROP TABLE t1; diff --git a/mysql-test/suite/storage_engine/truncate_table.test b/mysql-test/suite/storage_engine/truncate_table.test index c84fba143b7..a9277b39619 100644 --- a/mysql-test/suite/storage_engine/truncate_table.test +++ b/mysql-test/suite/storage_engine/truncate_table.test @@ -19,7 +19,7 @@ if (!$mysql_errname) { INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c'); TRUNCATE TABLE t1; - SELECT * FROM t1; + SELECT a,b FROM t1; } DROP TABLE t1; @@ -51,7 +51,7 @@ if (!$mysql_errname) --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # SHOW TABLE STATUS LIKE 't1'; - SELECT * FROM t1; + SELECT a,c FROM t1; DROP TABLE t1; } diff --git a/mysql-test/suite/storage_engine/trx/cons_snapshot_repeatable_read.result b/mysql-test/suite/storage_engine/trx/cons_snapshot_repeatable_read.result index a52f18fc623..3b0bdb3b560 100644 --- a/mysql-test/suite/storage_engine/trx/cons_snapshot_repeatable_read.result +++ b/mysql-test/suite/storage_engine/trx/cons_snapshot_repeatable_read.result @@ -9,7 +9,7 @@ connection con2; INSERT INTO t1 (a) VALUES (1); connection con1; # If consistent read works on this isolation level (REPEATABLE READ), the following SELECT should not return the value we inserted (1) -SELECT * FROM t1; +SELECT a FROM t1; a COMMIT; connection default; diff --git a/mysql-test/suite/storage_engine/trx/cons_snapshot_serializable.result b/mysql-test/suite/storage_engine/trx/cons_snapshot_serializable.result index 8d75ea075a2..691039e8d96 100644 --- a/mysql-test/suite/storage_engine/trx/cons_snapshot_serializable.result +++ b/mysql-test/suite/storage_engine/trx/cons_snapshot_serializable.result @@ -9,7 +9,7 @@ connection con2; INSERT INTO t1 (a) VALUES (1); connection con1; # If consistent read works on this isolation level (SERIALIZABLE), the following SELECT should not return the value we inserted (1) -SELECT * FROM t1; +SELECT a FROM t1; a COMMIT; connection default; diff --git a/mysql-test/suite/storage_engine/trx/consistent_snapshot.inc b/mysql-test/suite/storage_engine/trx/consistent_snapshot.inc index 8dc9d6c4bb1..7f0dfe04214 100644 --- a/mysql-test/suite/storage_engine/trx/consistent_snapshot.inc +++ b/mysql-test/suite/storage_engine/trx/consistent_snapshot.inc @@ -38,7 +38,7 @@ if ($mysql_errname) connection con1; --echo # If consistent read works on this isolation level ($trx_isolation), the following SELECT should not return the value we inserted (1) -SELECT * FROM t1; +SELECT a FROM t1; COMMIT; connection default; diff --git a/mysql-test/suite/storage_engine/trx/delete.result b/mysql-test/suite/storage_engine/trx/delete.result index 827877a7e30..14e5389dcfb 100644 --- a/mysql-test/suite/storage_engine/trx/delete.result +++ b/mysql-test/suite/storage_engine/trx/delete.result @@ -4,7 +4,7 @@ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'f'),(7,' INSERT INTO t1 (a,b) SELECT a, b FROM t1; BEGIN; DELETE FROM t1 WHERE b IN ('c'); -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 1 a @@ -24,7 +24,7 @@ a b 8 h DELETE FROM t1 WHERE a < 0 OR b = 'a'; COMMIT; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 10000 foobar 10000 foobar @@ -46,7 +46,7 @@ SAVEPOINT spt1; DELETE FROM t1; RELEASE SAVEPOINT spt1; ROLLBACK; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 10000 foobar 10000 foobar diff --git a/mysql-test/suite/storage_engine/trx/delete.test b/mysql-test/suite/storage_engine/trx/delete.test index 0898eebb49a..50da1f20153 100644 --- a/mysql-test/suite/storage_engine/trx/delete.test +++ b/mysql-test/suite/storage_engine/trx/delete.test @@ -22,11 +22,11 @@ if ($mysql_errname) --source ../unexpected_result.inc } --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; DELETE FROM t1 WHERE a < 0 OR b = 'a'; COMMIT; --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; BEGIN; DELETE FROM t1 WHERE a <= 4 ORDER BY b DESC LIMIT 1; @@ -35,7 +35,7 @@ DELETE FROM t1; RELEASE SAVEPOINT spt1; ROLLBACK; --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; BEGIN; DELETE FROM t1 WHERE a <= 4 ORDER BY b DESC LIMIT 1; diff --git a/mysql-test/suite/storage_engine/trx/insert.result b/mysql-test/suite/storage_engine/trx/insert.result index 986d63b2a07..1d8aca98687 100644 --- a/mysql-test/suite/storage_engine/trx/insert.result +++ b/mysql-test/suite/storage_engine/trx/insert.result @@ -4,7 +4,7 @@ BEGIN; INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(100,'foo'); INSERT t1 (a,b) VALUE (10,'foo'),(11,'abc'); COMMIT; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 10 foo @@ -21,7 +21,7 @@ INSERT INTO t1 (a,b) VALUES (DEFAULT,DEFAULT); RELEASE SAVEPOINT spt1; INSERT INTO t1 (a,b) VALUES (DEFAULT,DEFAULT); ROLLBACK; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 10 foo @@ -39,7 +39,7 @@ INSERT t1 SET b = DEFAULT; ROLLBACK TO SAVEPOINT spt1; INSERT INTO t1 (b,a) VALUES ('test1',10); COMMIT; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 10 NULL diff --git a/mysql-test/suite/storage_engine/trx/insert.test b/mysql-test/suite/storage_engine/trx/insert.test index c458f90b1bb..1a736584b03 100644 --- a/mysql-test/suite/storage_engine/trx/insert.test +++ b/mysql-test/suite/storage_engine/trx/insert.test @@ -15,7 +15,7 @@ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(100,'foo'); INSERT t1 (a,b) VALUE (10,'foo'),(11,'abc'); COMMIT; --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; BEGIN; INSERT INTO t1 (b,a) VALUES ('test',0); @@ -25,7 +25,7 @@ RELEASE SAVEPOINT spt1; INSERT INTO t1 (a,b) VALUES (DEFAULT,DEFAULT); ROLLBACK; --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; BEGIN; INSERT t1 (a) VALUE (10),(20); @@ -36,7 +36,7 @@ ROLLBACK TO SAVEPOINT spt1; INSERT INTO t1 (b,a) VALUES ('test1',10); COMMIT; --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; DROP TABLE t1; diff --git a/mysql-test/suite/storage_engine/trx/level_read_committed.result b/mysql-test/suite/storage_engine/trx/level_read_committed.result index 12c0c2f42a8..ce1b126dc1a 100644 --- a/mysql-test/suite/storage_engine/trx/level_read_committed.result +++ b/mysql-test/suite/storage_engine/trx/level_read_committed.result @@ -6,7 +6,7 @@ SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; connection con1; CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; START TRANSACTION; -SELECT * FROM t1; +SELECT a FROM t1; a connection con2; BEGIN; @@ -14,53 +14,53 @@ INSERT INTO t1 (a) VALUES(1); # WARNING: Statement ended with errno 0, errname ''. # If it differs from the result file, it might indicate a problem. connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a connection con2; INSERT INTO t1 (a) VALUES (2); # WARNING: Statement ended with errno 0, errname ''. # If it differs from the result file, it might indicate a problem. connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a INSERT INTO t1 (a) SELECT a+100 FROM t1; # WARNING: Statement ended with errno 0, errname ''. # If it differs from the result file, it might indicate a problem. -SELECT * FROM t1; +SELECT a FROM t1; a connection con2; -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 COMMIT; -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 INSERT INTO t1 (a) SELECT a+200 FROM t1; # WARNING: Statement ended with errno 0, errname ''. # If it differs from the result file, it might indicate a problem. -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 201 202 COMMIT; -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 201 202 connection con2; -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 @@ -81,7 +81,7 @@ connection con2; INSERT INTO t1 (a) VALUES (1); connection con1; # If consistent read works on this isolation level (READ COMMITTED), the following SELECT should not return the value we inserted (1) -SELECT * FROM t1; +SELECT a FROM t1; a 1 COMMIT; diff --git a/mysql-test/suite/storage_engine/trx/level_read_uncommitted.result b/mysql-test/suite/storage_engine/trx/level_read_uncommitted.result index 2bf93768b00..68fbe5632cb 100644 --- a/mysql-test/suite/storage_engine/trx/level_read_uncommitted.result +++ b/mysql-test/suite/storage_engine/trx/level_read_uncommitted.result @@ -6,7 +6,7 @@ SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; connection con1; CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; START TRANSACTION; -SELECT * FROM t1; +SELECT a FROM t1; a connection con2; BEGIN; @@ -14,7 +14,7 @@ INSERT INTO t1 (a) VALUES(1); # WARNING: Statement ended with errno 0, errname ''. # If it differs from the result file, it might indicate a problem. connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a 1 connection con2; @@ -22,35 +22,35 @@ INSERT INTO t1 (a) VALUES (2); # WARNING: Statement ended with errno 0, errname ''. # If it differs from the result file, it might indicate a problem. connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 INSERT INTO t1 (a) SELECT a+100 FROM t1; # WARNING: Statement ended with errno 0, errname ''. # If it differs from the result file, it might indicate a problem. -SELECT * FROM t1; +SELECT a FROM t1; a 1 101 102 2 connection con2; -SELECT * FROM t1; +SELECT a FROM t1; a 1 101 102 2 COMMIT; -SELECT * FROM t1; +SELECT a FROM t1; a 1 101 102 2 connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a 1 101 @@ -59,7 +59,7 @@ a INSERT INTO t1 (a) SELECT a+200 FROM t1; # WARNING: Statement ended with errno 0, errname ''. # If it differs from the result file, it might indicate a problem. -SELECT * FROM t1; +SELECT a FROM t1; a 1 101 @@ -70,7 +70,7 @@ a 301 302 COMMIT; -SELECT * FROM t1; +SELECT a FROM t1; a 1 101 @@ -81,7 +81,7 @@ a 301 302 connection con2; -SELECT * FROM t1; +SELECT a FROM t1; a 1 101 @@ -106,7 +106,7 @@ connection con2; INSERT INTO t1 (a) VALUES (1); connection con1; # If consistent read works on this isolation level (READ UNCOMMITTED), the following SELECT should not return the value we inserted (1) -SELECT * FROM t1; +SELECT a FROM t1; a 1 COMMIT; diff --git a/mysql-test/suite/storage_engine/trx/level_repeatable_read.result b/mysql-test/suite/storage_engine/trx/level_repeatable_read.result index 82324c16801..c828b18dba0 100644 --- a/mysql-test/suite/storage_engine/trx/level_repeatable_read.result +++ b/mysql-test/suite/storage_engine/trx/level_repeatable_read.result @@ -6,7 +6,7 @@ SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; connection con1; CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; START TRANSACTION; -SELECT * FROM t1; +SELECT a FROM t1; a connection con2; BEGIN; @@ -14,50 +14,50 @@ INSERT INTO t1 (a) VALUES(1); # WARNING: Statement ended with errno 0, errname ''. # If it differs from the result file, it might indicate a problem. connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a connection con2; INSERT INTO t1 (a) VALUES (2); # WARNING: Statement ended with errno 0, errname ''. # If it differs from the result file, it might indicate a problem. connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a INSERT INTO t1 (a) SELECT a+100 FROM t1; ERROR HY000: Lock wait timeout exceeded; try restarting transaction # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'. # If it differs from the result file, it might indicate a problem. -SELECT * FROM t1; +SELECT a FROM t1; a connection con2; -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 COMMIT; -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a INSERT INTO t1 (a) SELECT a+200 FROM t1; # WARNING: Statement ended with errno 0, errname ''. # If it differs from the result file, it might indicate a problem. -SELECT * FROM t1; +SELECT a FROM t1; a 201 202 COMMIT; -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 201 202 connection con2; -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 diff --git a/mysql-test/suite/storage_engine/trx/level_serializable.result b/mysql-test/suite/storage_engine/trx/level_serializable.result index 0f990dfbf77..3f57395fa37 100644 --- a/mysql-test/suite/storage_engine/trx/level_serializable.result +++ b/mysql-test/suite/storage_engine/trx/level_serializable.result @@ -6,7 +6,7 @@ SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; connection con1; CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; START TRANSACTION; -SELECT * FROM t1; +SELECT a FROM t1; a connection con2; BEGIN; @@ -15,7 +15,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'. # If it differs from the result file, it might indicate a problem. connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a connection con2; INSERT INTO t1 (a) VALUES (2); @@ -23,32 +23,32 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'. # If it differs from the result file, it might indicate a problem. connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a INSERT INTO t1 (a) SELECT a+100 FROM t1; # WARNING: Statement ended with errno 0, errname ''. # If it differs from the result file, it might indicate a problem. -SELECT * FROM t1; +SELECT a FROM t1; a connection con2; -SELECT * FROM t1; +SELECT a FROM t1; a COMMIT; -SELECT * FROM t1; +SELECT a FROM t1; a connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a INSERT INTO t1 (a) SELECT a+200 FROM t1; # WARNING: Statement ended with errno 0, errname ''. # If it differs from the result file, it might indicate a problem. -SELECT * FROM t1; +SELECT a FROM t1; a COMMIT; -SELECT * FROM t1; +SELECT a FROM t1; a connection con2; -SELECT * FROM t1; +SELECT a FROM t1; a connection default; disconnect con1; diff --git a/mysql-test/suite/storage_engine/trx/select_for_update.result b/mysql-test/suite/storage_engine/trx/select_for_update.result index 8b0de87de05..f5954489d91 100644 --- a/mysql-test/suite/storage_engine/trx/select_for_update.result +++ b/mysql-test/suite/storage_engine/trx/select_for_update.result @@ -3,23 +3,23 @@ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTO INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'a'); connect con1,localhost,root,,; BEGIN; -SELECT * FROM t1 WHERE b='a' FOR UPDATE; +SELECT a,b FROM t1 WHERE b='a' FOR UPDATE; a b 1 a 3 a connection default; SET lock_wait_timeout = 1; -SELECT * FROM t1 WHERE b='a'; +SELECT a,b FROM t1 WHERE b='a'; a b 1 a 3 a -SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE; +SELECT a,b FROM t1 WHERE b='a' LOCK IN SHARE MODE; ERROR HY000: Lock wait timeout exceeded; try restarting transaction UPDATE t1 SET b='c' WHERE b='a'; ERROR HY000: Lock wait timeout exceeded; try restarting transaction connection con1; COMMIT; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 2 b @@ -27,7 +27,7 @@ a b disconnect con1; connection default; UPDATE t1 SET b='c' WHERE b='a'; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 c 2 b diff --git a/mysql-test/suite/storage_engine/trx/select_for_update.test b/mysql-test/suite/storage_engine/trx/select_for_update.test index 93ccc1915df..2a7dee2d3f4 100644 --- a/mysql-test/suite/storage_engine/trx/select_for_update.test +++ b/mysql-test/suite/storage_engine/trx/select_for_update.test @@ -22,7 +22,7 @@ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'a'); --connect (con1,localhost,root,,) BEGIN; --sorted_result -SELECT * FROM t1 WHERE b='a' FOR UPDATE; +SELECT a,b FROM t1 WHERE b='a' FOR UPDATE; if ($mysql_errname) { --let $functionality = SELECT .. FOR UPDATE @@ -35,7 +35,7 @@ SET lock_wait_timeout = 1; # Should still be able to select --sorted_result -SELECT * FROM t1 WHERE b='a'; +SELECT a,b FROM t1 WHERE b='a'; if ($mysql_errname) { --let $functionality = SELECT .. FOR UPDATE or locking @@ -46,7 +46,7 @@ if ($mysql_errname) --sorted_result --let $error_codes = ER_LOCK_WAIT_TIMEOUT -SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE; +SELECT a,b FROM t1 WHERE b='a' LOCK IN SHARE MODE; --source ../check_errors.inc if ($mysql_errname != ER_LOCK_WAIT_TIMEOUT) { @@ -66,7 +66,7 @@ if ($mysql_errname != ER_LOCK_WAIT_TIMEOUT) --connection con1 COMMIT; --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; --disconnect con1 --connection default @@ -78,7 +78,7 @@ if ($mysql_errname) --source ../unexpected_result.inc } --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; DROP TABLE t1; diff --git a/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.result b/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.result index 00610a03bd8..3d668d721ae 100644 --- a/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.result +++ b/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.result @@ -3,17 +3,17 @@ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTO INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'a'); connect con1,localhost,root,,; BEGIN; -SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE; +SELECT a,b FROM t1 WHERE b='a' LOCK IN SHARE MODE; a b 1 a 3 a connection default; SET lock_wait_timeout = 1; -SELECT * FROM t1 WHERE b='a'; +SELECT a,b FROM t1 WHERE b='a'; a b 1 a 3 a -SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE; +SELECT a,b FROM t1 WHERE b='a' LOCK IN SHARE MODE; a b 1 a 3 a @@ -21,7 +21,7 @@ UPDATE t1 SET b='c' WHERE b='a'; ERROR HY000: Lock wait timeout exceeded; try restarting transaction connection con1; COMMIT; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 2 b @@ -29,7 +29,7 @@ a b disconnect con1; connection default; UPDATE t1 SET b='c' WHERE b='a'; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 c 2 b diff --git a/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.test b/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.test index a50c86403e9..4c03b44640b 100644 --- a/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.test +++ b/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.test @@ -22,7 +22,7 @@ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'a'); --connect (con1,localhost,root,,) BEGIN; --sorted_result -SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE; +SELECT a,b FROM t1 WHERE b='a' LOCK IN SHARE MODE; if ($mysql_errname) { --let $functionality = LOCK IN SHARE MODE @@ -35,14 +35,14 @@ SET lock_wait_timeout = 1; # Should still be able to select --sorted_result -SELECT * FROM t1 WHERE b='a'; +SELECT a,b FROM t1 WHERE b='a'; if ($mysql_errname) { --let $functionality = LOCK IN SHARE MODE --source ../unexpected_result.inc } --sorted_result -SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE; +SELECT a,b FROM t1 WHERE b='a' LOCK IN SHARE MODE; if ($mysql_errname) { --let $functionality = LOCK IN SHARE MODE @@ -61,7 +61,7 @@ if ($mysql_errname != ER_LOCK_WAIT_TIMEOUT) --connection con1 COMMIT; --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; --disconnect con1 --connection default @@ -73,7 +73,7 @@ if ($mysql_errname) --source ../unexpected_result.inc } --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; DROP TABLE t1; diff --git a/mysql-test/suite/storage_engine/trx/transaction_isolation.inc b/mysql-test/suite/storage_engine/trx/transaction_isolation.inc index c81071d99b6..9e07ff1b857 100644 --- a/mysql-test/suite/storage_engine/trx/transaction_isolation.inc +++ b/mysql-test/suite/storage_engine/trx/transaction_isolation.inc @@ -31,7 +31,7 @@ let $create_definition = a $int_col; START TRANSACTION; --sorted_result -SELECT * FROM t1; # First snapshot +SELECT a FROM t1; # First snapshot connection con2; @@ -42,7 +42,7 @@ INSERT INTO t1 (a) VALUES(1); connection con1; --sorted_result -SELECT * FROM t1; # Second snapshot +SELECT a FROM t1; # Second snapshot connection con2; --let $error_codes = 0,ER_LOCK_WAIT_TIMEOUT @@ -51,25 +51,25 @@ INSERT INTO t1 (a) VALUES (2); connection con1; --sorted_result -SELECT * FROM t1; # Third snapshot +SELECT a FROM t1; # Third snapshot --let $error_codes = 0,ER_LOCK_WAIT_TIMEOUT INSERT INTO t1 (a) SELECT a+100 FROM t1; --source ../strict_check_errors.inc --sorted_result -SELECT * FROM t1; +SELECT a FROM t1; connection con2; --sorted_result -SELECT * FROM t1; # Inside the transaction +SELECT a FROM t1; # Inside the transaction COMMIT; --sorted_result -SELECT * FROM t1; # Outside the transaction +SELECT a FROM t1; # Outside the transaction connection con1; --sorted_result -SELECT * FROM t1; # Inside the transaction +SELECT a FROM t1; # Inside the transaction # Note: INSERT .. SELECT might be tricky, for example for InnoDB # even with REPEATABLE-READ it works as if it is executed with READ COMMITTED. @@ -81,14 +81,14 @@ INSERT INTO t1 (a) SELECT a+200 FROM t1; --source ../strict_check_errors.inc --sorted_result -SELECT * FROM t1; +SELECT a FROM t1; COMMIT; --sorted_result -SELECT * FROM t1; # Outside the transaction +SELECT a FROM t1; # Outside the transaction connection con2; --sorted_result -SELECT * FROM t1; # After both transactions have committed +SELECT a FROM t1; # After both transactions have committed connection default; disconnect con1; diff --git a/mysql-test/suite/storage_engine/trx/update.result b/mysql-test/suite/storage_engine/trx/update.result index e609bfcbc23..968674619bd 100644 --- a/mysql-test/suite/storage_engine/trx/update.result +++ b/mysql-test/suite/storage_engine/trx/update.result @@ -6,7 +6,7 @@ BEGIN; UPDATE t1 SET a=a+100; UPDATE t1 SET a=a-50, b=DEFAULT WHERE a>100; COMMIT; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 10050 NULL 10050 NULL @@ -31,7 +31,7 @@ UPDATE t1 SET b = ''; ROLLBACK TO SAVEPOINT spt1; UPDATE t1 SET b = 'upd' WHERE a = 10050; COMMIT; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 10050 upd 10050 upd diff --git a/mysql-test/suite/storage_engine/trx/update.test b/mysql-test/suite/storage_engine/trx/update.test index df65e244528..245b7554477 100644 --- a/mysql-test/suite/storage_engine/trx/update.test +++ b/mysql-test/suite/storage_engine/trx/update.test @@ -26,7 +26,7 @@ if (!$mysql_errname) UPDATE t1 SET a=a-50, b=DEFAULT WHERE a>100; COMMIT; --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; BEGIN; UPDATE t1 SET b = 'update' WHERE a <= 4 ORDER BY a DESC, b ASC LIMIT 3; @@ -41,7 +41,7 @@ if (!$mysql_errname) UPDATE t1 SET b = 'upd' WHERE a = 10050; COMMIT; --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; } DROP TABLE t1; diff --git a/mysql-test/suite/storage_engine/trx/xa.result b/mysql-test/suite/storage_engine/trx/xa.result index 3e2cb43a11c..72017018e2a 100644 --- a/mysql-test/suite/storage_engine/trx/xa.result +++ b/mysql-test/suite/storage_engine/trx/xa.result @@ -7,18 +7,18 @@ connection con2; XA START 'xa1'; INSERT INTO t1 (a) VALUES (1); connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a connection con2; INSERT INTO t1 (a) VALUES (2); XA END 'xa1'; connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a connection con2; XA PREPARE 'xa1'; connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a connection con2; XA RECOVER; @@ -26,7 +26,7 @@ formatID gtrid_length bqual_length data 1 3 0 xa1 XA COMMIT 'xa1'; connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 @@ -34,7 +34,7 @@ connection con2; XA START 'xa2'; INSERT INTO t1 (a) VALUES (3); connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 @@ -42,14 +42,14 @@ connection con2; INSERT INTO t1 (a) VALUES (4); XA END 'xa2'; connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 connection con2; XA COMMIT 'xa2' ONE PHASE; connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 @@ -59,7 +59,7 @@ connection con2; XA START 'xa3'; INSERT INTO t1 (a) VALUES (5); connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 @@ -69,7 +69,7 @@ connection con2; INSERT INTO t1 (a) VALUES (6); XA END 'xa3'; connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 @@ -78,7 +78,7 @@ a connection con2; XA PREPARE 'xa3'; connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 @@ -87,7 +87,7 @@ a connection con2; XA ROLLBACK 'xa3'; connection con1; -SELECT * FROM t1; +SELECT a FROM t1; a 1 2 diff --git a/mysql-test/suite/storage_engine/trx/xa.test b/mysql-test/suite/storage_engine/trx/xa.test index c64ba7cd27b..17cae7eae76 100644 --- a/mysql-test/suite/storage_engine/trx/xa.test +++ b/mysql-test/suite/storage_engine/trx/xa.test @@ -30,7 +30,7 @@ INSERT INTO t1 (a) VALUES (1); --connection con1 --sorted_result -SELECT * FROM t1; +SELECT a FROM t1; --connection con2 INSERT INTO t1 (a) VALUES (2); @@ -38,14 +38,14 @@ XA END 'xa1'; --connection con1 --sorted_result -SELECT * FROM t1; +SELECT a FROM t1; --connection con2 XA PREPARE 'xa1'; --connection con1 --sorted_result -SELECT * FROM t1; +SELECT a FROM t1; --connection con2 XA RECOVER; @@ -53,7 +53,7 @@ XA COMMIT 'xa1'; --connection con1 --sorted_result -SELECT * FROM t1; +SELECT a FROM t1; # One-phase COMMIT @@ -63,7 +63,7 @@ INSERT INTO t1 (a) VALUES (3); --connection con1 --sorted_result -SELECT * FROM t1; +SELECT a FROM t1; --connection con2 INSERT INTO t1 (a) VALUES (4); @@ -71,14 +71,14 @@ XA END 'xa2'; --connection con1 --sorted_result -SELECT * FROM t1; +SELECT a FROM t1; --connection con2 XA COMMIT 'xa2' ONE PHASE; --connection con1 --sorted_result -SELECT * FROM t1; +SELECT a FROM t1; # Rollback @@ -88,7 +88,7 @@ INSERT INTO t1 (a) VALUES (5); --connection con1 --sorted_result -SELECT * FROM t1; +SELECT a FROM t1; --connection con2 INSERT INTO t1 (a) VALUES (6); @@ -96,21 +96,21 @@ XA END 'xa3'; --connection con1 --sorted_result -SELECT * FROM t1; +SELECT a FROM t1; --connection con2 XA PREPARE 'xa3'; --connection con1 --sorted_result -SELECT * FROM t1; +SELECT a FROM t1; --connection con2 XA ROLLBACK 'xa3'; --connection con1 --sorted_result -SELECT * FROM t1; +SELECT a FROM t1; DROP TABLE t1; diff --git a/mysql-test/suite/storage_engine/trx/xa_recovery.result b/mysql-test/suite/storage_engine/trx/xa_recovery.result index e14e9a0bf1a..a9208a6e9d3 100644 --- a/mysql-test/suite/storage_engine/trx/xa_recovery.result +++ b/mysql-test/suite/storage_engine/trx/xa_recovery.result @@ -22,7 +22,7 @@ formatID gtrid_length bqual_length data 1 3 0 xa2 XA ROLLBACK 'xa1'; XA COMMIT 'xa2'; -SELECT * FROM t1; +SELECT a FROM t1; a 3 4 diff --git a/mysql-test/suite/storage_engine/trx/xa_recovery.test b/mysql-test/suite/storage_engine/trx/xa_recovery.test index d7ac2e782d1..4dab66b77dd 100644 --- a/mysql-test/suite/storage_engine/trx/xa_recovery.test +++ b/mysql-test/suite/storage_engine/trx/xa_recovery.test @@ -64,7 +64,7 @@ EOF XA RECOVER; XA ROLLBACK 'xa1'; XA COMMIT 'xa2'; -SELECT * FROM t1; +SELECT a FROM t1; DROP TABLE t1; --source ../cleanup_engine.inc diff --git a/mysql-test/suite/storage_engine/type_binary.inc b/mysql-test/suite/storage_engine/type_binary.inc index 812a1cc9527..dbee1d57274 100644 --- a/mysql-test/suite/storage_engine/type_binary.inc +++ b/mysql-test/suite/storage_engine/type_binary.inc @@ -27,16 +27,16 @@ if (!$mysql_errname) # Valid values - INSERT INTO t1 VALUES ('','','','',''); - INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.'); + INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('','','','',''); + INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.'); --sorted_result SELECT HEX(b), HEX(b0), HEX(b1), HEX(b20), HEX(b255) FROM t1; # Invalid values - INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256)); - INSERT INTO t1 SELECT b255, b255, b255, b255, CONCAT(b255,b255) FROM t1; + INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256)); + INSERT INTO t1 (b,b0,b1,b20,b255) SELECT b255, b255, b255, b255, CONCAT(b255,b255) FROM t1; --sorted_result SELECT HEX(b), HEX(b0), HEX(b1), HEX(b20), HEX(b255) FROM t1; diff --git a/mysql-test/suite/storage_engine/type_binary.result b/mysql-test/suite/storage_engine/type_binary.result index 455dbb57a7e..8da8b04095b 100644 --- a/mysql-test/suite/storage_engine/type_binary.result +++ b/mysql-test/suite/storage_engine/type_binary.result @@ -12,20 +12,20 @@ b0 binary(0) # # # # b1 binary(1) # # # # b20 binary(20) # # # # b255 binary(255) # # # # -INSERT INTO t1 VALUES ('','','','',''); -INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.'); +INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('','','','',''); +INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.'); SELECT HEX(b), HEX(b0), HEX(b1), HEX(b20), HEX(b255) FROM t1; HEX(b) HEX(b0) HEX(b1) HEX(b20) HEX(b255) 00 00 0000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 61 62 616263646566676869206B6C6D6E6F7071727374 4372656174696E6720616E2061727469636C6520666F7220746865204B6E6F776C65646765626173652069732073696D696C617220746F2061736B696E67207175657374696F6E732E2046697273742C206E6176696761746520746F207468652063617465676F727920776865726520796F75206665656C207468652061727469636C652073686F756C642062652E204F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C726561647920657869737420776869636820776F756C6420776F726B2E00000000000000000000000000000000000000000000000000000000000000 -INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256)); +INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256)); Warnings: Warning 1265 Data truncated for column 'b' at row 1 Warning 1265 Data truncated for column 'b0' at row 1 Warning 1265 Data truncated for column 'b1' at row 1 Warning 1265 Data truncated for column 'b20' at row 1 Warning 1265 Data truncated for column 'b255' at row 1 -INSERT INTO t1 SELECT b255, b255, b255, b255, CONCAT(b255,b255) FROM t1; +INSERT INTO t1 (b,b0,b1,b20,b255) SELECT b255, b255, b255, b255, CONCAT(b255,b255) FROM t1; Warnings: Warning 1265 Data truncated for column 'b' at row 1 Warning 1265 Data truncated for column 'b0' at row 1 diff --git a/mysql-test/suite/storage_engine/type_binary_indexes.result b/mysql-test/suite/storage_engine/type_binary_indexes.result index 6f828aed100..96e0d6d601a 100644 --- a/mysql-test/suite/storage_engine/type_binary_indexes.result +++ b/mysql-test/suite/storage_engine/type_binary_indexes.result @@ -88,7 +88,7 @@ SHOW INDEX IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment t1 1 v16 1 v16 # # 10 NULL # # INSERT INTO t1 (b,b20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char3','varchar1a','varchar1b'),('c','char4','varchar3a','varchar3b'),('d','char5','varchar4a','varchar3b'),('e','char6','varchar2a','varchar3b'); -INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 (b,b20,v16,v128) SELECT b,b20,v16,v128 FROM t1; EXPLAIN SELECT HEX(SUBSTRING(v16,0,3)) FROM t1 WHERE v16 LIKE 'varchar%'; id select_type table type possible_keys key key_len ref rows Extra # # # # # NULL # # # # diff --git a/mysql-test/suite/storage_engine/type_binary_indexes.test b/mysql-test/suite/storage_engine/type_binary_indexes.test index 24b16aa5175..943593027f8 100644 --- a/mysql-test/suite/storage_engine/type_binary_indexes.test +++ b/mysql-test/suite/storage_engine/type_binary_indexes.test @@ -130,7 +130,7 @@ if (!$mysql_errname) SHOW INDEX IN t1; INSERT INTO t1 (b,b20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char3','varchar1a','varchar1b'),('c','char4','varchar3a','varchar3b'),('d','char5','varchar4a','varchar3b'),('e','char6','varchar2a','varchar3b'); - INSERT INTO t1 SELECT * FROM t1; + INSERT INTO t1 (b,b20,v16,v128) SELECT b,b20,v16,v128 FROM t1; --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 # EXPLAIN SELECT HEX(SUBSTRING(v16,0,3)) FROM t1 WHERE v16 LIKE 'varchar%'; diff --git a/mysql-test/suite/storage_engine/type_bit.inc b/mysql-test/suite/storage_engine/type_bit.inc index 1a232305e1c..eb7920f8d83 100644 --- a/mysql-test/suite/storage_engine/type_bit.inc +++ b/mysql-test/suite/storage_engine/type_bit.inc @@ -43,28 +43,28 @@ if (!$mysql_errname) SHOW COLUMNS IN t1; } - INSERT INTO t1 VALUES (0,POW(2,20)-1,b'1111111111111111111111111111111111111111111111111111111111111111',1); + INSERT INTO t1 (a,b,c,d) VALUES (0,POW(2,20)-1,b'1111111111111111111111111111111111111111111111111111111111111111',1); --sorted_result SELECT BIN(a), HEX(b), c+0 FROM t1 WHERE d>0; - INSERT INTO t1 VALUES (1,0,-1,0); + INSERT INTO t1 (a,b,c,d) VALUES (1,0,-1,0); --sorted_result SELECT a+0, b+0, c+0 FROM t1 WHERE d<100; - INSERT INTO t1 VALUES (b'1', 'f', 0xFF, 0x0); + INSERT INTO t1 (a,b,c,d) VALUES (b'1', 'f', 0xFF, 0x0); --sorted_result SELECT a+0, b+0, c+0 FROM t1 WHERE d IN (0, 2); # Out of range values # (should produce warnings) - INSERT INTO t1 VALUES (0x10,0,0,1); + INSERT INTO t1 (a,b,c,d) VALUES (0x10,0,0,1); --sorted_result - SELECT * FROM t1; + SELECT a,b,c,d FROM t1; - INSERT INTO t1 VALUES (0x01,0,0x10000000000000000,0); + INSERT INTO t1 (a,b,c,d) VALUES (0x01,0,0x10000000000000000,0); --sorted_result - SELECT * FROM t1; + SELECT a,b,c,d FROM t1; DROP TABLE t1; diff --git a/mysql-test/suite/storage_engine/type_bit.result b/mysql-test/suite/storage_engine/type_bit.result index 69b9ac53d76..3c88b297d8a 100644 --- a/mysql-test/suite/storage_engine/type_bit.result +++ b/mysql-test/suite/storage_engine/type_bit.result @@ -18,29 +18,29 @@ a bit(1) # # # b bit(20) # # # c bit(64) # # # d bit(1) # # # -INSERT INTO t1 VALUES (0,POW(2,20)-1,b'1111111111111111111111111111111111111111111111111111111111111111',1); +INSERT INTO t1 (a,b,c,d) VALUES (0,POW(2,20)-1,b'1111111111111111111111111111111111111111111111111111111111111111',1); SELECT BIN(a), HEX(b), c+0 FROM t1 WHERE d>0; BIN(a) HEX(b) c+0 0 FFFFF 18446744073709551615 -INSERT INTO t1 VALUES (1,0,-1,0); +INSERT INTO t1 (a,b,c,d) VALUES (1,0,-1,0); SELECT a+0, b+0, c+0 FROM t1 WHERE d<100; a+0 b+0 c+0 0 1048575 18446744073709551615 1 0 18446744073709551615 -INSERT INTO t1 VALUES (b'1', 'f', 0xFF, 0x0); +INSERT INTO t1 (a,b,c,d) VALUES (b'1', 'f', 0xFF, 0x0); SELECT a+0, b+0, c+0 FROM t1 WHERE d IN (0, 2); a+0 b+0 c+0 1 0 18446744073709551615 1 102 255 -INSERT INTO t1 VALUES (0x10,0,0,1); +INSERT INTO t1 (a,b,c,d) VALUES (0x10,0,0,1); Warnings: Warning 1264 Out of range value for column 'a' at row 1 -SELECT * FROM t1; +SELECT a,b,c,d FROM t1; a b c d -INSERT INTO t1 VALUES (0x01,0,0x10000000000000000,0); +INSERT INTO t1 (a,b,c,d) VALUES (0x01,0,0x10000000000000000,0); Warnings: Warning 1264 Out of range value for column 'c' at row 1 -SELECT * FROM t1; +SELECT a,b,c,d FROM t1; a b c d DROP TABLE t1; CREATE TABLE t1 (a BIT(65) <CUSTOM_COL_OPTIONS>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; diff --git a/mysql-test/suite/storage_engine/type_blob.inc b/mysql-test/suite/storage_engine/type_blob.inc index 93a52fc9971..626c556102e 100644 --- a/mysql-test/suite/storage_engine/type_blob.inc +++ b/mysql-test/suite/storage_engine/type_blob.inc @@ -33,7 +33,7 @@ if (!$mysql_errname) # Valid values # (cannot get MAX for all columns due to max_allowed_packet limitations) - INSERT INTO t1 VALUES + INSERT INTO t1 (b,b0,b1,b300,bm,b70k,b17m,t,m,l) VALUES ('','','','','','','','','',''), ('a','b','c','d','e','f','g','h','i','j'), ('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'), @@ -44,7 +44,7 @@ if (!$mysql_errname) # Invalid values (produce warnings, except for mediumblob and longblob columns for which the values are within limits) - INSERT INTO t1 VALUES + INSERT INTO t1 (b,b0,b1,b300,bm,b70k,b17m,t,m,l) VALUES ( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) ); --sorted_result diff --git a/mysql-test/suite/storage_engine/type_blob.result b/mysql-test/suite/storage_engine/type_blob.result index a93391f749a..9a9e14709e5 100644 --- a/mysql-test/suite/storage_engine/type_blob.result +++ b/mysql-test/suite/storage_engine/type_blob.result @@ -22,7 +22,7 @@ b17m longblob # # # t tinyblob # # # m mediumblob # # # l longblob # # # -INSERT INTO t1 VALUES +INSERT INTO t1 (b,b0,b1,b300,bm,b70k,b17m,t,m,l) VALUES ('','','','','','','','','',''), ('a','b','c','d','e','f','g','h','i','j'), ('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'), @@ -33,7 +33,7 @@ LENGTH(b) LENGTH(b0) LENGTH(b1) LENGTH(b300) LENGTH(bm) LENGTH(b70k) LENGTH(b17m 1 1 1 1 1 1 1 1 1 1 5 5 5 5 5 5 5 5 5 6 65535 65535 255 65535 65535 1048576 2097152 255 1048576 2097152 -INSERT INTO t1 VALUES +INSERT INTO t1 (b,b0,b1,b300,bm,b70k,b17m,t,m,l) VALUES ( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) ); Warnings: Warning 1265 Data truncated for column 'b' at row 1 diff --git a/mysql-test/suite/storage_engine/type_bool.inc b/mysql-test/suite/storage_engine/type_bool.inc index ae7d0043c49..b14f658c973 100644 --- a/mysql-test/suite/storage_engine/type_bool.inc +++ b/mysql-test/suite/storage_engine/type_bool.inc @@ -25,40 +25,40 @@ if (!$mysql_errname) # Valid values - INSERT INTO t1 VALUES (1,TRUE); + INSERT INTO t1 (b1,b2) VALUES (1,TRUE); --sorted_result - SELECT * FROM t1; + SELECT b1,b2 FROM t1; - INSERT INTO t1 VALUES (FALSE,0); + INSERT INTO t1 (b1,b2) VALUES (FALSE,0); --sorted_result - SELECT * FROM t1; + SELECT b1,b2 FROM t1; - INSERT INTO t1 VALUES (2,3); + INSERT INTO t1 (b1,b2) VALUES (2,3); --sorted_result - SELECT * FROM t1; + SELECT b1,b2 FROM t1; - INSERT INTO t1 VALUES (-1,-2); + INSERT INTO t1 (b1,b2) VALUES (-1,-2); --sorted_result - SELECT * FROM t1; + SELECT b1,b2 FROM t1; --sorted_result SELECT IF(b1,'true','false') AS a, IF(b2,'true','false') AS b FROM t1; --sorted_result - SELECT * FROM t1 WHERE b1 = TRUE; + SELECT b1,b2 FROM t1 WHERE b1 = TRUE; --sorted_result - SELECT * FROM t1 WHERE b2 = FALSE; + SELECT b1,b2 FROM t1 WHERE b2 = FALSE; # Invalid values - INSERT INTO t1 VALUES ('a','b'); + INSERT INTO t1 (b1,b2) VALUES ('a','b'); --sorted_result - SELECT * FROM t1; + SELECT b1,b2 FROM t1; - INSERT INTO t1 VALUES (128,-129); + INSERT INTO t1 (b1,b2) VALUES (128,-129); --sorted_result - SELECT * FROM t1; + SELECT b1,b2 FROM t1; # This is why we don't have zerofill and unsigned tests # for boolean columns: diff --git a/mysql-test/suite/storage_engine/type_bool.result b/mysql-test/suite/storage_engine/type_bool.result index 89beaa11a16..87308ed63fc 100644 --- a/mysql-test/suite/storage_engine/type_bool.result +++ b/mysql-test/suite/storage_engine/type_bool.result @@ -6,23 +6,23 @@ SHOW COLUMNS IN t1; Field Type Null Key Default Extra b1 tinyint(1) # # # b2 tinyint(1) # # # -INSERT INTO t1 VALUES (1,TRUE); -SELECT * FROM t1; +INSERT INTO t1 (b1,b2) VALUES (1,TRUE); +SELECT b1,b2 FROM t1; b1 b2 1 1 -INSERT INTO t1 VALUES (FALSE,0); -SELECT * FROM t1; +INSERT INTO t1 (b1,b2) VALUES (FALSE,0); +SELECT b1,b2 FROM t1; b1 b2 0 0 1 1 -INSERT INTO t1 VALUES (2,3); -SELECT * FROM t1; +INSERT INTO t1 (b1,b2) VALUES (2,3); +SELECT b1,b2 FROM t1; b1 b2 0 0 1 1 2 3 -INSERT INTO t1 VALUES (-1,-2); -SELECT * FROM t1; +INSERT INTO t1 (b1,b2) VALUES (-1,-2); +SELECT b1,b2 FROM t1; b1 b2 -1 -2 0 0 @@ -34,28 +34,28 @@ false false true true true true true true -SELECT * FROM t1 WHERE b1 = TRUE; +SELECT b1,b2 FROM t1 WHERE b1 = TRUE; b1 b2 1 1 -SELECT * FROM t1 WHERE b2 = FALSE; +SELECT b1,b2 FROM t1 WHERE b2 = FALSE; b1 b2 0 0 -INSERT INTO t1 VALUES ('a','b'); +INSERT INTO t1 (b1,b2) VALUES ('a','b'); Warnings: Warning 1366 Incorrect integer value: 'a' for column 'b1' at row 1 Warning 1366 Incorrect integer value: 'b' for column 'b2' at row 1 -SELECT * FROM t1; +SELECT b1,b2 FROM t1; b1 b2 -1 -2 0 0 0 0 1 1 2 3 -INSERT INTO t1 VALUES (128,-129); +INSERT INTO t1 (b1,b2) VALUES (128,-129); Warnings: Warning 1264 Out of range value for column 'b1' at row 1 Warning 1264 Out of range value for column 'b2' at row 1 -SELECT * FROM t1; +SELECT b1,b2 FROM t1; b1 b2 -1 -2 0 0 diff --git a/mysql-test/suite/storage_engine/type_char.inc b/mysql-test/suite/storage_engine/type_char.inc index 8484fc23b10..8e666299736 100644 --- a/mysql-test/suite/storage_engine/type_char.inc +++ b/mysql-test/suite/storage_engine/type_char.inc @@ -27,19 +27,19 @@ if (!$mysql_errname) # Valid values - INSERT INTO t1 VALUES ('','','','',''); - INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.'); + INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('','','','',''); + INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.'); --sorted_result - SELECT * FROM t1; + SELECT c,c0,c1,c20,c255 FROM t1; # Invalid values - INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256)); - INSERT INTO t1 SELECT c255, c255, c255, c255, CONCAT(c255,c1) FROM t1; + INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256)); + INSERT INTO t1 (c,c0,c1,c20,c255) SELECT c255, c255, c255, c255, CONCAT(c255,c1) FROM t1; --sorted_result - SELECT * FROM t1; + SELECT c,c0,c1,c20,c255 FROM t1; --sorted_result SELECT DISTINCT c20, REPEAT('a',LENGTH(c20)), COUNT(*) FROM t1 GROUP BY c1, c20; diff --git a/mysql-test/suite/storage_engine/type_char.result b/mysql-test/suite/storage_engine/type_char.result index 61d3cf2419d..ce6d6f11b19 100644 --- a/mysql-test/suite/storage_engine/type_char.result +++ b/mysql-test/suite/storage_engine/type_char.result @@ -12,20 +12,20 @@ c0 char(0) # # # c1 char(1) # # # c20 char(20) # # # c255 char(255) # # # -INSERT INTO t1 VALUES ('','','','',''); -INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.'); -SELECT * FROM t1; +INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('','','','',''); +INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.'); +SELECT c,c0,c1,c20,c255 FROM t1; c c0 c1 c20 c255 a b abcdefghi klmnopqrst Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn't already exist which would work. -INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256)); +INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256)); Warnings: Warning 1265 Data truncated for column 'c' at row 1 Warning 1265 Data truncated for column 'c0' at row 1 Warning 1265 Data truncated for column 'c1' at row 1 Warning 1265 Data truncated for column 'c20' at row 1 Warning 1265 Data truncated for column 'c255' at row 1 -INSERT INTO t1 SELECT c255, c255, c255, c255, CONCAT(c255,c1) FROM t1; +INSERT INTO t1 (c,c0,c1,c20,c255) SELECT c255, c255, c255, c255, CONCAT(c255,c1) FROM t1; Warnings: Warning 1265 Data truncated for column 'c' at row 2 Warning 1265 Data truncated for column 'c0' at row 2 @@ -36,7 +36,7 @@ Warning 1265 Data truncated for column 'c0' at row 3 Warning 1265 Data truncated for column 'c1' at row 3 Warning 1265 Data truncated for column 'c20' at row 3 Warning 1265 Data truncated for column 'c255' at row 3 -SELECT * FROM t1; +SELECT c,c0,c1,c20,c255 FROM t1; c c0 c1 c20 c255 diff --git a/mysql-test/suite/storage_engine/type_char_indexes.result b/mysql-test/suite/storage_engine/type_char_indexes.result index f02fcef3ef0..33594e2581f 100644 --- a/mysql-test/suite/storage_engine/type_char_indexes.result +++ b/mysql-test/suite/storage_engine/type_char_indexes.result @@ -96,10 +96,10 @@ varchar1b 2 varchar2b 1 varchar3b 1 SET SESSION optimizer_switch = 'engine_condition_pushdown=on'; -EXPLAIN SELECT * FROM t1 WHERE c > 'a'; +EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE c > 'a'; id select_type table type possible_keys key key_len ref rows Extra # # # range c_v c_v # # # Using index condition -SELECT * FROM t1 WHERE c > 'a'; +SELECT c,c20,v16,v128 FROM t1 WHERE c > 'a'; c c20 v16 v128 b char3 varchar1a varchar1b c char4 varchar3a varchar3b @@ -133,10 +133,10 @@ r1a r1a r2a r3a -EXPLAIN SELECT * FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16; +EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16; id select_type table type possible_keys key key_len ref rows Extra # # # range # v16 # # # # -SELECT * FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16; +SELECT c,c20,v16,v128 FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16; c c20 v16 v128 a char1 varchar1a varchar1b b char3 varchar1a varchar1b diff --git a/mysql-test/suite/storage_engine/type_char_indexes.test b/mysql-test/suite/storage_engine/type_char_indexes.test index 582800eabba..6fff8a6f73e 100644 --- a/mysql-test/suite/storage_engine/type_char_indexes.test +++ b/mysql-test/suite/storage_engine/type_char_indexes.test @@ -135,9 +135,9 @@ if (!$mysql_errname) SET SESSION optimizer_switch = 'engine_condition_pushdown=on'; --replace_column 1 # 2 # 3 # 7 # 8 # 9 # - EXPLAIN SELECT * FROM t1 WHERE c > 'a'; + EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE c > 'a'; --sorted_result - SELECT * FROM t1 WHERE c > 'a'; + SELECT c,c20,v16,v128 FROM t1 WHERE c > 'a'; SET SESSION optimizer_switch = @@global.optimizer_switch; DROP TABLE t1; @@ -175,9 +175,9 @@ if (!$mysql_errname) SELECT SUBSTRING(v16,7,3) FROM t1 IGNORE INDEX (v16) WHERE v16 LIKE 'varchar%'; --replace_column 1 # 2 # 3 # 5 # 7 # 8 # 9 # 10 # - EXPLAIN SELECT * FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16; + EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16; --sorted_result - SELECT * FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16; + SELECT c,c20,v16,v128 FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16; DROP TABLE t1; } diff --git a/mysql-test/suite/storage_engine/type_date_time.inc b/mysql-test/suite/storage_engine/type_date_time.inc index d0b953984be..29bfcf630f0 100644 --- a/mysql-test/suite/storage_engine/type_date_time.inc +++ b/mysql-test/suite/storage_engine/type_date_time.inc @@ -32,22 +32,22 @@ if (!$mysql_errname) # Valid values # '1970-01-01 00:00:01' - INSERT INTO t1 VALUES + INSERT INTO t1 (d,dt,ts,t,y,y4,y2) VALUES ('1000-01-01', '1000-01-01 00:00:00', FROM_UNIXTIME(1), '-838:59:59', '1901', '1901', '00'), ('9999-12-31', '9999-12-31 23:59:59', FROM_UNIXTIME(2147483647), '838:59:59', '2155', '2155', '99'), ('0000-00-00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '00:00:00', '0', '0', '0'), (DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm),YEAR(@tm),YEAR(@tm)); --sorted_result - SELECT * FROM t1; + SELECT d,dt,ts,t,y,y4,y2 FROM t1; # Invalid values - INSERT INTO t1 VALUES + INSERT INTO t1 (d,dt,ts,t,y,y4,y2) VALUES ('999-13-32', '999-11-31 00:00:00', '0', '-839:00:00', '1900', '1900', '-1' ); --sorted_result - SELECT * FROM t1; + SELECT d,dt,ts,t,y,y4,y2 FROM t1; DROP TABLE t1; } diff --git a/mysql-test/suite/storage_engine/type_date_time.result b/mysql-test/suite/storage_engine/type_date_time.result index 06b92d3149f..73c9a2ec7ed 100644 --- a/mysql-test/suite/storage_engine/type_date_time.result +++ b/mysql-test/suite/storage_engine/type_date_time.result @@ -19,18 +19,18 @@ y year(4) # # # y4 year(4) # # # y2 year(2) # # # SET @tm = '2012-04-09 05:27:00'; -INSERT INTO t1 VALUES +INSERT INTO t1 (d,dt,ts,t,y,y4,y2) VALUES ('1000-01-01', '1000-01-01 00:00:00', FROM_UNIXTIME(1), '-838:59:59', '1901', '1901', '00'), ('9999-12-31', '9999-12-31 23:59:59', FROM_UNIXTIME(2147483647), '838:59:59', '2155', '2155', '99'), ('0000-00-00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '00:00:00', '0', '0', '0'), (DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm),YEAR(@tm),YEAR(@tm)); -SELECT * FROM t1; +SELECT d,dt,ts,t,y,y4,y2 FROM t1; d dt ts t y y4 y2 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00 1000-01-01 1000-01-01 00:00:00 1970-01-01 03:00:01 -838:59:59 1901 1901 00 2012-04-09 2012-04-09 05:27:00 2012-04-09 05:27:00 05:27:00 2012 2012 12 9999-12-31 9999-12-31 23:59:59 2038-01-19 07:14:07 838:59:59 2155 2155 99 -INSERT INTO t1 VALUES +INSERT INTO t1 (d,dt,ts,t,y,y4,y2) VALUES ('999-13-32', '999-11-31 00:00:00', '0', '-839:00:00', '1900', '1900', '-1' ); Warnings: Warning 1265 Data truncated for column 'd' at row 1 @@ -40,7 +40,7 @@ Warning 1264 Out of range value for column 't' at row 1 Warning 1264 Out of range value for column 'y' at row 1 Warning 1264 Out of range value for column 'y4' at row 1 Warning 1264 Out of range value for column 'y2' at row 1 -SELECT * FROM t1; +SELECT d,dt,ts,t,y,y4,y2 FROM t1; d dt ts t y y4 y2 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 -838:59:59 0000 0000 00 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00 diff --git a/mysql-test/suite/storage_engine/type_enum.inc b/mysql-test/suite/storage_engine/type_enum.inc index 6b9b83fc52e..2e747e50ef4 100644 --- a/mysql-test/suite/storage_engine/type_enum.inc +++ b/mysql-test/suite/storage_engine/type_enum.inc @@ -28,16 +28,16 @@ if (!$mysql_errname) --replace_column 3 # 4 # 5 # SHOW COLUMNS IN t1; - INSERT INTO t1 VALUES ('','test2','4'),('',5,2); + INSERT INTO t1 (a,b,c) VALUES ('','test2','4'),('',5,2); --sorted_result - SELECT * FROM t1; + SELECT a,b,c FROM t1; # Out of range values # (should produce warnings) - INSERT INTO t1 VALUES (0,'test6',-1); + INSERT INTO t1 (a,b,c) VALUES (0,'test6',-1); --sorted_result - SELECT * FROM t1; + SELECT a,b,c FROM t1; # Non-unique values in enum # (should produce a warning) @@ -53,14 +53,14 @@ if (!$mysql_errname) --replace_column 3 # 4 # 5 # SHOW COLUMNS IN t1; - INSERT INTO t1 VALUES ('','test3','75','A'); + INSERT INTO t1 (a,b,c,e) VALUES ('','test3','75','A'); --sorted_result - SELECT * FROM t1; + SELECT a,b,c,e FROM t1; # Simple comparison --sorted_result - SELECT * FROM t1 WHERE b='test2' OR a != ''; + SELECT a,b,c,e FROM t1 WHERE b='test2' OR a != ''; DROP TABLE t1; } diff --git a/mysql-test/suite/storage_engine/type_enum.result b/mysql-test/suite/storage_engine/type_enum.result index 920aa5c7807..c2efd87ffb7 100644 --- a/mysql-test/suite/storage_engine/type_enum.result +++ b/mysql-test/suite/storage_engine/type_enum.result @@ -8,17 +8,17 @@ Field Type Null Key Default Extra a enum('') # # # b enum('test1','test2','test3','test4','test5') # # # c enum('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') # # # -INSERT INTO t1 VALUES ('','test2','4'),('',5,2); -SELECT * FROM t1; +INSERT INTO t1 (a,b,c) VALUES ('','test2','4'),('',5,2); +SELECT a,b,c FROM t1; a b c test2 4 test5 2 -INSERT INTO t1 VALUES (0,'test6',-1); +INSERT INTO t1 (a,b,c) VALUES (0,'test6',-1); Warnings: Warning 1265 Data truncated for column 'a' at row 1 Warning 1265 Data truncated for column 'b' at row 1 Warning 1265 Data truncated for column 'c' at row 1 -SELECT * FROM t1; +SELECT a,b,c FROM t1; a b c test2 4 @@ -33,14 +33,14 @@ a enum('') # # # b enum('test1','test2','test3','test4','test5') # # # c enum('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') # # # e enum('a','A') # # # -INSERT INTO t1 VALUES ('','test3','75','A'); -SELECT * FROM t1; +INSERT INTO t1 (a,b,c,e) VALUES ('','test3','75','A'); +SELECT a,b,c,e FROM t1; a b c e NULL test2 4 NULL test3 75 a test5 2 NULL -SELECT * FROM t1 WHERE b='test2' OR a != ''; +SELECT a,b,c,e FROM t1 WHERE b='test2' OR a != ''; a b c e test2 4 NULL DROP TABLE t1; diff --git a/mysql-test/suite/storage_engine/type_fixed.inc b/mysql-test/suite/storage_engine/type_fixed.inc index 6765fb575bc..3b4ade9ff6d 100644 --- a/mysql-test/suite/storage_engine/type_fixed.inc +++ b/mysql-test/suite/storage_engine/type_fixed.inc @@ -32,40 +32,40 @@ if (!$mysql_errname) # Always valid values - INSERT INTO t1 VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807); - INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0); - INSERT INTO t1 VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999); + INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807); + INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (0,0,0,0,0,0,0,0,0,0); + INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999); --sorted_result - SELECT * FROM t1; + SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; # Values which can be valid or not, # depending on whether columns are SIGNED or UNSIGNED # (if not valid should produce warnings) - INSERT INTO t1 VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807); - INSERT INTO t1 VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999); + INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807); + INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999); --sorted_result - SELECT * FROM t1; + SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; --sorted_result - SELECT * FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100; + SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100; # Invalid values - INSERT INTO t1 SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 ); + INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 ); --sorted_result - SELECT * FROM t1; + SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; - INSERT INTO t1 VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999); + INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999); --sorted_result - SELECT * FROM t1; + SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; - INSERT INTO t1 VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111); + INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111); --sorted_result - SELECT * FROM t1; + SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; --let $error_codes = ER_TOO_BIG_PRECISION --let $alter_definition = ADD COLUMN n66 NUMERIC(66) diff --git a/mysql-test/suite/storage_engine/type_fixed.result b/mysql-test/suite/storage_engine/type_fixed.result index 2c1566538db..5eea911a323 100644 --- a/mysql-test/suite/storage_engine/type_fixed.result +++ b/mysql-test/suite/storage_engine/type_fixed.result @@ -22,30 +22,30 @@ n0_0 decimal(10,0) # # # n1 decimal(1,0) # # # n20_4 decimal(20,4) # # # n65_4 decimal(65,4) # # # -INSERT INTO t1 VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807); -INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0); -INSERT INTO t1 VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999); -SELECT * FROM t1; +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (0,0,0,0,0,0,0,0,0,0); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999); +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -INSERT INTO t1 VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807); -INSERT INTO t1 VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999); -SELECT * FROM t1; +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999); +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 -100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000 -9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -SELECT * FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 -100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000 -9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999 0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -INSERT INTO t1 SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 ); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 ); Warnings: Warning 1264 Out of range value for column 'd' at row 1 Warning 1264 Out of range value for column 'd0' at row 1 @@ -56,7 +56,7 @@ Warning 1264 Out of range value for column 'n' at row 1 Warning 1264 Out of range value for column 'n0_0' at row 1 Warning 1264 Out of range value for column 'n1' at row 1 Warning 1264 Out of range value for column 'n20_4' at row 1 -SELECT * FROM t1; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 -100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000 -9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999 @@ -64,7 +64,7 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -INSERT INTO t1 VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999); Warnings: Warning 1264 Out of range value for column 'd' at row 1 Warning 1264 Out of range value for column 'd0' at row 1 @@ -76,7 +76,7 @@ Warning 1264 Out of range value for column 'n0_0' at row 1 Warning 1264 Out of range value for column 'n1' at row 1 Warning 1264 Out of range value for column 'n20_4' at row 1 Warning 1264 Out of range value for column 'n65_4' at row 1 -SELECT * FROM t1; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 -100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000 -9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999 @@ -85,7 +85,7 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999 -INSERT INTO t1 VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111); +INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111); Warnings: Note 1265 Data truncated for column 'd' at row 1 Note 1265 Data truncated for column 'd0' at row 1 @@ -97,7 +97,7 @@ Note 1265 Data truncated for column 'n0_0' at row 1 Note 1265 Data truncated for column 'n1' at row 1 Note 1265 Data truncated for column 'n20_4' at row 1 Note 1265 Data truncated for column 'n65_4' at row 1 -SELECT * FROM t1; +SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1; d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4 -100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000 -9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999 diff --git a/mysql-test/suite/storage_engine/type_float.inc b/mysql-test/suite/storage_engine/type_float.inc index 7e355f01e0d..1b8f0102755 100644 --- a/mysql-test/suite/storage_engine/type_float.inc +++ b/mysql-test/suite/storage_engine/type_float.inc @@ -32,13 +32,13 @@ if (!$mysql_errname) # Always valid values - INSERT INTO t1 VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999); + INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999); --sorted_result - --query_vertical SELECT * FROM t1 + --query_vertical SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1 - INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0); - INSERT INTO t1 VALUES ( + INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (0,0,0,0,0,0,0,0,0,0); + INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES ( 99999999999999999999999999999999999999, 99999999999999999999999999999999999999.9999999999999999, 0.9, @@ -52,28 +52,28 @@ if (!$mysql_errname) ); --sorted_result - --query_vertical SELECT * FROM t1 + --query_vertical SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1 # Values which can be valid or not, # depending on whether columns are SIGNED or UNSIGNED # (if not valid should produce warnings) - INSERT INTO t1 VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999); + INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999); --sorted_result - --query_vertical SELECT * FROM t1 + --query_vertical SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1 --sorted_result --query_vertical SELECT MAX(f), MAX(f0), MAX(r1_1), MAX(f23_0), MAX(f20_3), MAX(d), MAX(d1_0), MAX(d10_10), MAX(d53), MAX(d53_10) FROM t1 # Invalid values - INSERT INTO t1 SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1; + INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1; --sorted_result - --query_vertical SELECT * FROM t1 + --query_vertical SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1 - INSERT INTO t1 VALUES ( + INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES ( 999999999999999999999999999999999999999, 999999999999999999999999999999999999999.9999999999999999, 1.9, @@ -87,7 +87,7 @@ if (!$mysql_errname) ); --sorted_result - --query_vertical SELECT * FROM t1 + --query_vertical SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1 --let $error_codes = ER_TOO_BIG_DISPLAYWIDTH --let $alter_definition = ADD COLUMN d0_0 DOUBLE(0,0) diff --git a/mysql-test/suite/storage_engine/type_float.result b/mysql-test/suite/storage_engine/type_float.result index 1f863505430..5cd76673a3c 100644 --- a/mysql-test/suite/storage_engine/type_float.result +++ b/mysql-test/suite/storage_engine/type_float.result @@ -22,8 +22,8 @@ d1_0 double(1,0) # # # d10_10 double(10,10) # # # d53 double(53,0) # # # d53_10 double(53,10) # # # -INSERT INTO t1 VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999); -SELECT * FROM t1; +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999); +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 12345.1 d 11111111.111 d10_10 0.0123456789 @@ -34,8 +34,8 @@ f0 12345.1 f20_3 56789.988 f23_0 123457000 r1_1 0.9 -INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0); -INSERT INTO t1 VALUES ( +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (0,0,0,0,0,0,0,0,0,0); +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES ( 99999999999999999999999999999999999999, 99999999999999999999999999999999999999.9999999999999999, 0.9, @@ -50,7 +50,7 @@ INSERT INTO t1 VALUES ( Warnings: Warning 1264 Out of range value for column 'd53' at row 1 Warning 1264 Out of range value for column 'd53_10' at row 1 -SELECT * FROM t1; +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 12345.1 d 0 d 11111111.111 @@ -81,8 +81,8 @@ f23_0 1e38 r1_1 0.0 r1_1 0.9 r1_1 0.9 -INSERT INTO t1 VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999); -SELECT * FROM t1; +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999); +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 12345.1 d -1e60 d 0 @@ -134,7 +134,7 @@ MAX(f0) 9.999999680285692e37 MAX(f20_3) 99999998430674940.000 MAX(f23_0) 9.999999680285692e37 MAX(r1_1) 0.9 -INSERT INTO t1 SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1; +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1; Warnings: Warning 1264 Out of range value for column 'f' at row 1 Warning 1264 Out of range value for column 'f0' at row 1 @@ -142,7 +142,7 @@ Warning 1264 Out of range value for column 'r1_1' at row 1 Warning 1264 Out of range value for column 'f23_0' at row 1 Warning 1264 Out of range value for column 'f20_3' at row 1 Warning 1264 Out of range value for column 'd1_0' at row 1 -SELECT * FROM t1; +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 12345.1 d -1e60 d 0 @@ -193,7 +193,7 @@ r1_1 0.0 r1_1 0.9 r1_1 0.9 r1_1 0.9 -INSERT INTO t1 VALUES ( +INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES ( 999999999999999999999999999999999999999, 999999999999999999999999999999999999999.9999999999999999, 1.9, @@ -216,7 +216,7 @@ Warning 1264 Out of range value for column 'd1_0' at row 1 Warning 1264 Out of range value for column 'd10_10' at row 1 Warning 1264 Out of range value for column 'd53' at row 1 Warning 1264 Out of range value for column 'd53_10' at row 1 -SELECT * FROM t1; +SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1; f 12345.1 d -1e60 d 0 diff --git a/mysql-test/suite/storage_engine/type_int.inc b/mysql-test/suite/storage_engine/type_int.inc index 5aaea78fcd5..058b18a24d5 100644 --- a/mysql-test/suite/storage_engine/type_int.inc +++ b/mysql-test/suite/storage_engine/type_int.inc @@ -42,32 +42,32 @@ if (!$mysql_errname) # Always valid values - INSERT INTO t1 VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); - INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); - INSERT INTO t1 VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807); + INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); + INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); + INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807); --sorted_result - SELECT * FROM t1; + SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1; # Values which can be valid or not, # depending on whether columns are SIGNED or UNSIGNED # (if not valid should produce warnings) - INSERT INTO t1 VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808); - INSERT INTO t1 VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615); + INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808); + INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615); --sorted_result - SELECT * FROM t1; + SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1; # Invalid values - INSERT INTO t1 VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809); + INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809); - INSERT INTO t1 VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616); + INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616); - INSERT INTO t1 SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615); + INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615); --sorted_result - SELECT * FROM t1; + SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1; --let $error_codes = ER_TOO_BIG_DISPLAYWIDTH --let $alter_definition = ADD COLUMN i257 INT(257) diff --git a/mysql-test/suite/storage_engine/type_int.result b/mysql-test/suite/storage_engine/type_int.result index 47f4ebad93a..8f462648a6a 100644 --- a/mysql-test/suite/storage_engine/type_int.result +++ b/mysql-test/suite/storage_engine/type_int.result @@ -42,16 +42,16 @@ b bigint(20) # # # b0 bigint(20) # # # b1 bigint(1) # # # b20 bigint(20) # # # -INSERT INTO t1 VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); -INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); -INSERT INTO t1 VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807); -SELECT * FROM t1; +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807); +SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1; i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807 -INSERT INTO t1 VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808); -INSERT INTO t1 VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615); Warnings: Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'i0' at row 1 @@ -73,14 +73,14 @@ Warning 1264 Out of range value for column 'b' at row 1 Warning 1264 Out of range value for column 'b0' at row 1 Warning 1264 Out of range value for column 'b1' at row 1 Warning 1264 Out of range value for column 'b20' at row 1 -SELECT * FROM t1; +SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1; i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20 -2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807 2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807 -INSERT INTO t1 VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809); Warnings: Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'i0' at row 1 @@ -102,7 +102,7 @@ Warning 1264 Out of range value for column 'b' at row 1 Warning 1264 Out of range value for column 'b0' at row 1 Warning 1264 Out of range value for column 'b1' at row 1 Warning 1264 Out of range value for column 'b20' at row 1 -INSERT INTO t1 VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616); Warnings: Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'i0' at row 1 @@ -124,7 +124,7 @@ Warning 1264 Out of range value for column 'b' at row 1 Warning 1264 Out of range value for column 'b0' at row 1 Warning 1264 Out of range value for column 'b1' at row 1 Warning 1264 Out of range value for column 'b20' at row 1 -INSERT INTO t1 SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615); +INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615); Warnings: Warning 1264 Out of range value for column 'i' at row 1 Warning 1264 Out of range value for column 'i0' at row 1 @@ -190,7 +190,7 @@ Warning 1264 Out of range value for column 'm' at row 4 Warning 1264 Out of range value for column 'm0' at row 4 Warning 1264 Out of range value for column 'm1' at row 4 Warning 1264 Out of range value for column 'm20' at row 4 -SELECT * FROM t1; +SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1; i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20 -2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808 -2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808 diff --git a/mysql-test/suite/storage_engine/type_set.inc b/mysql-test/suite/storage_engine/type_set.inc index b4844b00ec7..bc927cf8014 100644 --- a/mysql-test/suite/storage_engine/type_set.inc +++ b/mysql-test/suite/storage_engine/type_set.inc @@ -25,19 +25,19 @@ if (!$mysql_errname) --replace_column 3 # 4 # 5 # SHOW COLUMNS IN t1; - INSERT INTO t1 VALUES + INSERT INTO t1 (a,b,c) VALUES ('','test2,test3','01,34,44,,23'), ('',5,2), (',','test4,test2',''); --sorted_result - SELECT * FROM t1; + SELECT a,b,c FROM t1; # Out of range values # (should produce warnings) - INSERT INTO t1 VALUES (0,'test6',-1); + INSERT INTO t1 (a,b,c) VALUES (0,'test6',-1); --sorted_result - SELECT * FROM t1; + SELECT a,b,c FROM t1; # Non-unique values in set # (should produce a warning) @@ -62,7 +62,7 @@ if (!$mysql_errname) # Simple comparison --sorted_result - SELECT * FROM t1 WHERE FIND_IN_SET('test2',b)>0 OR a != ''; + SELECT a,b,c,e FROM t1 WHERE FIND_IN_SET('test2',b)>0 OR a != ''; DROP TABLE t1; } diff --git a/mysql-test/suite/storage_engine/type_set.result b/mysql-test/suite/storage_engine/type_set.result index 210b07748bc..2248ce9f7e0 100644 --- a/mysql-test/suite/storage_engine/type_set.result +++ b/mysql-test/suite/storage_engine/type_set.result @@ -8,22 +8,22 @@ Field Type Null Key Default Extra a set('') # # # b set('test1','test2','test3','test4','test5') # # # c set('01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50''51','52','53','54','55','56','57','58','59','60','61','62','63','64') # # # -INSERT INTO t1 VALUES +INSERT INTO t1 (a,b,c) VALUES ('','test2,test3','01,34,44,,23'), ('',5,2), (',','test4,test2',''); Warnings: Warning 1265 Data truncated for column 'c' at row 1 -SELECT * FROM t1; +SELECT a,b,c FROM t1; a b c test1,test3 02 test2,test3 01,23,34,44 test2,test4 -INSERT INTO t1 VALUES (0,'test6',-1); +INSERT INTO t1 (a,b,c) VALUES (0,'test6',-1); Warnings: Warning 1265 Data truncated for column 'b' at row 1 Warning 1265 Data truncated for column 'c' at row 1 -SELECT * FROM t1; +SELECT a,b,c FROM t1; a b c 01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50'51,52,53,54,55,56,57,58,59,60,61,62,63,64 test1,test3 02 @@ -41,7 +41,7 @@ c set('01','02','03','04','05','06','07','08','09','10','11','12','13','14','15' e set('a','A') # # # ALTER TABLE t1 ADD COLUMN f SET('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i') <CUSTOM_COL_OPTIONS>; ERROR HY000: Too many strings for column f and SET -SELECT * FROM t1 WHERE FIND_IN_SET('test2',b)>0 OR a != ''; +SELECT a,b,c,e FROM t1 WHERE FIND_IN_SET('test2',b)>0 OR a != ''; a b c e test2,test3 01,23,34,44 NULL test2,test4 NULL diff --git a/mysql-test/suite/storage_engine/type_spatial.inc b/mysql-test/suite/storage_engine/type_spatial.inc index 5195f779bcc..212786d60bf 100644 --- a/mysql-test/suite/storage_engine/type_spatial.inc +++ b/mysql-test/suite/storage_engine/type_spatial.inc @@ -372,50 +372,50 @@ if (!$mysql_errname) SHOW FIELDS FROM gis_geometrycollection; SHOW FIELDS FROM gis_geometry; - INSERT INTO gis_point VALUES + INSERT INTO gis_point (fid,g) VALUES (101, PointFromText('POINT(10 10)')), (102, PointFromText('POINT(20 10)')), (103, PointFromText('POINT(20 20)')), (104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)')))); - INSERT INTO gis_line VALUES + INSERT INTO gis_line (fid,g) VALUES (105, LineFromText('LINESTRING(0 0,0 10,10 0)')), (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), (107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10))))); - INSERT INTO gis_polygon VALUES + INSERT INTO gis_polygon (fid,g) VALUES (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), (110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))))); - INSERT INTO gis_multi_point VALUES + INSERT INTO gis_multi_point (fid,g) VALUES (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), (113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10))))); - INSERT INTO gis_multi_line VALUES + INSERT INTO gis_multi_line (fid,g) VALUES (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), (116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))))); - INSERT INTO gis_multi_polygon VALUES + INSERT INTO gis_multi_polygon (fid,g) VALUES (117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), (118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), (119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))))); - INSERT INTO gis_geometrycollection VALUES + INSERT INTO gis_geometrycollection (fid,g) VALUES (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), (121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))), (122, GeomFromText('GeometryCollection()')), (123, GeomFromText('GeometryCollection EMPTY')); - INSERT into gis_geometry SELECT * FROM gis_point; - INSERT into gis_geometry SELECT * FROM gis_line; - INSERT into gis_geometry SELECT * FROM gis_polygon; - INSERT into gis_geometry SELECT * FROM gis_multi_point; - INSERT into gis_geometry SELECT * FROM gis_multi_line; - INSERT into gis_geometry SELECT * FROM gis_multi_polygon; - INSERT into gis_geometry SELECT * FROM gis_geometrycollection; + INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_point; + INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_line; + INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_polygon; + INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_point; + INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_line; + INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_polygon; + INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_geometrycollection; SELECT fid, AsText(g) FROM gis_point; SELECT fid, AsText(g) FROM gis_line; @@ -475,7 +475,7 @@ if (!$mysql_errname) USE gis_ogs; --echo # Lakes - INSERT INTO lakes VALUES ( + INSERT INTO lakes (fid,name,shore) VALUES ( 101, 'BLUE LAKE', PolyFromText( 'POLYGON( @@ -486,37 +486,37 @@ if (!$mysql_errname) --echo # Road Segments - INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2, + INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(102, 'Route 5', NULL, 2, LineFromText( 'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101)); - INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4, + INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(103, 'Route 5', 'Main Street', 4, LineFromText( 'LINESTRING( 44 31, 56 34, 70 38 )' ,101)); - INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2, + INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(104, 'Route 5', NULL, 2, LineFromText( 'LINESTRING( 70 38, 72 48 )' ,101)); - INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4, + INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(105, 'Main Street', NULL, 4, LineFromText( 'LINESTRING( 70 38, 84 42 )' ,101)); - INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL, + INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(106, 'Dirt Road by Green Forest', NULL, 1, LineFromText( 'LINESTRING( 28 26, 28 0 )',101)); --echo # DividedRoutes - INSERT INTO divided_routes VALUES(119, 'Route 75', 4, + INSERT INTO divided_routes (fid,name,num_lanes,centerlines) VALUES(119, 'Route 75', 4, MLineFromText( 'MULTILINESTRING((10 48,10 21,10 0), (16 0,16 23,16 48))', 101)); --echo # Forests - INSERT INTO forests VALUES(109, 'Green Forest', + INSERT INTO forests (fid,name,boundary) VALUES(109, 'Green Forest', MPolyFromText( 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26), (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))', @@ -524,28 +524,28 @@ if (!$mysql_errname) --echo # Bridges - INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText( + INSERT INTO bridges (fid,name,position) VALUES(110, 'Cam Bridge', PointFromText( 'POINT( 44 31 )', 101)); --echo # Streams - INSERT INTO streams VALUES(111, 'Cam Stream', + INSERT INTO streams (fid,name,centerline) VALUES(111, 'Cam Stream', LineFromText( 'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101)); - INSERT INTO streams VALUES(112, NULL, + INSERT INTO streams (fid,name,centerline) VALUES(112, NULL, LineFromText( 'LINESTRING( 76 0, 78 4, 73 9 )', 101)); --echo # Buildings - INSERT INTO buildings VALUES(113, '123 Main Street', + INSERT INTO buildings (fid,name,position,footprint) VALUES(113, '123 Main Street', PointFromText( 'POINT( 52 30 )', 101), PolyFromText( 'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101)); - INSERT INTO buildings VALUES(114, '215 Main Street', + INSERT INTO buildings (fid,name,position,footprint) VALUES(114, '215 Main Street', PointFromText( 'POINT( 64 33 )', 101), PolyFromText( @@ -554,24 +554,24 @@ if (!$mysql_errname) --echo # Ponds - INSERT INTO ponds VALUES(120, NULL, 'Stock Pond', + INSERT INTO ponds (fid,name,type,shores) VALUES(120, NULL, 'Stock Pond', MPolyFromText( 'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ), ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101)); --echo # Named Places - INSERT INTO named_places VALUES(117, 'Ashton', + INSERT INTO named_places (fid,name,boundary) VALUES(117, 'Ashton', PolyFromText( 'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101)); - INSERT INTO named_places VALUES(118, 'Goose Island', + INSERT INTO named_places (fid,name,boundary) VALUES(118, 'Goose Island', PolyFromText( 'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101)); --echo # Map Neatlines - INSERT INTO map_neatlines VALUES(115, + INSERT INTO map_neatlines (fid,neatline) VALUES(115, PolyFromText( 'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101)); diff --git a/mysql-test/suite/storage_engine/type_spatial.result b/mysql-test/suite/storage_engine/type_spatial.result index c6b856ab8b0..94e3b22fd3c 100644 --- a/mysql-test/suite/storage_engine/type_spatial.result +++ b/mysql-test/suite/storage_engine/type_spatial.result @@ -77,43 +77,43 @@ SHOW FIELDS FROM gis_geometry; Field Type Null Key Default Extra fid int(11) YES NULL g geometry YES NULL -INSERT INTO gis_point VALUES +INSERT INTO gis_point (fid,g) VALUES (101, PointFromText('POINT(10 10)')), (102, PointFromText('POINT(20 10)')), (103, PointFromText('POINT(20 20)')), (104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)')))); -INSERT INTO gis_line VALUES +INSERT INTO gis_line (fid,g) VALUES (105, LineFromText('LINESTRING(0 0,0 10,10 0)')), (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), (107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10))))); -INSERT INTO gis_polygon VALUES +INSERT INTO gis_polygon (fid,g) VALUES (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), (110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))))); -INSERT INTO gis_multi_point VALUES +INSERT INTO gis_multi_point (fid,g) VALUES (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), (113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10))))); -INSERT INTO gis_multi_line VALUES +INSERT INTO gis_multi_line (fid,g) VALUES (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), (116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))))); -INSERT INTO gis_multi_polygon VALUES +INSERT INTO gis_multi_polygon (fid,g) VALUES (117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), (118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), (119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))))); -INSERT INTO gis_geometrycollection VALUES +INSERT INTO gis_geometrycollection (fid,g) VALUES (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), (121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))), (122, GeomFromText('GeometryCollection()')), (123, GeomFromText('GeometryCollection EMPTY')); -INSERT into gis_geometry SELECT * FROM gis_point; -INSERT into gis_geometry SELECT * FROM gis_line; -INSERT into gis_geometry SELECT * FROM gis_polygon; -INSERT into gis_geometry SELECT * FROM gis_multi_point; -INSERT into gis_geometry SELECT * FROM gis_multi_line; -INSERT into gis_geometry SELECT * FROM gis_multi_polygon; -INSERT into gis_geometry SELECT * FROM gis_geometrycollection; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_point; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_line; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_polygon; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_point; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_line; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_polygon; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_geometrycollection; SELECT fid, AsText(g) FROM gis_point; fid AsText(g) 101 POINT(10 10) @@ -431,7 +431,7 @@ first second w c o e d t i r DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; USE gis_ogs; # Lakes -INSERT INTO lakes VALUES ( +INSERT INTO lakes (fid,name,shore) VALUES ( 101, 'BLUE LAKE', PolyFromText( 'POLYGON( @@ -440,68 +440,68 @@ PolyFromText( )', 101)); # Road Segments -INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2, +INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(102, 'Route 5', NULL, 2, LineFromText( 'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101)); -INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4, +INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(103, 'Route 5', 'Main Street', 4, LineFromText( 'LINESTRING( 44 31, 56 34, 70 38 )' ,101)); -INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2, +INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(104, 'Route 5', NULL, 2, LineFromText( 'LINESTRING( 70 38, 72 48 )' ,101)); -INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4, +INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(105, 'Main Street', NULL, 4, LineFromText( 'LINESTRING( 70 38, 84 42 )' ,101)); -INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL, +INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(106, 'Dirt Road by Green Forest', NULL, 1, LineFromText( 'LINESTRING( 28 26, 28 0 )',101)); # DividedRoutes -INSERT INTO divided_routes VALUES(119, 'Route 75', 4, +INSERT INTO divided_routes (fid,name,num_lanes,centerlines) VALUES(119, 'Route 75', 4, MLineFromText( 'MULTILINESTRING((10 48,10 21,10 0), (16 0,16 23,16 48))', 101)); # Forests -INSERT INTO forests VALUES(109, 'Green Forest', +INSERT INTO forests (fid,name,boundary) VALUES(109, 'Green Forest', MPolyFromText( 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26), (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))', 101)); # Bridges -INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText( +INSERT INTO bridges (fid,name,position) VALUES(110, 'Cam Bridge', PointFromText( 'POINT( 44 31 )', 101)); # Streams -INSERT INTO streams VALUES(111, 'Cam Stream', +INSERT INTO streams (fid,name,centerline) VALUES(111, 'Cam Stream', LineFromText( 'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101)); -INSERT INTO streams VALUES(112, NULL, +INSERT INTO streams (fid,name,centerline) VALUES(112, NULL, LineFromText( 'LINESTRING( 76 0, 78 4, 73 9 )', 101)); # Buildings -INSERT INTO buildings VALUES(113, '123 Main Street', +INSERT INTO buildings (fid,name,position,footprint) VALUES(113, '123 Main Street', PointFromText( 'POINT( 52 30 )', 101), PolyFromText( 'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101)); -INSERT INTO buildings VALUES(114, '215 Main Street', +INSERT INTO buildings (fid,name,position,footprint) VALUES(114, '215 Main Street', PointFromText( 'POINT( 64 33 )', 101), PolyFromText( 'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101)); # Ponds -INSERT INTO ponds VALUES(120, NULL, 'Stock Pond', +INSERT INTO ponds (fid,name,type,shores) VALUES(120, NULL, 'Stock Pond', MPolyFromText( 'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ), ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101)); # Named Places -INSERT INTO named_places VALUES(117, 'Ashton', +INSERT INTO named_places (fid,name,boundary) VALUES(117, 'Ashton', PolyFromText( 'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101)); -INSERT INTO named_places VALUES(118, 'Goose Island', +INSERT INTO named_places (fid,name,boundary) VALUES(118, 'Goose Island', PolyFromText( 'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101)); # Map Neatlines -INSERT INTO map_neatlines VALUES(115, +INSERT INTO map_neatlines (fid,neatline) VALUES(115, PolyFromText( 'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101)); SELECT Dimension(shore) diff --git a/mysql-test/suite/storage_engine/type_spatial_indexes.result b/mysql-test/suite/storage_engine/type_spatial_indexes.result index a3c2a4d4e75..cebcb80d14f 100644 --- a/mysql-test/suite/storage_engine/type_spatial_indexes.result +++ b/mysql-test/suite/storage_engine/type_spatial_indexes.result @@ -77,43 +77,43 @@ SHOW FIELDS FROM gis_geometry; Field Type Null Key Default Extra fid int(11) YES NULL g geometry YES NULL -INSERT INTO gis_point VALUES +INSERT INTO gis_point (fid,g) VALUES (101, PointFromText('POINT(10 10)')), (102, PointFromText('POINT(20 10)')), (103, PointFromText('POINT(20 20)')), (104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)')))); -INSERT INTO gis_line VALUES +INSERT INTO gis_line (fid,g) VALUES (105, LineFromText('LINESTRING(0 0,0 10,10 0)')), (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), (107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10))))); -INSERT INTO gis_polygon VALUES +INSERT INTO gis_polygon (fid,g) VALUES (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), (110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))))); -INSERT INTO gis_multi_point VALUES +INSERT INTO gis_multi_point (fid,g) VALUES (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), (113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10))))); -INSERT INTO gis_multi_line VALUES +INSERT INTO gis_multi_line (fid,g) VALUES (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), (116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))))); -INSERT INTO gis_multi_polygon VALUES +INSERT INTO gis_multi_polygon (fid,g) VALUES (117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), (118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), (119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))))); -INSERT INTO gis_geometrycollection VALUES +INSERT INTO gis_geometrycollection (fid,g) VALUES (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), (121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))), (122, GeomFromText('GeometryCollection()')), (123, GeomFromText('GeometryCollection EMPTY')); -INSERT into gis_geometry SELECT * FROM gis_point; -INSERT into gis_geometry SELECT * FROM gis_line; -INSERT into gis_geometry SELECT * FROM gis_polygon; -INSERT into gis_geometry SELECT * FROM gis_multi_point; -INSERT into gis_geometry SELECT * FROM gis_multi_line; -INSERT into gis_geometry SELECT * FROM gis_multi_polygon; -INSERT into gis_geometry SELECT * FROM gis_geometrycollection; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_point; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_line; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_polygon; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_point; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_line; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_polygon; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_geometrycollection; SELECT fid, AsText(g) FROM gis_point; fid AsText(g) 101 POINT(10 10) @@ -431,7 +431,7 @@ first second w c o e d t i r DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; USE gis_ogs; # Lakes -INSERT INTO lakes VALUES ( +INSERT INTO lakes (fid,name,shore) VALUES ( 101, 'BLUE LAKE', PolyFromText( 'POLYGON( @@ -440,68 +440,68 @@ PolyFromText( )', 101)); # Road Segments -INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2, +INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(102, 'Route 5', NULL, 2, LineFromText( 'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101)); -INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4, +INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(103, 'Route 5', 'Main Street', 4, LineFromText( 'LINESTRING( 44 31, 56 34, 70 38 )' ,101)); -INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2, +INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(104, 'Route 5', NULL, 2, LineFromText( 'LINESTRING( 70 38, 72 48 )' ,101)); -INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4, +INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(105, 'Main Street', NULL, 4, LineFromText( 'LINESTRING( 70 38, 84 42 )' ,101)); -INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL, +INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(106, 'Dirt Road by Green Forest', NULL, 1, LineFromText( 'LINESTRING( 28 26, 28 0 )',101)); # DividedRoutes -INSERT INTO divided_routes VALUES(119, 'Route 75', 4, +INSERT INTO divided_routes (fid,name,num_lanes,centerlines) VALUES(119, 'Route 75', 4, MLineFromText( 'MULTILINESTRING((10 48,10 21,10 0), (16 0,16 23,16 48))', 101)); # Forests -INSERT INTO forests VALUES(109, 'Green Forest', +INSERT INTO forests (fid,name,boundary) VALUES(109, 'Green Forest', MPolyFromText( 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26), (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))', 101)); # Bridges -INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText( +INSERT INTO bridges (fid,name,position) VALUES(110, 'Cam Bridge', PointFromText( 'POINT( 44 31 )', 101)); # Streams -INSERT INTO streams VALUES(111, 'Cam Stream', +INSERT INTO streams (fid,name,centerline) VALUES(111, 'Cam Stream', LineFromText( 'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101)); -INSERT INTO streams VALUES(112, NULL, +INSERT INTO streams (fid,name,centerline) VALUES(112, NULL, LineFromText( 'LINESTRING( 76 0, 78 4, 73 9 )', 101)); # Buildings -INSERT INTO buildings VALUES(113, '123 Main Street', +INSERT INTO buildings (fid,name,position,footprint) VALUES(113, '123 Main Street', PointFromText( 'POINT( 52 30 )', 101), PolyFromText( 'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101)); -INSERT INTO buildings VALUES(114, '215 Main Street', +INSERT INTO buildings (fid,name,position,footprint) VALUES(114, '215 Main Street', PointFromText( 'POINT( 64 33 )', 101), PolyFromText( 'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101)); # Ponds -INSERT INTO ponds VALUES(120, NULL, 'Stock Pond', +INSERT INTO ponds (fid,name,type,shores) VALUES(120, NULL, 'Stock Pond', MPolyFromText( 'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ), ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101)); # Named Places -INSERT INTO named_places VALUES(117, 'Ashton', +INSERT INTO named_places (fid,name,boundary) VALUES(117, 'Ashton', PolyFromText( 'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101)); -INSERT INTO named_places VALUES(118, 'Goose Island', +INSERT INTO named_places (fid,name,boundary) VALUES(118, 'Goose Island', PolyFromText( 'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101)); # Map Neatlines -INSERT INTO map_neatlines VALUES(115, +INSERT INTO map_neatlines (fid,neatline) VALUES(115, PolyFromText( 'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101)); SELECT Dimension(shore) @@ -777,43 +777,43 @@ SHOW FIELDS FROM gis_geometry; Field Type Null Key Default Extra fid int(11) YES NULL g geometry NO NULL -INSERT INTO gis_point VALUES +INSERT INTO gis_point (fid,g) VALUES (101, PointFromText('POINT(10 10)')), (102, PointFromText('POINT(20 10)')), (103, PointFromText('POINT(20 20)')), (104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)')))); -INSERT INTO gis_line VALUES +INSERT INTO gis_line (fid,g) VALUES (105, LineFromText('LINESTRING(0 0,0 10,10 0)')), (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), (107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10))))); -INSERT INTO gis_polygon VALUES +INSERT INTO gis_polygon (fid,g) VALUES (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), (110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))))); -INSERT INTO gis_multi_point VALUES +INSERT INTO gis_multi_point (fid,g) VALUES (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), (113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10))))); -INSERT INTO gis_multi_line VALUES +INSERT INTO gis_multi_line (fid,g) VALUES (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), (116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))))); -INSERT INTO gis_multi_polygon VALUES +INSERT INTO gis_multi_polygon (fid,g) VALUES (117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), (118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), (119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))))); -INSERT INTO gis_geometrycollection VALUES +INSERT INTO gis_geometrycollection (fid,g) VALUES (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), (121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))), (122, GeomFromText('GeometryCollection()')), (123, GeomFromText('GeometryCollection EMPTY')); -INSERT into gis_geometry SELECT * FROM gis_point; -INSERT into gis_geometry SELECT * FROM gis_line; -INSERT into gis_geometry SELECT * FROM gis_polygon; -INSERT into gis_geometry SELECT * FROM gis_multi_point; -INSERT into gis_geometry SELECT * FROM gis_multi_line; -INSERT into gis_geometry SELECT * FROM gis_multi_polygon; -INSERT into gis_geometry SELECT * FROM gis_geometrycollection; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_point; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_line; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_polygon; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_point; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_line; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_polygon; +INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_geometrycollection; SELECT fid, AsText(g) FROM gis_point; fid AsText(g) 101 POINT(10 10) @@ -1131,7 +1131,7 @@ first second w c o e d t i r DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; USE gis_ogs; # Lakes -INSERT INTO lakes VALUES ( +INSERT INTO lakes (fid,name,shore) VALUES ( 101, 'BLUE LAKE', PolyFromText( 'POLYGON( @@ -1140,68 +1140,68 @@ PolyFromText( )', 101)); # Road Segments -INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2, +INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(102, 'Route 5', NULL, 2, LineFromText( 'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101)); -INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4, +INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(103, 'Route 5', 'Main Street', 4, LineFromText( 'LINESTRING( 44 31, 56 34, 70 38 )' ,101)); -INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2, +INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(104, 'Route 5', NULL, 2, LineFromText( 'LINESTRING( 70 38, 72 48 )' ,101)); -INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4, +INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(105, 'Main Street', NULL, 4, LineFromText( 'LINESTRING( 70 38, 84 42 )' ,101)); -INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL, +INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(106, 'Dirt Road by Green Forest', NULL, 1, LineFromText( 'LINESTRING( 28 26, 28 0 )',101)); # DividedRoutes -INSERT INTO divided_routes VALUES(119, 'Route 75', 4, +INSERT INTO divided_routes (fid,name,num_lanes,centerlines) VALUES(119, 'Route 75', 4, MLineFromText( 'MULTILINESTRING((10 48,10 21,10 0), (16 0,16 23,16 48))', 101)); # Forests -INSERT INTO forests VALUES(109, 'Green Forest', +INSERT INTO forests (fid,name,boundary) VALUES(109, 'Green Forest', MPolyFromText( 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26), (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))', 101)); # Bridges -INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText( +INSERT INTO bridges (fid,name,position) VALUES(110, 'Cam Bridge', PointFromText( 'POINT( 44 31 )', 101)); # Streams -INSERT INTO streams VALUES(111, 'Cam Stream', +INSERT INTO streams (fid,name,centerline) VALUES(111, 'Cam Stream', LineFromText( 'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101)); -INSERT INTO streams VALUES(112, NULL, +INSERT INTO streams (fid,name,centerline) VALUES(112, NULL, LineFromText( 'LINESTRING( 76 0, 78 4, 73 9 )', 101)); # Buildings -INSERT INTO buildings VALUES(113, '123 Main Street', +INSERT INTO buildings (fid,name,position,footprint) VALUES(113, '123 Main Street', PointFromText( 'POINT( 52 30 )', 101), PolyFromText( 'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101)); -INSERT INTO buildings VALUES(114, '215 Main Street', +INSERT INTO buildings (fid,name,position,footprint) VALUES(114, '215 Main Street', PointFromText( 'POINT( 64 33 )', 101), PolyFromText( 'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101)); # Ponds -INSERT INTO ponds VALUES(120, NULL, 'Stock Pond', +INSERT INTO ponds (fid,name,type,shores) VALUES(120, NULL, 'Stock Pond', MPolyFromText( 'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ), ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101)); # Named Places -INSERT INTO named_places VALUES(117, 'Ashton', +INSERT INTO named_places (fid,name,boundary) VALUES(117, 'Ashton', PolyFromText( 'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101)); -INSERT INTO named_places VALUES(118, 'Goose Island', +INSERT INTO named_places (fid,name,boundary) VALUES(118, 'Goose Island', PolyFromText( 'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101)); # Map Neatlines -INSERT INTO map_neatlines VALUES(115, +INSERT INTO map_neatlines (fid,neatline) VALUES(115, PolyFromText( 'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101)); SELECT Dimension(shore) diff --git a/mysql-test/suite/storage_engine/type_text.inc b/mysql-test/suite/storage_engine/type_text.inc index 0f31e91c776..86521e5fb1e 100644 --- a/mysql-test/suite/storage_engine/type_text.inc +++ b/mysql-test/suite/storage_engine/type_text.inc @@ -33,7 +33,7 @@ if (!$mysql_errname) # Valid values # (cannot get MAX for all columns due to max_allowed_packet limitations) - INSERT INTO t1 VALUES + INSERT INTO t1 (t,t0,t1,t300,tm,t70k,t17m,tt,m,l) VALUES ('','','','','','','','','',''), ('a','b','c','d','e','f','g','h','i','j'), ('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'), @@ -44,7 +44,7 @@ if (!$mysql_errname) # Invalid values (produce warnings, except for mediumtext and longtext columns for which the values are within limits) - INSERT INTO t1 VALUES + INSERT INTO t1 (t,t0,t1,t300,tm,t70k,t17m,tt,m,l) VALUES ( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) ); --sorted_result diff --git a/mysql-test/suite/storage_engine/type_text.result b/mysql-test/suite/storage_engine/type_text.result index b3ca7a8d9da..88204e2235e 100644 --- a/mysql-test/suite/storage_engine/type_text.result +++ b/mysql-test/suite/storage_engine/type_text.result @@ -22,7 +22,7 @@ t17m longtext # # # tt tinytext # # # m mediumtext # # # l longtext # # # -INSERT INTO t1 VALUES +INSERT INTO t1 (t,t0,t1,t300,tm,t70k,t17m,tt,m,l) VALUES ('','','','','','','','','',''), ('a','b','c','d','e','f','g','h','i','j'), ('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'), @@ -33,7 +33,7 @@ LENGTH(t) LENGTH(t0) LENGTH(t1) LENGTH(t300) LENGTH(tm) LENGTH(t70k) LENGTH(t17m 1 1 1 1 1 1 1 1 1 1 5 5 5 5 5 5 5 5 5 6 65535 65535 255 65535 65535 1048576 1048576 255 1048576 1048576 -INSERT INTO t1 VALUES +INSERT INTO t1 (t,t0,t1,t300,tm,t70k,t17m,tt,m,l) VALUES ( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) ); Warnings: Warning 1265 Data truncated for column 't' at row 1 diff --git a/mysql-test/suite/storage_engine/type_varchar.inc b/mysql-test/suite/storage_engine/type_varchar.inc index 472f74e0dd1..e2da3deba39 100644 --- a/mysql-test/suite/storage_engine/type_varchar.inc +++ b/mysql-test/suite/storage_engine/type_varchar.inc @@ -72,7 +72,7 @@ if (!$mysql_errname) o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. '); --sorted_result - SELECT * FROM t1; + SELECT v0,v1,v64,v65000 FROM t1; # Invalid values diff --git a/mysql-test/suite/storage_engine/type_varchar.result b/mysql-test/suite/storage_engine/type_varchar.result index 055c8dcd7ca..f5e9bb416fe 100644 --- a/mysql-test/suite/storage_engine/type_varchar.result +++ b/mysql-test/suite/storage_engine/type_varchar.result @@ -51,7 +51,7 @@ INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','y','Once there, double check that * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. '); -SELECT * FROM t1; +SELECT v0,v1,v64,v65000 FROM t1; v0 v1 v64 v65000 diff --git a/mysql-test/suite/storage_engine/update.result b/mysql-test/suite/storage_engine/update.result index 3b96558c7c5..a07a1b57a5c 100644 --- a/mysql-test/suite/storage_engine/update.result +++ b/mysql-test/suite/storage_engine/update.result @@ -3,7 +3,7 @@ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTO INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(10000,'foobar'); INSERT INTO t1 (a,b) SELECT a, b FROM t1; UPDATE t1 SET a=a+100; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 101 a 101 a @@ -18,7 +18,7 @@ a b 105 e 105 e UPDATE t1 SET a=a-100, b=DEFAULT WHERE a>100; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 NULL 1 NULL @@ -33,7 +33,7 @@ a b 5 NULL 5 NULL UPDATE t1 SET b = 'update' WHERE a <= 4 ORDER BY b DESC, a ASC LIMIT 1; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 NULL 1 update diff --git a/mysql-test/suite/storage_engine/update.test b/mysql-test/suite/storage_engine/update.test index 4f892fa547d..ad36382f8be 100644 --- a/mysql-test/suite/storage_engine/update.test +++ b/mysql-test/suite/storage_engine/update.test @@ -24,16 +24,16 @@ if ($mysql_errname) if (!$mysql_errname) { --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; UPDATE t1 SET a=a-100, b=DEFAULT WHERE a>100; --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; # ORDER BY and LIMIT UPDATE t1 SET b = 'update' WHERE a <= 4 ORDER BY b DESC, a ASC LIMIT 1; --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; } # Cleanup diff --git a/mysql-test/suite/storage_engine/update_ignore.result b/mysql-test/suite/storage_engine/update_ignore.result index 26b7168196a..27e62c4f966 100644 --- a/mysql-test/suite/storage_engine/update_ignore.result +++ b/mysql-test/suite/storage_engine/update_ignore.result @@ -5,7 +5,7 @@ INSERT INTO t1 (a,b) SELECT a, b FROM t1; CREATE TABLE t2 (c <CHAR_COLUMN>, d <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; INSERT INTO t2 (c,d) SELECT b, a FROM t1; UPDATE IGNORE t1 SET b = 'upd1' WHERE b IS NOT NULL ORDER BY a LIMIT 1; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 1 upd1 @@ -23,7 +23,7 @@ UPDATE IGNORE t1, t2 SET b = 'upd2a', c = 'upd2b' WHERE c < b OR a != ( SELECT 1 UNION SELECT 2 ); Warnings: Warning 1242 Subquery returns more than 1 row -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 1 upd2a @@ -37,7 +37,7 @@ a b 4 upd2a 5 upd2a 5 upd2a -SELECT * FROM t2; +SELECT c,d FROM t2; c d upd2b 1 upd2b 1 diff --git a/mysql-test/suite/storage_engine/update_ignore.test b/mysql-test/suite/storage_engine/update_ignore.test index ddd4f7405a3..98f817b0e77 100644 --- a/mysql-test/suite/storage_engine/update_ignore.test +++ b/mysql-test/suite/storage_engine/update_ignore.test @@ -26,14 +26,14 @@ if ($mysql_errname) if (!$mysql_errname) { --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; UPDATE IGNORE t1, t2 SET b = 'upd2a', c = 'upd2b' WHERE c < b OR a != ( SELECT 1 UNION SELECT 2 ); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; --sorted_result - SELECT * FROM t2; + SELECT c,d FROM t2; } # Cleanup diff --git a/mysql-test/suite/storage_engine/update_low_prio.result b/mysql-test/suite/storage_engine/update_low_prio.result index 31a31b6be62..1e038103870 100644 --- a/mysql-test/suite/storage_engine/update_low_prio.result +++ b/mysql-test/suite/storage_engine/update_low_prio.result @@ -19,7 +19,7 @@ a+SLEEP(1) 11 12 connection default; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 21 foobar 22 b @@ -37,7 +37,7 @@ a+SLEEP(1) 21 22 connection default; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 41 foobar 42 b @@ -56,7 +56,7 @@ a+SLEEP(1) 41 42 connection default; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 71 foobar 72 b diff --git a/mysql-test/suite/storage_engine/update_low_prio.test b/mysql-test/suite/storage_engine/update_low_prio.test index 6c089c7172f..8cc1ad07d5c 100644 --- a/mysql-test/suite/storage_engine/update_low_prio.test +++ b/mysql-test/suite/storage_engine/update_low_prio.test @@ -76,7 +76,7 @@ if ($mysql_errname) } --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; # UPDATE LOW_PRIORITY @@ -107,7 +107,7 @@ SELECT a+SLEEP(1) FROM t1; --connection default --reap --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; SET LOW_PRIORITY_UPDATES = 1; @@ -152,7 +152,7 @@ if ($mysql_errname) --source unexpected_result.inc } --sorted_result -SELECT * FROM t1; +SELECT a,b FROM t1; --disconnect con1 --disconnect con2 diff --git a/mysql-test/suite/storage_engine/update_multi.result b/mysql-test/suite/storage_engine/update_multi.result index 42b2f239dd2..909cce8213d 100644 --- a/mysql-test/suite/storage_engine/update_multi.result +++ b/mysql-test/suite/storage_engine/update_multi.result @@ -5,7 +5,7 @@ INSERT INTO t1 (a,b) SELECT a, b FROM t1; CREATE TABLE t2 (c <CHAR_COLUMN>, d <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; INSERT INTO t2 (c,d) SELECT b, a FROM t1; UPDATE t1, t2 SET t1.a = t2.d+100, t2.c = 'multi' WHERE c < b AND a + d != 1; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 1 a @@ -19,7 +19,7 @@ a b 101 e 101 foobar 101 foobar -SELECT * FROM t2; +SELECT c,d FROM t2; c d foobar 10000 foobar 10000 @@ -34,7 +34,7 @@ multi 4 multi 5 multi 5 UPDATE t2, t1 SET t2.d = DEFAULT WHERE c = 'foobar' and b = c; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 a 1 a @@ -48,7 +48,7 @@ a b 101 e 101 foobar 101 foobar -SELECT * FROM t2; +SELECT c,d FROM t2; c d foobar NULL foobar NULL diff --git a/mysql-test/suite/storage_engine/update_multi.test b/mysql-test/suite/storage_engine/update_multi.test index 589a8319382..4820eb5df46 100644 --- a/mysql-test/suite/storage_engine/update_multi.test +++ b/mysql-test/suite/storage_engine/update_multi.test @@ -26,15 +26,15 @@ if ($mysql_errname) if (!$mysql_errname) { --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; --sorted_result - SELECT * FROM t2; + SELECT c,d FROM t2; UPDATE t2, t1 SET t2.d = DEFAULT WHERE c = 'foobar' and b = c; --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; --sorted_result - SELECT * FROM t2; + SELECT c,d FROM t2; } # Cleanup diff --git a/mysql-test/suite/storage_engine/update_with_keys.result b/mysql-test/suite/storage_engine/update_with_keys.result index 8250f31a19e..ed62c96a5e6 100644 --- a/mysql-test/suite/storage_engine/update_with_keys.result +++ b/mysql-test/suite/storage_engine/update_with_keys.result @@ -5,7 +5,7 @@ UPDATE t1 SET a=100, b='f' WHERE b IN ('b','c'); UPDATE t1 SET b='m' WHERE b = 'f'; UPDATE t1 SET b='z' WHERE a < 2; UPDATE t1 SET b=''; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 100 @@ -25,7 +25,7 @@ ERROR 23000: Duplicate entry '205' for key 'a' # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). # If you got a difference in error message, just add it to rdiff file UPDATE t1 SET a=12345 ORDER BY a, b LIMIT 1; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 12345 a 200 f @@ -51,7 +51,7 @@ ERROR 23000: Duplicate entry '4-d' for key 'a' # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). # If you got a difference in error message, just add it to rdiff file UPDATE t1 SET a=a+1; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 101 a 2 a @@ -74,7 +74,7 @@ ERROR 23000: Duplicate entry '205' for key 'PRIMARY' # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). # If you got a difference in error message, just add it to rdiff file UPDATE t1 SET a=12345 ORDER BY a DESC, b LIMIT 1; -SELECT * FROM t1; +SELECT a,b FROM t1; a b 0 a 12345 e diff --git a/mysql-test/suite/storage_engine/update_with_keys.test b/mysql-test/suite/storage_engine/update_with_keys.test index 578ee3b3294..77843365cef 100644 --- a/mysql-test/suite/storage_engine/update_with_keys.test +++ b/mysql-test/suite/storage_engine/update_with_keys.test @@ -32,7 +32,7 @@ if (!$mysql_errname) UPDATE t1 SET b='z' WHERE a < 2; UPDATE t1 SET b=''; --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; } DROP TABLE t1; } @@ -62,7 +62,7 @@ if (!$mysql_errname) --source check_errors.inc UPDATE t1 SET a=12345 ORDER BY a, b LIMIT 1; --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; # We'll check that the next update causes an error, # but won't check the result because it might be different depending @@ -101,7 +101,7 @@ if (!$mysql_errname) --source check_errors.inc UPDATE t1 SET a=a+1; --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY UPDATE t1 SET b='z'; --source check_errors.inc @@ -135,7 +135,7 @@ if (!$mysql_errname) UPDATE t1 SET a=12345 ORDER BY a DESC, b LIMIT 1; --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; # We'll check that the next update causes an error, # but won't check the result because it might be different depending diff --git a/mysql-test/suite/storage_engine/vcol.result b/mysql-test/suite/storage_engine/vcol.result index bae7636f6cb..d51ab038576 100644 --- a/mysql-test/suite/storage_engine/vcol.result +++ b/mysql-test/suite/storage_engine/vcol.result @@ -9,7 +9,7 @@ INSERT INTO t1 (a,b) VALUES (3,3),(4,4); Warnings: Warning 1906 The value specified for computed column 'b' in table 't1' ignored Warning 1906 The value specified for computed column 'b' in table 't1' ignored -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 2 2 3 @@ -26,7 +26,7 @@ INSERT INTO t1 (a,b) VALUES (3,3),(4,4); Warnings: Warning 1906 The value specified for computed column 'b' in table 't1' ignored Warning 1906 The value specified for computed column 'b' in table 't1' ignored -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 2 2 3 @@ -43,7 +43,7 @@ INSERT INTO t1 (a,b) VALUES (3,3),(4,4); Warnings: Warning 1906 The value specified for computed column 'b' in table 't1' ignored Warning 1906 The value specified for computed column 'b' in table 't1' ignored -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 2 2 3 @@ -60,7 +60,7 @@ INSERT INTO t1 (a,b) VALUES (3,3),(4,4); Warnings: Warning 1906 The value specified for computed column 'b' in table 't1' ignored Warning 1906 The value specified for computed column 'b' in table 't1' ignored -SELECT * FROM t1; +SELECT a,b FROM t1; a b 1 2 2 3 diff --git a/mysql-test/suite/storage_engine/vcol.test b/mysql-test/suite/storage_engine/vcol.test index 90819ffbd47..e6257ab324b 100644 --- a/mysql-test/suite/storage_engine/vcol.test +++ b/mysql-test/suite/storage_engine/vcol.test @@ -24,7 +24,7 @@ if (!$mysql_errname) INSERT INTO t1 (a) VALUES (1),(2); INSERT INTO t1 (a,b) VALUES (3,3),(4,4); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; DROP TABLE t1; @@ -37,7 +37,7 @@ if (!$mysql_errname) INSERT INTO t1 (a) VALUES (1),(2); INSERT INTO t1 (a,b) VALUES (3,3),(4,4); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; DROP TABLE t1; @@ -50,7 +50,7 @@ if (!$mysql_errname) INSERT INTO t1 (a) VALUES (1),(2); INSERT INTO t1 (a,b) VALUES (3,3),(4,4); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; DROP TABLE t1; @@ -63,7 +63,7 @@ if (!$mysql_errname) INSERT INTO t1 (a) VALUES (1),(2); INSERT INTO t1 (a,b) VALUES (3,3),(4,4); --sorted_result - SELECT * FROM t1; + SELECT a,b FROM t1; DROP TABLE t1; } diff --git a/mysql-test/suite/sys_vars/disabled.def b/mysql-test/suite/sys_vars/disabled.def index 1ae495e4863..596191d09b6 100644 --- a/mysql-test/suite/sys_vars/disabled.def +++ b/mysql-test/suite/sys_vars/disabled.def @@ -10,6 +10,5 @@ # ############################################################################## -innodb_trx_rseg_n_slots_debug_basic: variable innodb_trx_rseg_n_slots_debug is removed in MariaDB innodb_flush_checkpoint_debug_basic: removed from XtraDB-26.0 diff --git a/mysql-test/suite/sys_vars/r/innodb_limit_optimistic_insert_debug_basic.result b/mysql-test/suite/sys_vars/r/innodb_limit_optimistic_insert_debug_basic.result new file mode 100644 index 00000000000..3d4f401aad1 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/innodb_limit_optimistic_insert_debug_basic.result @@ -0,0 +1,58 @@ +SET @start_global_value = @@global.innodb_limit_optimistic_insert_debug; +SELECT @start_global_value; +@start_global_value +0 +select @@global.innodb_limit_optimistic_insert_debug; +@@global.innodb_limit_optimistic_insert_debug +0 +select @@session.innodb_limit_optimistic_insert_debug; +ERROR HY000: Variable 'innodb_limit_optimistic_insert_debug' is a GLOBAL variable +show global variables like 'innodb_limit_optimistic_insert_debug'; +Variable_name Value +innodb_limit_optimistic_insert_debug 0 +show session variables like 'innodb_limit_optimistic_insert_debug'; +Variable_name Value +innodb_limit_optimistic_insert_debug 0 +select * from information_schema.global_variables where variable_name='innodb_limit_optimistic_insert_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG 0 +select * from information_schema.session_variables where variable_name='innodb_limit_optimistic_insert_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG 0 +set global innodb_limit_optimistic_insert_debug=1; +select @@global.innodb_limit_optimistic_insert_debug; +@@global.innodb_limit_optimistic_insert_debug +1 +select * from information_schema.global_variables where variable_name='innodb_limit_optimistic_insert_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG 1 +select * from information_schema.session_variables where variable_name='innodb_limit_optimistic_insert_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG 1 +set @@global.innodb_limit_optimistic_insert_debug=0; +select @@global.innodb_limit_optimistic_insert_debug; +@@global.innodb_limit_optimistic_insert_debug +0 +select * from information_schema.global_variables where variable_name='innodb_limit_optimistic_insert_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG 0 +select * from information_schema.session_variables where variable_name='innodb_limit_optimistic_insert_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG 0 +set session innodb_limit_optimistic_insert_debug='some'; +ERROR HY000: Variable 'innodb_limit_optimistic_insert_debug' is a GLOBAL variable and should be set with SET GLOBAL +set @@session.innodb_limit_optimistic_insert_debug='some'; +ERROR HY000: Variable 'innodb_limit_optimistic_insert_debug' is a GLOBAL variable and should be set with SET GLOBAL +set global innodb_limit_optimistic_insert_debug=1.1; +ERROR 42000: Incorrect argument type to variable 'innodb_limit_optimistic_insert_debug' +set global innodb_limit_optimistic_insert_debug='foo'; +ERROR 42000: Incorrect argument type to variable 'innodb_limit_optimistic_insert_debug' +set global innodb_limit_optimistic_insert_debug=-2; +Warnings: +Warning 1292 Truncated incorrect innodb_limit_optimistic_insert_d value: '-2' +set global innodb_limit_optimistic_insert_debug=1e1; +ERROR 42000: Incorrect argument type to variable 'innodb_limit_optimistic_insert_debug' +SET @@global.innodb_limit_optimistic_insert_debug = @start_global_value; +SELECT @@global.innodb_limit_optimistic_insert_debug; +@@global.innodb_limit_optimistic_insert_debug +0 diff --git a/mysql-test/suite/sys_vars/r/innodb_changed_pages_limit_basic.result b/mysql-test/suite/sys_vars/r/innodb_max_changed_pages_basic.result index d9d067c2cf9..d9d067c2cf9 100644 --- a/mysql-test/suite/sys_vars/r/innodb_changed_pages_limit_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_max_changed_pages_basic.result diff --git a/mysql-test/suite/sys_vars/r/innodb_print_all_deadlocks_basic.result b/mysql-test/suite/sys_vars/r/innodb_print_all_deadlocks_basic.result new file mode 100644 index 00000000000..1bd078dfd7e --- /dev/null +++ b/mysql-test/suite/sys_vars/r/innodb_print_all_deadlocks_basic.result @@ -0,0 +1,22 @@ +SELECT @@innodb_print_all_deadlocks; +@@innodb_print_all_deadlocks +0 +SET GLOBAL innodb_print_all_deadlocks=1; +CREATE TABLE t1 (c1 INT, PRIMARY KEY (c1)) ENGINE=INNODB; +INSERT INTO t1 VALUES (123); +CREATE TABLE t2 (c2 INT, PRIMARY KEY (c2)) ENGINE=INNODB; +INSERT INTO t2 VALUES (456); +BEGIN; +SELECT * FROM t1 FOR UPDATE; +c1 +123 +BEGIN; +SELECT * FROM t2 FOR UPDATE; +c2 +456 +SELECT * FROM t2 FOR UPDATE; +SELECT * FROM t1 FOR UPDATE; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +DROP TABLE t2; +DROP TABLE t1; +SET GLOBAL innodb_print_all_deadlocks=default; diff --git a/mysql-test/suite/sys_vars/r/innodb_trx_purge_view_update_only_debug_basic.result b/mysql-test/suite/sys_vars/r/innodb_trx_purge_view_update_only_debug_basic.result new file mode 100644 index 00000000000..1779cbb48df --- /dev/null +++ b/mysql-test/suite/sys_vars/r/innodb_trx_purge_view_update_only_debug_basic.result @@ -0,0 +1,62 @@ +SET @start_global_value = @@global.innodb_trx_purge_view_update_only_debug; +SELECT @start_global_value; +@start_global_value +0 +select @@global.innodb_trx_purge_view_update_only_debug in (0, 1); +@@global.innodb_trx_purge_view_update_only_debug in (0, 1) +1 +select @@global.innodb_trx_purge_view_update_only_debug; +@@global.innodb_trx_purge_view_update_only_debug +0 +select @@session.innodb_trx_purge_view_update_only_debug; +ERROR HY000: Variable 'innodb_trx_purge_view_update_only_debug' is a GLOBAL variable +show global variables like 'innodb_trx_purge_view_update_only_debug'; +Variable_name Value +innodb_trx_purge_view_update_only_debug OFF +show session variables like 'innodb_trx_purge_view_update_only_debug'; +Variable_name Value +innodb_trx_purge_view_update_only_debug OFF +select * from information_schema.global_variables where variable_name='innodb_trx_purge_view_update_only_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG OFF +select * from information_schema.session_variables where variable_name='innodb_trx_purge_view_update_only_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG OFF +set global innodb_trx_purge_view_update_only_debug=1; +select @@global.innodb_trx_purge_view_update_only_debug; +@@global.innodb_trx_purge_view_update_only_debug +1 +select * from information_schema.global_variables where variable_name='innodb_trx_purge_view_update_only_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG ON +select * from information_schema.session_variables where variable_name='innodb_trx_purge_view_update_only_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG ON +set @@global.innodb_trx_purge_view_update_only_debug=0; +select @@global.innodb_trx_purge_view_update_only_debug; +@@global.innodb_trx_purge_view_update_only_debug +0 +select * from information_schema.global_variables where variable_name='innodb_trx_purge_view_update_only_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG OFF +select * from information_schema.session_variables where variable_name='innodb_trx_purge_view_update_only_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG OFF +set session innodb_trx_purge_view_update_only_debug='some'; +ERROR HY000: Variable 'innodb_trx_purge_view_update_only_debug' is a GLOBAL variable and should be set with SET GLOBAL +set @@session.innodb_trx_purge_view_update_only_debug='some'; +ERROR HY000: Variable 'innodb_trx_purge_view_update_only_debug' is a GLOBAL variable and should be set with SET GLOBAL +set global innodb_trx_purge_view_update_only_debug=1.1; +ERROR 42000: Incorrect argument type to variable 'innodb_trx_purge_view_update_only_debug' +set global innodb_trx_purge_view_update_only_debug='foo'; +ERROR 42000: Variable 'innodb_trx_purge_view_update_only_debug' can't be set to the value of 'foo' +set global innodb_trx_purge_view_update_only_debug=-2; +ERROR 42000: Variable 'innodb_trx_purge_view_update_only_debug' can't be set to the value of '-2' +set global innodb_trx_purge_view_update_only_debug=1e1; +ERROR 42000: Incorrect argument type to variable 'innodb_trx_purge_view_update_only_debug' +set global innodb_trx_purge_view_update_only_debug=2; +ERROR 42000: Variable 'innodb_trx_purge_view_update_only_debug' can't be set to the value of '2' +SET @@global.innodb_trx_purge_view_update_only_debug = @start_global_value; +SELECT @@global.innodb_trx_purge_view_update_only_debug; +@@global.innodb_trx_purge_view_update_only_debug +0 diff --git a/mysql-test/suite/sys_vars/r/ndb_log_update_as_write_basic.result b/mysql-test/suite/sys_vars/r/ndb_log_update_as_write_basic.result deleted file mode 100644 index 6353fba2b7c..00000000000 --- a/mysql-test/suite/sys_vars/r/ndb_log_update_as_write_basic.result +++ /dev/null @@ -1,14 +0,0 @@ -SET @global_start_value = @@global.ndb_log_update_as_write; -ERROR HY000: Unknown system variable 'ndb_log_update_as_write' -SELECT @@global.ndb_log_update_as_write; -ERROR HY000: Unknown system variable 'ndb_log_update_as_write' -'Bug: The value is not a system variable or atleast not supported in version 5.1.22' -'#--------------------FN_DYNVARS_102_01------------------------#' -'#---------------------FN_DYNVARS_102_02-------------------------#' -'#--------------------FN_DYNVARS_102_03------------------------#' -'#--------------------FN_DYNVARS_102_04-------------------------#' -'#-------------------FN_DYNVARS_102_05----------------------------#' -'#----------------------FN_DYNVARS_102_06------------------------#' -'#----------------------FN_DYNVARS_102_07------------------------#' -'#---------------------FN_DYNVARS_102_08-------------------------#' -'#---------------------FN_DYNVARS_102_09----------------------#' diff --git a/mysql-test/suite/sys_vars/r/ndb_log_updated_only_basic.result b/mysql-test/suite/sys_vars/r/ndb_log_updated_only_basic.result deleted file mode 100644 index 38abb7cc263..00000000000 --- a/mysql-test/suite/sys_vars/r/ndb_log_updated_only_basic.result +++ /dev/null @@ -1,14 +0,0 @@ -SET @global_start_value = @@global.ndb_log_updated_only; -ERROR HY000: Unknown system variable 'ndb_log_updated_only' -SELECT @@global.ndb_log_updated_only; -ERROR HY000: Unknown system variable 'ndb_log_updated_only' -'Bug: The value is not a system variable or atleast not supported in version 5.1.22' -'#--------------------FN_DYNVARS_103_01------------------------#' -'#---------------------FN_DYNVARS_103_02-------------------------#' -'#--------------------FN_DYNVARS_103_03------------------------#' -'#--------------------FN_DYNVARS_103_04-------------------------#' -'#-------------------FN_DYNVARS_103_05----------------------------#' -'#----------------------FN_DYNVARS_103_06------------------------#' -'#----------------------FN_DYNVARS_103_07------------------------#' -'#---------------------FN_DYNVARS_103_08-------------------------#' -'#---------------------FN_DYNVARS_103_09----------------------#' diff --git a/mysql-test/suite/sys_vars/r/pseudo_slave_mode_basic.result b/mysql-test/suite/sys_vars/r/pseudo_slave_mode_basic.result new file mode 100644 index 00000000000..c98dd338909 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/pseudo_slave_mode_basic.result @@ -0,0 +1,119 @@ +SET @session_start_value = @@session.pseudo_slave_mode; +SELECT @session_start_value; +@session_start_value +0 +'#--------------------FN_DYNVARS_156_01------------------------#' +SET @@session.pseudo_slave_mode = 0; +Warnings: +Warning 1231 'pseudo_slave_mode' change was ineffective. +SET @@session.pseudo_slave_mode = DEFAULT; +Warnings: +Warning 1231 'pseudo_slave_mode' change was ineffective. +SELECT @@session.pseudo_slave_mode; +@@session.pseudo_slave_mode +0 +SET @@session.pseudo_slave_mode = 1; +SET @@session.pseudo_slave_mode = DEFAULT; +Warnings: +Warning 1231 Slave applier execution mode not active, statement ineffective. +SELECT @@session.pseudo_slave_mode; +@@session.pseudo_slave_mode +0 +'#---------------------FN_DYNVARS_156_02-------------------------#' +SET pseudo_slave_mode = 1; +SELECT @@pseudo_slave_mode; +@@pseudo_slave_mode +1 +SELECT session.pseudo_slave_mode; +ERROR 42S02: Unknown table 'session' in field list +SELECT local.pseudo_slave_mode; +ERROR 42S02: Unknown table 'local' in field list +SET session pseudo_slave_mode = 0; +Warnings: +Warning 1231 Slave applier execution mode not active, statement ineffective. +SELECT @@session.pseudo_slave_mode; +@@session.pseudo_slave_mode +0 +'#--------------------FN_DYNVARS_156_03------------------------#' +SET @@session.pseudo_slave_mode = 0; +Warnings: +Warning 1231 'pseudo_slave_mode' change was ineffective. +SELECT @@session.pseudo_slave_mode; +@@session.pseudo_slave_mode +0 +SET @@session.pseudo_slave_mode = 1; +SELECT @@session.pseudo_slave_mode; +@@session.pseudo_slave_mode +1 +'#--------------------FN_DYNVARS_156_04-------------------------#' +SET @@session.pseudo_slave_mode = -1; +ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of '-1' +SET @@session.pseudo_slave_mode = 2; +ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of '2' +SET @@session.pseudo_slave_mode = "T"; +ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'T' +SET @@session.pseudo_slave_mode = "Y"; +ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'Y' +SET @@session.pseudo_slave_mode = TRÜE; +ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'TRÜE' +SET @@session.pseudo_slave_mode = ÕN; +ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'ÕN' +SET @@session.pseudo_slave_mode = OF; +ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'OF' +SET @@session.pseudo_slave_mode = ÓFF; +ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'ÓFF' +SET @@session.pseudo_slave_mode = '¹'; +ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of '¹' +SET @@session.pseudo_slave_mode = NO; +ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'NO' +'#-------------------FN_DYNVARS_156_05----------------------------#' +SET @@global.pseudo_slave_mode = 0; +ERROR HY000: Variable 'pseudo_slave_mode' is a SESSION variable and can't be used with SET GLOBAL +SELECT @@global.pseudo_slave_mode; +ERROR HY000: Variable 'pseudo_slave_mode' is a SESSION variable +'#----------------------FN_DYNVARS_156_06------------------------#' +SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='pseudo_slave_mode'; +count(VARIABLE_VALUE) +1 +'#----------------------FN_DYNVARS_156_07------------------------#' +SELECT IF(@@session.pseudo_slave_mode, "ON", "OFF") = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='pseudo_slave_mode'; +IF(@@session.pseudo_slave_mode, "ON", "OFF") = VARIABLE_VALUE +1 +SELECT @@session.pseudo_slave_mode; +@@session.pseudo_slave_mode +1 +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='pseudo_slave_mode'; +VARIABLE_VALUE +ON +'#---------------------FN_DYNVARS_156_08-------------------------#' +SET @@session.pseudo_slave_mode = OFF; +Warnings: +Warning 1231 Slave applier execution mode not active, statement ineffective. +SELECT @@session.pseudo_slave_mode; +@@session.pseudo_slave_mode +0 +SET @@session.pseudo_slave_mode = ON; +SELECT @@session.pseudo_slave_mode; +@@session.pseudo_slave_mode +1 +'#---------------------FN_DYNVARS_156_09----------------------#' +SET @@session.pseudo_slave_mode = TRUE; +SELECT @@session.pseudo_slave_mode; +@@session.pseudo_slave_mode +1 +SET @@session.pseudo_slave_mode = FALSE; +Warnings: +Warning 1231 Slave applier execution mode not active, statement ineffective. +SELECT @@session.pseudo_slave_mode; +@@session.pseudo_slave_mode +0 +SET @@session.pseudo_slave_mode = @session_start_value; +Warnings: +Warning 1231 'pseudo_slave_mode' change was ineffective. +SELECT @@session.pseudo_slave_mode; +@@session.pseudo_slave_mode +0 diff --git a/mysql-test/suite/sys_vars/t/innodb_limit_optimistic_insert_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_limit_optimistic_insert_debug_basic.test new file mode 100644 index 00000000000..7998297c69e --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_limit_optimistic_insert_debug_basic.test @@ -0,0 +1,50 @@ +--source include/have_innodb.inc +--source include/have_debug.inc + +SET @start_global_value = @@global.innodb_limit_optimistic_insert_debug; +SELECT @start_global_value; + +# +# exists as global only +# +select @@global.innodb_limit_optimistic_insert_debug; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.innodb_limit_optimistic_insert_debug; +show global variables like 'innodb_limit_optimistic_insert_debug'; +show session variables like 'innodb_limit_optimistic_insert_debug'; +select * from information_schema.global_variables where variable_name='innodb_limit_optimistic_insert_debug'; +select * from information_schema.session_variables where variable_name='innodb_limit_optimistic_insert_debug'; + +# +# show that it's writable +# +set global innodb_limit_optimistic_insert_debug=1; +select @@global.innodb_limit_optimistic_insert_debug; +select * from information_schema.global_variables where variable_name='innodb_limit_optimistic_insert_debug'; +select * from information_schema.session_variables where variable_name='innodb_limit_optimistic_insert_debug'; +set @@global.innodb_limit_optimistic_insert_debug=0; +select @@global.innodb_limit_optimistic_insert_debug; +select * from information_schema.global_variables where variable_name='innodb_limit_optimistic_insert_debug'; +select * from information_schema.session_variables where variable_name='innodb_limit_optimistic_insert_debug'; +--error ER_GLOBAL_VARIABLE +set session innodb_limit_optimistic_insert_debug='some'; +--error ER_GLOBAL_VARIABLE +set @@session.innodb_limit_optimistic_insert_debug='some'; + +# +# incorrect types +# +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_limit_optimistic_insert_debug=1.1; +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_limit_optimistic_insert_debug='foo'; +set global innodb_limit_optimistic_insert_debug=-2; +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_limit_optimistic_insert_debug=1e1; + +# +# Cleanup +# + +SET @@global.innodb_limit_optimistic_insert_debug = @start_global_value; +SELECT @@global.innodb_limit_optimistic_insert_debug; diff --git a/mysql-test/suite/sys_vars/t/innodb_changed_pages_limit_basic.test b/mysql-test/suite/sys_vars/t/innodb_max_changed_pages_basic.test index 00aa476e8d2..00aa476e8d2 100644 --- a/mysql-test/suite/sys_vars/t/innodb_changed_pages_limit_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_max_changed_pages_basic.test diff --git a/mysql-test/suite/sys_vars/t/innodb_print_all_deadlocks_basic.test b/mysql-test/suite/sys_vars/t/innodb_print_all_deadlocks_basic.test new file mode 100644 index 00000000000..5ad0ae485e0 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_print_all_deadlocks_basic.test @@ -0,0 +1,48 @@ +# +# innodb_print_all_deadlocks +# + +-- source include/have_innodb.inc + +SELECT @@innodb_print_all_deadlocks; + +SET GLOBAL innodb_print_all_deadlocks=1; + +CREATE TABLE t1 (c1 INT, PRIMARY KEY (c1)) ENGINE=INNODB; +INSERT INTO t1 VALUES (123); + +CREATE TABLE t2 (c2 INT, PRIMARY KEY (c2)) ENGINE=INNODB; +INSERT INTO t2 VALUES (456); + +-- connect (con1,localhost,root,,) +-- connect (con2,localhost,root,,) + +-- connection con1 +BEGIN; +SELECT * FROM t1 FOR UPDATE; + +-- connection con2 +BEGIN; +SELECT * FROM t2 FOR UPDATE; + +-- connection con1 +-- send +SELECT * FROM t2 FOR UPDATE; + +-- connection con2 +let $wait_condition= +SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST +WHERE state = 'Sending data' AND info = 'SELECT * FROM t2 FOR UPDATE'; +-- source include/wait_condition.inc +-- error ER_LOCK_DEADLOCK +SELECT * FROM t1 FOR UPDATE; + +-- connection default + +-- disconnect con1 +-- disconnect con2 + +DROP TABLE t2; +DROP TABLE t1; + +SET GLOBAL innodb_print_all_deadlocks=default; diff --git a/mysql-test/suite/sys_vars/t/innodb_trx_purge_view_update_only_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_trx_purge_view_update_only_debug_basic.test new file mode 100644 index 00000000000..d7207515fe1 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_trx_purge_view_update_only_debug_basic.test @@ -0,0 +1,54 @@ +--source include/have_innodb.inc +--source include/have_debug.inc + +SET @start_global_value = @@global.innodb_trx_purge_view_update_only_debug; +SELECT @start_global_value; + +# +# exists as global only +# +select @@global.innodb_trx_purge_view_update_only_debug in (0, 1); +select @@global.innodb_trx_purge_view_update_only_debug; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.innodb_trx_purge_view_update_only_debug; +show global variables like 'innodb_trx_purge_view_update_only_debug'; +show session variables like 'innodb_trx_purge_view_update_only_debug'; +select * from information_schema.global_variables where variable_name='innodb_trx_purge_view_update_only_debug'; +select * from information_schema.session_variables where variable_name='innodb_trx_purge_view_update_only_debug'; + +# +# show that it's writable +# +set global innodb_trx_purge_view_update_only_debug=1; +select @@global.innodb_trx_purge_view_update_only_debug; +select * from information_schema.global_variables where variable_name='innodb_trx_purge_view_update_only_debug'; +select * from information_schema.session_variables where variable_name='innodb_trx_purge_view_update_only_debug'; +set @@global.innodb_trx_purge_view_update_only_debug=0; +select @@global.innodb_trx_purge_view_update_only_debug; +select * from information_schema.global_variables where variable_name='innodb_trx_purge_view_update_only_debug'; +select * from information_schema.session_variables where variable_name='innodb_trx_purge_view_update_only_debug'; +--error ER_GLOBAL_VARIABLE +set session innodb_trx_purge_view_update_only_debug='some'; +--error ER_GLOBAL_VARIABLE +set @@session.innodb_trx_purge_view_update_only_debug='some'; + +# +# incorrect types +# +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_trx_purge_view_update_only_debug=1.1; +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_trx_purge_view_update_only_debug='foo'; +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_trx_purge_view_update_only_debug=-2; +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_trx_purge_view_update_only_debug=1e1; +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_trx_purge_view_update_only_debug=2; + +# +# Cleanup +# + +SET @@global.innodb_trx_purge_view_update_only_debug = @start_global_value; +SELECT @@global.innodb_trx_purge_view_update_only_debug; diff --git a/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test b/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test deleted file mode 100644 index e616a807a38..00000000000 --- a/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test +++ /dev/null @@ -1,216 +0,0 @@ -############## mysql-test\t\ndb_log_update_as_write_basic.test ############### -# # -# Variable Name: ndb_log_update_as_write # -# Scope: GLOBAL # -# Access Type: Dynamic # -# Data Type: boolean # -# Default Value: # -# Range: # -# # -# # -# Creation Date: 2008-02-07 # -# Author: Rizwan # -# # -# Description: Test Cases of Dynamic System Variable ndb_log_update_as_write # -# that checks the behavior of this variable in the following ways# -# * Default Value # -# * Valid & Invalid values # -# * Scope & Access method # -# * Data Integrity # -# # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # -# # -############################################################################### -############## mysql-test\t\ndb_log_update_as_write_basic.test ################ -# # -# Variable Name: ndb_log_update_as_write # -# Scope: GLOBAL & SESSION # -# Access Type: Dynamic # -# Data Type: Numeric # -# Default Value: 1 # -# Range: 1 - 65536 # -# # -# # -# Creation Date: 2008-02-07 # -# Author: Rizwan Maredia # -# # -# Description: Test Cases of Dynamic System Variable ndb_log_update_as_write # -# that checks the behavior of this variable in the following ways # -# * Default Value # -# * Valid & Invalid values # -# * Scope & Access method # -# * Data Integrity # -# # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # -# # -################################################################################ -################# mysql-test\t\ndb_log_update_as_write_basic.test ###### -# # -# # -# Creation Date: 2008-02-07 # -# Author: Rizwan Maredia # -# # -# Description: Test Cases of Dynamic System Variable # -# ndb_log_update_as_write that check behavior of this # -# variable with valid values, invalid values, # -# accessing variable with scope that is # -# allowed and with scope that is now allowed. # -# Scope: Global # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system # -# -variables.html # -# # -######################################################################## - ---source include/load_sysvars.inc - -######################################################################## -# START OF ndb_log_update_as_write TESTS # -######################################################################## - - -################################################################################ -# Saving initial value of ndb_log_update_as_write in a temporary variable # -################################################################################ - - ---Error ER_UNKNOWN_SYSTEM_VARIABLE -SET @global_start_value = @@global.ndb_log_update_as_write; ---Error ER_UNKNOWN_SYSTEM_VARIABLE -SELECT @@global.ndb_log_update_as_write; - ---echo 'Bug: The value is not a system variable or atleast not supported in version 5.1.22' - - ---echo '#--------------------FN_DYNVARS_102_01------------------------#' -######################################################################## -# Display the DEFAULT value of ndb_log_update_as_write # -######################################################################## - -#SET @@ndb_log_update_as_write = 0; -#SET @@ndb_log_update_as_write = DEFAULT; -#SELECT @@ndb_log_update_as_write; -# -#SET @@ndb_log_update_as_write = 1; -#SET @@ndb_log_update_as_write = DEFAULT; -#SELECT @@ndb_log_update_as_write; - - ---echo '#---------------------FN_DYNVARS_102_02-------------------------#' -############################################################################# -# Check if ndb_log_update_as_write can be accessed with and without @@ sign # -############################################################################# - -#SET ndb_log_update_as_write = 1; -#SELECT @@ndb_log_update_as_write; -#--Error ER_UNKNOWN_TABLE -#SELECT global.ndb_log_update_as_write; -# -#SET global ndb_log_update_as_write = 1; -#SELECT @@global.ndb_log_update_as_write; - - ---echo '#--------------------FN_DYNVARS_102_03------------------------#' -######################################################################## -# Change the value of ndb_log_update_as_write to a valid value # -######################################################################## - -#SET @@global.ndb_log_update_as_write = 0; -#SELECT @@global.ndb_log_update_as_write; -#SET @@global.ndb_log_update_as_write = 1; -#SELECT @@global.ndb_log_update_as_write; -## a value of 2 is used to just flush logs and then shutdown cold. -#SET @@global.ndb_log_update_as_write = 2; -#SELECT @@global.ndb_log_update_as_write; - ---echo '#--------------------FN_DYNVARS_102_04-------------------------#' -########################################################################### -# Change the value of ndb_log_update_as_write to invalid value # -########################################################################### - -#--Error ER_WRONG_VALUE_FOR_VAR -#SET @@global.ndb_log_update_as_write = -1; -#--Error ER_WRONG_VALUE_FOR_VAR -#SET @@global.ndb_log_update_as_write = TRU; -#--Error ER_WRONG_VALUE_FOR_VAR -#SET @@global.ndb_log_update_as_write = TRUE_F; -#--Error ER_WRONG_VALUE_FOR_VAR -#SET @@global.ndb_log_update_as_write = FALS; -#--Error ER_WRONG_VALUE_FOR_VAR -#SET @@global.ndb_log_update_as_write = OON; -#--Error ER_WRONG_VALUE_FOR_VAR -#SET @@global.ndb_log_update_as_write = ONN; -#--Error ER_WRONG_VALUE_FOR_VAR -#SET @@global.ndb_log_update_as_write = OOFF; -#--Error ER_WRONG_VALUE_FOR_VAR -#SET @@global.ndb_log_update_as_write = 0FF; -#--Error ER_WRONG_VALUE_FOR_VAR -#SET @@global.ndb_log_update_as_write = ' 1'; -#--Error ER_WRONG_VALUE_FOR_VAR -#SET @@global.ndb_log_update_as_write = "0 "; - - - ---echo '#-------------------FN_DYNVARS_102_05----------------------------#' -########################################################################### -# Test if accessing session ndb_log_update_as_write gives error # -########################################################################### - -#--Error ER_LOCAL_VARIABLE -#SET @@session.ndb_log_update_as_write = 0; -#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR -#SET @@ndb_log_update_as_write = 0; -#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR -#SET @@local.ndb_log_update_as_write = 0; -#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR -#SELECT @@session.ndb_log_update_as_write; -#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR -#SELECT @@local.ndb_log_update_as_write; - ---echo '#----------------------FN_DYNVARS_102_06------------------------#' -######################################################################### -# Check if the value in SESSION Table contains variable value # -######################################################################### - -#SELECT count(VARIABLE_VALUE) AS res_is_0 FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='ndb_log_update_as_write'; - - ---echo '#----------------------FN_DYNVARS_102_07------------------------#' -######################################################################### -# Check if the value in GLOBAL Table matches value in variable # -######################################################################### - -#SELECT @@global.ndb_log_update_as_write = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='ndb_log_update_as_write'; - - ---echo '#---------------------FN_DYNVARS_102_08-------------------------#' -################################################################### -# Check if ON and OFF values can be used on variable # -################################################################### - -#SET @@ndb_log_update_as_write = OFF; -#SELECT @@ndb_log_update_as_write; -#SET @@ndb_log_update_as_write = ON; -#SELECT @@ndb_log_update_as_write; - ---echo '#---------------------FN_DYNVARS_102_09----------------------#' -################################################################### -# Check if TRUE and FALSE values can be used on variable # -################################################################### - -#SET @@ndb_log_update_as_write = TRUE; -#SELECT @@ndb_log_update_as_write; -#SET @@ndb_log_update_as_write = 'FALSE'; -#SELECT @@ndb_log_update_as_write; - -############################## -# Restore initial value # -############################## - -#SET @@ndb_log_update_as_write = @global_start_value; -#SELECT @@ndb_log_update_as_write; - -######################################################################## -# END OF ndb_log_update_as_write TESTS # -######################################################################## diff --git a/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test b/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test deleted file mode 100644 index c00ecf2e2fa..00000000000 --- a/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test +++ /dev/null @@ -1,216 +0,0 @@ -############## mysql-test\t\ndb_log_updated_only_basic.test ############### -# # -# Variable Name: ndb_log_updated_only # -# Scope: GLOBAL # -# Access Type: Dynamic # -# Data Type: boolean # -# Default Value: # -# Range: # -# # -# # -# Creation Date: 2008-02-07 # -# Author: Rizwan # -# # -# Description: Test Cases of Dynamic System Variable ndb_log_updated_only # -# that checks the behavior of this variable in the following ways# -# * Default Value # -# * Valid & Invalid values # -# * Scope & Access method # -# * Data Integrity # -# # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # -# # -############################################################################### -############## mysql-test\t\ndb_log_updated_only_basic.test ################ -# # -# Variable Name: ndb_log_updated_only # -# Scope: GLOBAL & SESSION # -# Access Type: Dynamic # -# Data Type: Numeric # -# Default Value: 1 # -# Range: 1 - 65536 # -# # -# # -# Creation Date: 2008-02-07 # -# Author: Rizwan Maredia # -# # -# Description: Test Cases of Dynamic System Variable ndb_log_updated_only # -# that checks the behavior of this variable in the following ways # -# * Default Value # -# * Valid & Invalid values # -# * Scope & Access method # -# * Data Integrity # -# # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # -# # -################################################################################ -################# mysql-test\t\ndb_log_updated_only_basic.test ######### -# # -# # -# Creation Date: 2008-02-07 # -# Author: Rizwan Maredia # -# # -# Description: Test Cases of Dynamic System Variable # -# ndb_log_updated_only that check behavior of this # -# variable with valid values, invalid values, # -# accessing variable with scope that is # -# allowed and with scope that is now allowed. # -# Scope: Global # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system # -# -variables.html # -# # -######################################################################## - ---source include/load_sysvars.inc - -######################################################################## -# START OF ndb_log_updated_only TESTS # -######################################################################## - - -################################################################################ -# Saving initial value of ndb_log_updated_only in a temporary variable # -################################################################################ - - ---Error ER_UNKNOWN_SYSTEM_VARIABLE -SET @global_start_value = @@global.ndb_log_updated_only; ---Error ER_UNKNOWN_SYSTEM_VARIABLE -SELECT @@global.ndb_log_updated_only; - ---echo 'Bug: The value is not a system variable or atleast not supported in version 5.1.22' - - ---echo '#--------------------FN_DYNVARS_103_01------------------------#' -######################################################################## -# Display the DEFAULT value of ndb_log_updated_only # -######################################################################## - -#SET @@ndb_log_updated_only = 0; -#SET @@ndb_log_updated_only = DEFAULT; -#SELECT @@ndb_log_updated_only; -# -#SET @@ndb_log_updated_only = 1; -#SET @@ndb_log_updated_only = DEFAULT; -#SELECT @@ndb_log_updated_only; - - ---echo '#---------------------FN_DYNVARS_103_02-------------------------#' -############################################################################# -# Check if ndb_log_updated_only can be accessed with and without @@ sign # -############################################################################# - -#SET ndb_log_updated_only = 1; -#SELECT @@ndb_log_updated_only; -#--Error ER_UNKNOWN_TABLE -#SELECT global.ndb_log_updated_only; -# -#SET global ndb_log_updated_only = 1; -#SELECT @@global.ndb_log_updated_only; - - ---echo '#--------------------FN_DYNVARS_103_03------------------------#' -######################################################################## -# Change the value of ndb_log_updated_only to a valid value # -######################################################################## - -#SET @@global.ndb_log_updated_only = 0; -#SELECT @@global.ndb_log_updated_only; -#SET @@global.ndb_log_updated_only = 1; -#SELECT @@global.ndb_log_updated_only; -## a value of 2 is used to just flush logs and then shutdown cold. -#SET @@global.ndb_log_updated_only = 2; -#SELECT @@global.ndb_log_updated_only; - ---echo '#--------------------FN_DYNVARS_103_04-------------------------#' -########################################################################### -# Change the value of ndb_log_updated_only to invalid value # -########################################################################### - -#--Error ER_WRONG_VALUE_FOR_VAR -#SET @@global.ndb_log_updated_only = -1; -#--Error ER_WRONG_VALUE_FOR_VAR -#SET @@global.ndb_log_updated_only = TRU; -#--Error ER_WRONG_VALUE_FOR_VAR -#SET @@global.ndb_log_updated_only = TRUE_F; -#--Error ER_WRONG_VALUE_FOR_VAR -#SET @@global.ndb_log_updated_only = FALS; -#--Error ER_WRONG_VALUE_FOR_VAR -#SET @@global.ndb_log_updated_only = OON; -#--Error ER_WRONG_VALUE_FOR_VAR -#SET @@global.ndb_log_updated_only = ONN; -#--Error ER_WRONG_VALUE_FOR_VAR -#SET @@global.ndb_log_updated_only = OOFF; -#--Error ER_WRONG_VALUE_FOR_VAR -#SET @@global.ndb_log_updated_only = 0FF; -#--Error ER_WRONG_VALUE_FOR_VAR -#SET @@global.ndb_log_updated_only = ' 1'; -#--Error ER_WRONG_VALUE_FOR_VAR -#SET @@global.ndb_log_updated_only = "0 "; - - - ---echo '#-------------------FN_DYNVARS_103_05----------------------------#' -########################################################################### -# Test if accessing session ndb_log_updated_only gives error # -########################################################################### - -#--Error ER_LOCAL_VARIABLE -#SET @@session.ndb_log_updated_only = 0; -#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR -#SET @@ndb_log_updated_only = 0; -#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR -#SET @@local.ndb_log_updated_only = 0; -#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR -#SELECT @@session.ndb_log_updated_only; -#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR -#SELECT @@local.ndb_log_updated_only; - ---echo '#----------------------FN_DYNVARS_103_06------------------------#' -######################################################################### -# Check if the value in SESSION Table contains variable value # -######################################################################### - -#SELECT count(VARIABLE_VALUE) AS res_is_0 FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='ndb_log_updated_only'; - - ---echo '#----------------------FN_DYNVARS_103_07------------------------#' -######################################################################### -# Check if the value in GLOBAL Table matches value in variable # -######################################################################### - -#SELECT @@global.ndb_log_updated_only = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='ndb_log_updated_only'; - - ---echo '#---------------------FN_DYNVARS_103_08-------------------------#' -################################################################### -# Check if ON and OFF values can be used on variable # -################################################################### - -#SET @@ndb_log_updated_only = OFF; -#SELECT @@ndb_log_updated_only; -#SET @@ndb_log_updated_only = ON; -#SELECT @@ndb_log_updated_only; - ---echo '#---------------------FN_DYNVARS_103_09----------------------#' -################################################################### -# Check if TRUE and FALSE values can be used on variable # -################################################################### - -#SET @@ndb_log_updated_only = TRUE; -#SELECT @@ndb_log_updated_only; -#SET @@ndb_log_updated_only = 'FALSE'; -#SELECT @@ndb_log_updated_only; - -############################## -# Restore initial value # -############################## - -#SET @@ndb_log_updated_only = @global_start_value; -#SELECT @@ndb_log_updated_only; - -######################################################################## -# END OF ndb_log_updated_only TESTS # -######################################################################## diff --git a/mysql-test/suite/sys_vars/t/pseudo_slave_mode_basic.test b/mysql-test/suite/sys_vars/t/pseudo_slave_mode_basic.test new file mode 100644 index 00000000000..3ef39bb8667 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/pseudo_slave_mode_basic.test @@ -0,0 +1,168 @@ +####################### mysql-test\t\pseudo_slave_mode_basic.test ################### +# # +# Variable Name: pseudo_slave_mode # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: # +# Valid Values: 0,1 # +# # +# # +# Creation Date: 2012-11-16 # +# # +# Description: Test Cases of Dynamic System Variable pseudo_slave_mode # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.5/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +######################################################################## +# START OF pseudo_slave_mode TESTS # +######################################################################## + + +############################################################################## +# Saving initial value of pseudo_slave_mode in a temporary variable # +############################################################################## + +SET @session_start_value = @@session.pseudo_slave_mode; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_156_01------------------------#' +######################################################################## +# Display the DEFAULT value of pseudo_slave_mode # +######################################################################## + +SET @@session.pseudo_slave_mode = 0; +SET @@session.pseudo_slave_mode = DEFAULT; +SELECT @@session.pseudo_slave_mode; + +SET @@session.pseudo_slave_mode = 1; +SET @@session.pseudo_slave_mode = DEFAULT; +SELECT @@session.pseudo_slave_mode; + + +--echo '#---------------------FN_DYNVARS_156_02-------------------------#' +############################################################################# +# Check if pseudo_slave_mode can be accessed with and without @@ sign # +############################################################################# + +SET pseudo_slave_mode = 1; +SELECT @@pseudo_slave_mode; + +--Error ER_UNKNOWN_TABLE +SELECT session.pseudo_slave_mode; + +--Error ER_UNKNOWN_TABLE +SELECT local.pseudo_slave_mode; + +SET session pseudo_slave_mode = 0; +SELECT @@session.pseudo_slave_mode; + + +--echo '#--------------------FN_DYNVARS_156_03------------------------#' +######################################################################## +# change the value of pseudo_slave_mode to a valid value # +######################################################################## + +SET @@session.pseudo_slave_mode = 0; +SELECT @@session.pseudo_slave_mode; +SET @@session.pseudo_slave_mode = 1; +SELECT @@session.pseudo_slave_mode; + + +--echo '#--------------------FN_DYNVARS_156_04-------------------------#' +########################################################################### +# Change the value of pseudo_slave_mode to invalid value # +########################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.pseudo_slave_mode = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.pseudo_slave_mode = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.pseudo_slave_mode = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.pseudo_slave_mode = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.pseudo_slave_mode = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.pseudo_slave_mode = ÕN; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.pseudo_slave_mode = OF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.pseudo_slave_mode = ÓFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.pseudo_slave_mode = '¹'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.pseudo_slave_mode = NO; + + +--echo '#-------------------FN_DYNVARS_156_05----------------------------#' +########################################################################### +# Test if accessing global pseudo_slave_mode gives error # +########################################################################### + +--error ER_LOCAL_VARIABLE +SET @@global.pseudo_slave_mode = 0; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@global.pseudo_slave_mode; + +--echo '#----------------------FN_DYNVARS_156_06------------------------#' +######################################################################### +# Check if the value in SESSION Table contains variable value # +######################################################################### + +SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='pseudo_slave_mode'; + +--echo '#----------------------FN_DYNVARS_156_07------------------------#' +######################################################################### +# Check if the value in SESSION Table matches value in variable # +######################################################################### + +SELECT IF(@@session.pseudo_slave_mode, "ON", "OFF") = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='pseudo_slave_mode'; +SELECT @@session.pseudo_slave_mode; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='pseudo_slave_mode'; + +--echo '#---------------------FN_DYNVARS_156_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@session.pseudo_slave_mode = OFF; +SELECT @@session.pseudo_slave_mode; +SET @@session.pseudo_slave_mode = ON; +SELECT @@session.pseudo_slave_mode; + +--echo '#---------------------FN_DYNVARS_156_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@session.pseudo_slave_mode = TRUE; +SELECT @@session.pseudo_slave_mode; +SET @@session.pseudo_slave_mode = FALSE; +SELECT @@session.pseudo_slave_mode; + +############################## +# Restore initial value # +############################## + +SET @@session.pseudo_slave_mode = @session_start_value; +SELECT @@session.pseudo_slave_mode; + +############################################################### +# END OF pseudo_slave_mode TESTS # +############################################################### diff --git a/mysql-test/t/bug13633383.test b/mysql-test/t/bug13633383.test index 72eb2f81c98..e31d4a8c9f6 100644 --- a/mysql-test/t/bug13633383.test +++ b/mysql-test/t/bug13633383.test @@ -5,19 +5,19 @@ CREATE TABLE t1 ( `a` int(11) DEFAULT NULL, `col432` bit(8) DEFAULT NULL, - `col433` multipoint DEFAULT NULL, - `col434` polygon DEFAULT NULL, + `col433` geometry DEFAULT NULL, + `col434` geometry DEFAULT NULL, `col435` decimal(50,17) unsigned DEFAULT NULL, `col436` geometry NOT NULL, `col437` tinyblob NOT NULL, - `col438` multipolygon DEFAULT NULL, + `col438` geometry DEFAULT NULL, `col439` mediumblob NOT NULL, `col440` tinyblob NOT NULL, `col441` double unsigned DEFAULT NULL ); CREATE TABLE t2 ( - `a` multipoint DEFAULT NULL, + `a` geometry DEFAULT NULL, `col460` date DEFAULT NULL, `col461` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `col462` date NOT NULL, @@ -34,7 +34,7 @@ CREATE TABLE t3 ( `col579` bit(38) NOT NULL, `col580` varchar(93) NOT NULL, `col581` datetime DEFAULT NULL, - `col583` multipolygon DEFAULT NULL, + `col583` geometry DEFAULT NULL, `col584` bit(47) NOT NULL ); diff --git a/mysql-test/t/cache_temporal_4265.test b/mysql-test/t/cache_temporal_4265.test new file mode 100644 index 00000000000..6135438f023 --- /dev/null +++ b/mysql-test/t/cache_temporal_4265.test @@ -0,0 +1,11 @@ +# +# MDEV-4265 5.5 is slower than 5.3 because of many str_to_datetime calls +# +--source include/have_debug.inc + +create table t1 (a date); +insert t1 values ('2000-01-02'), ('2001-02-03'), ('2002-03-04'); +set debug_dbug='d,str_to_datetime_warn'; +select * from t1 where a > date_add('2000-01-01', interval 5 day); +drop table t1; + diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index 4cf5cccc254..381c87c635c 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -343,3 +343,18 @@ SELECT 1 FROM t1 JOIN v1 ON 1 > (SELECT 1 FROM v2); DROP TABLE t1, t2; DROP VIEW v1, v2; set optimizer_switch=@save_derived_optimizer_switch; + +# +# MDEV-614 lp:1050806 - different result for a query using subquery between 5.5.25 and 5.5.27 +# MySQL Bug#66845 Wrong result (extra row) on a FROM subquery with a variable and ORDER BY +# +create table t1 (n bigint(20) unsigned, d1 datetime, d2 datetime, key (d1)); +insert t1 values (2085,'2012-01-01 00:00:00','2013-01-01 00:00:00'); +insert t1 values (2084,'2012-02-01 00:00:00','2013-01-01 00:00:00'); +insert t1 values (2088,'2012-03-01 00:00:00','2013-01-01 00:00:00'); +select * from ( + select n, d1, d2, @result := 0 as result + from t1 + where d1 < '2012-12-12 12:12:12' and n in (2085, 2084) order by d2 asc +) as calculated_result; +drop table t1; diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test index c7705294ef2..4b7e76e11ca 100644 --- a/mysql-test/t/derived_view.test +++ b/mysql-test/t/derived_view.test @@ -1512,6 +1512,40 @@ set optimizer_switch=@save3912_optimizer_switch; drop table t1, t2, t3; --echo # +--echo # MDEV-4209: equi-join on BLOB column from materialized view +--echo # or derived table +--echo # + +set @save_optimizer_switch=@@optimizer_switch; +set optimizer_switch='derived_with_keys=on'; + +CREATE TABLE t1 (c1 text, c2 int); +INSERT INTO t1 VALUES ('a',1), ('c',3), ('g',7), ('d',4), ('c',3); +CREATE TABLE t2 (c1 text, c2 int); +INSERT INTO t2 VALUES ('b',2), ('c',3); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; + +EXPLAIN EXTENDED +SELECT v1.c1, v1.c2 FROM v1, t2 WHERE v1.c1=t2.c1 AND v1.c2=t2.c2; +SELECT v1.c1, v1.c2 FROM v1, t2 WHERE v1.c1=t2.c1 AND v1.c2=t2.c2; + +EXPLAIN EXTENDED +SELECT t2.c1, t2.c2 FROM (SELECT c1 g, MAX(c2) m FROM t1 GROUP BY c1) t, t2 + WHERE t.g=t2.c1 AND t.m=t2.c2; +SELECT t2.c1, t2.c2 FROM (SELECT c1 g, MAX(c2) m FROM t1 GROUP BY c1) t, t2 + WHERE t.g=t2.c1 AND t.m=t2.c2; + +EXPLAIN EXTENDED +SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1; +SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1; + +DROP VIEW v1; +DROP TABLE t1,t2; + +set optimizer_switch=@save_optimizer_switch; + + +--echo # --echo # end of 5.3 tests --echo # diff --git a/mysql-test/t/dyncol.test b/mysql-test/t/dyncol.test index de30cac610a..c817e7209f6 100644 --- a/mysql-test/t/dyncol.test +++ b/mysql-test/t/dyncol.test @@ -552,6 +552,62 @@ select hex(COLUMN_CREATE(0, COLUMN_GET(COLUMN_CREATE(0, 0.0 as decimal), 0 as de select hex(COLUMN_CREATE(0, 0.0 as decimal)); --echo # +--echo # MDEV-4292: parse error when selecting on views using dynamic column +--echo # +create table t1 (i int, d blob); + +create view v1 as select i, column_get(d, 1 as binary) as a from t1; +select * from v1; +show create view v1; +drop view v1; + +create view v1 as select i, column_get(d, 1 as int) as a from t1; +select * from v1; +show create view v1; +drop view v1; + +create view v1 as select i, column_get(d, 1 as unsigned int) as a from t1; +select * from v1; +show create view v1; +drop view v1; + +create view v1 as select i, column_get(d, 1 as date) as a from t1; +select * from v1; +show create view v1; +drop view v1; + +create view v1 as select i, column_get(d, 1 as time) as a from t1; +select * from v1; +show create view v1; +drop view v1; + +create view v1 as select i, column_get(d, 1 as datetime) as a from t1; +select * from v1; +show create view v1; +drop view v1; + +create view v1 as select i, column_get(d, 1 as decimal) as a from t1; +select * from v1; +show create view v1; +drop view v1; + +create view v1 as select i, column_get(d, 1 as double) as a from t1; +select * from v1; +show create view v1; +drop view v1; + +create view v1 as select i, column_get(d, 1 as char) as a from t1; +select * from v1; +show create view v1; +drop view v1; + +drop table t1; + +--echo # +--echo # end of 5.3 tests +--echo # + +--echo # --echo # test of symbolic names --echo # --echo # creation test (names) diff --git a/mysql-test/t/func_date_add.test b/mysql-test/t/func_date_add.test index fc5a5cb2823..5f27978347c 100644 --- a/mysql-test/t/func_date_add.test +++ b/mysql-test/t/func_date_add.test @@ -88,3 +88,15 @@ select b + interval a day from t1; drop table t1; --echo End of 5.0 tests + +# +# MDEV-4284 Assertion `cmp_items[(uint)cmp_type]' fails in sql/item_cmpfunc.cc +# + +create table t1 (a varchar(10)); +insert t1 values ('2000-12-03'),('2008-05-03'); +select * from t1 where case a when adddate( '2012-12-12', 7 ) then true end; +drop table t1; + +--echo End of 5.5 tests + diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 89c6c0fe534..97766fefa91 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -1372,7 +1372,16 @@ set @@optimizer_switch=@save_optimizer_switch; --echo # DROP TABLE IF EXISTS t1,t2,t3,empty1; -### +# +# MDEV-4286 Server crashes in Protocol_text::store, stack smashing detected +# +create table t1 (i int, d date); +insert into t1 values (1, '2008-10-02'), (2, '2010-12-12'); +select avg(export_set( 3, 'y', sha(i))), group_concat(d) from t1 group by d order by i; +drop table t1; + +#### End of 5.3 tests + --echo # --echo # Bug#52123 Assertion failed: aggregator == aggr->Aggrtype(), --echo # file .\item_sum.cc, line 587 diff --git a/mysql-test/t/func_group_innodb.test b/mysql-test/t/func_group_innodb.test index 6706792d162..06405808d79 100644 --- a/mysql-test/t/func_group_innodb.test +++ b/mysql-test/t/func_group_innodb.test @@ -159,7 +159,20 @@ SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date = DROP TABLE t1; ---echo # End of test BUG#12713907 +--echo # +--echo # MDEV-4269: crash when grouping by values() +--echo # + +SELECT @@storage_engine INTO @old_engine; +set storage_engine=innodb; + +create table y select 1 b; +select 1 from y group by b; +select 1 from y group by values(b); +drop table y; +SET storage_engine=@old_engine; + +### End of 5.1 tests --echo # --echo # Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index d8d8f4538e1..f245b4f9f78 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -1385,6 +1385,24 @@ LOAD DATA INFILE 'bug58165.txt' INTO TABLE t1; SELECT * FROM t1; DROP TABLE t1; +# +# MDEV-759 lp:998340 - Valgrind complains on simple selects containing expression DAY(FROM_UNIXTIME(-1)) +# +SELECT SUBSTRING('1', DAY(FROM_UNIXTIME(-1))); +SELECT LEFT('1', DAY(FROM_UNIXTIME(-1))); +SELECT RIGHT('1', DAY(FROM_UNIXTIME(-1))); +SELECT REPEAT('1', DAY(FROM_UNIXTIME(-1))); +SELECT RPAD('hi', DAY(FROM_UNIXTIME(-1)),'?'); +SELECT LPAD('hi', DAY(FROM_UNIXTIME(-1)),'?'); + +# +# MDEV-4289 Assertion `0' fails in make_sortkey with GROUP_CONCAT, MAKE_SET, GROUP BY +# +create table t1 (i int); +insert into t1 values (null),(8); +select group_concat( i ), make_set( i, 'a', 'b' ) field from t1 group by field; +drop table t1; + --echo End of 5.1 tests --echo Start of 5.4 tests @@ -1502,11 +1520,6 @@ round( --connection default SET @@global.max_allowed_packet:= @tmp_max; --disconnect newconn - ---echo # ---echo # End of 5.5 tests ---echo # - # # Bug#11765562 58545: # EXPORT_SET() CAN BE USED TO MAKE ENTIRE SERVER COMPLETELY UNRESPONSIVE @@ -1517,3 +1530,16 @@ SELECT @@global.max_allowed_packet; SELECT CHAR_LENGTH(EXPORT_SET(1,1,1,REPEAT(1,100000000))); SET @@global.max_allowed_packet:= @tmp_max; +--echo # +--echo # MDEV-4272: DIV operator crashes in Item_func_int_div::val_int +--echo # (incorrect NULL value handling by convert) +--echo # +create table t1(a int) select null; +select 1 div convert(a using utf8) from t1; +drop table t1; + + +--echo # +--echo # End of 5.5 tests +--echo # + diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 57ef68595bf..f65681a6c5b 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -1174,3 +1174,13 @@ select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010') --error ER_TOO_BIG_PRECISION select now(258); + +# +# MDEV-4293 Valgrind warnings (Conditional jump or move depends on uninitialised value) in remove_eq_conds on time functions with NULL argument in WHERE +# +SELECT 1 FROM DUAL WHERE YEAR(TIMEDIFF(NULL, '12:12:12')); +SELECT 1 FROM DUAL WHERE MONTH(TIMEDIFF(NULL, '12:12:12')); +SELECT 1 FROM DUAL WHERE DAYOFMONTH(TIMEDIFF(NULL, '12:12:12')); +SELECT 1 FROM DUAL WHERE HOUR(TIMEDIFF(NULL, '12:12:12')); +SELECT 1 FROM DUAL WHERE MINUTE(TIMEDIFF(NULL, '12:12:12')); +SELECT 1 FROM DUAL WHERE SECOND(TIMEDIFF(NULL, '12:12:12')); diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test index e7e6fa59df0..731efe5648e 100644 --- a/mysql-test/t/gis-rtree.test +++ b/mysql-test/t/gis-rtree.test @@ -120,7 +120,7 @@ INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText(' drop table t1; CREATE TABLE t1 ( - line LINESTRING NOT NULL, + line GEOMETRY NOT NULL, kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po', name VARCHAR(32), @@ -935,7 +935,7 @@ DROP TABLE t1; --echo # and invalid spatial data --echo # -CREATE TABLE t1(a LINESTRING NOT NULL, b GEOMETRY NOT NULL, +CREATE TABLE t1(a POINT NOT NULL, b GEOMETRY NOT NULL, SPATIAL KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM; INSERT INTO t1 VALUES(GEOMFROMTEXT("point (0 0)"), GEOMFROMTEXT("point (1 1)")); --error ER_CANT_CREATE_GEOMETRY_OBJECT diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index b0ad8329cfb..cff93fc13ee 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -741,7 +741,7 @@ SET @a=POLYFROMWKB(@a); # Bug #57321 crashes and valgrind errors from spatial types # -create table t1(a polygon NOT NULL)engine=myisam; +create table t1(a geometry NOT NULL)engine=myisam; insert into t1 values (geomfromtext("point(0 1)")); insert into t1 values (geomfromtext("point(1 0)")); select * from (select polygon(t1.a) as p from t1 order by t1.a) d; @@ -759,6 +759,87 @@ create spatial index i on t1 (a); drop table t1; +# +# Bug#11767480 - SPATIAL INDEXES ON NON-SPATIAL COLUMNS CAUSE CRASHES. +# +CREATE TABLE t0 (a BINARY(32) NOT NULL); +--error ER_WRONG_ARGUMENTS +CREATE SPATIAL INDEX i on t0 (a); +INSERT INTO t0 VALUES (1); + +--error ER_WRONG_ARGUMENTS +CREATE TABLE t1( + col0 BINARY NOT NULL, + col2 TIMESTAMP, + SPATIAL INDEX i1 (col0) +) ENGINE=MyISAM; + +# Test other ways to add indices +CREATE TABLE t1 ( + col0 BINARY NOT NULL, + col2 TIMESTAMP +) ENGINE=MyISAM; + +--error ER_WRONG_ARGUMENTS +CREATE SPATIAL INDEX idx0 ON t1(col0); + +--error ER_WRONG_ARGUMENTS +ALTER TABLE t1 ADD SPATIAL INDEX i1 (col0); + +CREATE TABLE t2 ( + col0 INTEGER NOT NULL, + col1 POINT, + col2 POINT +); + +--error ER_WRONG_ARGUMENTS +CREATE SPATIAL INDEX idx0 ON t2 (col1, col2); + +--error ER_WRONG_ARGUMENTS +CREATE TABLE t3 ( + col0 INTEGER NOT NULL, + col1 POINT, + col2 LINESTRING, + SPATIAL INDEX i1 (col1, col2) +); + +# cleanup +DROP TABLE t0, t1, t2; + + +--echo # +--echo # BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS +--echo # +SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))); + +--echo # +--echo # BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN +--echo # GEOMETRY FUNCTION ARGUMENTS +--echo # +--replace_regex /non geometric .* value/non geometric '' value/ +--error ER_ILLEGAL_VALUE_FOR_TYPE +SELECT GEOMETRYCOLLECTION((SELECT @@OLD)); + +--echo # +--echo # MDEV-4252 geometry query crashes server +--echo # +select astext(0x0100000000030000000100000000000010); +select astext(st_centroid(0x0100000000030000000100000000000010)); +select astext(st_exteriorring(0x0100000000030000000100000000000010)); +select envelope(0x0100000000030000000100000000000010); +select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1); +select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1); + +--echo # +--echo # MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy +--echo # + +SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) ))); + +--echo # +--echo # MDEV-4295 Server crashes in get_point on a query with Area, AsBinary, MultiPoint +--echo # +SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2)))); --echo End of 5.1 tests #bug 850775 ST_AREA does not work on GEOMETRYCOLLECTIONs in maria-5.3-gis @@ -1293,6 +1374,7 @@ WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1; #WHERE lakes.name = 'Blue Lake'; DROP DATABASE gis_ogs; +USE test; --echo # --echo # BUG #1043845 st_distance() results are incorrect depending on variable order @@ -1308,25 +1390,18 @@ select st_distance(geomfromtext('point(-95.96269500000000000000 36.1418183333333 -95.9673057475387 36.1344478941074, -95.9673063519371 36.134484524621, -95.9673049102515 36.1343976584193) ')) ; -USE test; - --echo # ---echo # BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS +--echo # MDEV-4310 geometry function equals hangs forever. --echo # -SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))); - ---echo # ---echo # BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN ---echo # GEOMETRY FUNCTION ARGUMENTS ---echo # ---replace_regex /non geometric .* value/non geometric '' value/ ---error ER_ILLEGAL_VALUE_FOR_TYPE -SELECT GEOMETRYCOLLECTION((SELECT @@OLD)); - - ---echo End of 5.1 tests +create table t1(a geometry not null)engine=myisam; +insert into t1 values(geomfromtext("POINT(0 0)")); +insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)")); +insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)")); +select equals(`a`,convert(`a` using utf8)) from `t1`; +drop table t1; +--echo End of 5.3 tests --echo # --echo # Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE @@ -1358,4 +1433,13 @@ SELECT 1 FROM g1 WHERE a >= ANY DROP TABLE g1; +--echo # +--echo # MDEV-3819 missing constraints for spatial column types +--echo # + +create table t1 (pt point); +--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))')); +drop table t1; + --echo End of 5.5 tests diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 3c6f997f28e..8a2e847fb94 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1322,6 +1322,80 @@ SELECT 1 FROM t1 GROUP BY SUBSTRING(SYSDATE() FROM 'K' FOR 'jxW<'); DROP TABLE t1; SET SQL_BIG_TABLES=0; +--echo # +--echo # MDEV-641 LP:1002108 - Wrong result (or crash) from a query with duplicated field in the group list and a limit clause +--echo # Bug#11761078: 53534: INCORRECT 'SELECT SQL_BIG_RESULT...' +--echo # WITH GROUP BY ON DUPLICATED FIELDS +--echo # + +CREATE TABLE t1( + col1 int, + UNIQUE INDEX idx (col1)); + +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10), + (11),(12),(13),(14),(15),(16),(17),(18),(19),(20); + +let $query0=SELECT col1 AS field1, col1 AS field2 + FROM t1 GROUP BY field1, field2; + +# Needs to be range to exercise bug +--eval EXPLAIN $query0; +FLUSH STATUS; +--eval $query0; +SHOW SESSION STATUS LIKE 'Sort_scan%'; + +let $query=SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2 + FROM t1 GROUP BY field1, field2; + +# Needs to be range to exercise bug +--eval EXPLAIN $query; +FLUSH STATUS; +--eval $query; +SHOW SESSION STATUS LIKE 'Sort_scan%'; + +CREATE VIEW v1 AS SELECT * FROM t1; + +SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2 +FROM v1 +GROUP BY field1, field2; + +SELECT SQL_BIG_RESULT tbl1.col1 AS field1, tbl2.col1 AS field2 +FROM t1 as tbl1, t1 as tbl2 +GROUP BY field1, field2 +LIMIT 3; + +explain +select col1 f1, col1 f2 from t1 order by f2, f1; +select col1 f1, col1 f2 from t1 order by f2, f1; + +explain +select col1 f1, col1 f2 from t1 group by f2 order by f2, f1; +select col1 f1, col1 f2 from t1 group by f2 order by f2, f1; + +explain +select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1; +select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1; + +CREATE TABLE t2( + col1 int, + col2 int, + UNIQUE INDEX idx (col1, col2)); + +INSERT INTO t2(col1, col2) VALUES + (1,20),(2,19),(3,18),(4,17),(5,16),(6,15),(7,14),(8,13),(9,12),(10,11), + (11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1); + +explain +select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3; +select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3; + +explain +select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3; +select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3; + +DROP VIEW v1; +DROP TABLE t1, t2; + --echo # End of 5.1 tests --echo # diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test index 19f7cbe40a1..82097c53fe0 100644 --- a/mysql-test/t/group_min_max.test +++ b/mysql-test/t/group_min_max.test @@ -1204,6 +1204,64 @@ drop table t1; --echo End of 5.1 tests +--echo # +--echo # MDEV-765 lp:825075 - Wrong result with GROUP BY + multipart key + MIN/MAX loose scan +--echo # + +CREATE TABLE t1 (a varchar(1), b varchar(1), KEY (b,a)); +INSERT INTO t1 VALUES +('0',NULL),('9',NULL),('8','c'),('4','d'),('7','d'),(NULL,'f'), +('7','f'),('8','g'),(NULL,'j'); + +explain +SELECT max(a) , b FROM t1 WHERE a IS NULL OR b = 'z' GROUP BY b; +SELECT max(a) , b FROM t1 WHERE a IS NULL OR b = 'z' GROUP BY b; + +explain +SELECT b, min(a) FROM t1 WHERE a = '7' OR b = 'z' GROUP BY b; +SELECT b, min(a) FROM t1 WHERE a = '7' OR b = 'z' GROUP BY b; + +explain +SELECT b, min(a) FROM t1 WHERE (a = b OR b = 'd' OR b is NULL) GROUP BY b; +SELECT b, min(a) FROM t1 WHERE (a = b OR b = 'd' OR b is NULL) GROUP BY b; + +explain +SELECT b, min(a) FROM t1 WHERE a > ('0' = b) AND b = 'z' GROUP BY b; +SELECT b, min(a) FROM t1 WHERE a > ('0' = b) AND b = 'z' GROUP BY b; + +explain +SELECT b, min(a) FROM t1 WHERE a > '0' AND (b < (a = '7')) GROUP BY b; +SELECT b, min(a) FROM t1 WHERE a > '0' AND (b < (a = '7')) GROUP BY b; + +explain +SELECT b, min(a) FROM t1 WHERE (a > '0' AND (a > '1' OR b = 'd')) GROUP BY b; +SELECT b, min(a) FROM t1 WHERE (a > '0' AND (a > '1' OR b = 'd')) GROUP BY b; + +drop table t1; + +--echo # +--echo # MDEV-4140 Wrong result with GROUP BY + multipart key + MIN/MAX loose scan and a subquery +--echo # + +CREATE TABLE t1 (a int, b int, KEY (b, a)) ; +INSERT INTO t1 VALUES (0,99),(9,99),(4,0),(7,0),(99,0),(7,0),(8,0),(99,0),(1,0); +CREATE TABLE t2 (c int) ; +INSERT INTO t2 VALUES (0),(1); + +EXPLAIN +SELECT MIN(a), b FROM t1 WHERE a > 0 GROUP BY b; +SELECT MIN(a), b FROM t1 WHERE a > 0 GROUP BY b; +EXPLAIN +SELECT MIN(a), b FROM t1 WHERE a > ( SELECT c FROM t2 WHERE c = 0 ) GROUP BY b; +SELECT MIN(a), b FROM t1 WHERE a > ( SELECT c FROM t2 WHERE c = 0 ) GROUP BY b; +# this test is for 5.5 to ensure that the subquery is expensive +EXPLAIN +SELECT MIN(a), b FROM t1 WHERE a > ( SELECT min(c) FROM t2, t1 t1a, t1 t1b WHERE c = 0 ) GROUP BY b; +SELECT MIN(a), b FROM t1 WHERE a > ( SELECT min(c) FROM t2, t1 t1a, t1 t1b WHERE c = 0 ) GROUP BY b; + +drop table t1, t2; + +--echo End of 5.3 tests --echo # --echo # WL#3220 (Loose index scan for COUNT DISTINCT) @@ -1342,4 +1400,3 @@ explain SELECT f1, COUNT(DISTINCT f2) FROM t1 GROUP BY f1; drop table t1; --echo # End of test#50539. - diff --git a/mysql-test/t/information_schema_all_engines-master.opt b/mysql-test/t/information_schema_all_engines-master.opt index 085c81d34bb..0a9fa574e49 100644 --- a/mysql-test/t/information_schema_all_engines-master.opt +++ b/mysql-test/t/information_schema_all_engines-master.opt @@ -2,9 +2,10 @@ --loose-innodb-buffer-pool-pages --loose-innodb-buffer-pool-pages-blob --loose-innodb-buffer-pool-pages-index +--loose-innodb-changed-pages --loose-innodb-cmp ---loose-innodb-cmpmem-reset --loose-innodb-cmp-reset +--loose-innodb-cmpmem-reset --loose-innodb-index-stats --loose-innodb-lock-waits --loose-innodb-rseg diff --git a/mysql-test/t/innodb_ext_key.test b/mysql-test/t/innodb_ext_key.test index 3e82403ddb5..31c6fca2b95 100644 --- a/mysql-test/t/innodb_ext_key.test +++ b/mysql-test/t/innodb_ext_key.test @@ -414,6 +414,7 @@ INSERT INTO t1 (a) VALUES (4), (6); INSERT INTO t2 (b) VALUES (0), (8); set @save_optimizer_switch=@@optimizer_switch; +set @save_join_cache_level=@@join_cache_level; SET join_cache_level=3; SET optimizer_switch='join_cache_hashed=on'; @@ -424,6 +425,7 @@ EXPLAIN SELECT * FROM t1, t2 WHERE b=a; SELECT * FROM t1, t2 WHERE b=a; +set join_cache_level=@save_join_cache_level; set optimizer_switch=@save_optimizer_switch; DROP TABLE t1,t2; @@ -466,6 +468,78 @@ set optimizer_switch=@save_optimizer_switch; DROP TABLE t1; +--echo # +--echo # Bug mdev-4220: using ref instead of eq_ref +--echo # with extended_keys=on +--echo # (performance regression introduced in the patch for mdev-3851) +--echo # + +set @save_optimizer_switch=@@optimizer_switch; + +create table t1 (a int not null) engine=innodb; + +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t2 ( + pk int primary key, a int not null, b int, unique(a) +)engine=innodb; + +insert into t2 +select + A.a + 10 * B.a, A.a + 10 * B.a, A.a + 10 * B.a +from t1 A, t1 B; + +set optimizer_switch='extended_keys=off'; +explain +select * from t1, t2 where t2.a=t1.a and t2.b < 2; +flush status; +select * from t1, t2 where t2.a=t1.a and t2.b < 2; +show status like 'handler_read%'; + +set optimizer_switch='extended_keys=on'; +explain +select * from t1, t2 where t2.a=t1.a and t2.b < 2; +flush status; +select * from t1, t2 where t2.a=t1.a and t2.b < 2; +show status like 'handler_read%'; + +drop table t1,t2; + +# this test case did not demonstrate any regression +# it is added for better testing + +create table t1(a int) engine=myisam; +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t2(a int) engine=myisam; +insert into t2 select A.a + 10*B.a + 100*C.a from t1 A, t1 B, t1 C; + +create table t3 ( + pk1 int not null, pk2 int not null, col1 int not null, col2 int not null) +engine=innodb; +insert into t3 select a,a,a,a from t2; +alter table t3 add primary key (pk1, pk2); +alter table t3 add key (col1, col2); + +set optimizer_switch='extended_keys=off'; +--replace_column 9 # +explain +select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a; +--replace_column 9 # +explain +select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a; + +set optimizer_switch='extended_keys=on'; +--replace_column 9 # +explain +select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a; +--replace_column 9 # +explain +select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a; + +drop table t1,t2,t3; + +set optimizer_switch=@save_optimizer_switch; + set optimizer_switch=@save_ext_key_optimizer_switch; SET SESSION STORAGE_ENGINE=DEFAULT; - diff --git a/mysql-test/t/join_cache.test b/mysql-test/t/join_cache.test index 9b04c264faf..2d06c3e2a30 100644 --- a/mysql-test/t/join_cache.test +++ b/mysql-test/t/join_cache.test @@ -3594,7 +3594,7 @@ DROP TABLE t1,t2,t3; CREATE TABLE t1 ( col269 decimal(31,10) unsigned DEFAULT NULL, - col280 multipoint DEFAULT NULL, + col280 geometry DEFAULT NULL, col281 tinyint(1) DEFAULT NULL, col282 time NOT NULL, col284 datetime DEFAULT NULL, diff --git a/mysql-test/t/keywords.test b/mysql-test/t/keywords.test index 08016313ca7..6717cb44fbf 100644 --- a/mysql-test/t/keywords.test +++ b/mysql-test/t/keywords.test @@ -162,3 +162,14 @@ call p2(); DROP PROCEDURE p1; DROP PROCEDURE p2; DROP TABLE t1; + +# +# OPTION is not anymore a keyword +# + +create table option (option int not null); +drop table option; +--error 1064 +set option=1; +--error 1193 +set option option=1; diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 4066fcb264b..7e198275730 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -226,19 +226,19 @@ drop table t3,t1,t2; # # temporary merge tables # -CREATE TABLE t1 (c1 INT NOT NULL); -CREATE TABLE t2 (c1 INT NOT NULL); -INSERT INTO t1 VALUES (1); -INSERT INTO t2 VALUES (2); -CREATE TEMPORARY TABLE t3 (c1 INT NOT NULL) ENGINE=MRG_MYISAM UNION=(t1,t2); -SELECT * FROM t3; -CREATE TEMPORARY TABLE t4 (c1 INT NOT NULL); -CREATE TEMPORARY TABLE t5 (c1 INT NOT NULL); -INSERT INTO t4 VALUES (4); -INSERT INTO t5 VALUES (5); -CREATE TEMPORARY TABLE t6 (c1 INT NOT NULL) ENGINE=MRG_MYISAM UNION=(t4,t5); -SELECT * FROM t6; -DROP TABLE t6, t3, t1, t2, t4, t5; +create table t1 (a int not null); +create table t2 (a int not null); +insert into t1 values (1); +insert into t2 values (2); +create temporary table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2); +select * from t3; +create temporary table t4 (a int not null); +create temporary table t5 (a int not null); +insert into t4 values (1); +insert into t5 values (2); +create temporary table t6 (a int not null) ENGINE=MERGE UNION=(t4,t5); +select * from t6; +drop table t6, t3, t1, t2, t4, t5; # # Bug#19627 - temporary merge table locking # MERGE table and its children must match in temporary type. @@ -622,14 +622,6 @@ SHOW CREATE TABLE m1; DROP TABLE t1, m1; # -# BUG#35274 - merge table doesn't need any base tables, gives error 124 when -# key accessed -# -CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge; -SELECT MAX(a) FROM t1; -DROP TABLE t1; - -# # BUG#32047 - 'Spurious' errors while opening MERGE tables # CREATE TABLE t1(a INT); @@ -1306,9 +1298,9 @@ DROP TABLE t1, t2, t3; # Truncate failed with error message when table was in use by MERGE. # # Show that truncate of child table after use of parent table works. -CREATE TABLE t1 (c1 INT) ENGINE=MyISAM; -CREATE TABLE t2 (c1 INT) ENGINE=MyISAM; -CREATE TABLE t3 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2); +CREATE TABLE t1 (c1 INT) ENGINE= MyISAM; +CREATE TABLE t2 (c1 INT) ENGINE= MyISAM; +CREATE TABLE t3 (c1 INT) ENGINE= MRG_MYISAM UNION= (t1, t2); INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (2); SELECT * FROM t3; @@ -1840,6 +1832,51 @@ DROP TABLE m1, t1; --echo End of 5.1 tests +--echo # +--echo # MDEV-4277: Crash inside mi_killed_in_mariadb() with myisammrg +--echo # +create table t1 (a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t2 ( i int ) engine=myisam; +insert into t2 values (1),(2); + +create table t3 (a int, b int, filler char(100), key(a), key(b)) engine=myisam; +create table t4 like t3; +insert into t3 + select A.a+10*B.a+100*C.a, + A.a+10*B.a+100*C.a, + 'filler-data-FILLER-DATA-qqq' + from t1 A, t1 B, t1 C where C.a < 5; +insert into t4 + select A.a+10*B.a+100*C.a, + A.a+10*B.a+100*C.a, + 'filler-data-FILLER-DATA-qqq' + from t1 A, t1 B, t1 C where C.a >= 5; + +create table t5 like t3; +alter table t5 engine=merge; +alter table t5 union(t3, t4); + +update t5 set b=999, a=999 where b>950; + +explain +select * from t2, t5 where t5.a=999 and t5.b=999; +select * from t2, t5 where t5.a=999 and t5.b=999; + +drop table t5; +drop table t1,t2,t3,t4; + +--echo End of 5.3 tests + +# +# BUG#35274 - merge table doesn't need any base tables, gives error 124 when +# key accessed +# +CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge; +SELECT MAX(a) FROM t1; +DROP TABLE t1; + --echo # --echo # An additional test case for Bug#27430 Crash in subquery code --echo # when in PS and table DDL changed after PREPARE @@ -2845,3 +2882,4 @@ eval set global storage_engine=$default; # Check that all connections opened by test cases in this file are really # gone so execution of other tests won't be affected by their presence. --source include/wait_until_count_sessions.inc + diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 48735304aad..e0a35ca2bb9 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -696,6 +696,55 @@ DROP FUNCTION f1; DROP TABLE t1; --echo # +--echo # MDEV-4123: Incorrect results after multi-table update or +--echo # assertion `!table || (!table->read_set || +--echo # bitmap_is_set(table->read_set, field_index))' failure +--echo # + +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( + id int(10) unsigned NOT NULL, + level tinyint(3) unsigned NOT NULL, + PRIMARY KEY (id) +); +INSERT INTO t1 VALUES (2519583,1); + +DROP TABLE IF EXISTS t2; +CREATE TABLE t2 ( + club_id int(11) NOT NULL DEFAULT '0', + profile_id int(11) NOT NULL DEFAULT '0', + member_level_id int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (profile_id,club_id) +); +INSERT INTO t2 VALUES (2,2519583,12); + +DROP TABLE IF EXISTS t3; +CREATE TABLE t3 ( + member_level_id int(11) unsigned NOT NULL DEFAULT '0', + map_level int(11) unsigned NOT NULL DEFAULT '0', + map_status int(11) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (member_level_id) +); +INSERT INTO t3 VALUES (12,12,1); + +CREATE + VIEW v1 AS + select club_id,profile_id, + map_level AS member_level_id,map_status AS member_status + from (t2 tc join t3 map + on(((tc.member_level_id = map.member_level_id) and + (club_id = 2)))); + +select level, count(*) as cnt from t1 group by level; +UPDATE t1 c LEFT JOIN v1 t ON (c.id = t.profile_id AND t.club_id = 2) + SET c.level = IF (t.member_status IS NULL, 1, IF (t.member_status = 1, 2,3)); +select level, count(*) as cnt from t1 group by level; +drop view v1; +drop table t1,t2,t3; + +--echo end of tests + +--echo # --echo # BUG#57373: Multi update+InnoDB reports ER_KEY_NOT_FOUND if a --echo # table is updated twice --echo # @@ -759,6 +808,5 @@ SELECT * FROM t2; DROP TABLE t1,t2; - - +--echo end of 5.5 tests diff --git a/mysql-test/t/myisam-metadata.test b/mysql-test/t/myisam-metadata.test new file mode 100644 index 00000000000..c5327aa3a71 --- /dev/null +++ b/mysql-test/t/myisam-metadata.test @@ -0,0 +1,49 @@ +# +# Test bugs in MyISAM that may cause problems for metadata +# + +--source include/big_test.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +# +# LP:989055 - Querying myisam table metadata may corrupt the table +# + +CREATE TABLE t1 ( + id INT PRIMARY KEY, + a VARCHAR(100), + INDEX(a) +) ENGINE=MyISAM; +ALTER TABLE t1 DISABLE KEYS; + +let $1=100000; +--disable_query_log +while ($1) +{ + eval insert into t1 values($1, "line number $1"); + dec $1; +} +--enable_query_log + +--connect(con1,localhost,root,,) +--send + ALTER TABLE t1 ENABLE KEYS; + +--connection default +--let $wait_timeout=10 +--let $show_statement= SHOW PROCESSLIST +--let $field= State +--let $condition= = 'Repair by sorting' +--source include/wait_show_condition.inc + +--replace_column 7 # 8 # 9 # 12 # 13 # 14 # +SHOW TABLE STATUS LIKE 't1'; + +--connection con1 +--reap +--connection default +--disconnect con1 +DROP TABLE t1; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 4199d98073c..8323890b028 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1536,10 +1536,10 @@ drop table t1; # CREATE TABLE t1 (line LINESTRING NOT NULL) engine=myisam; -INSERT INTO t1 VALUES (GeomFromText("POINT(0 0)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(0 0)")); checksum table t1; CREATE TABLE t2 (line LINESTRING NOT NULL) engine=myisam; -INSERT INTO t2 VALUES (GeomFromText("POINT(0 0)")); +INSERT INTO t2 VALUES (GeomFromText("LINESTRING(0 0)")); checksum table t2; CREATE TABLE t3 select * from t1; checksum table t3; @@ -1582,22 +1582,6 @@ SELECT h+0, d + 0, e, g + 0 FROM t1; DROP TABLE t1; ---echo # ---echo # Test of BUG#35570 CHECKSUM TABLE unreliable if LINESTRING field ---echo # (same content / differen checksum) ---echo # - -CREATE TABLE t1 (line LINESTRING NOT NULL) engine=myisam; -INSERT INTO t1 VALUES (GeomFromText("POINT(0 0)")); -checksum table t1; -CREATE TABLE t2 (line LINESTRING NOT NULL) engine=myisam; -INSERT INTO t2 VALUES (GeomFromText("POINT(0 0)")); -checksum table t2; -CREATE TABLE t3 select * from t1; -checksum table t3; -drop table t1,t2,t3; - - # # BUG#47073 - valgrind errs, corruption,failed repair of partition, # low myisam_sort_buffer_size diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index 71a985654ef..662cd4c7c0c 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -593,6 +593,15 @@ create database `aa``bb````cc`; --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/backticks.sql drop database `aa``bb````cc`; +# +# MySQL Bug#13639125 DELIMITER STRIPS THE NEXT NEW LINE IN A SQL STATEMENT +# +--write_file $MYSQLTEST_VARDIR/tmp/13639125.sql +select ">> +delimiter +<<" as a; +EOF +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/13639125.sql --echo --echo End of tests diff --git a/mysql-test/t/mysqld--help.test b/mysql-test/t/mysqld--help.test index 806e6f7f8d1..4b5572c2bbe 100644 --- a/mysql-test/t/mysqld--help.test +++ b/mysql-test/t/mysqld--help.test @@ -23,8 +23,11 @@ perl; datadir slave-load-tmpdir tmpdir socket/; # Plugins which may or may not be there: - @plugins=qw/innodb ndb archive blackhole federated partition ndbcluster feedback debug temp-pool ssl des-key-file - xtradb thread-concurrency super-large-pages mutex-deadlock-detector null-audit maria aria pbxt oqgraph sphinx thread-handling thread-pool/; + @plugins=qw/innodb ndb archive blackhole federated partition ndbcluster + feedback debug temp-pool ssl des-key-file + xtradb thread-concurrency super-large-pages + mutex-deadlock-detector null-audit maria aria pbxt oqgraph + sphinx thread-handling thread-pool query-cache-info/; # And substitute the content some environment variables with their # names: diff --git a/mysql-test/t/mysqlshow.test b/mysql-test/t/mysqlshow.test index fc5d4d982e5..cf8661d090c 100644 --- a/mysql-test/t/mysqlshow.test +++ b/mysql-test/t/mysqlshow.test @@ -29,7 +29,7 @@ select "---- -v -v -t ------" as ""; DROP TABLE t1, t2; -if (`select count(*) from information_schema.plugins where plugin_name='innodb' and plugin_auth_version > "1.1.8-29.3"`) +if (`select count(*) from information_schema.plugins where plugin_name='innodb' and plugin_auth_version > "5.5.31"`) { # because of lp:1066512 this test shows xtradb I_S plugins, even when # xtradb is supposed to be disabled diff --git a/mysql-test/t/partition_rename_longfilename.test b/mysql-test/t/partition_rename_longfilename.test index 5e454f01da7..51d9c583f56 100644 --- a/mysql-test/t/partition_rename_longfilename.test +++ b/mysql-test/t/partition_rename_longfilename.test @@ -1,4 +1,5 @@ -- source include/not_windows.inc +-- source include/support_long_file_names.inc -- source include/have_partition.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 44eaf7130a7..af507b1f7ef 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -4460,5 +4460,24 @@ INSERT INTO t2 VALUES (3),(4); SELECT * FROM t1, t2 WHERE a=3 AND a=b; drop table t1,t2; +--echo # +--echo # Bug mdev-4250: wrong transformation of WHERE condition with OR +--echo # + +CREATE TABLE t1 (pk int PRIMARY KEY, a int); +INSERT INTO t1 VALUES (3,0), (2,0), (4,1), (5,0), (1,0); + +SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0; +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0; + +DROP TABLE t1; + +SELECT * FROM mysql.time_zone +WHERE ( NOT (Use_leap_seconds <= Use_leap_seconds AND Time_zone_id != 1) + AND Time_zone_id = Time_zone_id + OR Time_zone_id <> Time_zone_id ) + AND Use_leap_seconds <> 'N'; + --echo End of 5.3 tests diff --git a/mysql-test/t/subselect_sj2_mat.test b/mysql-test/t/subselect_sj2_mat.test index 7c3b37b517a..61d9b09edff 100644 --- a/mysql-test/t/subselect_sj2_mat.test +++ b/mysql-test/t/subselect_sj2_mat.test @@ -36,4 +36,230 @@ WHERE a IN DROP TABLE t1, t2; set max_join_size= @tmp_906385; +--echo # +--echo # mdev-3995: Wrong result for semijoin with materialization +--echo # + +set @save_optimizer_switch=@@optimizer_switch; + +CREATE TABLE t1 ( + cat_id int(10) unsigned NOT NULL, + PRIMARY KEY (cat_id) +) ENGINE=MyISAM; + +INSERT INTO t1 VALUES +(709411),(709412),(709413),(709414),(709416),(709417),(709418),(709419),(709421),(709422), +(709424),(709425),(709427),(709428),(709429),(709431),(709432),(709433),(709434),(709435), +(709438),(709439),(709441),(709442),(709443),(709444),(709445),(709446),(709447),(709450), +(709451),(709454),(709455),(709456),(709457),(709459),(709460),(709461),(709462),(709463), +(709464),(709465),(709467),(709469),(709470),(709471),(709472),(709473),(709474),(709475), +(709476),(709477),(709478),(709479),(709480),(709481),(709483),(709484),(709485),(709487), +(709490),(709491),(709492),(709493),(709494),(709495),(709496),(709497),(709498),(709499), +(709500),(709501),(709502),(709503),(709504),(709505),(709506),(709507),(709509),(709510), +(709511),(709512),(709513),(709514),(709515),(709516),(709517),(709518),(709519),(709520), +(709521),(709522),(709523),(709524),(709525),(709526),(709527),(709528),(709529),(709530), +(709531),(709532),(709533),(709534),(709535),(709536),(709537),(709538),(709539),(709540), +(709541),(709542),(709543),(709544),(709545),(709546),(709548),(709549),(709551),(709552), +(709553),(709555),(709556),(709557),(709558),(709559),(709560),(709561),(709562),(709563), +(709564),(709565),(709566),(709567),(709568),(709569),(709570),(709571),(709572),(709573), +(709574),(709575),(709576),(709577),(709578),(709579),(709580),(709581),(709582),(709583), +(709584),(709585),(709586),(709587),(709588),(709590),(709591),(709592),(709593),(709594), +(709595),(709596),(709597),(709598),(709600),(709601),(709602),(709603),(709604),(709605), +(709606),(709608),(709609),(709610),(709611),(709612),(709613),(709614),(709615),(709616), +(709617),(709618),(709619),(709620),(709621),(709622),(709623),(709624),(709625),(709626), +(709627),(709628),(709629),(709630),(709631),(709632),(709633),(709634),(709635),(709637), +(709638),(709639),(709640),(709641),(709642),(709643),(709644),(709645),(709646),(709649), +(709650),(709651),(709652),(709653),(709654),(709655),(709656),(709657),(709658),(709659); + +CREATE TABLE t2 ( + cat_id int(10) NOT NULL, + KEY cat_id (cat_id) +) ENGINE=MyISAM; + +INSERT INTO t2 VALUES +(708742),(708755),(708759),(708761),(708766),(708769),(708796),(708798),(708824),(708825), +(708838),(708844),(708861),(708882),(708887),(708889),(708890),(709586),(709626); + +CREATE TABLE t3 ( + sack_id int(10) unsigned NOT NULL, + kit_id tinyint(3) unsigned NOT NULL DEFAULT '0', + cat_id int(10) unsigned NOT NULL, + PRIMARY KEY (sack_id,kit_id,cat_id) +) ENGINE=MyISAM; + +INSERT INTO t3 VALUES +(33479,6,708523),(33479,6,708632),(33479,6,709085),(33479,6,709586),(33479,6,709626); + +CREATE TABLE t4 ( + cat_id int(10) unsigned NOT NULL, + KEY cat_id (cat_id) +) ENGINE=MyISAM; + +INSERT INTO t4 (cat_id) SELECT cat_id from t2; + +set optimizer_switch='materialization=off'; + +EXPLAIN +SELECT count(*) FROM t1, t3 + WHERE t1.cat_id = t3.cat_id AND + t3.cat_id IN (SELECT cat_id FROM t2) AND + t3.sack_id = 33479 AND t3.kit_id = 6; + +SELECT count(*) FROM t1, t3 + WHERE t1.cat_id = t3.cat_id AND + t3.cat_id IN (SELECT cat_id FROM t2) AND + t3.sack_id = 33479 AND t3.kit_id = 6; + +set optimizer_switch='materialization=on'; + +EXPLAIN +SELECT count(*) FROM t1, t3 + WHERE t1.cat_id = t3.cat_id AND + t3.cat_id IN (SELECT cat_id FROM t4) AND + t3.sack_id = 33479 AND t3.kit_id = 6; + +SELECT count(*) FROM t1, t3 + WHERE t1.cat_id = t3.cat_id AND + t3.cat_id IN (SELECT cat_id FROM t4) AND + t3.sack_id = 33479 AND t3.kit_id = 6; + +EXPLAIN +SELECT count(*) FROM t1, t3 + WHERE t1.cat_id = t3.cat_id AND + t3.cat_id IN (SELECT cat_id FROM t2) AND + t3.sack_id = 33479 AND t3.kit_id = 6; + +SELECT count(*) FROM t1, t3 + WHERE t1.cat_id = t3.cat_id AND + t3.cat_id IN (SELECT cat_id FROM t2) AND + t3.sack_id = 33479 AND t3.kit_id = 6; + + +DROP TABLE t1,t2,t3,t4; + +set optimizer_switch=@save_optimizer_switch; + +--echo # +--echo # mdev-3913: LEFT JOIN with materialized multi-table IN subquery in WHERE +--echo # + +set @save_optimizer_switch=@@optimizer_switch; + +CREATE TABLE t1 (a1 char(1), b1 char(1), index idx(b1,a1)); +INSERT INTO t1 VALUES ('f','c'),('d','m'),('g','y'); +INSERT INTO t1 VALUES ('f','c'),('d','m'),('g','y'); + +CREATE TABLE t2 (a2 char(1), b2 char(1)); +INSERT INTO t2 VALUES ('y','y'),('y','y'),('w','w'); + +CREATE TABLE t3 (a3 int); +INSERT INTO t3 VALUES (8),(6); + +CREATE TABLE t4 (a4 char(1), b4 char(1)); +INSERT INTO t4 VALUES ('y','y'),('y','y'),('w','w'); + +set optimizer_switch='materialization=off'; + +EXPLAIN EXTENDED +SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 ) + WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4); +SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 ) + WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4); + +set optimizer_switch='materialization=on'; + +EXPLAIN EXTENDED +SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 ) + WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4); +SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 ) + WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4); + +DROP TABLE t1,t2,t3,t4; + +set optimizer_switch=@save_optimizer_switch; + +--echo # +--echo # mdev-4172: LEFT JOIN with materialized multi-table IN subquery in WHERE +--echo # and OR in ON condition +--echo # + +set @save_optimizer_switch=@@optimizer_switch; + +CREATE TABLE t1 (a1 int, c1 varchar(1)); +INSERT t1 VALUES (7,'v'), (3,'y'); + +CREATE TABLE t2 (c2 varchar(1)); +INSERT INTO t2 VALUES ('y'), ('y'); + +CREATE TABLE t3 (c3 varchar(1)); +INSERT INTO t3 VALUES + ('j'), ('v'), ('c'), ('m'), ('d'), + ('d'), ('y'), ('t'), ('d'), ('s'); + +CREATE TABLE t4 (a4 int, c4 varchar(1)); +INSERT INTO t4 SELECT * FROM t1; + +set optimizer_switch='materialization=off'; + +EXPLAIN EXTENDED +SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z') + WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4); +SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z') + WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4); + +set optimizer_switch='materialization=on'; + +EXPLAIN EXTENDED +SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z') + WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4); +SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z') + WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4); + +DROP TABLE t1,t2,t3,t4; + +set optimizer_switch=@save_optimizer_switch; + +--echo # +--echo # mdev-4177: materialization of a subquery whose WHERE condition is OR +--echo # formula with two disjucts such that the second one is always false +--echo # + +set @save_optimizer_switch=@@optimizer_switch; +set @save_join_cache_level=@@join_cache_level; + +CREATE TABLE t1 (i1 int) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1), (7), (4), (8), (4); + +CREATE TABLE t2 (i2 int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (7), (5); + +CREATE TABLE t3 (i3 int) ENGINE=MyISAM; +INSERT INTO t3 VALUES (7), (2), (9); + +set join_cache_level=3; + +set optimizer_switch='materialization=off,semijoin=off'; + +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2); +SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2); + +set optimizer_switch='materialization=on,semijoin=on'; + +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2); +SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2); + +EXPLAIN EXTENDED +SELECT * FROM t1 + WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 0 AND i3 = i2 OR 1=2); +SELECT * FROM t1 + WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 0 AND i3 = i2 OR 1=2); +SELECT * FROM t1 + WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 7 AND i3 = i2 OR 1=2); + +DROP TABLE t1,t2,t3; + +set join_cache_level= @save_join_cache_level; +set optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/t/temporal_scale_4283.test b/mysql-test/t/temporal_scale_4283.test new file mode 100644 index 00000000000..d79ca7caa54 --- /dev/null +++ b/mysql-test/t/temporal_scale_4283.test @@ -0,0 +1,13 @@ +# +# MDEV-4283 Assertion `scale <= precision' fails in strings/decimal.c +# +create table t1 (a int); +insert into t1 values (4),(8); +select distinct 100 mod timestampadd( week, a, '2002-05-20' ) from t1; +drop table t1; + +create table t1 (i int); +insert into t1 values (2),(4); +select distinct convert_tz( '2001-03-21', 'utc', 'met' ) mod i from t1; +drop table t1; + diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index 989e0d29210..d1648254fb2 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -463,6 +463,16 @@ DROP TABLE t1; --echo End of 5.1 tests +# +# MDEV-4281 Assertion `maybe_null && item->null_value' fails in make_sortkey on CASE with different return types, GROUP_CONCAT, GROUP BY +# +create table t1 (d date, t time) engine=myisam; +insert into t1 values ('2000-12-03','22:55:23'),('2008-05-03','10:19:31'); +select case when d = '2012-12-12' then d else t end as cond, group_concat( d ) from t1 group by cond; +drop table t1; + +--echo End of 5.3 tests + --echo # --echo # Start of 5.5 tests --echo # diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test index 2043342e2c8..5b0b70631a5 100644 --- a/mysql-test/t/type_enum.test +++ b/mysql-test/t/type_enum.test @@ -221,3 +221,18 @@ SELECT a FROM t1 WHERE a=0; DROP TABLE t1; --echo End of 5.1 tests + +--echo # +--echo # MDEV-4241: Assertion failure: scale >= 0 && precision > 0 && +--echo # scale <= precision in decimal_bin_size +--echo # +CREATE TABLE t1 ( + f1 enum('1','2','3','4','5') +) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +--enable_metadata +SELECT AVG(f1) FROM t1; +--disable_metadata +drop table t1; + +--echo End of 5.3 tests diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index c6930a7e468..2c889c2cc0c 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -364,7 +364,7 @@ SELECT (@v:=a) <> (@v:=1) FROM t1; DROP TABLE t1; # -# LP BUG#1001506 Crash on a query with GROUP BY and user variables +# lp:1001506 Crash on a query with GROUP BY and user variables # MySQL Bug #11764372 57197: EVEN MORE USER VARIABLE CRASHING FUN # @@ -374,15 +374,49 @@ SELECT DISTINCT @a:=MIN(t1.a) FROM t1, t1 AS t2 GROUP BY @b:=(SELECT COUNT(*) > t2.a); DROP TABLE t1; +# +# +# Bug #12408412: GROUP_CONCAT + ORDER BY + INPUT/OUTPUT +# SAME USER VARIABLE = CRASH +# +SET @bug12408412=1; +SELECT GROUP_CONCAT(@bug12408412 ORDER BY 1) INTO @bug12408412; + --echo End of 5.1 tests # -# Bug#50511: Sometimes wrong handling of user variables containing NULL. +# MDEV-616 lp:1002126 +# Bug #11764371 57196: MORE FUN WITH ASSERTION: !TABLE->FILE || +# TABLE->FILE->INITED == HANDLER:: # ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (0); +SELECT DISTINCT POW(COUNT(*), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 ON @a)) +AS b FROM t1 GROUP BY a; +SELECT @a; +DROP TABLE t1; +CREATE TABLE t1(f1 INT, f2 INT); +INSERT INTO t1 VALUES (1,2),(2,3),(3,1); +CREATE TABLE t2(a INT); +INSERT INTO t2 VALUES (1); +SET @var=NULL; +SELECT @var:=(SELECT f2 FROM t2 WHERE @var) FROM t1 GROUP BY f1 ORDER BY f2 DESC +LIMIT 1; +SELECT @var; +DROP TABLE t1, t2; + +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (0),(1),(3); +SELECT DISTINCT POW(COUNT(distinct a), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 ON @a limit 1)) AS b FROM t1 GROUP BY a; +SELECT @a; +DROP TABLE t1; + +--echo End of 5.2 tests + +# +# Bug#50511: Sometimes wrong handling of user variables containing NULL. +# CREATE TABLE t1(f1 INT AUTO_INCREMENT, PRIMARY KEY(f1)); @@ -415,7 +449,6 @@ SELECT f1, f2 FROM t1 ORDER BY f2; DROP TRIGGER trg1; DROP TABLE t1; - --echo # --echo # Bug #12408412: GROUP_CONCAT + ORDER BY + INPUT/OUTPUT --echo # SAME USER VARIABLE = CRASH @@ -452,6 +485,8 @@ SELECT DISTINCT POW(COUNT(distinct a), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 SELECT @a; DROP TABLE t1; +--echo End of 5.5 tests + --echo # --echo # Check that used memory extends if we set a variable --echo # @@ -466,4 +501,3 @@ eval select $tmp < $tmp2; --enable_column_names --enable_query_log ---echo End of 5.5 tests diff --git a/mysys/errors.c b/mysys/errors.c index 6cc0f083922..ebbdc410901 100644 --- a/mysys/errors.c +++ b/mysys/errors.c @@ -54,7 +54,7 @@ const char *globerrs[GLOBERRS]= "File '%s' (fileno: %d) was not closed", "Can't change ownership of the file '%s' (Errcode: %M)", "Can't change permissions of the file '%s' (Errcode: %M)", - "Can't seek in file '%s' (Errcode: %M)" + "Can't seek in file '%s' (Errcode: %M)", "Can't change mode for file '%s' to 0x%lx (Errcode: %M)", "Warning: Can't copy ownership for file '%s' (Errcode: %M)" }; @@ -108,12 +108,12 @@ void init_glob_errs() void wait_for_free_space(const char *filename, int errors) { if (errors == 0) - my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH), + my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH | ME_JUST_WARNING), filename,my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC); if (!(errors % MY_WAIT_GIVE_USER_A_MESSAGE)) my_printf_error(EE_DISK_FULL, "Retry in %d secs. Message reprinted in %d secs", - MYF(ME_BELL | ME_NOREFRESH), + MYF(ME_BELL | ME_NOREFRESH | ME_JUST_WARNING), MY_WAIT_FOR_USER_TO_FIX_PANIC, MY_WAIT_GIVE_USER_A_MESSAGE * MY_WAIT_FOR_USER_TO_FIX_PANIC ); (void) sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC); diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c index a51d94f8e73..d684be238e6 100644 --- a/mysys/mf_pack.c +++ b/mysys/mf_pack.c @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. - Copyright (c) 2012, Monty Program Ab +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. + Copyright (c) 2012, 2013, Monty Program 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 @@ -12,7 +12,8 @@ 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 */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ #include "mysys_priv.h" #include <m_string.h> @@ -452,10 +453,10 @@ char *intern_filename(char *to, const char *from) char buff[FN_REFLEN + 1]; if (from == to) { /* Dirname may destroy from */ - strmov(buff,from); + (void) strnmov(buff, from, FN_REFLEN); from=buff; } length= dirname_part(to, from, &to_length); /* Copy dirname & fix chars */ - (void) strmov(to + to_length,from+length); + (void) strnmov(to + to_length, from + length, FN_REFLEN - to_length); return (to); } /* intern_filename */ diff --git a/mysys/my_lib.c b/mysys/my_lib.c index 9c8655338c1..f11ea97d328 100644 --- a/mysys/my_lib.c +++ b/mysys/my_lib.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 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 @@ -11,7 +11,8 @@ 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ /* TODO: check for overun of memory for names. */ @@ -96,7 +97,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags) MEM_ROOT *names_storage; DIR *dirp; struct dirent *dp; - char tmp_path[FN_REFLEN+1],*tmp_file; + char tmp_path[FN_REFLEN + 2], *tmp_file; char dirent_tmp[sizeof(struct dirent)+_POSIX_PATH_MAX+1]; DBUG_ENTER("my_dir"); @@ -199,10 +200,11 @@ char * directory_file_name (char * dst, const char *src) { /* Process as Unix format: just remove test the final slash. */ char *end; + DBUG_ASSERT(strlen(src) < (FN_REFLEN + 1)); if (src[0] == 0) src= (char*) "."; /* Use empty as current */ - end=strmov(dst, src); + end= strnmov(dst, src, FN_REFLEN + 1); if (end[-1] != FN_LIBCHAR) { end[0]=FN_LIBCHAR; /* Add last '/' */ diff --git a/mysys/my_write.c b/mysys/my_write.c index 204e2e1488d..3c94fab2ec7 100644 --- a/mysys/my_write.c +++ b/mysys/my_write.c @@ -47,11 +47,17 @@ size_t my_write(File Filedes, const uchar *Buffer, size_t Count, myf MyFlags) #else writtenbytes= write(Filedes, Buffer, Count); #endif - DBUG_EXECUTE_IF("simulate_file_write_error", - { - errno= ENOSPC; - writtenbytes= (size_t) -1; - }); + + /** + To simulate the write error set the errno = error code + and the number pf written bytes to -1. + */ + DBUG_EXECUTE_IF ("simulate_file_write_error", + if (!errors) { + errno= ENOSPC; + writtenbytes= (size_t) -1; + }); + if (writtenbytes == Count) break; if (writtenbytes != (size_t) -1) diff --git a/mysys/thr_rwlock.c b/mysys/thr_rwlock.c index 17fafecd8fd..dd6c625a286 100644 --- a/mysys/thr_rwlock.c +++ b/mysys/thr_rwlock.c @@ -24,7 +24,7 @@ static BOOL have_srwlock= FALSE; /* Prototypes and function pointers for windows functions */ typedef VOID (WINAPI* srw_func) (PSRWLOCK SRWLock); -typedef BOOL (WINAPI* srw_bool_func) (PSRWLOCK SRWLock); +typedef BOOLEAN (WINAPI* srw_bool_func) (PSRWLOCK SRWLock); static srw_func my_InitializeSRWLock; static srw_func my_AcquireSRWLockExclusive; diff --git a/packaging/WiX/custom_ui.wxs b/packaging/WiX/custom_ui.wxs index 568053f4cf5..6e243832e12 100644 --- a/packaging/WiX/custom_ui.wxs +++ b/packaging/WiX/custom_ui.wxs @@ -2,7 +2,7 @@ xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<!--
- Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
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
@@ -30,7 +30,7 @@ <Control Id="Back" Type="PushButton" X="156" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" Disabled="yes" />
<Control Id="Description" Type="Text" X="135" Y="80" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgDescription)" />
<Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgTitle)" />
- <Control Id="CopyrightText" Type="Text" X="135" Y="200" Width="220" Height="40" Transparent="yes" Text="Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved." />
+ <Control Id="CopyrightText" Type="Text" X="135" Y="200" Width="220" Height="40" Transparent="yes" Text="Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved." />
<Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="!(loc.WelcomeDlgBitmap)" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
</Dialog>
diff --git a/packaging/rpm-uln/mysql.spec.sh b/packaging/rpm-uln/mysql.spec.sh index 8b25b160be1..3e2c5c3f11c 100644 --- a/packaging/rpm-uln/mysql.spec.sh +++ b/packaging/rpm-uln/mysql.spec.sh @@ -508,21 +508,28 @@ mkdir release # TODO / FIXME: Do we need "scriptstub"? gcc $CFLAGS $LDFLAGS -o scriptstub "-DLIBDIR=\"%{_libdir}/mysql\"" %{SOURCE4} -# TODO / FIXME: "libmysqld.so" should have been produced above - WORK in PROGRESS +# TODO / FIXME: "libmysqld.so" should have been produced above # regular build will make libmysqld.a but not libmysqld.so :-( cd release mkdir libmysqld/work cd libmysqld/work -ar -x ../libmysqld.a -rm rpl_utility.cc.o sql_binlog.cc.o # Try-and-Error: These modules cause unresolved references -gcc $CFLAGS $LDFLAGS -shared -Wl,-soname,libmysqld.so.0 -o libmysqld.so.0.0.1 \ - *.o \ +# "libmysqld" provides the same ABI as "libmysqlclient", but it implements the server: +# The shared object is identified by the full version, +# for linkage selection the first two levels are sufficient so that upgrades are possible +# (see "man ld", option "-soname"). +SO_FULL='%{mysql_version}' +SO_USE=`echo $SO_FULL | sed -e 's/\([0-9]\.[0-9]\)\.[0-9]*/\1/'` +# These two modules should pull everything else which is needed: +ar -x ../libmysqld.a client.c.o signal_handler.cc.o +gcc $CFLAGS $LDFLAGS -shared -Wl,-soname,libmysqld.so.$SO_USE -o libmysqld.so.$SO_FULL \ + *.o ../libmysqld.a \ -lpthread -lcrypt -laio -lnsl -lssl -lcrypto -lz -lrt -lstdc++ -lm -lc # this is to check that we built a complete library cp %{SOURCE9} . -ln -s libmysqld.so.0.0.1 libmysqld.so.0 -gcc -I../../include -I../../../%{src_dir}/include $CFLAGS mysql-embedded-check.c libmysqld.so.0 -LD_LIBRARY_PATH=. ldd ./a.out +PROGNAME=`basename %{SOURCE9} .c` +ln -s libmysqld.so.$SO_FULL libmysqld.so.$SO_USE +gcc -I../../include -I../../../%{src_dir}/include $CFLAGS -o $PROGNAME %{SOURCE9} libmysqld.so.$SO_USE +LD_LIBRARY_PATH=. ldd $PROGNAME cd ../.. cd .. @@ -618,9 +625,11 @@ mv ${RPM_BUILD_ROOT}%{_bindir}/mysql_config ${RPM_BUILD_ROOT}%{_libdir}/mysql/my install -m 0755 scriptstub ${RPM_BUILD_ROOT}%{_bindir}/mysql_config rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.a -install -m 0755 release/libmysqld/work/libmysqld.so.0.0.1 ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so.0.0.1 -ln -s libmysqld.so.0.0.1 ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so.0 -ln -s libmysqld.so.0 ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so +SO_FULL='%{mysql_version}' +SO_USE=`echo $SO_FULL | sed -e 's/\([0-9]\.[0-9]\)\.[0-9]*/\1/'` +install -m 0755 release/libmysqld/work/libmysqld.so.$SO_FULL ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so.$SO_FULL +ln -s libmysqld.so.$SO_FULL ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so.$SO_USE +ln -s libmysqld.so.$SO_USE ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so rm -f ${RPM_BUILD_ROOT}%{_bindir}/comp_err rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/comp_err.1* @@ -964,6 +973,12 @@ fi %{_mandir}/man1/mysql_client_test.1* %changelog +* Thu Dec 7 2012 Joerg Bruehe <joerg.bruehe@oracle.com> +- Change the way in which "libmysqld.so" is created: Using all object modules + was wrong, gcc / ld can resolve the dependencies from "libmysqld.a". + Also, identify the ".so" version from the MySQL version, "0.0.1" was wrong. + Bug#15972480 + * Tue Sep 18 2012 Joerg Bruehe <joerg.bruehe@oracle.com> - Restrict the vendor check to Oracle: There is no history here which we have to allow for. diff --git a/plugin/auth_examples/CMakeLists.txt b/plugin/auth_examples/CMakeLists.txt index fb27289770f..f6c2b637067 100644 --- a/plugin/auth_examples/CMakeLists.txt +++ b/plugin/auth_examples/CMakeLists.txt @@ -27,5 +27,7 @@ MYSQL_ADD_PLUGIN(qa_auth_server qa_auth_server.c MYSQL_ADD_PLUGIN(qa_auth_client qa_auth_client.c MODULE_ONLY COMPONENT Test) +MYSQL_ADD_PLUGIN(auth_0x0100 auth_0x0100.c MODULE_ONLY COMPONENT Test) + MYSQL_ADD_PLUGIN(mysql_clear_password clear_password_client.c MODULE_ONLY COMPONENT SharedLibraries) diff --git a/plugin/auth_examples/auth_0x0100.c b/plugin/auth_examples/auth_0x0100.c new file mode 100644 index 00000000000..d1373b8a0b4 --- /dev/null +++ b/plugin/auth_examples/auth_0x0100.c @@ -0,0 +1,91 @@ +/* Copyright (C) 2013 Sergei Golubchik and Monty Program 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; version 2 of the + License. + + 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/** + @file + + auth plugin that uses old structures as of + MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0100 + + To test the old version support. + It intentionally uses no constants like CR_OK ok PASSWORD_USED_YES. +*/ + +#include <mysql/plugin.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> + +#if 0 +#include <mysql/plugin_auth.h> +#else +#define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0100 +typedef void MYSQL_PLUGIN_VIO; /* we don't use it here */ + +typedef struct st_mysql_server_auth_info +{ + char *user_name; + unsigned int user_name_length; + const char *auth_string; + unsigned long auth_string_length; + char authenticated_as[49]; + char external_user[512]; + int password_used; + const char *host_or_ip; + unsigned int host_or_ip_length; +} MYSQL_SERVER_AUTH_INFO; + +struct st_mysql_auth +{ + int interface_version; + const char *client_auth_plugin; + int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info); +}; +#endif + +static int do_auth_0x0100(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info) +{ + info->password_used= 1; + strcpy(info->authenticated_as, "zzzzzzzzzzzzzzzz"); + memset(info->external_user, 'o', 510); + info->external_user[510]='.'; + info->external_user[511]=0; + return vio ? -1 : 0; /* use vio to avoid the 'unused' warning */ +} + +static struct st_mysql_auth auth_0x0100_struct= +{ + MYSQL_AUTHENTICATION_INTERFACE_VERSION, 0, do_auth_0x0100 +}; + +maria_declare_plugin(auth_0x0100) +{ + MYSQL_AUTHENTICATION_PLUGIN, + &auth_0x0100_struct, + "auth_0x0100", + "Sergei Golubchik", + "Test for API 0x0100 support", + PLUGIN_LICENSE_GPL, + NULL, + NULL, + 0x0100, + NULL, + NULL, + "1.0", + MariaDB_PLUGIN_MATURITY_EXPERIMENTAL, +} +maria_declare_plugin_end; + diff --git a/plugin/auth_socket/CMakeLists.txt b/plugin/auth_socket/CMakeLists.txt index 731f7d01f9a..ae7dbffe2ae 100644 --- a/plugin/auth_socket/CMakeLists.txt +++ b/plugin/auth_socket/CMakeLists.txt @@ -21,7 +21,19 @@ int main() { struct ucred cred; getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cred, 0); }" HAVE_PEERCRED) + +IF (NOT HAVE_PEERCRED) + # Hi, OpenBSD! + CHECK_CXX_SOURCE_COMPILES( + "#include <sys/types.h> + #include <sys/socket.h> + int main() { + struct sockpeercred cred; + getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cred, 0); + }" HAVE_SOCKPEERCRED) + ADD_DEFINITIONS(-Ducred=sockpeercred) +ENDIF() -IF(HAVE_PEERCRED) +IF(HAVE_PEERCRED OR HAVE_SOCKPEERCRED) MYSQL_ADD_PLUGIN(auth_socket auth_socket.c MODULE_ONLY) ENDIF() diff --git a/plugin/qc_info/CMakeLists.txt b/plugin/qc_info/CMakeLists.txt new file mode 100644 index 00000000000..f9c58f77466 --- /dev/null +++ b/plugin/qc_info/CMakeLists.txt @@ -0,0 +1,4 @@ +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/regex + ${CMAKE_SOURCE_DIR}/extra/yassl/include) + +MYSQL_ADD_PLUGIN(QUERY_CACHE_INFO qc_info.cc) diff --git a/plugin/qc_info/qc_info.cc b/plugin/qc_info/qc_info.cc new file mode 100644 index 00000000000..e20b4dac5ea --- /dev/null +++ b/plugin/qc_info/qc_info.cc @@ -0,0 +1,213 @@ +/* + Copyright (c) 2008, Roland Bouman + http://rpbouman.blogspot.com/ + roland.bouman@gmail.com + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Roland Bouman nor the + names of the contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +/* + * TODO: report query cache flags + */ +#ifndef MYSQL_SERVER +#define MYSQL_SERVER +#endif + +#include <sql_cache.h> +#include <sql_parse.h> // check_global_access +#include <sql_acl.h> // PROCESS_ACL +#include <sql_class.h> // THD +#include <table.h> // ST_SCHEMA_TABLE +#include <mysql/plugin.h> + +class Accessible_Query_Cache : public Query_cache { +public: + HASH *get_queries() + { + return &this->queries; + } +} *qc; + +bool schema_table_store_record(THD *thd, TABLE *table); + +#define MAX_STATEMENT_TEXT_LENGTH 32767 +#define COLUMN_STATEMENT_SCHEMA 0 +#define COLUMN_STATEMENT_TEXT 1 +#define COLUMN_RESULT_BLOCKS_COUNT 2 +#define COLUMN_RESULT_BLOCKS_SIZE 3 +#define COLUMN_RESULT_BLOCKS_SIZE_USED 4 + +/* ST_FIELD_INFO is defined in table.h */ +static ST_FIELD_INFO qc_info_fields[]= +{ + {"STATEMENT_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0}, + {"STATEMENT_TEXT", MAX_STATEMENT_TEXT_LENGTH, MYSQL_TYPE_STRING, 0, 0, 0}, + {"RESULT_BLOCKS_COUNT", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, 0}, + {"RESULT_BLOCKS_SIZE", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, 0}, + {"RESULT_BLOCKS_SIZE_USED", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, 0}, + {0, 0, MYSQL_TYPE_STRING, 0, 0, 0} +}; + +static int qc_info_fill_table(THD *thd, TABLE_LIST *tables, + COND *cond) +{ + int status= 1; + CHARSET_INFO *scs= system_charset_info; + TABLE *table= tables->table; + HASH *queries = qc->get_queries(); + + /* one must have PROCESS privilege to see others' queries */ + if (check_global_access(thd, PROCESS_ACL, true)) + return 0; + + if (qc->try_lock(thd)) + return status; + + /* loop through all queries in the query cache */ + for (uint i= 0; i < queries->records; i++) + { + const uchar *query_cache_block_raw; + Query_cache_block* query_cache_block; + Query_cache_query* query_cache_query; + uint result_blocks_count; + ulonglong result_blocks_size; + ulonglong result_blocks_size_used; + Query_cache_block *first_result_block; + Query_cache_block *result_block; + const char *statement_text; + size_t statement_text_length; + const char *key, *db; + size_t key_length, db_length; + + query_cache_block_raw = my_hash_element(queries, i); + query_cache_block = (Query_cache_block*)query_cache_block_raw; + if (query_cache_block->type != Query_cache_block::QUERY) + continue; + + query_cache_query = query_cache_block->query(); + + /* Get the actual SQL statement for this query cache query */ + statement_text = (const char*)query_cache_query->query(); + statement_text_length = strlen(statement_text); + /* We truncate SQL statements up to MAX_STATEMENT_TEXT_LENGTH in our I_S table */ + table->field[COLUMN_STATEMENT_TEXT]->store((char*)statement_text, + min(statement_text_length, MAX_STATEMENT_TEXT_LENGTH), scs); + + /* get the entire key that identifies this query cache query */ + key = (const char*)query_cache_query_get_key(query_cache_block_raw, + &key_length, 0); + /* The database against which the statement is executed is part of the + query cache query key + */ + compile_time_assert(QUERY_CACHE_DB_LENGTH_SIZE == 2); + db= key + statement_text_length + 1 + QUERY_CACHE_DB_LENGTH_SIZE; + db_length= uint2korr(db - QUERY_CACHE_DB_LENGTH_SIZE); + + table->field[COLUMN_STATEMENT_SCHEMA]->store(db, db_length, scs); + + /* If we have result blocks, process them */ + first_result_block= query_cache_query->result(); + if(first_result_block) + { + /* initialize so we can loop over the result blocks*/ + result_block= first_result_block; + result_blocks_count = 1; + result_blocks_size = result_block->length; + result_blocks_size_used = result_block->used; + + /* loop over the result blocks*/ + while((result_block= result_block->next)!=first_result_block) + { + /* calculate total number of result blocks */ + result_blocks_count++; + /* calculate total size of result blocks */ + result_blocks_size += result_block->length; + /* calculate total of used size of result blocks */ + result_blocks_size_used += result_block->used; + } + } + else + { + result_blocks_count = 0; + result_blocks_size = 0; + result_blocks_size_used = 0; + } + table->field[COLUMN_RESULT_BLOCKS_COUNT]->store(result_blocks_count, 0); + table->field[COLUMN_RESULT_BLOCKS_SIZE]->store(result_blocks_size, 0); + table->field[COLUMN_RESULT_BLOCKS_SIZE_USED]->store(result_blocks_size_used, 0); + + if (schema_table_store_record(thd, table)) + goto cleanup; + } + status = 0; + +cleanup: + qc->unlock(); + return status; +} + +static int qc_info_plugin_init(void *p) +{ + ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p; + + schema->fields_info= qc_info_fields; + schema->fill_table= qc_info_fill_table; + +#ifdef _WIN32 + qc = (Accessible_Query_Cache *) + GetProcAddress(GetModuleHandle(NULL), "?query_cache@@3VQuery_cache@@A"); +#else + qc = (Accessible_Query_Cache *)&query_cache; +#endif + + return qc == 0; +} + + +static struct st_mysql_information_schema qc_info_plugin= +{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION }; + +/* + Plugin library descriptor +*/ + +maria_declare_plugin(query_cache_info) +{ + MYSQL_INFORMATION_SCHEMA_PLUGIN, + &qc_info_plugin, + "QUERY_CACHE_INFO", + "Roland Bouman", + "Lists all queries in the query cache.", + PLUGIN_LICENSE_BSD, + qc_info_plugin_init, /* Plugin Init */ + 0, /* Plugin Deinit */ + 0x0100, /* version, hex */ + NULL, /* status variables */ + NULL, /* system variables */ + "1.0", /* version as a string */ + MariaDB_PLUGIN_MATURITY_ALPHA +} +maria_declare_plugin_end; + diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index b28e8a3ba1c..241cb84a399 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -257,7 +257,7 @@ fi # Now we can get arguments from the groups [mysqld] and [mysql_install_db] # in the my.cfg file, then re-run to merge with command line arguments. -parse_arguments `"$print_defaults" $defaults mysqld mariadb mysql_install_db client-server` +parse_arguments `"$print_defaults" $defaults --mysqld mysql_install_db` parse_arguments PICK-ARGS-FROM-ARGV "$@" # Configure paths to support files diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh index 81015746ae9..cd1b6fc18b7 100644 --- a/scripts/mysqld_multi.sh +++ b/scripts/mysqld_multi.sh @@ -237,7 +237,7 @@ sub defaults_for_group sub init_log { - foreach my $opt (defaults_for_group('mysqld mariadb')) + foreach my $opt (defaults_for_group('--mysqld')) { if ($opt =~ m/^--datadir=(.*)/ && -d "$1" && -w "$1") { diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index f49f885bf5a..572a08781c8 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -71,6 +71,7 @@ Usage: $0 [OPTIONS] --defaults-extra-file=FILE Also use defaults from the specified file --ledir=DIRECTORY Look for mysqld in the specified directory --open-files-limit=LIMIT Limit the number of open files + --crash-script=FILE Script to call when mysqld crashes --timezone=TZ Set the system timezone --malloc-lib=LIB Preload shared library LIB if available --mysqld=FILE Use the specified file as mysqld @@ -202,6 +203,7 @@ parse_arguments() { optname_subst=`echo "$optname" | sed 's/_/-/g'` arg=`echo $arg | sed "s/^$optname/$optname_subst/"` case "$arg" in + --crash-script=*) CRASH_SCRIPT="$val" ;; # these get passed explicitly to mysqld --basedir=*) MY_BASEDIR_VERSION="$val" ;; --datadir=*|--data=*) DATADIR="$val" ;; @@ -501,7 +503,7 @@ append_arg_to_args () { args= SET_USER=2 -parse_arguments `$print_defaults $defaults --loose-verbose mysqld mariadb server client-server` +parse_arguments `$print_defaults $defaults --loose-verbose --mysqld` if test $SET_USER -eq 2 then SET_USER=0 @@ -585,7 +587,7 @@ then log_notice "Logging to '$err_log'." logging=file - if [ ! -e "$err_log" ]; then # if error log already exists, + if [ ! -f "$err_log" ]; then # if error log already exists, touch "$err_log" # we just append. otherwise, chmod "$fmode" "$err_log" # fix the permissions here! fi @@ -799,13 +801,13 @@ have_sleep=1 while true do - rm -f $safe_mysql_unix_port "$pid_file" # Some extra safety + rm -f "$pid_file" # Some extra safety start_time=`date +%M%S` eval_log_error "$cmd" - if [ $want_syslog -eq 0 -a ! -e "$err_log" ]; then + if [ $want_syslog -eq 0 -a ! -f "$err_log" ]; then touch "$err_log" # hypothetical: log was renamed but not chown $user "$err_log" # flushed yet. we'd recreate it with chmod "$fmode" "$err_log" # wrong owner next time we log, so set @@ -874,6 +876,11 @@ do done fi log_notice "mysqld restarted" + if test -n "$CRASH_SCRIPT" + then + crash_script_output=`$CRASH_SCRIPT 2>&1` + log_error "$crash_script_output" + fi done log_notice "mysqld from pid file $pid_file ended" diff --git a/scripts/mysqldumpslow.sh b/scripts/mysqldumpslow.sh index 0de4fe159f0..c04ffad7457 100644 --- a/scripts/mysqldumpslow.sh +++ b/scripts/mysqldumpslow.sh @@ -53,7 +53,7 @@ GetOptions(\%opt, $opt{'help'} and usage(); unless (@ARGV) { - my $defaults = `my_print_defaults mysqld mariadb`; + my $defaults = `my_print_defaults --mysqld`; my $datadir = ($defaults =~ m/--datadir=(.*)/g)[-1]; if (!$datadir or $opt{i}) { diff --git a/sql-common/client.c b/sql-common/client.c index 96fc8cf71a2..64010919fe3 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -2200,7 +2200,10 @@ mysql_autodetect_character_set(MYSQL *mysql) #ifdef __WIN__ char cpbuf[64]; { - my_snprintf(cpbuf, sizeof(cpbuf), "cp%d", (int) GetConsoleCP()); + UINT cp= GetConsoleCP(); + if (cp == 0) + cp= GetACP(); + my_snprintf(cpbuf, sizeof(cpbuf), "cp%d", (int)cp); csname= my_os_charset_to_mysql_charset(cpbuf); } #elif defined(HAVE_SETLOCALE) && defined(HAVE_NL_LANGINFO) @@ -2571,8 +2574,6 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio, mysql->server_version, mysql->server_capabilities, mysql->server_status, mysql->client_flag)); - compile_time_assert(MYSQL_USERNAME_LENGTH == USERNAME_LENGTH); - /* This needs to be changed as it's not useful with big packets */ if (mysql->user[0]) strmake(end, mysql->user, USERNAME_LENGTH); diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 4aa7b8f882e..5d61df2fa9b 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -188,9 +188,12 @@ INSTALL_DEBUG_TARGET(mysqld PDB_DESTINATION ${INSTALL_SBINDIR}/debug RENAME mysqld-debug) +INCLUDE(${CMAKE_SOURCE_DIR}/cmake/bison.cmake) + # Handle out-of-source build from source package with possibly broken # bison. Copy bison output to from source to build directory, if not already # there +IF (NOT BISON_USABLE) IF (NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.cc) IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc) @@ -201,9 +204,8 @@ IF (NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) ENDIF() ENDIF() ENDIF() +ENDIF() - -INCLUDE(${CMAKE_SOURCE_DIR}/cmake/bison.cmake) RUN_BISON( ${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.yy ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc diff --git a/sql/field.cc b/sql/field.cc index d4468ba3c5b..a0f46778092 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -199,7 +199,7 @@ static enum_field_types field_types_merge_rules [FIELDTYPE_NUM][FIELDTYPE_NUM]= //MYSQL_TYPE_NULL MYSQL_TYPE_TIMESTAMP MYSQL_TYPE_LONG, MYSQL_TYPE_VARCHAR, //MYSQL_TYPE_LONGLONG MYSQL_TYPE_INT24 - MYSQL_TYPE_LONGLONG, MYSQL_TYPE_INT24, + MYSQL_TYPE_LONGLONG, MYSQL_TYPE_LONG, //MYSQL_TYPE_DATE MYSQL_TYPE_TIME MYSQL_TYPE_VARCHAR, MYSQL_TYPE_VARCHAR, //MYSQL_TYPE_DATETIME MYSQL_TYPE_YEAR @@ -230,7 +230,7 @@ static enum_field_types field_types_merge_rules [FIELDTYPE_NUM][FIELDTYPE_NUM]= //MYSQL_TYPE_NULL MYSQL_TYPE_TIMESTAMP MYSQL_TYPE_FLOAT, MYSQL_TYPE_VARCHAR, //MYSQL_TYPE_LONGLONG MYSQL_TYPE_INT24 - MYSQL_TYPE_FLOAT, MYSQL_TYPE_INT24, + MYSQL_TYPE_FLOAT, MYSQL_TYPE_FLOAT, //MYSQL_TYPE_DATE MYSQL_TYPE_TIME MYSQL_TYPE_VARCHAR, MYSQL_TYPE_VARCHAR, //MYSQL_TYPE_DATETIME MYSQL_TYPE_YEAR @@ -261,7 +261,7 @@ static enum_field_types field_types_merge_rules [FIELDTYPE_NUM][FIELDTYPE_NUM]= //MYSQL_TYPE_NULL MYSQL_TYPE_TIMESTAMP MYSQL_TYPE_DOUBLE, MYSQL_TYPE_VARCHAR, //MYSQL_TYPE_LONGLONG MYSQL_TYPE_INT24 - MYSQL_TYPE_DOUBLE, MYSQL_TYPE_INT24, + MYSQL_TYPE_DOUBLE, MYSQL_TYPE_DOUBLE, //MYSQL_TYPE_DATE MYSQL_TYPE_TIME MYSQL_TYPE_VARCHAR, MYSQL_TYPE_VARCHAR, //MYSQL_TYPE_DATETIME MYSQL_TYPE_YEAR @@ -292,7 +292,7 @@ static enum_field_types field_types_merge_rules [FIELDTYPE_NUM][FIELDTYPE_NUM]= //MYSQL_TYPE_NULL MYSQL_TYPE_TIMESTAMP MYSQL_TYPE_NULL, MYSQL_TYPE_TIMESTAMP, //MYSQL_TYPE_LONGLONG MYSQL_TYPE_INT24 - MYSQL_TYPE_LONGLONG, MYSQL_TYPE_INT24, + MYSQL_TYPE_LONGLONG, MYSQL_TYPE_LONGLONG, //MYSQL_TYPE_DATE MYSQL_TYPE_TIME MYSQL_TYPE_NEWDATE, MYSQL_TYPE_TIME, //MYSQL_TYPE_DATETIME MYSQL_TYPE_YEAR @@ -7619,6 +7619,19 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs) if (wkb_type < (uint32) Geometry::wkb_point || wkb_type > (uint32) Geometry::wkb_last) goto err; + + if (geom_type != Field::GEOM_GEOMETRY && + geom_type != Field::GEOM_GEOMETRYCOLLECTION && + (uint32) geom_type != wkb_type) + { + my_printf_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, + ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD), MYF(0), + Geometry::ci_collection[geom_type]->m_name.str, + Geometry::ci_collection[wkb_type]->m_name.str, field_name, + (ulong) table->in_use->warning_info->current_row_for_warning()); + goto err_exit; + } + Field_blob::store_length(length); if (table->copy_blobs || length <= MAX_FIELD_WIDTH) { // Must make a copy @@ -7630,9 +7643,10 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs) return 0; err: - bzero(ptr, Field_blob::pack_length()); my_message(ER_CANT_CREATE_GEOMETRY_OBJECT, ER(ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0)); +err_exit: + bzero(ptr, Field_blob::pack_length()); return -1; } diff --git a/sql/field.h b/sql/field.h index e832928b114..92a01b9421c 100644 --- a/sql/field.h +++ b/sql/field.h @@ -2151,6 +2151,7 @@ public: bool has_charset(void) const { return TRUE; } /* enum and set are sorted as integers */ CHARSET_INFO *sort_charset(void) const { return &my_charset_bin; } + uint decimals() const { return 0; } virtual uchar *pack(uchar *to, const uchar *from, uint max_length); virtual const uchar *unpack(uchar *to, const uchar *from, diff --git a/sql/filesort.cc b/sql/filesort.cc index f31afc226cc..0efdf90c936 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -953,7 +953,10 @@ static void make_sortkey(register Sort_param *param, { MYSQL_TIME buf; if (item->get_date_result(&buf, TIME_FUZZY_DATE | TIME_INVALID_DATES)) - DBUG_ASSERT(maybe_null && item->null_value); + { + DBUG_ASSERT(maybe_null); + DBUG_ASSERT(item->null_value); + } else value= pack_time(&buf); } diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index ce3f17aeb92..5f67a89cb9c 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -3801,6 +3801,7 @@ int ha_partition::truncate_partition(Alter_info *alter_info, bool *binlog_stmt) part, sub_elem->partition_name)); if ((error= m_file[part]->ha_truncate())) break; + sub_elem->part_state= PART_NORMAL; } while (++j < num_subparts); } else @@ -4399,6 +4400,7 @@ bool ha_partition::init_record_priority_queue() { if (bitmap_is_set(&m_part_info->used_partitions, i)) { + DBUG_PRINT("info", ("init rec-buf for part %u", i)); int2store(ptr, i); ptr+= m_rec_length + PARTITION_BYTES_IN_POS; } @@ -5293,11 +5295,27 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order) m_top_entry= NO_CURRENT_PART_ID; queue_remove_all(&m_queue); - DBUG_PRINT("info", ("m_part_spec.start_part %d", m_part_spec.start_part)); - for (i= m_part_spec.start_part; i <= m_part_spec.end_part; i++) + /* + Position part_rec_buf_ptr to point to the first used partition >= + start_part. There may be partitions marked by used_partitions, + but is before start_part. These partitions has allocated record buffers + but is dynamically pruned, so those buffers must be skipped. + */ + uint first_used_part= bitmap_get_first_set(&m_part_info->used_partitions); + for (; first_used_part < m_part_spec.start_part; first_used_part++) + { + if (bitmap_is_set(&(m_part_info->used_partitions), first_used_part)) + part_rec_buf_ptr+= m_rec_length + PARTITION_BYTES_IN_POS; + } + DBUG_PRINT("info", ("m_part_spec.start_part %u first_used_part %u", + m_part_spec.start_part, first_used_part)); + for (i= first_used_part; i <= m_part_spec.end_part; i++) { if (!(bitmap_is_set(&(m_part_info->used_partitions), i))) continue; + DBUG_PRINT("info", ("reading from part %u (scan_type: %u)", + i, m_index_scan_type)); + DBUG_ASSERT(i == uint2korr(part_rec_buf_ptr)); uchar *rec_buf_ptr= part_rec_buf_ptr + PARTITION_BYTES_IN_POS; int error; handler *file= m_file[i]; diff --git a/sql/innodb_priv.h b/sql/innodb_priv.h index 5406c292b18..24ee848bed1 100644 --- a/sql/innodb_priv.h +++ b/sql/innodb_priv.h @@ -25,7 +25,7 @@ class THD; int get_quote_char_for_identifier(THD *thd, const char *name, uint length); bool schema_table_store_record(THD *thd, TABLE *table); void localtime_to_TIME(MYSQL_TIME *to, struct tm *from); -bool check_global_access(THD *thd, ulong want_access); +bool check_global_access(THD *thd, ulong want_access, bool no_errors=false); uint strconvert(CHARSET_INFO *from_cs, const char *from, CHARSET_INFO *to_cs, char *to, uint to_length, uint *errors); diff --git a/sql/item.cc b/sql/item.cc index 9ef1593b0bf..1d8e466b2fd 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1277,11 +1277,15 @@ bool Item::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate) DBUG_ASSERT(0); } - return 0; + return null_value= 0; err: + /* + if the item was not null and convertion failed, we return a zero date + if allowed, otherwise - null. + */ bzero((char*) ltime,sizeof(*ltime)); - return 1; + return null_value|= (fuzzydate & (TIME_NO_ZERO_DATE|TIME_NO_ZERO_IN_DATE)); } bool Item::get_seconds(ulonglong *sec, ulong *sec_part) @@ -8655,7 +8659,7 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) Item_cache* Item_cache::get_cache(const Item *item) { - return get_cache(item, item->result_type()); + return get_cache(item, item->cmp_type()); } diff --git a/sql/item.h b/sql/item.h index db17b723071..d72d2f1f80b 100644 --- a/sql/item.h +++ b/sql/item.h @@ -4053,6 +4053,7 @@ public: bool cache_value(); bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate); int save_in_field(Field *field, bool no_conversions); + Item_result cmp_type() const { return TIME_RESULT; } void store_packed(longlong val_arg, Item *example); /* Having a clone_item method tells optimizer that this object diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index b1208243e6b..6f10e84a5f5 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -241,15 +241,15 @@ static uint collect_cmp_types(Item **items, uint nitems, bool skip_nulls= FALSE) items[i]->cmp_type() == ROW_RESULT) && cmp_row_type(items[0], items[i])) return 0; - found_types|= 1<< (uint)item_cmp_type(left_result, - items[i]->cmp_type()); + found_types|= 1U << (uint)item_cmp_type(left_result, + items[i]->cmp_type()); } /* Even if all right-hand items are NULLs and we are skipping them all, we need at least one type bit in the found_type bitmask. */ if (skip_nulls && !found_types) - found_types= 1 << (uint)left_result; + found_types= 1U << (uint)left_result; return found_types; } @@ -906,7 +906,8 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg, } if ((*is_null= item->null_value)) return ~(ulonglong) 0; - if (cache_arg && item->const_item() && item->type() != Item::CACHE_ITEM) + if (cache_arg && item->const_item() && + !(item->type() == Item::CACHE_ITEM && item->cmp_type() == TIME_RESULT)) { Query_arena backup; Query_arena *save_arena= thd->switch_to_arena_for_cached_items(&backup); @@ -2864,12 +2865,12 @@ Item *Item_func_case::find_item(String *str) cmp_type= item_cmp_type(left_result_type, args[i]->cmp_type()); DBUG_ASSERT(cmp_type != ROW_RESULT); DBUG_ASSERT(cmp_items[(uint)cmp_type]); - if (!(value_added_map & (1<<(uint)cmp_type))) + if (!(value_added_map & (1U << (uint)cmp_type))) { cmp_items[(uint)cmp_type]->store_value(args[first_expr_num]); if ((null_value=args[first_expr_num]->null_value)) return else_expr_num != -1 ? args[else_expr_num] : 0; - value_added_map|= 1<<(uint)cmp_type; + value_added_map|= 1U << (uint)cmp_type; } if (!cmp_items[(uint)cmp_type]->cmp(args[i]) && !args[i]->null_value) return args[i + 1]; @@ -3076,10 +3077,10 @@ void Item_func_case::fix_length_and_dec() return; Item *date_arg= 0; - if (found_types & (1 << TIME_RESULT)) + if (found_types & (1U << TIME_RESULT)) date_arg= find_date_time_item(args, arg_count, 0); - if (found_types & (1 << STRING_RESULT)) + if (found_types & (1U << STRING_RESULT)) { /* If we'll do string comparison, we also need to aggregate @@ -3120,7 +3121,7 @@ void Item_func_case::fix_length_and_dec() for (i= 0; i <= (uint)TIME_RESULT; i++) { - if (found_types & (1 << i) && !cmp_items[i]) + if (found_types & (1U << i) && !cmp_items[i]) { DBUG_ASSERT((Item_result)i != ROW_RESULT); @@ -3976,7 +3977,7 @@ void Item_func_in::fix_length_and_dec() } for (i= 0; i <= (uint)TIME_RESULT; i++) { - if (found_types & 1 << i) + if (found_types & (1U << i)) { (type_cnt)++; cmp_type= (Item_result) i; @@ -4103,14 +4104,14 @@ void Item_func_in::fix_length_and_dec() } else { - if (found_types & (1 << TIME_RESULT)) + if (found_types & (1U << TIME_RESULT)) date_arg= find_date_time_item(args, arg_count, 0); - if (found_types & (1 << STRING_RESULT) && + if (found_types & (1U << STRING_RESULT) && agg_arg_charsets_for_comparison(cmp_collation, args, arg_count)) return; for (i= 0; i <= (uint) TIME_RESULT; i++) { - if (found_types & (1 << i) && !cmp_items[i]) + if (found_types & (1U << i) && !cmp_items[i]) { if (!cmp_items[i] && !(cmp_items[i]= cmp_item::get_comparator((Item_result)i, date_arg, @@ -4196,12 +4197,12 @@ longlong Item_func_in::val_int() Item_result cmp_type= item_cmp_type(left_result_type, args[i]->cmp_type()); in_item= cmp_items[(uint)cmp_type]; DBUG_ASSERT(in_item); - if (!(value_added_map & (1 << (uint)cmp_type))) + if (!(value_added_map & (1U << (uint)cmp_type))) { in_item->store_value(args[0]); if ((null_value= args[0]->null_value)) return 0; - value_added_map|= 1 << (uint)cmp_type; + value_added_map|= 1U << (uint)cmp_type; } if (!in_item->cmp(args[i]) && !args[i]->null_value) return (longlong) (!negated); @@ -5574,6 +5575,7 @@ Item_equal::Item_equal(Item *f1, Item *f2, bool with_const_item) equal_items.push_back(f1); equal_items.push_back(f2); compare_as_dates= with_const_item && f2->cmp_type() == TIME_RESULT; + upper_levels= NULL; } @@ -5602,10 +5604,11 @@ Item_equal::Item_equal(Item_equal *item_equal) with_const= item_equal->with_const; compare_as_dates= item_equal->compare_as_dates; cond_false= item_equal->cond_false; + upper_levels= item_equal->upper_levels; } -/* +/** @brief Add a constant item to the Item_equal object @@ -5659,6 +5662,7 @@ void Item_equal::add_const(Item *c, Item *f) const_item_cache= 1; } + /** @brief Check whether a field is referred to in the multiple equality @@ -5727,6 +5731,87 @@ void Item_equal::merge(Item_equal *item) /** @brief + Merge members of another Item_equal object into this one + + @param item multiple equality whose members are to be merged + + @details + If the Item_equal 'item' happened to have some elements of the list + of equal items belonging to 'this' object then the function merges + the equal items from 'item' into this list. + If both lists contains constants and they are different then + the value of the cond_false flag is set to TRUE. + + @retval + 1 the lists of equal items in 'item' and 'this' contain common elements + @retval + 0 otherwise + + @notes + The method 'merge' just joins the list of equal items belonging to 'item' + to the list of equal items belonging to this object assuming that the lists + are disjoint. It would be more correct to call the method 'join'. + The method 'merge_with_check' really merges two lists of equal items if they + have common members. +*/ + +bool Item_equal::merge_with_check(Item_equal *item) +{ + bool intersected= FALSE; + Item_equal_fields_iterator_slow fi(*this); + while (fi++) + { + if (item->contains(fi.get_curr_field())) + { + fi.remove(); + intersected= TRUE; + } + } + if (intersected) + item->merge(this); + return intersected; +} + + +/** + @brief + Merge this object into a list of Item_equal objects + + @param list the list of Item_equal objects to merge into + + @details + If the list of equal items from 'this' object contains common members + with the lists of equal items belonging to Item_equal objects from 'list' + then all involved Item_equal objects e1,...,ek are merged into one + Item equal that replaces e1,...,ek in the 'list'. Otherwise this + Item_equal is joined to the 'list'. +*/ + +void Item_equal::merge_into_list(List<Item_equal> *list) +{ + Item_equal *item; + List_iterator<Item_equal> it(*list); + Item_equal *merge_into= NULL; + while((item= it++)) + { + if (!merge_into) + { + if (merge_with_check(item)) + merge_into= item; + } + else + { + if (item->merge_with_check(merge_into)) + it.remove(); + } + } + if (!merge_into) + list->push_back(this); +} + + +/** + @brief Order equal items of the multiple equality according to a sorting criteria @param compare function to compare items from the equal_items list diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 5a5f9ad60fd..4ca31e01df9 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -1578,6 +1578,11 @@ public: DBUG_ASSERT(nlist->elements); list.prepand(nlist); } + void add_at_end(List<Item> *nlist) + { + DBUG_ASSERT(nlist->elements); + list.concat(nlist); + } bool fix_fields(THD *, Item **ref); void fix_after_pullout(st_select_lex *new_parent, Item **ref); @@ -1603,6 +1608,7 @@ public: bool eval_not_null_tables(uchar *opt_arg); }; +template <template<class> class LI, class T> class Item_equal_iterator; /* The class Item_equal is used to represent conjunctions of equality @@ -1730,7 +1736,11 @@ class Item_equal: public Item_bool_func used in the original equality. */ Item_field *context_field; + public: + + COND_EQUAL *upper_levels; /* multiple equalities of upper and levels */ + inline Item_equal() : Item_bool_func(), with_const(FALSE), eval_item(0), cond_false(0), context_field(NULL) @@ -1747,6 +1757,8 @@ public: /** Get number of field items / references to field items in this object */ uint n_field_items() { return equal_items.elements-test(with_const); } void merge(Item_equal *item); + bool merge_with_check(Item_equal *equal_item); + void merge_into_list(List<Item_equal> *list); void update_const(); enum Functype functype() const { return MULT_EQUAL_FUNC; } longlong val_int(); @@ -1762,7 +1774,8 @@ public: CHARSET_INFO *compare_collation(); void set_context_field(Item_field *ctx_field) { context_field= ctx_field; } - friend class Item_equal_fields_iterator; + friend class Item_equal_iterator<List_iterator_fast,Item>; + friend class Item_equal_iterator<List_iterator,Item>; friend Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels, Item_equal *item_equal); friend bool setup_sj_materialization_part1(struct st_join_table *tab); @@ -1781,43 +1794,55 @@ public: { upper_levels= 0; } + void copy(COND_EQUAL &cond_equal) + { + max_members= cond_equal.max_members; + upper_levels= cond_equal.upper_levels; + if (cond_equal.current_level.is_empty()) + current_level.empty(); + else + current_level= cond_equal.current_level; + } }; /* - The class Item_equal_fields_iterator is used to iterate over references - to table/view columns from a list of equal items. + The template Item_equal_iterator is used to define classes + Item_equal_fields_iterator and Item_equal_fields_iterator_slow. + These are helper classes for the class Item equal + Both classes are used to iterate over references to table/view columns + from the list of equal items that included in an Item_equal object. + The second class supports the operation of removal of the current member + from the list when performing an iteration. */ -class Item_equal_fields_iterator : public List_iterator_fast<Item> +template <template<class> class LI, typename T> class Item_equal_iterator + : public LI<T> { +protected: Item_equal *item_equal; Item *curr_item; public: - Item_equal_fields_iterator(Item_equal &item_eq) - :List_iterator_fast<Item> (item_eq.equal_items) + Item_equal_iterator<LI,T>(Item_equal &item_eq) + :LI<T> (item_eq.equal_items) { curr_item= NULL; item_equal= &item_eq; if (item_eq.with_const) { - List_iterator_fast<Item> *list_it= this; + LI<T> *list_it= this; curr_item= (*list_it)++; } } Item* operator++(int) { - List_iterator_fast<Item> *list_it= this; + LI<T> *list_it= this; curr_item= (*list_it)++; return curr_item; } - Item ** ref() - { - return List_iterator_fast<Item>::ref(); - } void rewind(void) { - List_iterator_fast<Item> *list_it= this; + LI<T> *list_it= this; list_it->rewind(); if (item_equal->with_const) curr_item= (*list_it)++; @@ -1829,6 +1854,36 @@ public: } }; +typedef Item_equal_iterator<List_iterator_fast,Item > Item_equal_iterator_fast; + +class Item_equal_fields_iterator + :public Item_equal_iterator_fast +{ +public: + Item_equal_fields_iterator(Item_equal &item_eq) + :Item_equal_iterator_fast(item_eq) + { } + Item ** ref() + { + return List_iterator_fast<Item>::ref(); + } +}; + +typedef Item_equal_iterator<List_iterator,Item > Item_equal_iterator_iterator_slow; + +class Item_equal_fields_iterator_slow + :public Item_equal_iterator_iterator_slow +{ +public: + Item_equal_fields_iterator_slow(Item_equal &item_eq) + :Item_equal_iterator_iterator_slow(item_eq) + { } + void remove() + { + List_iterator<Item>::remove(); + } +}; + class Item_cond_and :public Item_cond { diff --git a/sql/item_create.cc b/sql/item_create.cc index fc31b074055..ba6eb7ff603 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -4453,8 +4453,7 @@ Create_func_make_set::create_native(THD *thd, LEX_STRING name, return NULL; } - Item *param_1= item_list->pop(); - return new (thd->mem_root) Item_func_make_set(param_1, *item_list); + return new (thd->mem_root) Item_func_make_set(*item_list); } diff --git a/sql/item_func.cc b/sql/item_func.cc index aca76eac82a..b4c825b6222 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -769,13 +769,14 @@ void Item_num_op::find_num_type(void) { hybrid_type= DECIMAL_RESULT; result_precision(); + fix_decimals(); } else { DBUG_ASSERT(r0 == INT_RESULT && r1 == INT_RESULT); - decimals= 0; hybrid_type=INT_RESULT; result_precision(); + decimals= 0; } DBUG_PRINT("info", ("Type: %s", (hybrid_type == REAL_RESULT ? "REAL_RESULT" : @@ -1708,6 +1709,7 @@ void Item_func_div::fix_length_and_dec() break; case DECIMAL_RESULT: result_precision(); + fix_decimals(); break; case STRING_RESULT: case ROW_RESULT: @@ -1907,6 +1909,16 @@ longlong Item_func_neg::int_op() if (args[0]->unsigned_flag && (ulonglong) value > (ulonglong) LONGLONG_MAX + 1) return raise_integer_overflow(); + + if (value == LONGLONG_MIN) + { + if (args[0]->unsigned_flag != unsigned_flag) + /* negation of LONGLONG_MIN is LONGLONG_MIN. */ + return LONGLONG_MIN; + else + return raise_integer_overflow(); + } + return check_integer_overflow(-value, !args[0]->unsigned_flag && value < 0); } @@ -4819,7 +4831,7 @@ void Item_func_set_user_var::save_item_result(Item *item) { DBUG_ENTER("Item_func_set_user_var::save_item_result"); - switch (cached_result_type) { + switch (args[0]->result_type()) { case REAL_RESULT: save_result.vreal= item->val_result(); break; diff --git a/sql/item_func.h b/sql/item_func.h index f562c87fe1c..653641c9f72 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -431,6 +431,13 @@ public: void fix_num_length_and_dec(); virtual void find_num_type()= 0; /* To be called from fix_length_and_dec */ + inline void fix_decimals() + { + DBUG_ASSERT(result_type() == DECIMAL_RESULT); + if (decimals == NOT_FIXED_DEC) + set_if_smaller(decimals, max_length - 1); + } + double val_real(); longlong val_int(); my_decimal *val_decimal(my_decimal *); diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index e3e80bdf59f..0a7f18e6546 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -561,8 +561,8 @@ longlong Item_func_spatial_mbr_rel::val_int() args[1]->null_value || !(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) || !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) || - g1->get_mbr(&mbr1, &dummy) || - g2->get_mbr(&mbr2, &dummy)))) + g1->get_mbr(&mbr1, &dummy) || !mbr1.valid() || + g2->get_mbr(&mbr2, &dummy) || !mbr2.valid()))) return 0; switch (spatial_rel) { @@ -687,12 +687,11 @@ longlong Item_func_spatial_rel::val_int() if ((null_value= (args[0]->null_value || args[1]->null_value || !(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) || - !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length()))))) + !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) || + g1->get_mbr(&mbr1, &c_end) || !mbr1.valid() || + g2->get_mbr(&mbr2, &c_end) || !mbr2.valid()))) goto exit; - g1->get_mbr(&mbr1, &c_end); - g2->get_mbr(&mbr2, &c_end); - umbr= mbr1; umbr.add_mbr(&mbr2); collector.set_extent(umbr.xmin, umbr.xmax, umbr.ymin, umbr.ymax); @@ -826,14 +825,14 @@ String *Item_func_spatial_operation::val_str(String *str_value) if ((null_value= (args[0]->null_value || args[1]->null_value || !(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) || - !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length()))))) + !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) || + g1->get_mbr(&mbr1, &c_end) || !mbr1.valid() || + g2->get_mbr(&mbr2, &c_end) || !mbr2.valid()))) { str_value= 0; goto exit; } - g1->get_mbr(&mbr1, &c_end); - g2->get_mbr(&mbr2, &c_end); mbr1.add_mbr(&mbr2); collector.set_extent(mbr1.xmin, mbr1.xmax, mbr1.ymin, mbr1.ymax); @@ -1358,11 +1357,11 @@ longlong Item_func_issimple::val_int() DBUG_ENTER("Item_func_issimple::val_int"); DBUG_ASSERT(fixed == 1); - if ((null_value= args[0]->null_value) || - !(g= Geometry::construct(&buffer, swkb->ptr(), swkb->length()))) + if ((null_value= (args[0]->null_value || + !(g= Geometry::construct(&buffer, swkb->ptr(), swkb->length())) || + g->get_mbr(&mbr, &c_end)))) DBUG_RETURN(0); - g->get_mbr(&mbr, &c_end); collector.set_extent(mbr.xmin, mbr.xmax, mbr.ymin, mbr.ymax); if (g->get_class_info()->m_type_id == Geometry::wkb_point) @@ -1598,11 +1597,11 @@ double Item_func_distance::val_real() if ((null_value= (args[0]->null_value || args[1]->null_value || !(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) || - !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length()))))) + !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) || + g1->get_mbr(&mbr1, &c_end) || + g2->get_mbr(&mbr2, &c_end)))) goto mem_error; - g1->get_mbr(&mbr1, &c_end); - g2->get_mbr(&mbr2, &c_end); mbr1.add_mbr(&mbr2); collector.set_extent(mbr1.xmin, mbr1.xmax, mbr1.ymin, mbr1.ymax); diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 48de0c4bc5c..462db3c24fd 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2461,40 +2461,16 @@ String *Item_func_elt::val_str(String *str) } -void Item_func_make_set::split_sum_func(THD *thd, Item **ref_pointer_array, - List<Item> &fields) -{ - item->split_sum_func2(thd, ref_pointer_array, fields, &item, TRUE); - Item_str_func::split_sum_func(thd, ref_pointer_array, fields); -} - - void Item_func_make_set::fix_length_and_dec() { - uint32 char_length= arg_count - 1; /* Separators */ + uint32 char_length= arg_count - 2; /* Separators */ - if (agg_arg_charsets_for_string_result(collation, args, arg_count)) + if (agg_arg_charsets_for_string_result(collation, args + 1, arg_count - 1)) return; - for (uint i=0 ; i < arg_count ; i++) + for (uint i=1 ; i < arg_count ; i++) char_length+= args[i]->max_char_length(); fix_char_length(char_length); - used_tables_cache|= item->used_tables(); - not_null_tables_cache&= item->not_null_tables(); - const_item_cache&= item->const_item(); - with_sum_func= with_sum_func || item->with_sum_func; - with_field= with_field || item->with_field; -} - - -void Item_func_make_set::update_used_tables() -{ - DBUG_ENTER("Item_func_make_set::update_used_tables"); - Item_func::update_used_tables(); - item->update_used_tables(); - used_tables_cache|=item->used_tables(); - const_item_cache&=item->const_item(); - DBUG_VOID_RETURN; } @@ -2503,15 +2479,15 @@ String *Item_func_make_set::val_str(String *str) DBUG_ASSERT(fixed == 1); ulonglong bits; bool first_found=0; - Item **ptr=args; + Item **ptr=args+1; String *result=&my_empty_string; - bits=item->val_int(); - if ((null_value=item->null_value)) + bits=args[0]->val_int(); + if ((null_value=args[0]->null_value)) return NULL; - if (arg_count < 64) - bits &= ((ulonglong) 1 << arg_count)-1; + if (arg_count < 65) + bits &= ((ulonglong) 1 << (arg_count-1))-1; for (; bits; bits >>= 1, ptr++) { @@ -2551,39 +2527,6 @@ String *Item_func_make_set::val_str(String *str) } -Item *Item_func_make_set::transform(Item_transformer transformer, uchar *arg) -{ - DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare()); - - Item *new_item= item->transform(transformer, arg); - if (!new_item) - return 0; - - /* - THD::change_item_tree() should be called only if the tree was - really transformed, i.e. when a new item has been created. - Otherwise we'll be allocating a lot of unnecessary memory for - change records at each execution. - */ - if (item != new_item) - current_thd->change_item_tree(&item, new_item); - return Item_str_func::transform(transformer, arg); -} - - -void Item_func_make_set::print(String *str, enum_query_type query_type) -{ - str->append(STRING_WITH_LEN("make_set(")); - item->print(str, query_type); - if (arg_count) - { - str->append(','); - print_args(str, 0, query_type); - } - str->append(')'); -} - - String *Item_func_char::val_str(String *str) { DBUG_ASSERT(fixed == 1); @@ -2990,7 +2933,7 @@ String *Item_func_conv_charset::val_str(String *str) return null_value ? 0 : &str_value; String *arg= args[0]->val_str(str); uint dummy_errors; - if (!arg) + if (args[0]->null_value) { null_value=1; return 0; @@ -4677,11 +4620,16 @@ null: void Item_dyncol_get::print(String *str, enum_query_type query_type) { + /* see create_func_dyncol_get */ + DBUG_ASSERT(str->length() >= 5); + DBUG_ASSERT(strncmp(str->ptr() + str->length() - 5, "cast(", 5) == 0); + + str->length(str->length() - 5); // removing "cast(" str->append(STRING_WITH_LEN("column_get(")); args[0]->print(str, query_type); str->append(','); args[1]->print(str, query_type); - str->append(')'); + /* let the parent cast item add " as <type>)" */ } diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 486b7cf36ef..00863e9af2b 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -544,31 +544,13 @@ public: class Item_func_make_set :public Item_str_func { - Item *item; String tmp_str; public: - Item_func_make_set(Item *a,List<Item> &list) :Item_str_func(list),item(a) {} + Item_func_make_set(List<Item> &list) :Item_str_func(list) {} String *val_str(String *str); - bool fix_fields(THD *thd, Item **ref) - { - DBUG_ASSERT(fixed == 0); - return ((!item->fixed && item->fix_fields(thd, &item)) || - item->check_cols(1) || - Item_func::fix_fields(thd, ref)); - } - void split_sum_func(THD *thd, Item **ref_pointer_array, List<Item> &fields); void fix_length_and_dec(); - void update_used_tables(); const char *func_name() const { return "make_set"; } - - bool walk(Item_processor processor, bool walk_subquery, uchar *arg) - { - return item->walk(processor, walk_subquery, arg) || - Item_str_func::walk(processor, walk_subquery, arg); - } - Item *transform(Item_transformer transformer, uchar *arg); - virtual void print(String *str, enum_query_type query_type); }; @@ -859,25 +841,37 @@ public: { if (args[0]->result_type() == STRING_RESULT) return Item_str_func::val_int(); - return args[0]->val_int(); + longlong res= args[0]->val_int(); + if ((null_value= args[0]->null_value)) + return 0; + return res; } double val_real() { if (args[0]->result_type() == STRING_RESULT) return Item_str_func::val_real(); - return args[0]->val_real(); + double res= args[0]->val_real(); + if ((null_value= args[0]->null_value)) + return 0; + return res; } my_decimal *val_decimal(my_decimal *d) { if (args[0]->result_type() == STRING_RESULT) return Item_str_func::val_decimal(d); - return args[0]->val_decimal(d); + my_decimal *res= args[0]->val_decimal(d); + if ((null_value= args[0]->null_value)) + return NULL; + return res; } bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) { if (args[0]->result_type() == STRING_RESULT) return Item_str_func::get_date(ltime, fuzzydate); - return args[0]->get_date(ltime, fuzzydate); + bool res= args[0]->get_date(ltime, fuzzydate); + if ((null_value= args[0]->null_value)) + return 1; + return res; } void fix_length_and_dec(); const char *func_name() const { return "convert"; } diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index c2273721805..f2ef955af05 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -1102,6 +1102,11 @@ enum Item_result Item_singlerow_subselect::result_type() const return engine->type(); } +enum Item_result Item_singlerow_subselect::cmp_type() const +{ + return engine->cmptype(); +} + /* Don't rely on the result type to calculate field type. Ask the engine instead. @@ -1866,7 +1871,8 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join) print_where(item, "rewrite with MIN/MAX", QT_ORDINARY);); save_allow_sum_func= thd->lex->allow_sum_func; - thd->lex->allow_sum_func|= 1 << thd->lex->current_select->nest_level; + thd->lex->allow_sum_func|= + (nesting_map)1 << thd->lex->current_select->nest_level; /* Item_sum_(max|min) can't substitute other item => we can use 0 as reference, also Item_sum_(max|min) can't be fixed after creation, so @@ -3503,12 +3509,13 @@ void subselect_engine::set_row(List<Item> &item_list, Item_cache **row) { Item *sel_item; List_iterator_fast<Item> li(item_list); - res_type= STRING_RESULT; + cmp_type= res_type= STRING_RESULT; res_field_type= MYSQL_TYPE_VAR_STRING; for (uint i= 0; (sel_item= li++); i++) { item->max_length= sel_item->max_length; res_type= sel_item->result_type(); + cmp_type= sel_item->cmp_type(); res_field_type= sel_item->field_type(); item->decimals= sel_item->decimals; item->unsigned_flag= sel_item->unsigned_flag; @@ -3519,7 +3526,7 @@ void subselect_engine::set_row(List<Item> &item_list, Item_cache **row) //psergey-backport-timours: row[i]->store(sel_item); } if (item_list.elements > 1) - res_type= ROW_RESULT; + cmp_type= res_type= ROW_RESULT; } void subselect_single_select_engine::fix_length_and_dec(Item_cache **row) diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 4d9555f0366..e806f45041a 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -287,6 +287,7 @@ public: bool val_bool(); bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate); enum Item_result result_type() const; + enum Item_result cmp_type() const; enum_field_types field_type() const; void fix_length_and_dec(); @@ -733,6 +734,7 @@ protected: THD *thd; /* pointer to current THD */ Item_subselect *item; /* item, that use this engine */ enum Item_result res_type; /* type of results */ + enum Item_result cmp_type; /* how to compare the results */ enum_field_types res_field_type; /* column type of the results */ bool maybe_null; /* may be null (first item in select) */ public: @@ -747,7 +749,7 @@ public: { result= res; item= si; - res_type= STRING_RESULT; + cmp_type= res_type= STRING_RESULT; res_field_type= MYSQL_TYPE_VAR_STRING; maybe_null= 0; set_thd(thd_arg); @@ -787,6 +789,7 @@ public: virtual uint cols()= 0; /* return number of columns in select */ virtual uint8 uncacheable()= 0; /* query is uncacheable */ enum Item_result type() { return res_type; } + enum Item_result cmptype() { return cmp_type; } enum_field_types field_type() { return res_field_type; } virtual void exclude()= 0; virtual bool may_be_null() { return maybe_null; }; diff --git a/sql/item_sum.cc b/sql/item_sum.cc index ab4827f16aa..9410a12f21b 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -152,9 +152,10 @@ bool Item_sum::check_sum_func(THD *thd, Item **ref) If it is there under a construct where it is not allowed we report an error. */ - invalid= !(allow_sum_func & (1 << max_arg_level)); + invalid= !(allow_sum_func & ((nesting_map)1 << max_arg_level)); } - else if (max_arg_level >= 0 || !(allow_sum_func & (1 << nest_level))) + else if (max_arg_level >= 0 || + !(allow_sum_func & ((nesting_map)1 << nest_level))) { /* The set function can be aggregated only in outer subqueries. @@ -163,7 +164,8 @@ bool Item_sum::check_sum_func(THD *thd, Item **ref) */ if (register_sum_func(thd, ref)) return TRUE; - invalid= aggr_level < 0 && !(allow_sum_func & (1 << nest_level)); + invalid= aggr_level < 0 && + !(allow_sum_func & ((nesting_map)1 << nest_level)); if (!invalid && thd->variables.sql_mode & MODE_ANSI) invalid= aggr_level < 0 && max_arg_level < nest_level; } @@ -311,14 +313,15 @@ bool Item_sum::register_sum_func(THD *thd, Item **ref) sl && sl->nest_level > max_arg_level; sl= sl->master_unit()->outer_select() ) { - if (aggr_level < 0 && (allow_sum_func & (1 << sl->nest_level))) + if (aggr_level < 0 && + (allow_sum_func & ((nesting_map)1 << sl->nest_level))) { /* Found the most nested subquery where the function can be aggregated */ aggr_level= sl->nest_level; aggr_sel= sl; } } - if (sl && (allow_sum_func & (1 << sl->nest_level))) + if (sl && (allow_sum_func & ((nesting_map)1 << sl->nest_level))) { /* We reached the subquery of level max_arg_level and checked @@ -564,7 +567,7 @@ void Item_sum::update_used_tables () used_tables_cache&= PSEUDO_TABLE_BITS; // the aggregate function is aggregated into its local context - used_tables_cache |= (1 << aggr_sel->join->table_count) - 1; + used_tables_cache|= ((table_map)1 << aggr_sel->join->tables) - 1; } because if we do it, table elimination will assume that - constructs like "COUNT(*)" use columns from all tables @@ -1594,9 +1597,10 @@ void Item_sum_avg::fix_length_and_dec() f_scale= args[0]->decimals; dec_bin_size= my_decimal_get_binary_size(f_precision, f_scale); } - else { + else + { decimals= min(args[0]->decimals + prec_increment, NOT_FIXED_DEC); - max_length= args[0]->max_length + prec_increment; + max_length= min(args[0]->max_length + prec_increment, float_length(decimals)); } } diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 02a7b8511af..69a6dac5381 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -923,16 +923,14 @@ longlong Item_func_dayofmonth::val_int() { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - (void) get_arg0_date(<ime, TIME_FUZZY_DATE); - return (longlong) ltime.day; + return get_arg0_date(<ime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.day; } longlong Item_func_month::val_int() { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - (void) get_arg0_date(<ime, TIME_FUZZY_DATE); - return (longlong) ltime.month; + return get_arg0_date(<ime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.month; } @@ -983,16 +981,14 @@ longlong Item_func_hour::val_int() { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - (void) get_arg0_time(<ime); - return ltime.hour; + return get_arg0_time(<ime) ? 0 : ltime.hour; } longlong Item_func_minute::val_int() { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - (void) get_arg0_time(<ime); - return ltime.minute; + return get_arg0_time(<ime) ? 0 : ltime.minute; } /** @@ -1002,8 +998,7 @@ longlong Item_func_second::val_int() { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - (void) get_arg0_time(<ime); - return ltime.second; + return get_arg0_time(<ime) ? 0 : ltime.second; } @@ -1120,8 +1115,7 @@ longlong Item_func_year::val_int() { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - (void) get_arg0_date(<ime, TIME_FUZZY_DATE); - return (longlong) ltime.year; + return get_arg0_date(<ime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.year; } diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 3e3cd698efc..9b2db9e816e 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -491,6 +491,7 @@ public: enum Item_result result_type () const { return STRING_RESULT; } CHARSET_INFO *charset_for_protocol(void) const { return &my_charset_bin; } enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; } + Item_result cmp_type() const { return TIME_RESULT; } String *val_str(String *str); longlong val_int(); double val_real(); diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc index 5a824e48b7b..723429f107a 100644 --- a/sql/item_xmlfunc.cc +++ b/sql/item_xmlfunc.cc @@ -2704,8 +2704,12 @@ int xml_enter(MY_XML_PARSER *st,const char *attr, size_t len) node.parent= data->parent; // Set parent for the new node to old parent data->parent= numnodes; // Remember current node as new parent + DBUG_ASSERT(data->level <= MAX_LEVEL); data->pos[data->level]= numnodes; - node.level= data->level++; + if (data->level < MAX_LEVEL) + node.level= data->level++; + else + return MY_XML_ERROR; node.type= st->current_node_type; // TAG or ATTR node.beg= attr; node.end= attr + len; diff --git a/sql/log_event.cc b/sql/log_event.cc index 10f0fe1e931..55b95996515 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1808,6 +1808,7 @@ void Log_event::print_header(IO_CACHE* file, /** Prints a quoted string to io cache. Control characters are displayed as hex sequence, e.g. \x00 + Single-quote and backslash characters are escaped with a \ @param[in] file IO cache @param[in] prt Pointer to string @@ -1823,6 +1824,10 @@ my_b_write_quoted(IO_CACHE *file, const uchar *ptr, uint length) { if (*s > 0x1F) my_b_write(file, s, 1); + else if (*s == '\'') + my_b_write(file, "\\'", 2); + else if (*s == '\\') + my_b_write(file, "\\\\", 2); else { uchar hex[10]; @@ -4828,10 +4833,21 @@ do_server_version_split(char* version, for (uint i= 0; i<=2; i++) { number= strtoul(p, &r, 10); - split_versions->ver[i]= (uchar) number; - DBUG_ASSERT(number < 256); // fit in uchar + /* + It is an invalid version if any version number greater than 255 or + first number is not followed by '.'. + */ + if (number < 256 && (*r == '.' || i != 0)) + split_versions->ver[i]= (uchar) number; + else + { + split_versions->ver[0]= 0; + split_versions->ver[1]= 0; + split_versions->ver[2]= 0; + break; + } + p= r; - DBUG_ASSERT(!((i == 0) && (*r != '.'))); // should be true in practice if (*r == '.') p++; // skip the dot } @@ -4849,7 +4865,6 @@ do_server_version_split(char* version, into 'server_version_split': X.Y.Zabc (X,Y,Z numbers, a not a digit) -> {X,Y,Z} X.Yabc -> {X,Y,0} - Xabc -> {X,0,0} 'server_version_split' is then used for lookups to find if the server which created this event has some known bug. */ diff --git a/sql/log_event.h b/sql/log_event.h index ff13cab9cd5..24a08ae107c 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -1127,7 +1127,7 @@ public: return thd ? thd->db : 0; } #else - Log_event() : temp_buf(0) {} + Log_event() : temp_buf(0), flags(0) {} /* avoid having to link mysqlbinlog against libpthread */ static Log_event* read_log_event(IO_CACHE* file, const Format_description_log_event @@ -2464,12 +2464,26 @@ public: #ifdef MYSQL_SERVER bool write(IO_CACHE* file); #endif - bool is_valid() const + bool header_is_valid() const { return ((common_header_len >= ((binlog_version==1) ? OLD_HEADER_LEN : LOG_EVENT_MINIMAL_HEADER_LEN)) && (post_header_len != NULL)); } + + bool version_is_valid() const + { + /* It is invalid only when all version numbers are 0 */ + return !(server_version_split.ver[0] == 0 && + server_version_split.ver[1] == 0 && + server_version_split.ver[2] == 0); + } + + bool is_valid() const + { + return header_is_valid() && version_is_valid(); + } + int get_data_size() { /* diff --git a/sql/mdl.h b/sql/mdl.h index af7d75c1297..68f24a7a0e8 100644 --- a/sql/mdl.h +++ b/sql/mdl.h @@ -242,8 +242,14 @@ public: const char *db, const char *name) { m_ptr[0]= (char) mdl_namespace; - m_db_name_length= (uint16) (strmov(m_ptr + 1, db) - m_ptr - 1); - m_length= (uint16) (strmov(m_ptr + m_db_name_length + 2, name) - m_ptr + 1); + /* + It is responsibility of caller to ensure that db and object names + are not longer than NAME_LEN. Still we play safe and try to avoid + buffer overruns. + */ + m_db_name_length= (uint16) (strmake(m_ptr + 1, db, NAME_LEN) - m_ptr - 1); + m_length= (uint16) (strmake(m_ptr + m_db_name_length + 2, name, NAME_LEN) - + m_ptr + 1); } void mdl_key_init(const MDL_key *rhs) { diff --git a/sql/mysqld.cc b/sql/mysqld.cc index fa8b855d91c..19d01e61771 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1310,6 +1310,7 @@ static void clean_up(bool print_message); static int test_if_case_insensitive(const char *dir_name); #ifndef EMBEDDED_LIBRARY +static bool pid_file_created= false; static void usage(void); static void start_signal_handler(void); static void close_server_sock(); @@ -1318,6 +1319,7 @@ static void wait_for_signal_thread_to_end(void); static void create_pid_file(); static void mysqld_exit(int exit_code) __attribute__((noreturn)); #endif +static void delete_pid_file(myf flags); static void end_ssl(); @@ -1825,7 +1827,6 @@ void clean_up(bool print_message) item_user_lock_free(); lex_free(); /* Free some memory */ item_create_cleanup(); - free_charsets(); if (!opt_noacl) { #ifdef HAVE_DLOPEN @@ -1872,10 +1873,8 @@ void clean_up(bool print_message) debug_sync_end(); #endif /* defined(ENABLED_DEBUG_SYNC) */ -#if !defined(EMBEDDED_LIBRARY) - if (!opt_bootstrap) - mysql_file_delete(key_file_pid, pidfile_name, MYF(0)); // This may not always exist -#endif + delete_pid_file(MYF(0)); + if (print_message && my_default_lc_messages && server_start_time) sql_print_information(ER_DEFAULT(ER_SHUTDOWN_COMPLETE),my_progname); cleanup_errmsgs(); @@ -1891,6 +1890,7 @@ void clean_up(bool print_message) my_atomic_rwlock_destroy(&thread_running_lock); my_atomic_rwlock_destroy(&thread_count_lock); my_atomic_rwlock_destroy(&statistics_lock); + free_charsets(); mysql_mutex_lock(&LOCK_thread_count); DBUG_PRINT("quit", ("got thread count lock")); ready_to_exit=1; @@ -3261,14 +3261,7 @@ pthread_handler_t handle_shutdown(void *arg) } #endif -const char *load_default_groups[]= { -#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE -"mysql_cluster", -#endif -"mysqld", "server", MYSQL_BASE_VERSION, -"mariadb", MARIADB_BASE_VERSION, -"client-server", -0, 0}; +#include <mysqld_default_groups.h> #if defined(__WIN__) && !defined(EMBEDDED_LIBRARY) static const int load_default_groups_sz= @@ -5013,9 +5006,7 @@ int mysqld_main(int argc, char **argv) (void) pthread_kill(signal_thread, MYSQL_KILL_SIGNAL); - - if (!opt_bootstrap) - mysql_file_delete(key_file_pid, pidfile_name, MYF(MY_WME)); // Not needed anymore + delete_pid_file(MYF(MY_WME)); if (unix_sock != INVALID_SOCKET) unlink(mysqld_unix_port); @@ -7434,7 +7425,7 @@ static int mysql_init_variables(void) log_error_file_ptr= log_error_file; protocol_version= PROTOCOL_VERSION; what_to_log= ~ (1L << (uint) COM_TIME); - refresh_version= 1L; /* Increments on each reload */ + refresh_version= 2L; /* Increments on each reload. 0 and 1 are reserved */ denied_connections= 0; executed_events= 0; global_query_id= thread_id= 1L; @@ -8461,13 +8452,14 @@ static void create_pid_file() if ((file= mysql_file_create(key_file_pid, pidfile_name, 0664, O_WRONLY | O_TRUNC, MYF(MY_WME))) >= 0) { - char buff[21], *end; + char buff[MAX_BIGINT_WIDTH + 1], *end; end= int10_to_str((long) getpid(), buff, 10); *end++= '\n'; if (!mysql_file_write(file, (uchar*) buff, (uint) (end-buff), MYF(MY_WME | MY_NABP))) { mysql_file_close(file, MYF(0)); + pid_file_created= true; return; } mysql_file_close(file, MYF(0)); @@ -8477,6 +8469,26 @@ static void create_pid_file() } #endif /* EMBEDDED_LIBRARY */ + +/** + Remove the process' pid file. + + @param flags file operation flags +*/ + +static void delete_pid_file(myf flags) +{ +#ifndef EMBEDDED_LIBRARY + if (pid_file_created) + { + mysql_file_delete(key_file_pid, pidfile_name, flags); + pid_file_created= false; + } +#endif /* EMBEDDED_LIBRARY */ + return; +} + + /** Clear most status variables. */ void refresh_status(THD *thd) { diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 7a3a0c94a18..8b07e022ad3 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -11691,7 +11691,8 @@ static bool get_constant_key_infix(KEY *index_info, SEL_ARG *index_range_tree, KEY_PART_INFO **first_non_infix_part); static bool check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item, - Field::imagetype image_type); + Field::imagetype image_type, + bool *has_min_max_fld, bool *has_other_fld); static void cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts, @@ -12031,6 +12032,13 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time) else goto next_index; } + /* + This function is called on the precondition that the index is covering. + Therefore if the GROUP BY list contains more elements than the index, + these are duplicates. The GROUP BY list cannot be a prefix of the index. + */ + if (cur_part == end_part && tmp_group) + goto next_index; } /* Check (GA2) if this is a DISTINCT query. @@ -12084,7 +12092,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time) cur_parts have bits set for only used keyparts. */ ulonglong all_parts, cur_parts; - all_parts= (1<<max_key_part) - 1; + all_parts= (1ULL << max_key_part) - 1; cur_parts= used_key_parts_map.to_ulonglong() >> 1; if (all_parts != cur_parts) goto next_index; @@ -12241,10 +12249,12 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time) DBUG_RETURN(NULL); /* Check (SA3) for the where clause. */ + bool has_min_max_fld= false, has_other_fld= false; if (join->conds && min_max_arg_item && !check_group_min_max_predicates(join->conds, min_max_arg_item, (index_info->flags & HA_SPATIAL) ? - Field::itMBR : Field::itRAW)) + Field::itMBR : Field::itRAW, + &has_min_max_fld, &has_other_fld)) DBUG_RETURN(NULL); /* @@ -12292,16 +12302,24 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time) SYNOPSIS check_group_min_max_predicates() - cond tree (or subtree) describing all or part of the WHERE - clause being analyzed - min_max_arg_item the field referenced by the MIN/MAX function(s) - min_max_arg_part the keypart of the MIN/MAX argument if any + cond [in] the expression tree being analyzed + min_max_arg [in] the field referenced by the MIN/MAX function(s) + image_type [in] + has_min_max_arg [out] true if the subtree being analyzed references min_max_arg + has_other_arg [out] true if the subtree being analyzed references a column + other min_max_arg DESCRIPTION The function walks recursively over the cond tree representing a WHERE clause, and checks condition (SA3) - if a field is referenced by a MIN/MAX aggregate function, it is referenced only by one of the following - predicates: {=, !=, <, <=, >, >=, between, is null, is not null}. + predicates $FUNC$: + {=, !=, <, <=, >, >=, between, is [not] null, multiple equal}. + In addition the function checks that the WHERE condition is equivalent to + "cond1 AND cond2" where : + cond1 - does not use min_max_column at all. + cond2 - is an AND/OR tree with leaves in form + "$FUNC$(min_max_column[, const])". RETURN TRUE if cond passes the test @@ -12310,7 +12328,8 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time) static bool check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item, - Field::imagetype image_type) + Field::imagetype image_type, + bool *has_min_max_arg, bool *has_other_arg) { DBUG_ENTER("check_group_min_max_predicates"); DBUG_ASSERT(cond && min_max_arg_item); @@ -12322,12 +12341,24 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item, DBUG_PRINT("info", ("Analyzing: %s", ((Item_func*) cond)->func_name())); List_iterator_fast<Item> li(*((Item_cond*) cond)->argument_list()); Item *and_or_arg; + Item_func::Functype func_type= ((Item_cond*) cond)->functype(); + bool has_min_max= false, has_other= false; while ((and_or_arg= li++)) { - if (!check_group_min_max_predicates(and_or_arg, min_max_arg_item, - image_type)) + /* + The WHERE clause doesn't pass the condition if: + (1) any subtree doesn't pass the condition or + (2) the subtree passes the test, but it is an OR and it references both + the min/max argument and other columns. + */ + if (!check_group_min_max_predicates(and_or_arg, min_max_arg_item, //1 + image_type, + &has_min_max, &has_other) || + (func_type == Item_func::COND_OR_FUNC && has_min_max && has_other))//2 DBUG_RETURN(FALSE); } + *has_min_max_arg= has_min_max || *has_min_max_arg; + *has_other_arg= has_other || *has_other_arg; DBUG_RETURN(TRUE); } @@ -12361,6 +12392,10 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item, if (cond_type == Item::FIELD_ITEM) { DBUG_PRINT("info", ("Analyzing: %s", cond->full_name())); + if (min_max_arg_item->eq((Item_field*)cond, 1)) + *has_min_max_arg= true; + else + *has_other_arg= true; DBUG_RETURN(TRUE); } @@ -12369,9 +12404,33 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item, /* Test if cond references only group-by or non-group fields. */ Item_func *pred= (Item_func*) cond; + Item_func::Functype pred_type= pred->functype(); + DBUG_PRINT("info", ("Analyzing: %s", pred->func_name())); + if (pred_type == Item_func::MULT_EQUAL_FUNC) + { + /* + Check that each field in a multiple equality is either a constant or + it is a reference to the min/max argument, or it doesn't contain the + min/max argument at all. + */ + Item_equal_fields_iterator eq_it(*((Item_equal*)pred)); + Item *eq_item; + bool has_min_max= false, has_other= false; + while ((eq_item= eq_it++)) + { + if (min_max_arg_item->eq(eq_item->real_item(), 1)) + has_min_max= true; + else + has_other= true; + } + *has_min_max_arg= has_min_max || *has_min_max_arg; + *has_other_arg= has_other || *has_other_arg; + DBUG_RETURN(!(has_min_max && has_other)); + } + Item **arguments= pred->arguments(); Item *cur_arg; - DBUG_PRINT("info", ("Analyzing: %s", pred->func_name())); + bool has_min_max= false, has_other= false; for (uint arg_idx= 0; arg_idx < pred->argument_count (); arg_idx++) { cur_arg= arguments[arg_idx]->real_item(); @@ -12380,11 +12439,11 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item, { if (min_max_arg_item->eq(cur_arg, 1)) { - /* - If pred references the MIN/MAX argument, check whether pred is a range - condition that compares the MIN/MAX argument with a constant. - */ - Item_func::Functype pred_type= pred->functype(); + has_min_max= true; + /* + If pred references the MIN/MAX argument, check whether pred is a range + condition that compares the MIN/MAX argument with a constant. + */ if (pred_type != Item_func::EQUAL_FUNC && pred_type != Item_func::LT_FUNC && pred_type != Item_func::LE_FUNC && @@ -12424,14 +12483,16 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item, min_max_arg_item->field->cmp_type() != args[1]->result_type()))) DBUG_RETURN(FALSE); } + else + has_other= true; } else if (cur_arg->type() == Item::FUNC_ITEM) { - if (!check_group_min_max_predicates(cur_arg, min_max_arg_item, - image_type)) + if (!check_group_min_max_predicates(cur_arg, min_max_arg_item, image_type, + &has_min_max, &has_other)) DBUG_RETURN(FALSE); } - else if (cur_arg->const_item()) + else if (cur_arg->const_item() && !cur_arg->is_expensive()) { /* For predicates of the form "const OP expr" we also have to check 'expr' @@ -12441,7 +12502,11 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item, } else DBUG_RETURN(FALSE); + if(has_min_max && has_other) + DBUG_RETURN(FALSE); } + *has_min_max_arg= has_min_max || *has_min_max_arg; + *has_other_arg= has_other || *has_other_arg; DBUG_RETURN(TRUE); } diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 6698d4af28d..710c04ba063 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -2549,6 +2549,10 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx, /* Mark strategy as used */ (*strategy)->mark_used(); pos->sj_strategy= sj_strategy; + if (sj_strategy == SJ_OPT_MATERIALIZE) + join->sjm_lookup_tables |= handled_fanout; + else + join->sjm_lookup_tables &= ~handled_fanout; *current_read_time= read_time; *current_record_count= rec_count; join->cur_dups_producing_tables &= ~handled_fanout; @@ -3073,6 +3077,13 @@ void restore_prev_sj_state(const table_map remaining_tables, const JOIN_TAB *tab, uint idx) { TABLE_LIST *emb_sj_nest; + + if (tab->emb_sj_nest) + { + table_map subq_tables= tab->emb_sj_nest->sj_inner_tables; + tab->join->sjm_lookup_tables &= ~subq_tables; + } + if ((emb_sj_nest= tab->emb_sj_nest)) { /* If we're removing the last SJ-inner table, remove the sj-nest */ @@ -3250,6 +3261,7 @@ void fix_semijoin_strategies_for_picked_join_order(JOIN *join) uint tablenr; table_map remaining_tables= 0; table_map handled_tabs= 0; + join->sjm_lookup_tables= 0; for (tablenr= table_count - 1 ; tablenr != join->const_tables - 1; tablenr--) { POSITION *pos= join->best_positions + tablenr; @@ -3275,6 +3287,7 @@ void fix_semijoin_strategies_for_picked_join_order(JOIN *join) first= tablenr - sjm->tables + 1; join->best_positions[first].n_sj_tables= sjm->tables; join->best_positions[first].sj_strategy= SJ_OPT_MATERIALIZE; + join->sjm_lookup_tables|= s->table->map; } else if (pos->sj_strategy == SJ_OPT_MATERIALIZE_SCAN) { diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc index 1b9e744bcc1..8a1170cf4fa 100644 --- a/sql/rpl_utility.cc +++ b/sql/rpl_utility.cc @@ -878,8 +878,13 @@ TABLE *table_def::create_conversion_table(THD *thd, Relay_log_info *rli, TABLE * DBUG_ENTER("table_def::create_conversion_table"); List<Create_field> field_list; - - for (uint col= 0 ; col < size() ; ++col) + /* + At slave, columns may differ. So we should create + min(columns@master, columns@slave) columns in the + conversion table. + */ + uint const cols_to_create= min(target_table->s->fields, size()); + for (uint col= 0 ; col < cols_to_create; ++col) { Create_field *field_def= (Create_field*) alloc_root(thd->mem_root, sizeof(Create_field)); diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index a6ebebeae39..8c7a8000695 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -4989,13 +4989,13 @@ ER_WRONG_NAME_FOR_CATALOG 42000 spa "Nombre de catalog incorrecto '%-.100s'" swe "Felaktigt katalog namn '%-.100s'" ER_WARN_QC_RESIZE - eng "Query cache failed to set size %lu; new query cache size is %lu" - ger "Änderung der Query-Cache-Größe auf %lu fehlgeschlagen; neue Query-Cache-Größe ist %lu" - por "Falha em Query cache para configurar tamanho %lu, novo tamanho de query cache é %lu" - rus "Кеш запроÑов не может уÑтановить размер %lu, новый размер кеша зпроÑов - %lu" - spa "Query cache fallada para configurar tamaño %lu, nuevo tamaño de query cache es %lu" - swe "Storleken av "Query cache" kunde inte sättas till %lu, ny storlek är %lu" - ukr "Кеш запитів неÑпроможен вÑтановити розмір %lu, новий розмір кеша запитів - %lu" + eng "Query cache failed to set size %llu; new query cache size is %lu" + ger "Änderung der Query-Cache-Größe auf %llu fehlgeschlagen; neue Query-Cache-Größe ist %lu" + por "Falha em Query cache para configurar tamanho %llu, novo tamanho de query cache é %lu" + rus "Кеш запроÑов не может уÑтановить размер %llu, новый размер кеша зпроÑов - %lu" + spa "Query cache fallada para configurar tamaño %llu, nuevo tamaño de query cache es %lu" + swe "Storleken av "Query cache" kunde inte sättas till %llu, ny storlek är %lu" + ukr "Кеш запитів неÑпроможен вÑтановити розмір %llu, новий розмір кеша запитів - %lu" ER_BAD_FT_COLUMN eng "Column '%-.192s' cannot be part of FULLTEXT index" ger "Feld '%-.192s' kann nicht Teil eines FULLTEXT-Index sein" diff --git a/sql/slave.cc b/sql/slave.cc index da10169d97b..e2a4d229ab9 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1337,6 +1337,7 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi) unavailable (very old master not supporting UNIX_TIMESTAMP()?). */ +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("dbug.before_get_UNIX_TIMESTAMP", { const char act[]= @@ -1346,6 +1347,7 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi) DBUG_ASSERT(!debug_sync_set_action(current_thd, STRING_WITH_LEN(act))); };); +#endif master_res= NULL; if (!mysql_real_query(mysql, STRING_WITH_LEN("SELECT UNIX_TIMESTAMP()")) && @@ -1387,6 +1389,7 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi) Note: we could have put a @@SERVER_ID in the previous SELECT UNIX_TIMESTAMP() instead, but this would not have worked on 3.23 masters. */ +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("dbug.before_get_SERVER_ID", { const char act[]= @@ -1396,6 +1399,7 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi) DBUG_ASSERT(!debug_sync_set_action(current_thd, STRING_WITH_LEN(act))); };); +#endif master_res= NULL; master_row= NULL; if (!mysql_real_query(mysql, @@ -3241,6 +3245,7 @@ pthread_handler_t handle_slave_io(void *arg) connected: +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("dbug.before_get_running_status_yes", { const char act[]= @@ -3250,6 +3255,7 @@ connected: DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act))); };); +#endif // TODO: the assignment below should be under mutex (5.0) mi->slave_running= MYSQL_SLAVE_RUN_CONNECT; diff --git a/sql/spatial.cc b/sql/spatial.cc index de0b563eaf4..2359f4fa271 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -312,6 +312,9 @@ bool Geometry::envelope(String *result) const const char *end; if (get_mbr(&mbr, &end)) + return 1; + + if (!mbr.valid()) { /* Empty geometry */ if (result->reserve(1 + 4*2)) @@ -444,18 +447,19 @@ const char *Geometry::append_points(String *txt, uint32 n_points, const char *Geometry::get_mbr_for_points(MBR *mbr, const char *data, uint offset) const { - uint32 points; + uint32 n_points; /* read number of points */ if (no_data(data, 4)) return 0; - points= uint4korr(data); + n_points= uint4korr(data); data+= 4; - if (no_data(data, (POINT_DATA_SIZE + offset) * points)) + if (n_points > max_n_points || + no_data(data, (POINT_DATA_SIZE + offset) * n_points)) return 0; /* Calculate MBR for points */ - while (points--) + while (n_points--) { data+= offset; mbr->add_xy(data, data + SIZEOF_STORED_DOUBLE); @@ -559,9 +563,12 @@ const Geometry::Class_info *Gis_point::get_class_info() const uint32 Gis_line_string::get_data_size() const { - if (no_data(m_data, 4)) + uint32 n_points, size; + if (no_data(m_data, 4) || + (n_points= uint4korr(m_data)) > max_n_points || + no_data(m_data, (size= 4 + n_points * POINT_DATA_SIZE))) return GET_SIZE_ERROR; - return 4 + uint4korr(m_data) * POINT_DATA_SIZE; + return size; } @@ -631,7 +638,7 @@ bool Gis_line_string::get_data_as_wkt(String *txt, const char **end) const n_points= uint4korr(data); data += 4; - if (n_points < 1 || + if (n_points < 1 || n_points > max_n_points || no_data(data, POINT_DATA_SIZE * n_points) || txt->reserve(((MAX_DIGITS_IN_DOUBLE + 1)*2 + 1) * n_points)) return 1; @@ -669,7 +676,8 @@ int Gis_line_string::geom_length(double *len, const char **end) const return 1; n_points= uint4korr(data); data+= 4; - if (n_points < 1 || no_data(data, POINT_DATA_SIZE * n_points)) + if (n_points < 1 || n_points > max_n_points || + no_data(data, POINT_DATA_SIZE * n_points)) return 1; get_point(&prev_x, &prev_y, data); @@ -717,7 +725,7 @@ int Gis_line_string::is_closed(int *closed) const return 0; } data+= 4; - if (n_points == 0 || + if (n_points == 0 || n_points > max_n_points || no_data(data, POINT_DATA_SIZE * n_points)) return 1; @@ -753,6 +761,9 @@ int Gis_line_string::end_point(String *result) const if (no_data(m_data, 4)) return 1; n_points= uint4korr(m_data); + if (n_points == 0 || n_points > max_n_points || + no_data(m_data, POINT_DATA_SIZE * n_points)) + return 1; return create_point(result, m_data + 4 + (n_points - 1) * POINT_DATA_SIZE); } @@ -762,11 +773,14 @@ int Gis_line_string::point_n(uint32 num, String *result) const uint32 n_points; if (no_data(m_data, 4)) return 1; + num--; n_points= uint4korr(m_data); - if ((uint32) (num - 1) >= n_points) // means (num > n_points || num < 1) + if (num >= n_points || + num > max_n_points || // means (num > n_points || num < 1) + no_data(m_data, num * POINT_DATA_SIZE)) return 1; - return create_point(result, m_data + 4 + (num - 1) * POINT_DATA_SIZE); + return create_point(result, m_data + 4 + num*POINT_DATA_SIZE); } @@ -782,7 +796,8 @@ int Gis_line_string::store_shapes(Gcalc_shape_transporter *trn) const return 1; n_points= uint4korr(data); data+= 4; - if (n_points < 1 || no_data(data, POINT_DATA_SIZE * n_points)) + if (n_points < 1 || n_points > max_n_points || + no_data(data, POINT_DATA_SIZE * n_points)) return 1; trn->start_line(); @@ -815,6 +830,7 @@ const Geometry::Class_info *Gis_line_string::get_class_info() const uint32 Gis_polygon::get_data_size() const { uint32 n_linear_rings; + uint32 n_points; const char *data= m_data; if (no_data(data, 4)) @@ -824,10 +840,13 @@ uint32 Gis_polygon::get_data_size() const while (n_linear_rings--) { - if (no_data(data, 4)) + if (no_data(data, 4) || + (n_points= uint4korr(data)) > max_n_points) return GET_SIZE_ERROR; - data+= 4 + uint4korr(data)*POINT_DATA_SIZE; + data+= 4 + n_points*POINT_DATA_SIZE; } + if (no_data(data, 0)) + return GET_SIZE_ERROR; return (uint32) (data - m_data); } @@ -966,7 +985,7 @@ bool Gis_polygon::get_data_as_wkt(String *txt, const char **end) const return 1; n_points= uint4korr(data); data+= 4; - if (no_data(data, POINT_DATA_SIZE * n_points) || + if (n_points > max_n_points || no_data(data, POINT_DATA_SIZE * n_points) || txt->reserve(2 + ((MAX_DIGITS_IN_DOUBLE + 1) * 2 + 1) * n_points)) return 1; txt->qs_append('('); @@ -1020,7 +1039,8 @@ int Gis_polygon::area(double *ar, const char **end_of_data) const if (no_data(data, 4)) return 1; n_points= uint4korr(data); - if (no_data(data, POINT_DATA_SIZE * n_points)) + if (n_points == 0 || n_points > max_n_points || + no_data(data, POINT_DATA_SIZE * n_points)) return 1; get_point(&prev_x, &prev_y, data+4); data+= (4+POINT_DATA_SIZE); @@ -1056,7 +1076,8 @@ int Gis_polygon::exterior_ring(String *result) const n_points= uint4korr(data); data+= 4; length= n_points * POINT_DATA_SIZE; - if (no_data(data, length) || result->reserve(1 + 4 + 4 + length)) + if (n_points > max_n_points || + no_data(data, length) || result->reserve(1 + 4 + 4 + length)) return 1; result->q_append((char) wkb_ndr); @@ -1102,7 +1123,8 @@ int Gis_polygon::interior_ring_n(uint32 num, String *result) const n_points= uint4korr(data); points_size= n_points * POINT_DATA_SIZE; data+= 4; - if (no_data(data, points_size) || result->reserve(1 + 4 + 4 + points_size)) + if (n_points > max_n_points || + no_data(data, points_size) || result->reserve(1 + 4 + 4 + points_size)) return 1; result->q_append((char) wkb_ndr); @@ -1122,13 +1144,11 @@ int Gis_polygon::centroid_xy(double *x, double *y) const const char *data= m_data; bool first_loop= 1; - if (no_data(data, 4)) + if (no_data(data, 4) || + (n_linear_rings= uint4korr(data)) == 0) return 1; - n_linear_rings= uint4korr(data); data+= 4; - DBUG_ASSERT(n_linear_rings > 0); - while (n_linear_rings--) { uint32 n_points, org_n_points; @@ -1141,7 +1161,8 @@ int Gis_polygon::centroid_xy(double *x, double *y) const return 1; org_n_points= n_points= uint4korr(data); data+= 4; - if (no_data(data, POINT_DATA_SIZE * n_points)) + if (n_points == 0 || n_points > max_n_points || + no_data(data, POINT_DATA_SIZE * n_points)) return 1; get_point(&prev_x, &prev_y, data); data+= POINT_DATA_SIZE; @@ -1215,7 +1236,8 @@ int Gis_polygon::store_shapes(Gcalc_shape_transporter *trn) const return 1; n_points= uint4korr(data); data+= 4; - if (!n_points || no_data(data, POINT_DATA_SIZE * n_points)) + if (!n_points || n_points > max_n_points || + no_data(data, POINT_DATA_SIZE * n_points)) return 1; trn->start_ring(); @@ -1268,9 +1290,14 @@ const Geometry::Class_info *Gis_polygon::get_class_info() const uint32 Gis_multi_point::get_data_size() const { - if (no_data(m_data, 4)) - return GET_SIZE_ERROR; - return 4 + uint4korr(m_data)*(POINT_DATA_SIZE + WKB_HEADER_SIZE); + uint32 n_points; + uint32 size; + + if (no_data(m_data, 4) || + (n_points= uint4korr(m_data)) > max_n_points || + no_data(m_data, (size= 4 + n_points*(POINT_DATA_SIZE + WKB_HEADER_SIZE)))) + return GET_SIZE_ERROR; + return size; } @@ -1364,8 +1391,8 @@ bool Gis_multi_point::get_data_as_wkt(String *txt, const char **end) const return 1; n_points= uint4korr(m_data); - if (no_data(m_data+4, - n_points * (POINT_DATA_SIZE + WKB_HEADER_SIZE)) || + if (n_points > max_n_points || + no_data(m_data+4, n_points * (POINT_DATA_SIZE + WKB_HEADER_SIZE)) || txt->reserve(((MAX_DIGITS_IN_DOUBLE + 1) * 2 + 1) * n_points)) return 1; *end= append_points(txt, n_points, m_data+4, WKB_HEADER_SIZE); @@ -1446,6 +1473,7 @@ const Geometry::Class_info *Gis_multi_point::get_class_info() const uint32 Gis_multi_line_string::get_data_size() const { uint32 n_line_strings; + uint32 n_points; const char *data= m_data; if (no_data(data, 4)) @@ -1455,11 +1483,13 @@ uint32 Gis_multi_line_string::get_data_size() const while (n_line_strings--) { - if (no_data(data, WKB_HEADER_SIZE + 4)) + if (no_data(data, WKB_HEADER_SIZE + 4) || + (n_points= uint4korr(data + WKB_HEADER_SIZE)) > max_n_points) return GET_SIZE_ERROR; - data+= (WKB_HEADER_SIZE + 4 + uint4korr(data + WKB_HEADER_SIZE) * - POINT_DATA_SIZE); + data+= (WKB_HEADER_SIZE + 4 + n_points*POINT_DATA_SIZE); } + if (no_data(data, 0)) + return GET_SIZE_ERROR; return (uint32) (data - m_data); } @@ -1583,7 +1613,7 @@ bool Gis_multi_line_string::get_data_as_wkt(String *txt, return 1; n_points= uint4korr(data + WKB_HEADER_SIZE); data+= WKB_HEADER_SIZE + 4; - if (no_data(data, n_points * POINT_DATA_SIZE) || + if (n_points > max_n_points || no_data(data, n_points * POINT_DATA_SIZE) || txt->reserve(2 + ((MAX_DIGITS_IN_DOUBLE + 1) * 2 + 1) * n_points)) return 1; txt->qs_append('('); @@ -1644,7 +1674,7 @@ int Gis_multi_line_string::geometry_n(uint32 num, String *result) const return 1; n_points= uint4korr(data + WKB_HEADER_SIZE); length= WKB_HEADER_SIZE + 4+ POINT_DATA_SIZE * n_points; - if (no_data(data, length)) + if (n_points > max_n_points || no_data(data, length)) return 1; if (!--num) break; @@ -1755,6 +1785,7 @@ const Geometry::Class_info *Gis_multi_line_string::get_class_info() const uint32 Gis_multi_polygon::get_data_size() const { uint32 n_polygons; + uint32 n_points; const char *data= m_data; if (no_data(data, 4)) @@ -1773,11 +1804,14 @@ uint32 Gis_multi_polygon::get_data_size() const while (n_linear_rings--) { - if (no_data(data, 4)) + if (no_data(data, 4) || + (n_points= uint4korr(data)) > max_n_points) return GET_SIZE_ERROR; - data+= 4 + uint4korr(data) * POINT_DATA_SIZE; + data+= 4 + n_points * POINT_DATA_SIZE; } } + if (no_data(data, 0)) + return GET_SIZE_ERROR; return (uint32) (data - m_data); } @@ -1905,7 +1939,8 @@ bool Gis_multi_polygon::get_data_as_wkt(String *txt, const char **end) const return 1; uint32 n_points= uint4korr(data); data+= 4; - if (no_data(data, POINT_DATA_SIZE * n_points) || + if (n_points > max_n_points || + no_data(data, POINT_DATA_SIZE * n_points) || txt->reserve(2 + ((MAX_DIGITS_IN_DOUBLE + 1) * 2 + 1) * n_points, 512)) return 1; @@ -1988,6 +2023,8 @@ int Gis_multi_polygon::geometry_n(uint32 num, String *result) const if (no_data(data, 4)) return 1; n_points= uint4korr(data); + if (n_points > max_n_points) + return 1; data+= 4 + POINT_DATA_SIZE * n_points; } } while (--num); @@ -2317,7 +2354,7 @@ bool Gis_geometry_collection::get_mbr(MBR *mbr, const char **end) const n_objects= uint4korr(data); data+= 4; if (n_objects == 0) - return 1; + goto exit; while (n_objects--) { @@ -2334,6 +2371,7 @@ bool Gis_geometry_collection::get_mbr(MBR *mbr, const char **end) const if (geom->get_mbr(mbr, &data)) return 1; } +exit: *end= data; return 0; } @@ -2351,10 +2389,11 @@ int Gis_geometry_collection::area(double *ar, const char **end) const return 1; n_objects= uint4korr(data); data+= 4; - if (n_objects == 0) - return 1; result= 0.0; + if (n_objects == 0) + goto exit; + while (n_objects--) { uint32 wkb_type; @@ -2371,6 +2410,7 @@ int Gis_geometry_collection::area(double *ar, const char **end) const return 1; result+= *ar; } +exit: *end= data; *ar= result; return 0; @@ -2389,10 +2429,11 @@ int Gis_geometry_collection::geom_length(double *len, const char **end) const return 1; n_objects= uint4korr(data); data+= 4; + result= 0.0; + if (n_objects == 0) - return 1; + goto exit; - result= 0.0; while (n_objects--) { uint32 wkb_type; @@ -2409,6 +2450,8 @@ int Gis_geometry_collection::geom_length(double *len, const char **end) const return 1; result+= *len; } + +exit: *end= data; *len= result; return 0; diff --git a/sql/spatial.h b/sql/spatial.h index 1277e7bc01c..9aaedfe8a20 100644 --- a/sql/spatial.h +++ b/sql/spatial.h @@ -200,6 +200,9 @@ struct MBR return (d == intersection.dimension()); } + + int valid() const + { return xmin <= xmax && ymin <= ymax; } }; @@ -210,6 +213,11 @@ struct Geometry_buffer; class Geometry { public: + // Maximum number of points in feature that can fit into String + static const uint32 max_n_points= + (uint32) (INT_MAX32 - WKB_HEADER_SIZE - 4 /* n_points */) / + POINT_DATA_SIZE; + Geometry() {} /* Remove gcc warning */ virtual ~Geometry() {} /* Remove gcc warning */ static void *operator new(size_t size, void *buffer) @@ -391,10 +399,6 @@ public: class Gis_line_string: public Geometry { - // Maximum number of points in LineString that can fit into String - static const uint32 max_n_points= - (uint32) (UINT_MAX32 - WKB_HEADER_SIZE - 4 /* n_points */) / - POINT_DATA_SIZE; public: Gis_line_string() {} /* Remove gcc warning */ virtual ~Gis_line_string() {} /* Remove gcc warning */ diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 25b54abf983..f6b3a7adeb7 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -52,6 +52,8 @@ #include "sql_db.h" #include "sql_array.h" +#include "sql_plugin_compat.h" + bool mysql_user_table_is_in_short_password_format= false; static const @@ -8876,7 +8878,20 @@ static int do_auth_once(THD *thd, const LEX_STRING *auth_plugin_name, if (plugin) { st_mysql_auth *auth= (st_mysql_auth *) plugin_decl(plugin)->info; - res= auth->authenticate_user(mpvio, &mpvio->auth_info); + switch (auth->interface_version) { + case 0x0200: + res= auth->authenticate_user(mpvio, &mpvio->auth_info); + break; + case 0x0100: + { + MYSQL_SERVER_AUTH_INFO_0x0100 compat; + compat.downgrade(&mpvio->auth_info); + res= auth->authenticate_user(mpvio, (MYSQL_SERVER_AUTH_INFO *)&compat); + compat.upgrade(&mpvio->auth_info); + } + break; + default: DBUG_ASSERT(0); + } if (unlock_plugin) plugin_unlock(thd, plugin); @@ -8927,8 +8942,6 @@ bool acl_authenticate(THD *thd, uint connect_errors, : COM_CONNECT; DBUG_ENTER("acl_authenticate"); - compile_time_assert(MYSQL_USERNAME_LENGTH == USERNAME_LENGTH); - bzero(&mpvio, sizeof(mpvio)); mpvio.read_packet= server_mpvio_read_packet; mpvio.write_packet= server_mpvio_write_packet; diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index e6bbef482a7..10636fd7296 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -89,6 +89,7 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list, const char **ext; MY_STAT stat_info; Open_table_context ot_ctx(thd, (MYSQL_OPEN_IGNORE_FLUSH | + MYSQL_OPEN_FOR_REPAIR | MYSQL_OPEN_HAS_MDL_LOCK | MYSQL_LOCK_IGNORE_TIMEOUT)); DBUG_ENTER("prepare_for_repair"); @@ -199,7 +200,8 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list, */ pos_in_locked_tables= table->pos_in_locked_tables; if (wait_while_table_is_used(thd, table, - HA_EXTRA_PREPARE_FOR_FORCED_CLOSE)) + HA_EXTRA_PREPARE_FOR_FORCED_CLOSE, + TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE)) goto end; /* Close table but don't remove from locked list */ close_all_tables_for_name(thd, table_list->table->s, @@ -593,8 +595,10 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, */ if (lock_type == TL_WRITE && !table->table->s->tmp_table) { + table->table->s->protect_against_usage(); if (wait_while_table_is_used(thd, table->table, - HA_EXTRA_PREPARE_FOR_RENAME)) + HA_EXTRA_PREPARE_FOR_RENAME, + TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE)) goto err; DEBUG_SYNC(thd, "after_admin_flush"); /* Flush entries in the query cache involving this table. */ @@ -826,6 +830,11 @@ send_result_message: case HA_ADMIN_TRY_ALTER: { + uint save_flags; + Alter_info *alter_info= &lex->alter_info; + + /* Store the original value of alter_info->flags */ + save_flags= alter_info->flags; /* This is currently used only by InnoDB. ha_innobase::optimize() answers "try with alter", so here we close the table, do an ALTER TABLE, @@ -833,10 +842,19 @@ send_result_message: We have to end the row, so analyze could return more rows. */ protocol->store(STRING_WITH_LEN("note"), system_charset_info); - protocol->store(STRING_WITH_LEN( - "Table does not support optimize, doing recreate + analyze instead"), - system_charset_info); - if (protocol->write()) + if(alter_info->flags & ALTER_ADMIN_PARTITION) + { + protocol->store(STRING_WITH_LEN( + "Table does not support optimize on partitions. All partitions " + "will be rebuilt and analyzed."),system_charset_info); + } + else + { + protocol->store(STRING_WITH_LEN( + "Table does not support optimize, doing recreate + analyze instead"), + system_charset_info); + } + if (protocol->write()) goto err; DBUG_PRINT("info", ("HA_ADMIN_TRY_ALTER, trying analyze...")); TABLE_LIST *save_next_local= table->next_local, @@ -855,6 +873,11 @@ send_result_message: table->mdl_request.ticket= NULL; DEBUG_SYNC(thd, "ha_admin_open_ltable"); table->mdl_request.set_type(MDL_SHARED_WRITE); + /* + Reset the ALTER_ADMIN_PARTITION bit in alter_info->flags + to force analyze on all partitions. + */ + alter_info->flags &= ~(ALTER_ADMIN_PARTITION); if ((table->table= open_ltable(thd, table, lock_type, 0))) { result_code= table->table->file->ha_analyze(thd, check_opt); @@ -865,6 +888,7 @@ send_result_message: } else result_code= -1; // open failed + alter_info->flags= save_flags; } /* Start a new row for the final status row */ protocol->prepare_for_resend(); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index b3321bd2771..d32f39cae2f 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -327,12 +327,9 @@ uint create_table_def_key(THD *thd, char *key, const TABLE_LIST *table_list, bool tmp_table) { - char *db_end= strnmov(key, table_list->db, MAX_DBKEY_LENGTH - 2); - *db_end++= '\0'; - char *table_end= strnmov(db_end, table_list->table_name, - key + MAX_DBKEY_LENGTH - 1 - db_end); - *table_end++= '\0'; - uint key_length= (uint) (table_end-key); + uint key_length= create_table_def_key(key, table_list->db, + table_list->table_name); + if (tmp_table) { int4store(key + key_length, thd->server_id); @@ -835,13 +832,10 @@ void release_table_share(TABLE_SHARE *share) TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name) { char key[SAFE_NAME_LEN*2+2]; - TABLE_LIST table_list; uint key_length; mysql_mutex_assert_owner(&LOCK_open); - table_list.db= (char*) db; - table_list.table_name= (char*) table_name; - key_length= create_table_def_key((THD*) 0, key, &table_list, 0); + key_length= create_table_def_key(key, db, table_name); return (TABLE_SHARE*) my_hash_search(&table_def_cache, (uchar*) key, key_length); } @@ -1077,7 +1071,7 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, if (share) { kill_delayed_threads_for_table(share); - /* tdc_remove_table() also sets TABLE_SHARE::version to 0. */ + /* tdc_remove_table() calls share->remove_from_cache_at_close() */ tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED, table->db, table->table_name, TRUE); found=1; @@ -2339,7 +2333,8 @@ bool rename_temporary_table(THD* thd, TABLE *table, const char *db, */ bool wait_while_table_is_used(THD *thd, TABLE *table, - enum ha_extra_function function) + enum ha_extra_function function, + enum_tdc_remove_table_type remove_type) { DBUG_ENTER("wait_while_table_is_used"); DBUG_PRINT("enter", ("table: '%s' share: 0x%lx db_stat: %u version: %lu", @@ -2350,7 +2345,7 @@ bool wait_while_table_is_used(THD *thd, TABLE *table, table->mdl_ticket, thd->variables.lock_wait_timeout)) DBUG_RETURN(TRUE); - tdc_remove_table(thd, TDC_RT_REMOVE_NOT_OWN, + tdc_remove_table(thd, remove_type, table->s->db.str, table->s->table_name.str, FALSE); /* extra() call must come only after all instances above are closed */ @@ -3096,7 +3091,9 @@ retry_share: goto err_unlock; } - if (!(flags & MYSQL_OPEN_IGNORE_FLUSH)) + if (!(flags & MYSQL_OPEN_IGNORE_FLUSH) || + (share->protected_against_usage() && + !(flags & MYSQL_OPEN_FOR_REPAIR))) { if (share->has_old_version()) { @@ -3243,7 +3240,7 @@ err_unlock: TABLE *find_locked_table(TABLE *list, const char *db, const char *table_name) { char key[MAX_DBKEY_LENGTH]; - uint key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1; + uint key_length= create_table_def_key(key, db, table_name); for (TABLE *table= list; table ; table=table->next) { @@ -6156,17 +6153,27 @@ TABLE *open_table_uncached(THD *thd, const char *path, const char *db, } -bool rm_temporary_table(handlerton *base, char *path) +/** + Delete a temporary table. + + @param base Handlerton for table to be deleted. + @param path Path to the table to be deleted (i.e. path + to its .frm without an extension). + + @retval false - success. + @retval true - failure. +*/ + +bool rm_temporary_table(handlerton *base, const char *path) { bool error=0; handler *file; - char *ext; + char frm_path[FN_REFLEN + 1]; DBUG_ENTER("rm_temporary_table"); - strmov(ext= strend(path), reg_ext); - if (mysql_file_delete(key_file_frm, path, MYF(0))) + strxnmov(frm_path, sizeof(frm_path) - 1, path, reg_ext, NullS); + if (mysql_file_delete(key_file_frm, frm_path, MYF(0))) error=1; /* purecov: inspected */ - *ext= 0; // remove extension file= get_new_handler((TABLE_SHARE*) 0, current_thd->mem_root, base); if (file && file->ha_delete_table(path)) { @@ -8112,7 +8119,8 @@ bool setup_fields(THD *thd, Item **ref_pointer_array, thd->mark_used_columns= mark_used_columns; DBUG_PRINT("info", ("thd->mark_used_columns: %d", thd->mark_used_columns)); if (allow_sum_func) - thd->lex->allow_sum_func|= 1 << thd->lex->current_select->nest_level; + thd->lex->allow_sum_func|= + (nesting_map)1 << thd->lex->current_select->nest_level; thd->where= THD::DEFAULT_WHERE; save_is_item_list_lookup= thd->lex->current_select->is_item_list_lookup; thd->lex->current_select->is_item_list_lookup= 0; @@ -9401,6 +9409,7 @@ void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type, TABLE *table; TABLE_SHARE *share; DBUG_ENTER("tdc_remove_table"); + DBUG_PRINT("enter",("name: %s remove_type: %d", table_name, remove_type)); if (! has_lock) mysql_mutex_lock(&LOCK_open); @@ -9413,7 +9422,7 @@ void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type, thd->mdl_context.is_lock_owner(MDL_key::TABLE, db, table_name, MDL_EXCLUSIVE)); - key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1; + key_length= create_table_def_key(key, db, table_name); if ((share= (TABLE_SHARE*) my_hash_search(&table_def_cache,(uchar*) key, key_length))) @@ -9426,7 +9435,8 @@ void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type, { DBUG_ASSERT(share->used_tables.is_empty()); } - else if (remove_type == TDC_RT_REMOVE_NOT_OWN) + else if (remove_type == TDC_RT_REMOVE_NOT_OWN || + remove_type == TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE) { I_P_List_iterator<TABLE, TABLE_share> it2(share->used_tables); while ((table= it2++)) @@ -9437,8 +9447,8 @@ void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type, } #endif /* - Set share's version to zero in order to ensure that it gets - automatically deleted once it is no longer referenced. + Mark share to ensure that it gets automatically deleted once + it is no longer referenced. Note that code in TABLE_SHARE::wait_for_old_version() assumes that marking share as old and removal of its unused tables @@ -9447,7 +9457,13 @@ void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type, TDC does not contain old shares which don't have any tables used. */ - share->version= 0; + if (remove_type == TDC_RT_REMOVE_NOT_OWN) + share->remove_from_cache_at_close(); + else + { + /* Ensure that no can open the table while it's used */ + share->protect_against_usage(); + } while ((table= it++)) free_cache_entry(table); @@ -9527,12 +9543,14 @@ open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias, { LEX_STRING pathstr; File_parser *parser; - char path[FN_REFLEN]; + char path[FN_REFLEN+1]; DBUG_ENTER("open_new_frm"); /* Create path with extension */ - pathstr.length= (uint) (strxmov(path, share->normalized_path.str, reg_ext, - NullS)- path); + pathstr.length= (uint) (strxnmov(path, sizeof(path) - 1, + share->normalized_path.str, + reg_ext, + NullS) - path); pathstr.str= path; if ((parser= sql_parse_prepare(&pathstr, mem_root, 1))) diff --git a/sql/sql_base.h b/sql/sql_base.h index 78ab8c7df24..7d1797e2883 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -60,7 +60,8 @@ enum find_item_error_report_type {REPORT_ALL_ERRORS, REPORT_EXCEPT_NOT_FOUND, IGNORE_EXCEPT_NON_UNIQUE}; enum enum_tdc_remove_table_type {TDC_RT_REMOVE_ALL, TDC_RT_REMOVE_NOT_OWN, - TDC_RT_REMOVE_UNUSED}; + TDC_RT_REMOVE_UNUSED, + TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE}; /* bits for last argument to remove_table_from_cache() */ #define RTFC_NO_FLAG 0x0000 @@ -81,6 +82,31 @@ uint cached_table_definitions(void); uint create_table_def_key(THD *thd, char *key, const TABLE_LIST *table_list, bool tmp_table); + +/** + Create a table cache key for non-temporary table. + + @param key Buffer for key (must be at least NAME_LEN*2+2 bytes). + @param db Database name. + @param table_name Table name. + + @return Length of key. + + @sa create_table_def_key(thd, char *, table_list, bool) +*/ + +inline uint +create_table_def_key(char *key, const char *db, const char *table_name) +{ + /* + In theory caller should ensure that both db and table_name are + not longer than NAME_LEN bytes. In practice we play safe to avoid + buffer overruns. + */ + return (uint)(strmake(strmake(key, db, NAME_LEN) + 1, table_name, + NAME_LEN) - key + 1); +} + TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key, uint key_length, uint db_flags, int *error, my_hash_value_type hash_value); @@ -128,6 +154,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update, */ #define MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK 0x1000 #define MYSQL_LOCK_NOT_TEMPORARY 0x2000 +#define MYSQL_OPEN_FOR_REPAIR 0x4000 /** Please refer to the internals manual. */ #define MYSQL_OPEN_REOPEN (MYSQL_OPEN_IGNORE_FLUSH |\ @@ -158,7 +185,7 @@ thr_lock_type read_lock_type_for_table(THD *thd, TABLE_LIST *table_list); my_bool mysql_rm_tmp_tables(void); -bool rm_temporary_table(handlerton *base, char *path); +bool rm_temporary_table(handlerton *base, const char *path); void close_tables_for_reopen(THD *thd, TABLE_LIST **tables, const MDL_savepoint &start_of_statement_svp); TABLE_LIST *find_table_in_list(TABLE_LIST *table, @@ -229,7 +256,9 @@ bool setup_tables_and_check_access(THD *thd, ulong want_access, bool full_table_list); bool wait_while_table_is_used(THD *thd, TABLE *table, - enum ha_extra_function function); + enum ha_extra_function function, + enum_tdc_remove_table_type remove_type= + TDC_RT_REMOVE_NOT_OWN); void drop_open_table(THD *thd, TABLE *table, const char *db_name, const char *table_name); diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index ddc75254c9e..33b938225c0 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -828,18 +828,18 @@ void Query_cache_block::destroy() DBUG_VOID_RETURN; } -inline uint Query_cache_block::headers_len() +uint Query_cache_block::headers_len() { return (ALIGN_SIZE(sizeof(Query_cache_block_table)*n_tables) + ALIGN_SIZE(sizeof(Query_cache_block))); } -inline uchar* Query_cache_block::data(void) +uchar* Query_cache_block::data(void) { return (uchar*)( ((uchar*)this) + headers_len() ); } -inline Query_cache_query * Query_cache_block::query() +Query_cache_query * Query_cache_block::query() { #ifndef DBUG_OFF if (type != QUERY) @@ -848,7 +848,7 @@ inline Query_cache_query * Query_cache_block::query() return (Query_cache_query *) data(); } -inline Query_cache_table * Query_cache_block::table() +Query_cache_table * Query_cache_block::table() { #ifndef DBUG_OFF if (type != TABLE) @@ -857,7 +857,7 @@ inline Query_cache_table * Query_cache_block::table() return (Query_cache_table *) data(); } -inline Query_cache_result * Query_cache_block::result() +Query_cache_result * Query_cache_block::result() { #ifndef DBUG_OFF if (type != RESULT && type != RES_CONT && type != RES_BEG && @@ -867,7 +867,7 @@ inline Query_cache_result * Query_cache_block::result() return (Query_cache_result *) data(); } -inline Query_cache_block_table * Query_cache_block::table(TABLE_COUNTER_TYPE n) +Query_cache_block_table * Query_cache_block::table(TABLE_COUNTER_TYPE n) { return ((Query_cache_block_table *) (((uchar*)this)+ALIGN_SIZE(sizeof(Query_cache_block)) + @@ -3123,8 +3123,8 @@ void Query_cache::invalidate_table(THD *thd, TABLE_LIST *table_list) char key[MAX_DBKEY_LENGTH]; uint key_length; - key_length=(uint) (strmov(strmov(key,table_list->db)+1, - table_list->table_name) -key)+ 1; + key_length= create_table_def_key(key, table_list->db, + table_list->table_name); // We don't store temporary tables => no key_length+=4 ... invalidate_table(thd, (uchar *)key, key_length); @@ -3242,8 +3242,8 @@ Query_cache::register_tables_from_list(THD *thd, TABLE_LIST *tables_used, DBUG_PRINT("qcache", ("view: %s db: %s", tables_used->view_name.str, tables_used->view_db.str)); - key_length= (uint) (strmov(strmov(key, tables_used->view_db.str) + 1, - tables_used->view_name.str) - key) + 1; + key_length= create_table_def_key(key, tables_used->view_db.str, + tables_used->view_name.str); /* There are not callback function for for VIEWs */ @@ -4288,14 +4288,13 @@ my_bool Query_cache::move_by_type(uchar **border, case Query_cache_block::RESULT: { DBUG_PRINT("qcache", ("block 0x%lx RES* (%d)", (ulong) block, - (int) block->type)); + (int) block->type)); if (*border == 0) break; - Query_cache_block *query_block = block->result()->parent(), - *next = block->next, - *prev = block->prev; - Query_cache_block::block_type type = block->type; + Query_cache_block *query_block= block->result()->parent(); BLOCK_LOCK_WR(query_block); + Query_cache_block *next= block->next, *prev= block->prev; + Query_cache_block::block_type type= block->type; ulong len = block->length, used = block->used; Query_cache_block *pprev = block->pprev, *pnext = block->pnext, @@ -4457,8 +4456,9 @@ uint Query_cache::filename_2_table_key (char *key, const char *path, *db_length= (filename - dbname) - 1; DBUG_PRINT("qcache", ("table '%-.*s.%s'", *db_length, dbname, filename)); - DBUG_RETURN((uint) (strmov(strmake(key, dbname, *db_length) + 1, - filename) -key) + 1); + DBUG_RETURN((uint) (strmake(strmake(key, dbname, + min(*db_length, NAME_LEN)) + 1, + filename, NAME_LEN) - key) + 1); } /**************************************************************************** diff --git a/sql/sql_cache.h b/sql/sql_cache.h index 7444d444cf9..f35ac889b23 100644 --- a/sql/sql_cache.h +++ b/sql/sql_cache.h @@ -141,12 +141,12 @@ struct Query_cache_block inline bool is_free(void) { return type == FREE; } void init(ulong length); void destroy(); - inline uint headers_len(); - inline uchar* data(void); - inline Query_cache_query *query(); - inline Query_cache_table *table(); - inline Query_cache_result *result(); - inline Query_cache_block_table *table(TABLE_COUNTER_TYPE n); + uint headers_len(); + uchar* data(void); + Query_cache_query *query(); + Query_cache_table *table(); + Query_cache_result *result(); + Query_cache_block_table *table(TABLE_COUNTER_TYPE n); }; struct Query_cache_query diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 9fd3827ab39..6218ca60311 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1377,11 +1377,12 @@ void THD::cleanup(void) #error xid_state in the cache should be replaced by the allocated value } #endif - { - transaction.xid_state.xa_state= XA_NOTR; - trans_rollback(this); - xid_cache_delete(&transaction.xid_state); - } + + close_temporary_tables(this); + + transaction.xid_state.xa_state= XA_NOTR; + trans_rollback(this); + xid_cache_delete(&transaction.xid_state); locked_tables_list.unlock_locked_tables(this); mysql_ha_cleanup(this); @@ -1415,7 +1416,6 @@ void THD::cleanup(void) delete_dynamic(&user_var_events); my_hash_free(&user_vars); - close_temporary_tables(this); sp_cache_clear(&sp_proc_cache); sp_cache_clear(&sp_func_cache); @@ -1860,6 +1860,19 @@ void THD::cleanup_after_query() stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0; auto_inc_intervals_in_cur_stmt_for_binlog.empty(); rand_used= 0; +#ifndef EMBEDDED_LIBRARY + /* + Clean possible unused INSERT_ID events by current statement. + is_update_query() is needed to ignore SET statements: + Statements that don't update anything directly and don't + used stored functions. This is mostly necessary to ignore + statements in binlog between SET INSERT_ID and DML statement + which is intended to consume its event (there can be other + SET statements between them). + */ + if ((rli_slave || rli_fake) && is_update_query(lex->sql_command)) + auto_inc_intervals_forced.empty(); +#endif } if (first_successful_insert_id_in_cur_stmt > 0) { @@ -3121,42 +3134,13 @@ int select_exists_subselect::send_data(List<Item> &items) int select_dumpvar::prepare(List<Item> &list, SELECT_LEX_UNIT *u) { unit= u; - List_iterator_fast<my_var> var_li(var_list); - List_iterator_fast<Item> it(list); - Item *item; - my_var *mv; - Item_func_set_user_var **suv; if (var_list.elements != list.elements) { my_message(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT, ER(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT), MYF(0)); return 1; - } - - /* - Iterate over the destination variables and mark them as being - updated in this query. - We need to do this at JOIN::prepare time to ensure proper - const detection of Item_func_get_user_var that is determined - by the presence of Item_func_set_user_vars - */ - - suv= set_var_items= (Item_func_set_user_var **) - sql_alloc(sizeof(Item_func_set_user_var *) * list.elements); - - while ((mv= var_li++) && (item= it++)) - { - if (!mv->local) - { - *suv= new Item_func_set_user_var(mv->s, item); - (*suv)->fix_fields(thd, 0); - } - else - *suv= NULL; - suv++; - } - + } return 0; } @@ -3486,7 +3470,6 @@ int select_dumpvar::send_data(List<Item> &items) List_iterator<Item> it(items); Item *item; my_var *mv; - Item_func_set_user_var **suv; DBUG_ENTER("select_dumpvar::send_data"); if (unit->offset_limit_cnt) @@ -3499,19 +3482,20 @@ int select_dumpvar::send_data(List<Item> &items) my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0)); DBUG_RETURN(1); } - for (suv= set_var_items; ((mv= var_li++) && (item= it++)); suv++) + while ((mv= var_li++) && (item= it++)) { if (mv->local) { - DBUG_ASSERT(!*suv); if (thd->spcont->set_variable(thd, mv->offset, &item)) DBUG_RETURN(1); } else { - DBUG_ASSERT(*suv); - (*suv)->save_item_result(item); - if ((*suv)->update()) + Item_func_set_user_var *suv= new Item_func_set_user_var(mv->s, item); + suv->save_item_result(item); + if (suv->fix_fields(thd, 0)) + DBUG_RETURN (1); + if (suv->update()) DBUG_RETURN (1); } } @@ -4497,9 +4481,14 @@ bool xid_cache_insert(XID *xid, enum xa_states xa_state) bool xid_cache_insert(XID_STATE *xid_state) { mysql_mutex_lock(&LOCK_xid_cache); - DBUG_ASSERT(my_hash_search(&xid_cache, xid_state->xid.key(), - xid_state->xid.key_length())==0); - my_bool res=my_hash_insert(&xid_cache, (uchar*)xid_state); + if (my_hash_search(&xid_cache, xid_state->xid.key(), + xid_state->xid.key_length())) + { + mysql_mutex_unlock(&LOCK_xid_cache); + my_error(ER_XAER_DUPID, MYF(0)); + return true; + } + bool res= my_hash_insert(&xid_cache, (uchar*)xid_state); mysql_mutex_unlock(&LOCK_xid_cache); return res; } diff --git a/sql/sql_class.h b/sql/sql_class.h index 01558603f68..a5bb12ae370 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -581,6 +581,9 @@ typedef struct system_variables ulong wt_timeout_long, wt_deadlock_search_depth_long; double long_query_time_double; + + my_bool pseudo_slave_mode; + } SV; /** @@ -3366,6 +3369,7 @@ public: #else void begin_dataset() {} #endif + virtual void update_used_tables() {} }; @@ -4133,6 +4137,7 @@ public: return updated; } virtual void abort_result_set(); + void update_used_tables(); }; class my_var : public Sql_alloc { @@ -4156,7 +4161,6 @@ public: class select_dumpvar :public select_result_interceptor { ha_rows row_count; - Item_func_set_user_var **set_var_items; public: List<my_var> var_list; select_dumpvar() { var_list.empty(); row_count= 0;} diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc index fde9f70fa79..6b0882bda80 100644 --- a/sql/sql_join_cache.cc +++ b/sql/sql_join_cache.cc @@ -775,7 +775,7 @@ ulong JOIN_CACHE::get_min_join_buffer_size() tab= next_linear_tab(join, tab, WITHOUT_BUSH_ROOTS)) { len+= tab->get_max_used_fieldlength(); - len_last=+ tab->get_used_fieldlength(); + len_last+= tab->get_used_fieldlength(); } size_t len_addon= get_record_max_affix_length() + get_max_key_addon_space_per_record(); diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 2f81172dc7f..a6038031936 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -3871,7 +3871,8 @@ void SELECT_LEX::update_used_tables() { for (ORDER *order= order_list.first; order; order= order->next) (*order->item)->update_used_tables(); - } + } + join->result->update_used_tables(); } diff --git a/sql/sql_list.h b/sql/sql_list.h index b4e0ab84aab..aef2f8d5f25 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -287,13 +287,15 @@ public: if (node == &end_of_list) return; } - *prev= *last; + *prev= &end_of_list; last= prev; } inline void prepand(base_list *list) { if (!list->is_empty()) { + if (is_empty()) + last= list->last; *list->last= first; first= list->first; elements+= list->elements; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index bdf2bd17589..ed4a68c8534 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1658,7 +1658,7 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident, break; case SCH_USER_STATS: case SCH_CLIENT_STATS: - if (check_global_access(thd, SUPER_ACL | PROCESS_ACL)) + if (check_global_access(thd, SUPER_ACL | PROCESS_ACL, true)) DBUG_RETURN(1); case SCH_TABLE_STATS: case SCH_INDEX_STATS: @@ -1833,7 +1833,7 @@ bool sp_process_definer(THD *thd) if ((strcmp(lex->definer->user.str, thd->security_ctx->priv_user) || my_strcasecmp(system_charset_info, lex->definer->host.str, thd->security_ctx->priv_host)) && - check_global_access(thd, SUPER_ACL)) + check_global_access(thd, SUPER_ACL, true)) { my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER"); DBUG_RETURN(TRUE); @@ -3095,6 +3095,7 @@ end_with_restore_list: thd->first_successful_insert_id_in_cur_stmt= thd->first_successful_insert_id_in_prev_stmt; +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("after_mysql_insert", { const char act1[]= @@ -3110,6 +3111,7 @@ end_with_restore_list: STRING_WITH_LEN(act2))); };); DEBUG_SYNC(thd, "after_mysql_insert"); +#endif break; } case SQLCOM_REPLACE_SELECT: @@ -5475,14 +5477,17 @@ bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table) 1 Access denied. In this case an error is sent to the client */ -bool check_global_access(THD *thd, ulong want_access) +bool check_global_access(THD *thd, ulong want_access, bool no_errors) { #ifndef NO_EMBEDDED_ACCESS_CHECKS char command[128]; if ((thd->security_ctx->master_access & want_access)) return 0; - get_privilege_desc(command, sizeof(command), want_access); - my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command); + if (!no_errors) + { + get_privilege_desc(command, sizeof(command), want_access); + my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command); + } status_var_increment(thd->status_var.access_denied_errors); return 1; #else diff --git a/sql/sql_parse.h b/sql/sql_parse.h index 4510ebe94e2..6d47e648be2 100644 --- a/sql/sql_parse.h +++ b/sql/sql_parse.h @@ -196,7 +196,7 @@ check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables, /* These were under the INNODB_COMPATIBILITY_HOOKS */ -bool check_global_access(THD *thd, ulong want_access); +bool check_global_access(THD *thd, ulong want_access, bool no_errors= false); inline bool is_supported_parser_charset(CHARSET_INFO *cs) { diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 1c47991f474..07b93818bb7 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -35,6 +35,8 @@ #include <mysql/plugin_auth.h> #include "lock.h" // MYSQL_LOCK_IGNORE_TIMEOUT #include <mysql/plugin_auth.h> +#include "sql_plugin_compat.h" + #define REPORT_TO_LOG 1 #define REPORT_TO_USER 2 @@ -135,7 +137,7 @@ static int min_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]= MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION, MYSQL_AUDIT_INTERFACE_VERSION, MYSQL_REPLICATION_INTERFACE_VERSION, - MYSQL_AUTHENTICATION_INTERFACE_VERSION + MIN_AUTHENTICATION_INTERFACE_VERSION }; static int cur_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]= { diff --git a/sql/sql_plugin_compat.h b/sql/sql_plugin_compat.h new file mode 100644 index 00000000000..8c6014f8dc6 --- /dev/null +++ b/sql/sql_plugin_compat.h @@ -0,0 +1,65 @@ +/* Copyright (C) 2013 Sergei Golubchik and Monty Program 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; version 2 of the License. + + 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/* old plugin api structures, used for backward compatibility */ + +#define upgrade_var(X) latest->X= X +#define upgrade_str(X) strmake(latest->X, X, sizeof(X)) +#define downgrade_var(X) X= latest->X +#define downgrade_str(X) strmake(X, latest->X, sizeof(X)-1) + +/**************************************************************/ +/* Authentication API, version 0x0100 *************************/ +#define MIN_AUTHENTICATION_INTERFACE_VERSION 0x0100 + +struct MYSQL_SERVER_AUTH_INFO_0x0100 { + char *user_name; + unsigned int user_name_length; + const char *auth_string; + unsigned long auth_string_length; + char authenticated_as[49]; + char external_user[512]; + int password_used; + const char *host_or_ip; + unsigned int host_or_ip_length; + + void upgrade(MYSQL_SERVER_AUTH_INFO *latest) + { + upgrade_var(user_name); + upgrade_var(user_name_length); + upgrade_var(auth_string); + upgrade_var(auth_string_length); + upgrade_str(authenticated_as); + upgrade_str(external_user); + upgrade_var(password_used); + upgrade_var(host_or_ip); + upgrade_var(host_or_ip_length); + } + void downgrade(MYSQL_SERVER_AUTH_INFO *latest) + { + downgrade_var(user_name); + downgrade_var(user_name_length); + downgrade_var(auth_string); + downgrade_var(auth_string_length); + downgrade_str(authenticated_as); + downgrade_str(external_user); + downgrade_var(password_used); + downgrade_var(host_or_ip); + downgrade_var(host_or_ip_length); + } +}; + +/**************************************************************/ + diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 6b8d0f5153f..631255e0d69 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -966,6 +966,7 @@ impossible position"; event_type= (Log_event_type)((uchar)(*packet)[LOG_EVENT_OFFSET+ev_offset]); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("dump_thread_wait_before_send_xid", { if (event_type == XID_EVENT) @@ -984,6 +985,7 @@ impossible position"; STRING_WITH_LEN(act2))); } }); +#endif if (event_type == FORMAT_DESCRIPTION_EVENT) { current_checksum_alg= get_checksum_alg(packet->ptr() + ev_offset, @@ -1348,6 +1350,8 @@ int start_slave(THD* thd , Master_info* mi, bool net_report) if (thd->lex->mi.pos) { + if (thd->lex->mi.relay_log_pos) + slave_errno=ER_BAD_SLAVE_UNTIL_COND; mi->rli.until_condition= Relay_log_info::UNTIL_MASTER_POS; mi->rli.until_log_pos= thd->lex->mi.pos; /* @@ -1359,6 +1363,8 @@ int start_slave(THD* thd , Master_info* mi, bool net_report) } else if (thd->lex->mi.relay_log_pos) { + if (thd->lex->mi.pos) + slave_errno=ER_BAD_SLAVE_UNTIL_COND; mi->rli.until_condition= Relay_log_info::UNTIL_RELAY_POS; mi->rli.until_log_pos= thd->lex->mi.relay_log_pos; strmake(mi->rli.until_log_name, thd->lex->mi.relay_log_name, diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 81f510a4563..0abac42eb73 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2012 Oracle and/or its affiliates. +/* Copyright (c) 2000, 2013 Oracle and/or its affiliates. Copyright (c) 2009, 2013 Monty Program Ab. This program is free software; you can redistribute it and/or modify @@ -130,9 +130,10 @@ static int return_zero_rows(JOIN *join, select_result *res, List<Item> &fields, bool send_row, ulonglong select_options, const char *info, Item *having, List<Item> &all_fields); -static COND *build_equal_items(THD *thd, COND *cond, +static COND *build_equal_items(JOIN *join, COND *cond, COND_EQUAL *inherited, List<TABLE_LIST> *join_list, + bool ignore_on_conds, COND_EQUAL **cond_equal_ref); static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab, COND *cond, @@ -148,7 +149,8 @@ static uint build_bitmap_for_nested_joins(List<TABLE_LIST> *join_list, static COND *optimize_cond(JOIN *join, COND *conds, List<TABLE_LIST> *join_list, - Item::cond_result *cond_value, + bool ignore_on_conds, + Item::cond_result *cond_value, COND_EQUAL **cond_equal); bool const_expression_in_where(COND *conds,Item *item, Item **comp_item); static bool create_internal_tmp_table_from_heap2(THD *, TABLE *, @@ -607,16 +609,16 @@ inline int setup_without_group(THD *thd, Item **ref_pointer_array, uint *reserved) { int res; - nesting_map save_allow_sum_func=thd->lex->allow_sum_func ; + st_select_lex *const select= thd->lex->current_select; + nesting_map save_allow_sum_func= thd->lex->allow_sum_func; /* Need to save the value, so we can turn off only any new non_agg_field_used additions coming from the WHERE */ - const bool saved_non_agg_field_used= - thd->lex->current_select->non_agg_field_used(); + const bool saved_non_agg_field_used= select->non_agg_field_used(); DBUG_ENTER("setup_without_group"); - thd->lex->allow_sum_func&= ~(1 << thd->lex->current_select->nest_level); + thd->lex->allow_sum_func&= ~((nesting_map)1 << select->nest_level); res= setup_conds(thd, tables, leaves, conds); if (thd->lex->current_select->first_cond_optimization) { @@ -627,12 +629,12 @@ inline int setup_without_group(THD *thd, Item **ref_pointer_array, } /* it's not wrong to have non-aggregated columns in a WHERE */ - thd->lex->current_select->set_non_agg_field_used(saved_non_agg_field_used); + select->set_non_agg_field_used(saved_non_agg_field_used); - thd->lex->allow_sum_func|= 1 << thd->lex->current_select->nest_level; + thd->lex->allow_sum_func|= (nesting_map)1 << select->nest_level; res= res || setup_order(thd, ref_pointer_array, tables, fields, all_fields, order); - thd->lex->allow_sum_func&= ~(1 << thd->lex->current_select->nest_level); + thd->lex->allow_sum_func&= ~((nesting_map)1 << select->nest_level); res= res || setup_group(thd, ref_pointer_array, tables, fields, all_fields, group, hidden_group_fields); thd->lex->allow_sum_func= save_allow_sum_func; @@ -781,7 +783,7 @@ JOIN::prepare(Item ***rref_pointer_array, { nesting_map save_allow_sum_func= thd->lex->allow_sum_func; thd->where="having clause"; - thd->lex->allow_sum_func|= 1 << select_lex_arg->nest_level; + thd->lex->allow_sum_func|= (nesting_map)1 << select_lex_arg->nest_level; select_lex->having_fix_field= 1; /* Wrap alone field in HAVING clause in case it will be outer field of subquery @@ -1155,7 +1157,8 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S if (setup_jtbm_semi_joins(this, join_list, &conds)) DBUG_RETURN(1); - conds= optimize_cond(this, conds, join_list, &cond_value, &cond_equal); + conds= optimize_cond(this, conds, join_list, FALSE, + &cond_value, &cond_equal); if (thd->is_error()) { @@ -1165,7 +1168,9 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S } { - having= optimize_cond(this, having, join_list, &having_value, &having_equal); + having= optimize_cond(this, having, join_list, TRUE, + &having_value, &having_equal); + if (thd->is_error()) { error= 1; @@ -2312,6 +2317,7 @@ void JOIN::exec_inner() { List<Item> *columns_list= &fields_list; int tmp_error; + DBUG_ENTER("JOIN::exec"); const bool has_group_by= this->group; @@ -4183,7 +4189,7 @@ add_key_field(JOIN *join, !(field->table->pos_in_table_list->is_materialized_derived() && field->table->created)) || (field->table->pos_in_table_list->is_materialized_derived() && - !field->table->created))) + !field->table->created && !(field->flags & BLOB_FLAG)))) { optimize= KEY_OPTIMIZE_EQ; } @@ -5160,6 +5166,7 @@ static void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array) } + /** Check for the presence of AGGFN(DISTINCT a) queries that may be subject to loose index scan. @@ -5486,6 +5493,8 @@ best_access_path(JOIN *join, 2. we won't get two ref-or-null's */ if (!(remaining_tables & keyuse->used_tables) && + s->access_from_tables_is_allowed(keyuse->used_tables, + join->sjm_lookup_tables) && !(ref_or_null_part && (keyuse->optimize & KEY_OPTIMIZE_REF_OR_NULL))) { @@ -5606,7 +5615,8 @@ best_access_path(JOIN *join, in ReuseRangeEstimateForRef-3. */ if (table->quick_keys.is_set(key) && - (const_part & ((1 << table->quick_key_parts[key])-1)) == + (const_part & + (((key_part_map)1 << table->quick_key_parts[key])-1)) == (((key_part_map)1 << table->quick_key_parts[key])-1) && table->quick_n_ranges[key] == 1 && records > (double) table->quick_rows[key]) @@ -5770,7 +5780,8 @@ best_access_path(JOIN *join, */ if (table->quick_keys.is_set(key) && table->quick_key_parts[key] <= max_key_part && - const_part & (1 << table->quick_key_parts[key]) && + const_part & + ((key_part_map)1 << table->quick_key_parts[key]) && table->quick_n_ranges[key] == 1 + test(ref_or_null_part & const_part) && records > (double) table->quick_rows[key]) @@ -8024,7 +8035,9 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, */ do { - if (!(~used_tables & keyuse->used_tables)) + if (!(~used_tables & keyuse->used_tables) && + j->access_from_tables_is_allowed(keyuse->used_tables, + join->sjm_lookup_tables)) { if (are_tables_local(j, keyuse->val->used_tables())) { @@ -8093,7 +8106,9 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, uint i; for (i=0 ; i < keyparts ; keyuse++,i++) { - while (((~used_tables) & keyuse->used_tables) || + while (((~used_tables) & keyuse->used_tables) || + !j->access_from_tables_is_allowed(keyuse->used_tables, + join->sjm_lookup_tables) || keyuse->keypart == NO_KEYPART || (keyuse->keypart != (is_hash_join_key_no(key) ? @@ -8105,7 +8120,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, j->ref.items[i]=keyuse->val; // Save for cond removal j->ref.cond_guards[i]= keyuse->cond_guard; if (keyuse->null_rejecting) - j->ref.null_rejecting |= 1 << i; + j->ref.null_rejecting|= (key_part_map)1 << i; keyuse_uses_no_tables= keyuse_uses_no_tables && !keyuse->used_tables; /* Todo: we should remove this check for thd->lex->describe on the next @@ -8152,20 +8167,17 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, ulong key_flags= j->table->actual_key_flags(keyinfo); if (j->type == JT_CONST) j->table->const_table= 1; - else if (((key_flags & (HA_NOSAME | HA_NULL_PART_KEY))!= HA_NOSAME) || - keyparts != j->table->actual_n_key_parts(keyinfo) || - null_ref_key) - { - if (test(key_flags & HA_EXT_NOSAME) && keyparts == keyinfo->ext_key_parts && - !null_ref_key) - j->type= JT_EQ_REF; - else - { - /* Must read with repeat */ - j->type= null_ref_key ? JT_REF_OR_NULL : JT_REF; - j->ref.null_ref_key= null_ref_key; - j->ref.null_ref_part= null_ref_part; - } + else if (!((keyparts == keyinfo->key_parts && + ((key_flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME)) || + (keyparts > keyinfo->key_parts && // true only for extended keys + test(key_flags & HA_EXT_NOSAME) && + keyparts == keyinfo->ext_key_parts)) || + null_ref_key) + { + /* Must read with repeat */ + j->type= null_ref_key ? JT_REF_OR_NULL : JT_REF; + j->ref.null_ref_key= null_ref_key; + j->ref.null_ref_part= null_ref_part; } else if (keyuse_uses_no_tables) { @@ -8316,9 +8328,9 @@ inline void add_cond_and_fix(THD *thd, Item **e1, Item *e2) Item *res; if ((res= new Item_cond_and(*e1, e2))) { - *e1= res; res->fix_fields(thd, 0); res->update_used_tables(); + *e1= res; } } else @@ -8390,7 +8402,7 @@ static void add_not_null_conds(JOIN *join) { for (uint keypart= 0; keypart < tab->ref.key_parts; keypart++) { - if (tab->ref.null_rejecting & (1 << keypart)) + if (tab->ref.null_rejecting & ((key_part_map)1 << keypart)) { Item *item= tab->ref.items[keypart]; Item *notnull; @@ -10580,7 +10592,6 @@ bool JOIN_TAB::preread_init() } - /** Build a TABLE_REF structure for index lookup in the temporary table @@ -11832,7 +11843,9 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond, item_equal->n_field_items()); } - ((Item_cond_and*)cond)->cond_equal= cond_equal; + ((Item_cond_and*)cond)->cond_equal.copy(cond_equal); + cond_equal.current_level= + ((Item_cond_and*)cond)->cond_equal.current_level; inherited= &(((Item_cond_and*)cond)->cond_equal); } /* @@ -11887,6 +11900,7 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond, item_equal->update_used_tables(); set_if_bigger(thd->lex->current_select->max_equal_elems, item_equal->n_field_items()); + item_equal->upper_levels= inherited; return item_equal; } @@ -11909,7 +11923,8 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond, set_if_bigger(thd->lex->current_select->max_equal_elems, item_equal->n_field_items()); } - and_cond->cond_equal= cond_equal; + and_cond->cond_equal.copy(cond_equal); + cond_equal.current_level= and_cond->cond_equal.current_level; args->concat((List<Item> *)&cond_equal.current_level); return and_cond; @@ -11991,6 +12006,8 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond, @param inherited path to all inherited multiple equality items @param join_list list of join tables to which the condition refers to + @ignore_on_conds TRUE <-> do not build multiple equalities + for on expressions @param[out] cond_equal_ref pointer to the structure to place built equalities in @@ -11998,10 +12015,13 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond, pointer to the transformed condition containing multiple equalities */ -static COND *build_equal_items(THD *thd, COND *cond, COND_EQUAL *inherited, +static COND *build_equal_items(JOIN *join, COND *cond, + COND_EQUAL *inherited, List<TABLE_LIST> *join_list, + bool ignore_on_conds, COND_EQUAL **cond_equal_ref) { + THD *thd= join->thd; COND_EQUAL *cond_equal= 0; if (cond) @@ -12026,7 +12046,7 @@ static COND *build_equal_items(THD *thd, COND *cond, COND_EQUAL *inherited, } *cond_equal_ref= cond_equal; - if (join_list) + if (join_list && !ignore_on_conds) { TABLE_LIST *table; List_iterator<TABLE_LIST> li(*join_list); @@ -12041,8 +12061,8 @@ static COND *build_equal_items(THD *thd, COND *cond, COND_EQUAL *inherited, We can modify table->on_expr because its old value will be restored before re-execution of PS/SP. */ - table->on_expr= build_equal_items(thd, table->on_expr, inherited, - nested_join_list, + table->on_expr= build_equal_items(join, table->on_expr, inherited, + nested_join_list, ignore_on_conds, &table->cond_equal); } } @@ -12239,11 +12259,16 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels, Item *item_const= item_equal->get_const(); Item_equal_fields_iterator it(*item_equal); Item *head; - DBUG_ASSERT(!cond || cond->type() == Item::COND_ITEM); - TABLE_LIST *current_sjm= NULL; Item *current_sjm_head= NULL; + DBUG_ASSERT(!cond || + cond->type() == Item::INT_ITEM || + (cond->type() == Item::FUNC_ITEM && + ((Item_func *) cond)->functype() == Item_func::EQ_FUNC) || + (cond->type() == Item::COND_ITEM && + ((Item_func *) cond)->functype() == Item_func::COND_AND_FUNC)); + /* Pick the "head" item: the constant one or the first in the join order (if the first in the join order happends to be inside an SJM nest, that's @@ -12318,8 +12343,8 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels, if (produce_equality) { - if (eq_item) - eq_list.push_back(eq_item); + if (eq_item && eq_list.push_back(eq_item)) + return 0; /* If we're inside an SJM-nest (current_sjm!=NULL), and the multi-equality @@ -12343,31 +12368,61 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels, current_sjm= field_sjm; } - if (!cond) + /* + We have produced zero, one, or more pair-wise equalities eq_i. We want to + return an expression in form: + + cond AND eq_1 AND eq_2 AND eq_3 AND ... + + 'cond' is a parameter for this function, which may be NULL, an Item_int(1), + or an Item_func_eq or an Item_cond_and. + + We want to return a well-formed condition: no nested Item_cond_and objects, + or Item_cond_and with a single child: + - if 'cond' is an Item_cond_and, we add eq_i as its tail + - if 'cond' is Item_int(1), we return eq_i + - otherwise, we create our own Item_cond_and and put 'cond' at the front of + it. + - if we have only one condition to return, we don't create an Item_cond_and + */ + + if (eq_item && eq_list.push_back(eq_item)) + return 0; + COND *res= 0; + switch (eq_list.elements) + { + case 0: + res= cond ? cond : new Item_int((longlong) 1, 1); + break; + case 1: + if (!cond || cond->type() == Item::INT_ITEM) + res= eq_item; + break; + default: + break; + } + if (!res) { - if (eq_list.is_empty()) + if (cond) { - if (eq_item) - return eq_item; - return new Item_int((longlong) 1, 1); + if (cond->type() == Item::COND_ITEM) + { + res= cond; + ((Item_cond *) res)->add_at_end(&eq_list); + } + else if (eq_list.push_front(cond)) + return 0; } - /* eq_item is always set if list is not empty */ - DBUG_ASSERT(eq_item); - eq_list.push_back(eq_item); - if (!(cond= new Item_cond_and(eq_list))) - return 0; // Error - } - else + } + if (!res) + res= new Item_cond_and(eq_list); + if (res) { - if (eq_item) - eq_list.push_back(eq_item); - if (!eq_list.is_empty()) - ((Item_cond *) cond)->add_at_head(&eq_list); + res->quick_fix_field(); + res->update_used_tables(); } - cond->quick_fix_field(); - cond->update_used_tables(); - - return cond; + + return res; } @@ -12470,31 +12525,68 @@ static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab, if (and_level) { + COND *eq_cond= 0; List_iterator_fast<Item_equal> it(cond_equal->current_level); + bool false_eq_cond= FALSE; while ((item_equal= it++)) { - cond= eliminate_item_equal(cond, cond_equal->upper_levels, item_equal); - // This occurs when eliminate_item_equal() founds that cond is - // always false and substitutes it with Item_int 0. - // Due to this, value of item_equal will be 0, so just return it. - if (!cond) - return org_cond; // Error - if (cond->type() != Item::COND_ITEM) + eq_cond= eliminate_item_equal(eq_cond, cond_equal->upper_levels, + item_equal); + if (!eq_cond) + { + eq_cond= 0; + break; + } + else if (eq_cond->type() == Item::INT_ITEM && !eq_cond->val_bool()) + { + /* + This occurs when eliminate_item_equal() founds that cond is + always false and substitutes it with Item_int 0. + Due to this, value of item_equal will be 0, so just return it. + */ + cond= eq_cond; + false_eq_cond= TRUE; break; + } } - } - if (cond->type() == Item::COND_ITEM && - !((Item_cond*)cond)->argument_list()->elements) - cond= new Item_int((int32)cond->val_bool()); - + if (eq_cond && !false_eq_cond) + { + /* Insert the generated equalities before all other conditions */ + if (eq_cond->type() == Item::COND_ITEM) + ((Item_cond *) cond)->add_at_head( + ((Item_cond *) eq_cond)->argument_list()); + else + { + if (cond_list->is_empty()) + cond= eq_cond; + else + { + /* Do not add an equality condition if it's always true */ + if (eq_cond->type() != Item::INT_ITEM && + cond_list->push_front(eq_cond)) + eq_cond= 0; + } + } + } + if (!eq_cond) + { + /* + We are out of memory doing the transformation. + This is a fatal error now. However we bail out by returning the + original condition that we had before we started the transformation. + */ + cond_list->concat((List<Item> *) &cond_equal->current_level); + } + } } else if (cond->type() == Item::FUNC_ITEM && ((Item_cond*) cond)->functype() == Item_func::MULT_EQUAL_FUNC) { item_equal= (Item_equal *) cond; item_equal->sort(&compare_fields_by_table_order, table_join_idx); + cond_equal= item_equal->upper_levels; if (cond_equal && cond_equal->current_level.head() == item_equal) - cond_equal= 0; + cond_equal= cond_equal->upper_levels; cond= eliminate_item_equal(0, cond_equal, item_equal); return cond ? cond : org_cond; } @@ -13453,7 +13545,8 @@ void optimize_wo_join_buffering(JOIN *join, uint first_tab, uint last_tab, static COND * -optimize_cond(JOIN *join, COND *conds, List<TABLE_LIST> *join_list, +optimize_cond(JOIN *join, COND *conds, + List<TABLE_LIST> *join_list, bool ignore_on_conds, Item::cond_result *cond_value, COND_EQUAL **cond_equal) { THD *thd= join->thd; @@ -13462,7 +13555,9 @@ optimize_cond(JOIN *join, COND *conds, List<TABLE_LIST> *join_list, if (!conds) { *cond_value= Item::COND_TRUE; - build_equal_items(join->thd, NULL, NULL, join_list, cond_equal); + if (!ignore_on_conds) + build_equal_items(join, NULL, NULL, join_list, ignore_on_conds, + cond_equal); } else { @@ -13475,7 +13570,8 @@ optimize_cond(JOIN *join, COND *conds, List<TABLE_LIST> *join_list, multiple equality contains a constant. */ DBUG_EXECUTE("where", print_where(conds, "original", QT_ORDINARY);); - conds= build_equal_items(join->thd, conds, NULL, join_list, cond_equal); + conds= build_equal_items(join, conds, NULL, join_list, ignore_on_conds, + cond_equal); DBUG_EXECUTE("where",print_where(conds,"after equal_items", QT_ORDINARY);); /* change field = field to field = const for each found field = const */ @@ -13531,7 +13627,61 @@ internal_remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value) li.remove(); else if (item != new_item) { - (void) li.replace(new_item); + if (and_level) + { + /* + Take a special care of multiple equality predicates + that may be part of 'cond' and 'new_item'. + Those multiple equalities that have common members + must be merged. + */ + Item_cond_and *cond_and= (Item_cond_and *) cond; + List<Item_equal> *cond_equal_items= + &cond_and->cond_equal.current_level; + List<Item> *cond_and_list= cond_and->argument_list(); + + if (new_item->type() == Item::COND_ITEM && + ((Item_cond*) new_item)->functype() == Item_func::COND_AND_FUNC) + { + Item_cond_and *new_item_and= (Item_cond_and *) new_item; + List<Item_equal> *new_item_equal_items= + &new_item_and->cond_equal.current_level; + List<Item> *new_item_and_list= new_item_and->argument_list(); + cond_and_list->disjoin((List<Item>*) cond_equal_items); + new_item_and_list->disjoin((List<Item>*) new_item_equal_items); + Item_equal *equal_item; + List_iterator<Item_equal> it(*new_item_equal_items); + while ((equal_item= it++)) + { + equal_item->merge_into_list(cond_equal_items); + } + if (new_item_and_list->is_empty()) + li.remove(); + else + li.replace(*new_item_and_list); + cond_and_list->concat((List<Item>*) cond_equal_items); + } + else if (new_item->type() == Item::FUNC_ITEM && + ((Item_cond*) new_item)->functype() == + Item_func::MULT_EQUAL_FUNC) + { + cond_and_list->disjoin((List<Item>*) cond_equal_items); + ((Item_equal *) new_item)->merge_into_list(cond_equal_items); + li.remove(); + cond_and_list->concat((List<Item>*) cond_equal_items); + } + else + li.replace(new_item); + } + else + { + if (new_item->type() == Item::COND_ITEM && + ((Item_cond*) new_item)->functype() == + ((Item_cond*) cond)->functype()) + li.replace(*((Item_cond*) new_item)->argument_list()); + else + li.replace(new_item); + } should_fix_fields=1; } if (*cond_value == Item::COND_UNDEF) @@ -14110,6 +14260,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, } case Item::FIELD_ITEM: case Item::DEFAULT_VALUE_ITEM: + case Item::INSERT_VALUE_ITEM: { Item_field *field= (Item_field*) item; bool orig_modify= modify_item; @@ -14788,11 +14939,11 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields, } else { - recinfo->null_bit= 1 << (null_count & 7); + recinfo->null_bit= (uint8)1 << (null_count & 7); recinfo->null_pos= null_count/8; } field->move_field(pos,null_flags+null_count/8, - 1 << (null_count & 7)); + (uint8)1 << (null_count & 7)); null_count++; } else @@ -15246,7 +15397,7 @@ TABLE *create_virtual_tmp_table(THD *thd, List<Create_field> &field_list) { cur_field->move_field(field_pos, (uchar*) null_pos, null_bit); null_bit<<= 1; - if (null_bit == (1 << 8)) + if (null_bit == (uint)1 << 8) { ++null_pos; null_bit= 1; @@ -19306,7 +19457,6 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order, *(join->pre_sort_join_tab)= *tab; - tab->select=NULL; tab->set_select_cond(NULL, __LINE__); tab->type=JT_ALL; // Read with normal read_record diff --git a/sql/sql_select.h b/sql/sql_select.h index 638de926d75..7e6f81cc65b 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -1,8 +1,8 @@ #ifndef SQL_SELECT_INCLUDED #define SQL_SELECT_INCLUDED -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. - Copyright (c) 2008-2011 Monty Program Ab +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. + Copyright (c) 2008, 2013, Monty Program 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 @@ -523,6 +523,16 @@ typedef struct st_join_table { bool preread_init(); bool is_sjm_nest() { return test(bush_children); } + + bool access_from_tables_is_allowed(table_map used_tables, + table_map sjm_lookup_tables) + { + table_map used_sjm_lookup_tables= used_tables & sjm_lookup_tables; + return !used_sjm_lookup_tables || + (emb_sj_nest && + !(used_sjm_lookup_tables & ~emb_sj_nest->sj_inner_tables)); + } + } JOIN_TAB; @@ -973,6 +983,11 @@ public: bool hash_join; bool do_send_rows; table_map const_table_map; + /** + Bitmap of semijoin tables that the current partial plan decided + to materialize and access by lookups + */ + table_map sjm_lookup_tables; /* Constant tables for which we have found a row (as opposed to those for which we didn't). @@ -1304,8 +1319,9 @@ public: outer_ref_cond= pseudo_bits_cond= NULL; in_to_exists_where= NULL; in_to_exists_having= NULL; - pre_sort_join_tab= NULL; + emb_sjm_nest= NULL; + sjm_lookup_tables= 0; } int prepare(Item ***rref_pointer_array, TABLE_LIST *tables, uint wind_num, diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 095ad409a94..269a99faadd 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3152,8 +3152,8 @@ int fill_schema_user_stats(THD* thd, TABLE_LIST* tables, COND* cond) int result; DBUG_ENTER("fill_schema_user_stats"); - if (check_global_access(thd, SUPER_ACL | PROCESS_ACL)) - DBUG_RETURN(1); + if (check_global_access(thd, SUPER_ACL | PROCESS_ACL, true)) + DBUG_RETURN(0); /* Iterates through all the global stats and sends them to the client. @@ -3187,8 +3187,8 @@ int fill_schema_client_stats(THD* thd, TABLE_LIST* tables, COND* cond) int result; DBUG_ENTER("fill_schema_client_stats"); - if (check_global_access(thd, SUPER_ACL | PROCESS_ACL)) - DBUG_RETURN(1); + if (check_global_access(thd, SUPER_ACL | PROCESS_ACL, true)) + DBUG_RETURN(0); /* Iterates through all the global stats and sends them to the client. diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 9d11677666f..095c557c531 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -796,7 +796,7 @@ copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs, uint32 length= min(to_length, from_length), length2= length; -#if defined(__i386__) +#if defined(__i386__) || defined(__x86_64__) /* Special loop for i386, it allows to refer to a non-aligned memory block as UINT32, which makes diff --git a/sql/sql_table.cc b/sql/sql_table.cc index d0a4aedfa4f..a379b581539 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2012, Oracle and/or its affiliates. - Copyright (c) 2010, 2011, Monty Program Ab + Copyright (c) 2010, 2013, Monty Program 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 @@ -649,13 +649,6 @@ uint build_tmptable_filename(THD* thd, char *buff, size_t bufflen) struct st_global_ddl_log { - /* - We need to adjust buffer size to be able to handle downgrades/upgrades - where IO_SIZE has changed. We'll set the buffer size such that we can - handle that the buffer size was upto 4 times bigger in the version - that wrote the DDL log. - */ - char file_entry_buf[4*IO_SIZE]; char file_name_str[FN_REFLEN]; char *file_name; DDL_LOG_MEMORY_ENTRY *first_free; @@ -683,51 +676,60 @@ mysql_mutex_t LOCK_gdl; #define DDL_LOG_NUM_ENTRY_POS 0 #define DDL_LOG_NAME_LEN_POS 4 #define DDL_LOG_IO_SIZE_POS 8 +#define DDL_LOG_HEADER_SIZE 12 -/* - Read one entry from ddl log file - SYNOPSIS - read_ddl_log_file_entry() - entry_no Entry number to read - RETURN VALUES - TRUE Error - FALSE Success +/** + Read one entry from ddl log file. + @param[out] file_entry_buf Buffer to read into + @param entry_no Entry number to read + @param size Number of bytes of the entry to read + + @return Operation status + @retval true Error + @retval false Success */ -static bool read_ddl_log_file_entry(uint entry_no) +static bool read_ddl_log_file_entry(uchar *file_entry_buf, + uint entry_no, + uint size) { bool error= FALSE; File file_id= global_ddl_log.file_id; - uchar *file_entry_buf= (uchar*)global_ddl_log.file_entry_buf; uint io_size= global_ddl_log.io_size; DBUG_ENTER("read_ddl_log_file_entry"); + DBUG_ASSERT(io_size >= size); - if (mysql_file_pread(file_id, file_entry_buf, io_size, io_size * entry_no, - MYF(MY_WME)) != io_size) + if (mysql_file_pread(file_id, file_entry_buf, size, io_size * entry_no, + MYF(MY_WME)) != size) error= TRUE; DBUG_RETURN(error); } -/* - Write one entry from ddl log file - SYNOPSIS - write_ddl_log_file_entry() - entry_no Entry number to write - RETURN VALUES - TRUE Error - FALSE Success +/** + Write one entry to ddl log file. + + @param file_entry_buf Buffer to write + @param entry_no Entry number to write + @param size Number of bytes of the entry to write + + @return Operation status + @retval true Error + @retval false Success */ -static bool write_ddl_log_file_entry(uint entry_no) +static bool write_ddl_log_file_entry(uchar *file_entry_buf, + uint entry_no, + uint size) { bool error= FALSE; File file_id= global_ddl_log.file_id; - char *file_entry_buf= (char*)global_ddl_log.file_entry_buf; + uint io_size= global_ddl_log.io_size; DBUG_ENTER("write_ddl_log_file_entry"); + DBUG_ASSERT(io_size >= size); - if (mysql_file_pwrite(file_id, (uchar*)file_entry_buf, - IO_SIZE, IO_SIZE * entry_no, MYF(MY_WME)) != IO_SIZE) + if (mysql_file_pwrite(file_id, file_entry_buf, size, + io_size * entry_no, MYF(MY_WME)) != size) error= TRUE; DBUG_RETURN(error); } @@ -746,17 +748,20 @@ static bool write_ddl_log_header() { uint16 const_var; bool error= FALSE; + uchar file_entry_buf[DDL_LOG_HEADER_SIZE]; DBUG_ENTER("write_ddl_log_header"); + DBUG_ASSERT((DDL_LOG_NAME_POS + 3 * global_ddl_log.name_len) + <= global_ddl_log.io_size); - int4store(&global_ddl_log.file_entry_buf[DDL_LOG_NUM_ENTRY_POS], + int4store(&file_entry_buf[DDL_LOG_NUM_ENTRY_POS], global_ddl_log.num_entries); - const_var= FN_LEN; - int4store(&global_ddl_log.file_entry_buf[DDL_LOG_NAME_LEN_POS], + const_var= global_ddl_log.name_len; + int4store(&file_entry_buf[DDL_LOG_NAME_LEN_POS], (ulong) const_var); - const_var= IO_SIZE; - int4store(&global_ddl_log.file_entry_buf[DDL_LOG_IO_SIZE_POS], + const_var= global_ddl_log.io_size; + int4store(&file_entry_buf[DDL_LOG_IO_SIZE_POS], (ulong) const_var); - if (write_ddl_log_file_entry(0UL)) + if (write_ddl_log_file_entry(file_entry_buf, 0UL, DDL_LOG_HEADER_SIZE)) { sql_print_error("Error writing ddl log header"); DBUG_RETURN(TRUE); @@ -796,18 +801,20 @@ static inline void create_ddl_log_file_name(char *file_name) static uint read_ddl_log_header() { - char *file_entry_buf= (char*)global_ddl_log.file_entry_buf; + char file_entry_buf[DDL_LOG_HEADER_SIZE]; char file_name[FN_REFLEN]; uint entry_no; bool successful_open= FALSE; DBUG_ENTER("read_ddl_log_header"); + DBUG_ASSERT(global_ddl_log.io_size <= IO_SIZE); create_ddl_log_file_name(file_name); if ((global_ddl_log.file_id= mysql_file_open(key_file_global_ddl_log, file_name, O_RDWR | O_BINARY, MYF(0))) >= 0) { - if (read_ddl_log_file_entry(0UL)) + if (read_ddl_log_file_entry((uchar *) file_entry_buf, 0UL, + DDL_LOG_HEADER_SIZE)) { /* Write message into error log */ sql_print_error("Failed to read ddl log file in recovery"); @@ -820,8 +827,6 @@ static uint read_ddl_log_header() entry_no= uint4korr(&file_entry_buf[DDL_LOG_NUM_ENTRY_POS]); global_ddl_log.name_len= uint4korr(&file_entry_buf[DDL_LOG_NAME_LEN_POS]); global_ddl_log.io_size= uint4korr(&file_entry_buf[DDL_LOG_IO_SIZE_POS]); - DBUG_ASSERT(global_ddl_log.io_size <= - sizeof(global_ddl_log.file_entry_buf)); } else { @@ -836,30 +841,22 @@ static uint read_ddl_log_header() } -/* - Read a ddl log entry - SYNOPSIS - read_ddl_log_entry() - read_entry Number of entry to read - out:entry_info Information from entry - RETURN VALUES - TRUE Error - FALSE Success - DESCRIPTION - Read a specified entry in the ddl log +/** + Set ddl log entry struct from buffer + @param read_entry Entry number + @param file_entry_buf Buffer to use + @param ddl_log_entry Entry to be set + + @note Pointers in ddl_log_entry will point into file_entry_buf! */ -bool read_ddl_log_entry(uint read_entry, DDL_LOG_ENTRY *ddl_log_entry) +static void set_ddl_log_entry_from_buf(uint read_entry, + uchar *file_entry_buf, + DDL_LOG_ENTRY *ddl_log_entry) { - char *file_entry_buf= (char*)&global_ddl_log.file_entry_buf; uint inx; uchar single_char; - DBUG_ENTER("read_ddl_log_entry"); - - if (read_ddl_log_file_entry(read_entry)) - { - DBUG_RETURN(TRUE); - } + DBUG_ENTER("set_ddl_log_entry_from_buf"); ddl_log_entry->entry_pos= read_entry; single_char= file_entry_buf[DDL_LOG_ENTRY_TYPE_POS]; ddl_log_entry->entry_type= (enum ddl_log_entry_code)single_char; @@ -867,14 +864,14 @@ bool read_ddl_log_entry(uint read_entry, DDL_LOG_ENTRY *ddl_log_entry) ddl_log_entry->action_type= (enum ddl_log_action_code)single_char; ddl_log_entry->phase= file_entry_buf[DDL_LOG_PHASE_POS]; ddl_log_entry->next_entry= uint4korr(&file_entry_buf[DDL_LOG_NEXT_ENTRY_POS]); - ddl_log_entry->name= &file_entry_buf[DDL_LOG_NAME_POS]; + ddl_log_entry->name= (char*) &file_entry_buf[DDL_LOG_NAME_POS]; inx= DDL_LOG_NAME_POS + global_ddl_log.name_len; - ddl_log_entry->from_name= &file_entry_buf[inx]; + ddl_log_entry->from_name= (char*) &file_entry_buf[inx]; inx+= global_ddl_log.name_len; - ddl_log_entry->handler_name= &file_entry_buf[inx]; - DBUG_RETURN(FALSE); + ddl_log_entry->handler_name= (char*) &file_entry_buf[inx]; + DBUG_VOID_RETURN; } - + /* Initialise ddl log @@ -1077,6 +1074,7 @@ static bool get_free_ddl_log_entry(DDL_LOG_MEMORY_ENTRY **active_entry, DDL_LOG_MEMORY_ENTRY *first_used= global_ddl_log.first_used; DBUG_ENTER("get_free_ddl_log_entry"); + mysql_mutex_assert_owner(&LOCK_gdl); if (global_ddl_log.first_free == NULL) { if (!(used_entry= (DDL_LOG_MEMORY_ENTRY*)my_malloc( @@ -1134,34 +1132,36 @@ bool write_ddl_log_entry(DDL_LOG_ENTRY *ddl_log_entry, DDL_LOG_MEMORY_ENTRY **active_entry) { bool error, write_header; + char file_entry_buf[IO_SIZE]; DBUG_ENTER("write_ddl_log_entry"); if (init_ddl_log()) { DBUG_RETURN(TRUE); } - global_ddl_log.file_entry_buf[DDL_LOG_ENTRY_TYPE_POS]= + memset(file_entry_buf, 0, sizeof(file_entry_buf)); + file_entry_buf[DDL_LOG_ENTRY_TYPE_POS]= (char)DDL_LOG_ENTRY_CODE; - global_ddl_log.file_entry_buf[DDL_LOG_ACTION_TYPE_POS]= + file_entry_buf[DDL_LOG_ACTION_TYPE_POS]= (char)ddl_log_entry->action_type; - global_ddl_log.file_entry_buf[DDL_LOG_PHASE_POS]= 0; - int4store(&global_ddl_log.file_entry_buf[DDL_LOG_NEXT_ENTRY_POS], + file_entry_buf[DDL_LOG_PHASE_POS]= 0; + int4store(&file_entry_buf[DDL_LOG_NEXT_ENTRY_POS], ddl_log_entry->next_entry); - DBUG_ASSERT(strlen(ddl_log_entry->name) < FN_LEN); - strmake(&global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS], - ddl_log_entry->name, FN_LEN - 1); + DBUG_ASSERT(strlen(ddl_log_entry->name) < global_ddl_log.name_len); + strmake(&file_entry_buf[DDL_LOG_NAME_POS], ddl_log_entry->name, + global_ddl_log.name_len - 1); if (ddl_log_entry->action_type == DDL_LOG_RENAME_ACTION || ddl_log_entry->action_type == DDL_LOG_REPLACE_ACTION) { - DBUG_ASSERT(strlen(ddl_log_entry->from_name) < FN_LEN); - strmake(&global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS + FN_LEN], - ddl_log_entry->from_name, FN_LEN - 1); + DBUG_ASSERT(strlen(ddl_log_entry->from_name) < global_ddl_log.name_len); + strmake(&file_entry_buf[DDL_LOG_NAME_POS + global_ddl_log.name_len], + ddl_log_entry->from_name, global_ddl_log.name_len - 1); } else - global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS + FN_LEN]= 0; - DBUG_ASSERT(strlen(ddl_log_entry->handler_name) < FN_LEN); - strmake(&global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS + (2*FN_LEN)], - ddl_log_entry->handler_name, FN_LEN - 1); + file_entry_buf[DDL_LOG_NAME_POS + global_ddl_log.name_len]= 0; + DBUG_ASSERT(strlen(ddl_log_entry->handler_name) < global_ddl_log.name_len); + strmake(&file_entry_buf[DDL_LOG_NAME_POS + (2*global_ddl_log.name_len)], + ddl_log_entry->handler_name, global_ddl_log.name_len - 1); if (get_free_ddl_log_entry(active_entry, &write_header)) { DBUG_RETURN(TRUE); @@ -1169,14 +1169,15 @@ bool write_ddl_log_entry(DDL_LOG_ENTRY *ddl_log_entry, error= FALSE; DBUG_PRINT("ddl_log", ("write type %c next %u name '%s' from_name '%s' handler '%s'", - (char) global_ddl_log.file_entry_buf[DDL_LOG_ACTION_TYPE_POS], + (char) file_entry_buf[DDL_LOG_ACTION_TYPE_POS], ddl_log_entry->next_entry, - (char*) &global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS], - (char*) &global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS - + FN_LEN], - (char*) &global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS - + (2*FN_LEN)])); - if (write_ddl_log_file_entry((*active_entry)->entry_pos)) + (char*) &file_entry_buf[DDL_LOG_NAME_POS], + (char*) &file_entry_buf[DDL_LOG_NAME_POS + + global_ddl_log.name_len], + (char*) &file_entry_buf[DDL_LOG_NAME_POS + + (2*global_ddl_log.name_len)])); + if (write_ddl_log_file_entry((uchar*) file_entry_buf, + (*active_entry)->entry_pos, IO_SIZE)) { error= TRUE; sql_print_error("Failed to write entry_no = %u", @@ -1226,13 +1227,14 @@ bool write_execute_ddl_log_entry(uint first_entry, DDL_LOG_MEMORY_ENTRY **active_entry) { bool write_header= FALSE; - char *file_entry_buf= (char*)global_ddl_log.file_entry_buf; + char file_entry_buf[IO_SIZE]; DBUG_ENTER("write_execute_ddl_log_entry"); if (init_ddl_log()) { DBUG_RETURN(TRUE); } + memset(file_entry_buf, 0, sizeof(file_entry_buf)); if (!complete) { /* @@ -1246,12 +1248,7 @@ bool write_execute_ddl_log_entry(uint first_entry, } else file_entry_buf[DDL_LOG_ENTRY_TYPE_POS]= (char)DDL_IGNORE_LOG_ENTRY_CODE; - file_entry_buf[DDL_LOG_ACTION_TYPE_POS]= 0; /* Ignored for execute entries */ - file_entry_buf[DDL_LOG_PHASE_POS]= 0; int4store(&file_entry_buf[DDL_LOG_NEXT_ENTRY_POS], first_entry); - file_entry_buf[DDL_LOG_NAME_POS]= 0; - file_entry_buf[DDL_LOG_NAME_POS + FN_LEN]= 0; - file_entry_buf[DDL_LOG_NAME_POS + 2*FN_LEN]= 0; if (!(*active_entry)) { if (get_free_ddl_log_entry(active_entry, &write_header)) @@ -1259,7 +1256,9 @@ bool write_execute_ddl_log_entry(uint first_entry, DBUG_RETURN(TRUE); } } - if (write_ddl_log_file_entry((*active_entry)->entry_pos)) + if (write_ddl_log_file_entry((uchar*) file_entry_buf, + (*active_entry)->entry_pos, + IO_SIZE)) { sql_print_error("Error writing execute entry in ddl log"); release_ddl_log_memory_entry(*active_entry); @@ -1304,10 +1303,16 @@ bool write_execute_ddl_log_entry(uint first_entry, bool deactivate_ddl_log_entry(uint entry_no) { - char *file_entry_buf= (char*)global_ddl_log.file_entry_buf; + uchar file_entry_buf[DDL_LOG_NAME_POS]; DBUG_ENTER("deactivate_ddl_log_entry"); - if (!read_ddl_log_file_entry(entry_no)) + + /* + Only need to read and write the first bytes of the entry, where + ENTRY_TYPE, ACTION_TYPE and PHASE reside. Using DDL_LOG_NAME_POS + to include all info except for the names. + */ + if (!read_ddl_log_file_entry(file_entry_buf, entry_no, DDL_LOG_NAME_POS)) { if (file_entry_buf[DDL_LOG_ENTRY_TYPE_POS] == DDL_LOG_ENTRY_CODE) { @@ -1325,7 +1330,7 @@ bool deactivate_ddl_log_entry(uint entry_no) { DBUG_ASSERT(0); } - if (write_ddl_log_file_entry(entry_no)) + if (write_ddl_log_file_entry(file_entry_buf, entry_no, DDL_LOG_NAME_POS)) { sql_print_error("Error in deactivating log entry. Position = %u", entry_no); @@ -1386,6 +1391,7 @@ void release_ddl_log_memory_entry(DDL_LOG_MEMORY_ENTRY *log_entry) DDL_LOG_MEMORY_ENTRY *next_log_entry= log_entry->next_log_entry; DDL_LOG_MEMORY_ENTRY *prev_log_entry= log_entry->prev_log_entry; DBUG_ENTER("release_ddl_log_memory_entry"); + mysql_mutex_assert_owner(&LOCK_gdl); global_ddl_log.first_free= log_entry; log_entry->next_log_entry= first_free; @@ -1415,24 +1421,26 @@ bool execute_ddl_log_entry(THD *thd, uint first_entry) { DDL_LOG_ENTRY ddl_log_entry; uint read_entry= first_entry; + uchar file_entry_buf[IO_SIZE]; DBUG_ENTER("execute_ddl_log_entry"); mysql_mutex_lock(&LOCK_gdl); do { - if (read_ddl_log_entry(read_entry, &ddl_log_entry)) + if (read_ddl_log_file_entry(file_entry_buf, read_entry, IO_SIZE)) { - /* Write to error log and continue with next log entry */ + /* Print the error to the log and continue with next log entry */ sql_print_error("Failed to read entry = %u from ddl log", read_entry); break; } + set_ddl_log_entry_from_buf(read_entry, file_entry_buf, &ddl_log_entry); DBUG_ASSERT(ddl_log_entry.entry_type == DDL_LOG_ENTRY_CODE || ddl_log_entry.entry_type == DDL_IGNORE_LOG_ENTRY_CODE); if (execute_ddl_log_action(thd, &ddl_log_entry)) { - /* Write to error log and continue with next log entry */ + /* Print the error to the log and continue with next log entry */ sql_print_error("Failed to execute action for entry = %u from ddl log", read_entry); break; @@ -1477,13 +1485,14 @@ void execute_ddl_log_recovery() uint num_entries, i; THD *thd; DDL_LOG_ENTRY ddl_log_entry; + uchar *file_entry_buf; + uint io_size; char file_name[FN_REFLEN]; DBUG_ENTER("execute_ddl_log_recovery"); /* Initialise global_ddl_log struct */ - bzero(global_ddl_log.file_entry_buf, sizeof(global_ddl_log.file_entry_buf)); global_ddl_log.inited= FALSE; global_ddl_log.recovery_phase= TRUE; global_ddl_log.io_size= IO_SIZE; @@ -1498,14 +1507,23 @@ void execute_ddl_log_recovery() thd->store_globals(); num_entries= read_ddl_log_header(); + io_size= global_ddl_log.io_size; + file_entry_buf= (uchar*) my_malloc(io_size, MYF(0)); + if (!file_entry_buf) + { + sql_print_error("Failed to allocate buffer for recover ddl log"); + DBUG_VOID_RETURN; + } for (i= 1; i < num_entries + 1; i++) { - if (read_ddl_log_entry(i, &ddl_log_entry)) + if (read_ddl_log_file_entry(file_entry_buf, i, io_size)) { sql_print_error("Failed to read entry no = %u from ddl log", i); continue; } + + set_ddl_log_entry_from_buf(i, file_entry_buf, &ddl_log_entry); if (ddl_log_entry.entry_type == DDL_LOG_EXECUTE_CODE) { if (execute_ddl_log_entry(thd, ddl_log_entry.next_entry)) @@ -1520,6 +1538,7 @@ void execute_ddl_log_recovery() (void) mysql_file_delete(key_file_global_ddl_log, file_name, MYF(0)); global_ddl_log.recovery_phase= FALSE; delete thd; + my_free(file_entry_buf); /* Remember that we don't have a THD */ set_current_thd(0); DBUG_VOID_RETURN; @@ -1536,14 +1555,16 @@ void execute_ddl_log_recovery() void release_ddl_log() { - DDL_LOG_MEMORY_ENTRY *free_list= global_ddl_log.first_free; - DDL_LOG_MEMORY_ENTRY *used_list= global_ddl_log.first_used; + DDL_LOG_MEMORY_ENTRY *free_list; + DDL_LOG_MEMORY_ENTRY *used_list; DBUG_ENTER("release_ddl_log"); if (!global_ddl_log.do_release) DBUG_VOID_RETURN; mysql_mutex_lock(&LOCK_gdl); + free_list= global_ddl_log.first_free; + used_list= global_ddl_log.first_used; while (used_list) { DDL_LOG_MEMORY_ENTRY *tmp= used_list->next_log_entry; @@ -2203,7 +2224,8 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists, if (thd->locked_tables_mode) { - if (wait_while_table_is_used(thd, table->table, HA_EXTRA_NOT_USED)) + if (wait_while_table_is_used(thd, table->table, HA_EXTRA_NOT_USED, + TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE)) { error= -1; goto err; @@ -6350,15 +6372,19 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, case LEAVE_AS_IS: break; case ENABLE: - if (wait_while_table_is_used(thd, table, extra_func)) + if (wait_while_table_is_used(thd, table, extra_func, + TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE)) goto err; DEBUG_SYNC(thd,"alter_table_enable_indexes"); error= table->file->ha_enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE); + table->s->allow_access_to_protected_table(); break; case DISABLE: - if (wait_while_table_is_used(thd, table, extra_func)) + if (wait_while_table_is_used(thd, table, extra_func, + TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE)) goto err; error=table->file->ha_disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE); + table->s->allow_access_to_protected_table(); break; default: DBUG_ASSERT(FALSE); @@ -6384,7 +6410,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, simple rename did nothing and therefore we can safely return without additional clean-up. */ - if (wait_while_table_is_used(thd, table, extra_func)) + if (wait_while_table_is_used(thd, table, extra_func, + TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE)) goto err; close_all_tables_for_name(thd, table->s, HA_EXTRA_PREPARE_FOR_RENAME); /* @@ -6824,6 +6851,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, if (table->s->tmp_table) { Open_table_context ot_ctx(thd, (MYSQL_OPEN_IGNORE_FLUSH | + MYSQL_OPEN_FOR_REPAIR | MYSQL_LOCK_IGNORE_TIMEOUT)); TABLE_LIST tbl; bzero((void*) &tbl, sizeof(tbl)); @@ -6894,7 +6922,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, table->file->indexes_are_disabled()) need_lock_for_indexes= true; if (!table->s->tmp_table && need_lock_for_indexes && - wait_while_table_is_used(thd, table, extra_func)) + wait_while_table_is_used(thd, table, extra_func, + TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE)) goto err_new_table_cleanup; thd_proc_info(thd, "manage keys"); DEBUG_SYNC(thd, "alter_table_manage_keys"); @@ -6903,6 +6932,11 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, error= trans_commit_stmt(thd); if (trans_commit_implicit(thd)) error= 1; + /* + If the table was locked, allow one to still run SHOW commands against it + */ + if (table->s->protected_against_usage()) + table->s->allow_access_to_protected_table(); } thd->count_cuted_fields= CHECK_FIELD_IGNORE; @@ -7114,7 +7148,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, if (lower_case_table_names) my_casedn_str(files_charset_info, old_name); - if (wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_RENAME)) + if (wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_RENAME, + TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE)) { if (pending_inplace_add_index) { diff --git a/sql/sql_time.cc b/sql/sql_time.cc index 57dbd979933..dadf579b2e7 100644 --- a/sql/sql_time.cc +++ b/sql/sql_time.cc @@ -302,6 +302,9 @@ str_to_datetime_with_warn(CHARSET_INFO *cs, make_truncated_value_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, str, length, flags & TIME_TIME_ONLY ? MYSQL_TIMESTAMP_TIME : ts_type, NullS); + DBUG_EXECUTE_IF("str_to_datetime_warn", + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_YES, str);); return ts_type; } diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index d7d902bc6b0..882f7fcca8c 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -701,10 +701,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables, thd->security_ctx->priv_host))) { if (check_global_access(thd, SUPER_ACL)) - { - my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER"); return TRUE; - } } /* diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc index 4b77344c042..d47fb24eaba 100644 --- a/sql/sql_truncate.cc +++ b/sql/sql_truncate.cc @@ -364,7 +364,8 @@ bool Truncate_statement::lock_table(THD *thd, TABLE_LIST *table_ref, { DEBUG_SYNC(thd, "upgrade_lock_for_truncate"); /* To remove the table from the cache we need an exclusive lock. */ - if (wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_DROP)) + if (wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_DROP, + TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE)) DBUG_RETURN(TRUE); m_ticket_downgrade= table->mdl_ticket; /* Close if table is going to be recreated. */ diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 28b9fe7eacd..cf30d1342c0 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1583,6 +1583,15 @@ int multi_update::prepare(List<Item> ¬_used_values, DBUG_RETURN(thd->is_fatal_error != 0); } +void multi_update::update_used_tables() +{ + Item *item; + List_iterator_fast<Item> it(*values); + while ((item= it++)) + { + item->update_used_tables(); + } +} /* Check if table is safe to update on fly diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 3cfd997b2b8..f4e03ac3d14 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -789,10 +789,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %pure_parser /* We have threads */ /* - Currently there are 173 shift/reduce conflicts. + Currently there are 174 shift/reduce conflicts. We should not introduce new conflicts any more. */ -%expect 173 +%expect 174 /* Comments for TOKENS. @@ -13132,6 +13132,7 @@ keyword: | LANGUAGE_SYM {} | NO_SYM {} | OPEN_SYM {} + | OPTION {} | OPTIONS_SYM {} | OWNER_SYM {} | PARSER_SYM {} diff --git a/sql/strfunc.cc b/sql/strfunc.cc index 9603ca30cfa..aa6d2535b0d 100644 --- a/sql/strfunc.cc +++ b/sql/strfunc.cc @@ -86,7 +86,7 @@ ulonglong find_set(TYPELIB *lib, const char *str, uint length, CHARSET_INFO *cs, *set_warning= 1; } else - found|= ((longlong) 1 << (find - 1)); + found|= 1ULL << (find - 1); if (pos >= end) break; start= pos + mblen; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index fcd2df7b338..6a7466d6cf1 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -3783,9 +3783,67 @@ static Sys_var_ulong Sys_debug_binlog_fsync_sleep( CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1)); #endif + static Sys_var_harows Sys_expensive_subquery_limit( "expensive_subquery_limit", "The maximum number of rows a subquery may examine in order to be " "executed during optimization and used for constant optimization", SESSION_VAR(expensive_subquery_limit), CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, HA_POS_ERROR), DEFAULT(100), BLOCK_SIZE(1)); + +static bool check_pseudo_slave_mode(sys_var *self, THD *thd, set_var *var) +{ + longlong previous_val= thd->variables.pseudo_slave_mode; + longlong val= (longlong) var->save_result.ulonglong_value; + bool rli_fake= false; + +#ifndef EMBEDDED_LIBRARY + rli_fake= thd->rli_fake ? true : false; +#endif + + if (rli_fake) + { + if (!val) + { +#ifndef EMBEDDED_LIBRARY + delete thd->rli_fake; + thd->rli_fake= NULL; +#endif + } + else if (previous_val && val) + goto ineffective; + else if (!previous_val && val) + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WRONG_VALUE_FOR_VAR, + "'pseudo_slave_mode' is already ON."); + } + else + { + if (!previous_val && !val) + goto ineffective; + else if (previous_val && !val) + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WRONG_VALUE_FOR_VAR, + "Slave applier execution mode not active, " + "statement ineffective."); + } + goto end; + +ineffective: + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WRONG_VALUE_FOR_VAR, + "'pseudo_slave_mode' change was ineffective."); + +end: + return FALSE; +} +static Sys_var_mybool Sys_pseudo_slave_mode( + "pseudo_slave_mode", + "SET pseudo_slave_mode= 0,1 are commands that mysqlbinlog " + "adds to beginning and end of binary log dumps. While zero " + "value indeed disables, the actual enabling of the slave " + "applier execution mode is done implicitly when a " + "Format_description_event is sent through the session.", + SESSION_ONLY(pseudo_slave_mode), NO_CMD_LINE, DEFAULT(FALSE), + NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_pseudo_slave_mode)); + diff --git a/sql/sys_vars.h b/sql/sys_vars.h index 1729dcefd63..31764aa82a4 100644 --- a/sql/sys_vars.h +++ b/sql/sys_vars.h @@ -547,8 +547,7 @@ public: protected: virtual uchar *session_value_ptr(THD *thd, LEX_STRING *base) { - return thd->security_ctx->proxy_user[0] ? - (uchar *) &(thd->security_ctx->proxy_user[0]) : NULL; + return (uchar*)thd->security_ctx->external_user; } }; diff --git a/sql/table.cc b/sql/table.cc index a011fa845a7..06e424b2cfb 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -324,7 +324,7 @@ TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key, share->normalized_path.str= share->path.str; share->normalized_path.length= path_length; - share->version= refresh_version; + share->set_refresh_version(); /* Since alloc_table_share() can be called without any locking (for @@ -1026,7 +1026,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, } } if (j == first_key_parts) - keyinfo->ext_key_flags= keyinfo->flags | HA_NOSAME | HA_EXT_NOSAME; + keyinfo->ext_key_flags= keyinfo->flags | HA_EXT_NOSAME; } share->ext_key_parts+= keyinfo->ext_key_parts; } diff --git a/sql/table.h b/sql/table.h index 1a567ae75d1..9aa68b05cf2 100644 --- a/sql/table.h +++ b/sql/table.h @@ -825,12 +825,42 @@ struct TABLE_SHARE return table_map_id; } - /** Is this table share being expelled from the table definition cache? */ inline bool has_old_version() const { return version != refresh_version; } + inline bool protected_against_usage() const + { + return version == 0; + } + inline void protect_against_usage() + { + version= 0; + } + /* + This is used only for the case of locked tables, as we want to + allow one to do SHOW commands on them even after ALTER or REPAIR + */ + inline void allow_access_to_protected_table() + { + DBUG_ASSERT(version == 0); + version= 1; + } + /* + Remove from table definition cache at close. + Table can still be opened by SHOW + */ + inline void remove_from_cache_at_close() + { + if (version != 0) /* Don't remove protection */ + version= 1; + } + inline void set_refresh_version() + { + version= refresh_version; + } + /** Convert unrelated members of TABLE_SHARE to one enum representing its type. diff --git a/sql/threadpool_unix.cc b/sql/threadpool_unix.cc index da38d64fa4d..94251660e37 100644 --- a/sql/threadpool_unix.cc +++ b/sql/threadpool_unix.cc @@ -29,14 +29,14 @@ #ifdef __linux__ #include <sys/epoll.h> typedef struct epoll_event native_event; -#endif -#if defined (__FreeBSD__) || defined (__APPLE__) +#elif defined(HAVE_KQUEUE) #include <sys/event.h> typedef struct kevent native_event; -#endif -#if defined (__sun) +#elif defined (__sun) #include <port.h> typedef port_event_t native_event; +#else +#error threadpool is not available on this platform #endif /** Maximum number of native events a listener can read in one go */ @@ -285,7 +285,7 @@ static void *native_event_get_userdata(native_event *event) return event->data.ptr; } -#elif defined (__FreeBSD__) || defined (__APPLE__) +#elif defined(HAVE_KQUEUE) int io_poll_create() { return kqueue(); @@ -386,8 +386,6 @@ static void* native_event_get_userdata(native_event *event) { return event->portev_user; } -#else -#error not ported yet to this OS #endif @@ -1247,11 +1245,12 @@ static void connection_abort(connection_t *connection) DBUG_ENTER("connection_abort"); thread_group_t *group= connection->thread_group; + threadpool_remove_connection(connection->thd); + mysql_mutex_lock(&group->mutex); group->connection_count--; mysql_mutex_unlock(&group->mutex); - - threadpool_remove_connection(connection->thd); + my_free(connection); DBUG_VOID_RETURN; } diff --git a/sql/transaction.cc b/sql/transaction.cc index 3359decbcd5..1623cd57d77 100644 --- a/sql/transaction.cc +++ b/sql/transaction.cc @@ -567,15 +567,19 @@ bool trans_xa_start(THD *thd) my_error(ER_XAER_RMFAIL, MYF(0), xa_state_names[xa_state]); else if (thd->locked_tables_mode || thd->in_active_multi_stmt_transaction()) my_error(ER_XAER_OUTSIDE, MYF(0)); - else if (xid_cache_search(thd->lex->xid)) - my_error(ER_XAER_DUPID, MYF(0)); else if (!trans_begin(thd)) { DBUG_ASSERT(thd->transaction.xid_state.xid.is_null()); thd->transaction.xid_state.xa_state= XA_ACTIVE; thd->transaction.xid_state.rm_error= 0; thd->transaction.xid_state.xid.set(thd->lex->xid); - xid_cache_insert(&thd->transaction.xid_state); + if (xid_cache_insert(&thd->transaction.xid_state)) + { + thd->transaction.xid_state.xa_state= XA_NOTR; + thd->transaction.xid_state.xid.null(); + trans_rollback(thd); + DBUG_RETURN(true); + } DBUG_RETURN(FALSE); } @@ -661,6 +665,16 @@ bool trans_xa_commit(THD *thd) if (!thd->transaction.xid_state.xid.eq(thd->lex->xid)) { + /* + xid_state.in_thd is always true beside of xa recovery procedure. + Note, that there is no race condition here between xid_cache_search + and xid_cache_delete, since we always delete our own XID + (thd->lex->xid == thd->transaction.xid_state.xid). + The only case when thd->lex->xid != thd->transaction.xid_state.xid + and xid_state->in_thd == 0 is in the function + xa_cache_insert(XID, xa_states), which is called before starting + client connections, and thus is always single-threaded. + */ XID_STATE *xs= xid_cache_search(thd->lex->xid); res= !xs || xs->in_thd; if (res) diff --git a/sql/tztime.cc b/sql/tztime.cc index b16cc65d6bb..000e3ac0518 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -1856,7 +1856,7 @@ static Time_zone* tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) { TABLE *table= 0; - TIME_ZONE_INFO *tz_info; + TIME_ZONE_INFO *tz_info= NULL; Tz_names_entry *tmp_tzname; Time_zone *return_val= 0; int res; @@ -1866,7 +1866,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) uchar keybuff[32]; Field *field; String abbr(buff, sizeof(buff), &my_charset_latin1); - char *alloc_buff, *tz_name_buff; + char *alloc_buff= NULL; + char *tz_name_buff= NULL; /* Temporary arrays that are used for loading of data for filling TIME_ZONE_INFO structure @@ -1886,22 +1887,6 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) DBUG_ENTER("tz_load_from_open_tables"); - /* Prepare tz_info for loading also let us make copy of time zone name */ - if (!(alloc_buff= (char*) alloc_root(&tz_storage, sizeof(TIME_ZONE_INFO) + - tz_name->length() + 1))) - { - sql_print_error("Out of memory while loading time zone description"); - return 0; - } - tz_info= (TIME_ZONE_INFO *)alloc_buff; - bzero(tz_info, sizeof(TIME_ZONE_INFO)); - tz_name_buff= alloc_buff + sizeof(TIME_ZONE_INFO); - /* - By writing zero to the end we guarantee that we can call ptr() - instead of c_ptr() for time zone name. - */ - strmake(tz_name_buff, tz_name->ptr(), tz_name->length()); - /* Let us find out time zone id by its name (there is only one index and it is specifically for this purpose). diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 5d6253a2a9f..8d418cb571c 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -907,10 +907,11 @@ int ha_archive::write_row(uchar *buf) ha_statistic_increment(&SSV::ha_write_count); mysql_mutex_lock(&share->mutex); - if (!share->archive_write_open) - if (init_archive_writer()) - DBUG_RETURN(errno); - + if (!share->archive_write_open && init_archive_writer()) + { + rc= errno; + goto error; + } if (table->next_number_field && record == table->record[0]) { @@ -990,7 +991,6 @@ int ha_archive::write_row(uchar *buf) error: mysql_mutex_unlock(&share->mutex); my_free(read_buf); - DBUG_RETURN(rc); } diff --git a/storage/heap/hp_delete.c b/storage/heap/hp_delete.c index 2bc7d00bfca..043e4d3540d 100644 --- a/storage/heap/hp_delete.c +++ b/storage/heap/hp_delete.c @@ -104,7 +104,7 @@ int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo, int hp_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo, const uchar *record, uchar *recpos, int flag) { - ulong blength,pos2,pos_hashnr,lastpos_hashnr; + ulong blength, pos2, pos_hashnr, lastpos_hashnr, key_pos; HASH_INFO *lastpos,*gpos,*pos,*pos3,*empty,*last_ptr; HP_SHARE *share=info->s; DBUG_ENTER("hp_delete_key"); @@ -116,9 +116,9 @@ int hp_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo, last_ptr=0; /* Search after record with key */ - pos= hp_find_hash(&keyinfo->block, - hp_mask(hp_rec_hashnr(keyinfo, record), blength, - share->records + 1)); + key_pos= hp_mask(hp_rec_hashnr(keyinfo, record), blength, share->records + 1); + pos= hp_find_hash(&keyinfo->block, key_pos); + gpos = pos3 = 0; while (pos->ptr_to_rec != recpos) diff --git a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c index 1f4d8126be6..24ff78df7c0 100644 --- a/storage/innobase/btr/btr0btr.c +++ b/storage/innobase/btr/btr0btr.c @@ -3094,6 +3094,8 @@ btr_lift_page_up( buf_block_t* blocks[BTR_MAX_LEVELS]; ulint n_blocks; /*!< last used index in blocks[] */ ulint i; + ibool lift_father_up = FALSE; + buf_block_t* block_orig = block; ut_ad(btr_page_get_prev(page, mtr) == FIL_NULL); ut_ad(btr_page_get_next(page, mtr) == FIL_NULL); @@ -3104,11 +3106,13 @@ btr_lift_page_up( { btr_cur_t cursor; - mem_heap_t* heap = mem_heap_create(100); - ulint* offsets; + ulint* offsets = NULL; + mem_heap_t* heap = mem_heap_create( + sizeof(*offsets) + * (REC_OFFS_HEADER_SIZE + 1 + 1 + index->n_fields)); buf_block_t* b; - offsets = btr_page_get_father_block(NULL, heap, index, + offsets = btr_page_get_father_block(offsets, heap, index, block, mtr, &cursor); father_block = btr_cur_get_block(&cursor); father_page_zip = buf_block_get_page_zip(father_block); @@ -3132,6 +3136,29 @@ btr_lift_page_up( blocks[n_blocks++] = b = btr_cur_get_block(&cursor); } + if (n_blocks && page_level == 0) { + /* The father page also should be the only on its level (not + root). We should lift up the father page at first. + Because the leaf page should be lifted up only for root page. + The freeing page is based on page_level (==0 or !=0) + to choose segment. If the page_level is changed ==0 from !=0, + later freeing of the page doesn't find the page allocation + to be freed.*/ + + lift_father_up = TRUE; + block = father_block; + page = buf_block_get_frame(block); + page_level = btr_page_get_level(page, mtr); + + ut_ad(btr_page_get_prev(page, mtr) == FIL_NULL); + ut_ad(btr_page_get_next(page, mtr) == FIL_NULL); + ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); + + father_block = blocks[0]; + father_page_zip = buf_block_get_page_zip(father_block); + father_page = buf_block_get_frame(father_block); + } + mem_heap_free(heap); } @@ -3139,6 +3166,7 @@ btr_lift_page_up( /* Make the father empty */ btr_page_empty(father_block, father_page_zip, index, page_level, mtr); + page_level++; /* Copy the records to the father page one by one. */ if (0 @@ -3171,7 +3199,7 @@ btr_lift_page_up( lock_update_copy_and_discard(father_block, block); /* Go upward to root page, decrementing levels by one. */ - for (i = 0; i < n_blocks; i++, page_level++) { + for (i = lift_father_up ? 1 : 0; i < n_blocks; i++, page_level++) { page_t* page = buf_block_get_frame(blocks[i]); page_zip_des_t* page_zip= buf_block_get_page_zip(blocks[i]); @@ -3193,7 +3221,7 @@ btr_lift_page_up( ut_ad(page_validate(father_page, index)); ut_ad(btr_check_node_ptr(index, father_block, mtr)); - return(father_block); + return(lift_father_up ? block_orig : father_block); } /*************************************************************//** diff --git a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c index 1f92de245b1..955be01f032 100644 --- a/storage/innobase/btr/btr0cur.c +++ b/storage/innobase/btr/btr0cur.c @@ -97,6 +97,11 @@ srv_refresh_innodb_monitor_stats(). Referenced by srv_printf_innodb_monitor(). */ UNIV_INTERN ulint btr_cur_n_sea_old = 0; +#ifdef UNIV_DEBUG +/* Flag to limit optimistic insert records */ +UNIV_INTERN uint btr_cur_limit_optimistic_insert_debug = 0; +#endif /* UNIV_DEBUG */ + /** In the optimistic insert, if the insert does not fit, but this much space can be released by page reorganize, then it is reorganized */ #define BTR_CUR_PAGE_REORGANIZE_LIMIT (UNIV_PAGE_SIZE / 32) @@ -1273,6 +1278,9 @@ btr_cur_optimistic_insert( } } + LIMIT_OPTIMISTIC_INSERT_DEBUG(page_get_n_recs(page), + goto fail); + /* If there have been many consecutive inserts, and we are on the leaf level, check if we have to split the page to reserve enough free space for future updates of records. */ diff --git a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c index 1af019dfc45..2406980196e 100644 --- a/storage/innobase/buf/buf0buf.c +++ b/storage/innobase/buf/buf0buf.c @@ -370,6 +370,33 @@ buf_get_total_list_len( } /********************************************************************//** +Get total list size in bytes from all buffer pools. */ +UNIV_INTERN +void +buf_get_total_list_size_in_bytes( +/*=============================*/ + buf_pools_list_size_t* buf_pools_list_size) /*!< out: list sizes + in all buffer pools */ +{ + ulint i; + ut_ad(buf_pools_list_size); + memset(buf_pools_list_size, 0, sizeof(*buf_pools_list_size)); + + for (i = 0; i < srv_buf_pool_instances; i++) { + buf_pool_t* buf_pool; + + buf_pool = buf_pool_from_array(i); + /* We don't need mutex protection since this is + for statistics purpose */ + buf_pools_list_size->LRU_bytes += buf_pool->stat.LRU_bytes; + buf_pools_list_size->unzip_LRU_bytes += + UT_LIST_GET_LEN(buf_pool->unzip_LRU) * UNIV_PAGE_SIZE; + buf_pools_list_size->flush_list_bytes += + buf_pool->stat.flush_list_bytes; + } +} + +/********************************************************************//** Get total buffer pool statistics. */ UNIV_INTERN void @@ -1657,34 +1684,24 @@ buf_page_make_young( } /********************************************************************//** -Sets the time of the first access of a page and moves a page to the -start of the buffer pool LRU list if it is too old. This high-level -function can be used to prevent an important page from slipping -out of the buffer pool. */ +Moves a page to the start of the buffer pool LRU list if it is too old. +This high-level function can be used to prevent an important page from +slipping out of the buffer pool. */ static void -buf_page_set_accessed_make_young( -/*=============================*/ - buf_page_t* bpage, /*!< in/out: buffer block of a +buf_page_make_young_if_needed( +/*==========================*/ + buf_page_t* bpage) /*!< in/out: buffer block of a file page */ - unsigned access_time) /*!< in: bpage->access_time - read under mutex protection, - or 0 if unknown */ { +#ifdef UNIV_DEBUG buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); - ut_ad(!buf_pool_mutex_own(buf_pool)); +#endif /* UNIV_DEBUG */ ut_a(buf_page_in_file(bpage)); if (buf_page_peek_if_too_old(bpage)) { - buf_pool_mutex_enter(buf_pool); - buf_LRU_make_block_young(bpage); - buf_pool_mutex_exit(buf_pool); - } else if (!access_time) { - ulint time_ms = ut_time_ms(); - buf_pool_mutex_enter(buf_pool); - buf_page_set_accessed(bpage, time_ms); - buf_pool_mutex_exit(buf_pool); + buf_page_make_young(bpage); } } @@ -1797,7 +1814,6 @@ buf_page_get_zip( buf_page_t* bpage; mutex_t* block_mutex; ibool must_read; - unsigned access_time; buf_pool_t* buf_pool = buf_pool_get(space, offset); buf_pool->stat.n_page_gets++; @@ -1865,13 +1881,14 @@ err_exit: got_block: must_read = buf_page_get_io_fix(bpage) == BUF_IO_READ; - access_time = buf_page_is_accessed(bpage); buf_pool_mutex_exit(buf_pool); + buf_page_set_accessed(bpage); + mutex_exit(block_mutex); - buf_page_set_accessed_make_young(bpage, access_time); + buf_page_make_young_if_needed(bpage); #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG ut_a(!bpage->file_page_was_freed); @@ -2458,22 +2475,29 @@ wait_until_unfixed: UNIV_MEM_INVALID(bpage, sizeof *bpage); - mutex_exit(&block->mutex); - mutex_exit(&buf_pool->zip_mutex); buf_pool->n_pend_unzip++; - buf_pool_mutex_exit(buf_pool); + access_time = buf_page_is_accessed(&block->page); + mutex_exit(&block->mutex); + mutex_exit(&buf_pool->zip_mutex); + buf_page_free_descriptor(bpage); - /* Decompress the page and apply buffered operations - while not holding buf_pool->mutex or block->mutex. */ + /* Decompress the page while not holding + buf_pool->mutex or block->mutex. */ success = buf_zip_decompress(block, srv_use_checksums); ut_a(success); if (UNIV_LIKELY(!recv_no_ibuf_operations)) { - ibuf_merge_or_delete_for_page(block, space, offset, - zip_size, TRUE); + if (access_time) { +#ifdef UNIV_IBUF_COUNT_DEBUG + ut_a(ibuf_count_get(space, offset) == 0); +#endif /* UNIV_IBUF_COUNT_DEBUG */ + } else { + ibuf_merge_or_delete_for_page( + block, space, offset, zip_size, TRUE); + } } /* Unfix and unlatch the block. */ @@ -2550,16 +2574,17 @@ wait_until_unfixed: ut_a(mode == BUF_GET_POSSIBLY_FREED || !block->page.file_page_was_freed); #endif - mutex_exit(&block->mutex); + buf_pool_mutex_exit(buf_pool); /* Check if this is the first access to the page */ - access_time = buf_page_is_accessed(&block->page); - buf_pool_mutex_exit(buf_pool); + buf_page_set_accessed(&block->page); - if (UNIV_LIKELY(mode != BUF_PEEK_IF_IN_POOL)) { - buf_page_set_accessed_make_young(&block->page, access_time); + mutex_exit(&block->mutex); + + if (mode != BUF_PEEK_IF_IN_POOL) { + buf_page_make_young_if_needed(&block->page); } #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG @@ -2610,7 +2635,7 @@ wait_until_unfixed: mtr_memo_push(mtr, block, fix_type); - if (UNIV_LIKELY(mode != BUF_PEEK_IF_IN_POOL) && !access_time) { + if (mode != BUF_PEEK_IF_IN_POOL && !access_time) { /* In the case of a first access, try to apply linear read-ahead */ @@ -2662,15 +2687,13 @@ buf_page_optimistic_get( buf_block_buf_fix_inc(block, file, line); - mutex_exit(&block->mutex); + access_time = buf_page_is_accessed(&block->page); - /* Check if this is the first access to the page. - We do a dirty read on purpose, to avoid mutex contention. - This field is only used for heuristic purposes; it does not - affect correctness. */ + buf_page_set_accessed(&block->page); - access_time = buf_page_is_accessed(&block->page); - buf_page_set_accessed_make_young(&block->page, access_time); + mutex_exit(&block->mutex); + + buf_page_make_young_if_needed(&block->page); ut_ad(!ibuf_inside(mtr) || ibuf_page(buf_block_get_space(block), @@ -2722,7 +2745,7 @@ buf_page_optimistic_get( #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG ut_a(block->page.file_page_was_freed == FALSE); #endif - if (UNIV_UNLIKELY(!access_time)) { + if (!access_time) { /* In the case of a first access, try to apply linear read-ahead */ @@ -2785,24 +2808,14 @@ buf_page_get_known_nowait( buf_block_buf_fix_inc(block, file, line); + buf_page_set_accessed(&block->page); + mutex_exit(&block->mutex); buf_pool = buf_pool_from_block(block); - if (mode == BUF_MAKE_YOUNG && buf_page_peek_if_too_old(&block->page)) { - buf_pool_mutex_enter(buf_pool); - buf_LRU_make_block_young(&block->page); - buf_pool_mutex_exit(buf_pool); - } else if (!buf_page_is_accessed(&block->page)) { - /* Above, we do a dirty read on purpose, to avoid - mutex contention. The field buf_page_t::access_time - is only used for heuristic purposes. Writes to the - field must be protected by mutex, however. */ - ulint time_ms = ut_time_ms(); - - buf_pool_mutex_enter(buf_pool); - buf_page_set_accessed(&block->page, time_ms); - buf_pool_mutex_exit(buf_pool); + if (mode == BUF_MAKE_YOUNG) { + buf_page_make_young_if_needed(&block->page); } ut_ad(!ibuf_inside(mtr) || mode == BUF_KEEP_OLD); @@ -2965,6 +2978,7 @@ buf_page_init( ulint offset, /*!< in: offset of the page within space in units of a page */ ulint fold, /*!< in: buf_page_address_fold(space,offset) */ + ulint zip_size,/*!< in: compressed page size, or 0 */ buf_block_t* block) /*!< in/out: block to init */ { buf_page_t* hash_page; @@ -3027,6 +3041,9 @@ buf_page_init( ut_d(block->page.in_page_hash = TRUE); HASH_INSERT(buf_page_t, hash, buf_pool->page_hash, fold, &block->page); + if (zip_size) { + page_zip_set_size(&block->page.zip, zip_size); + } } /********************************************************************//** @@ -3128,7 +3145,7 @@ err_exit: ut_ad(buf_pool_from_bpage(bpage) == buf_pool); - buf_page_init(buf_pool, space, offset, fold, block); + buf_page_init(buf_pool, space, offset, fold, zip_size, block); /* The block must be put to the LRU list, to the old blocks */ buf_LRU_add_block(bpage, TRUE/* to old blocks */); @@ -3146,8 +3163,6 @@ err_exit: buf_page_set_io_fix(bpage, BUF_IO_READ); if (UNIV_UNLIKELY(zip_size)) { - page_zip_set_size(&block->page.zip, zip_size); - /* buf_pool->mutex may be released and reacquired by buf_buddy_alloc(). Thus, we must release block->mutex in order not to @@ -3240,7 +3255,8 @@ err_exit: HASH_INSERT(buf_page_t, hash, buf_pool->page_hash, fold, bpage); - /* The block must be put to the LRU list, to the old blocks */ + /* The block must be put to the LRU list, to the old blocks + The zip_size is already set into the page zip */ buf_LRU_add_block(bpage, TRUE/* to old blocks */); #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG buf_LRU_insert_zip_clean(bpage); @@ -3284,7 +3300,6 @@ buf_page_create( buf_block_t* block; ulint fold; buf_block_t* free_block = NULL; - ulint time_ms = ut_time_ms(); buf_pool_t* buf_pool = buf_pool_get(space, offset); ut_ad(mtr); @@ -3332,7 +3347,7 @@ buf_page_create( mutex_enter(&block->mutex); - buf_page_init(buf_pool, space, offset, fold, block); + buf_page_init(buf_pool, space, offset, fold, zip_size, block); /* The block must be put to the LRU list */ buf_LRU_add_block(&block->page, FALSE); @@ -3350,8 +3365,6 @@ buf_page_create( buf_page_set_io_fix(&block->page, BUF_IO_READ); rw_lock_x_lock(&block->lock); - - page_zip_set_size(&block->page.zip, zip_size); mutex_exit(&block->mutex); /* buf_pool->mutex may be released and reacquired by buf_buddy_alloc(). Thus, we must release block->mutex @@ -3375,12 +3388,12 @@ buf_page_create( rw_lock_x_unlock(&block->lock); } - buf_page_set_accessed(&block->page, time_ms); - buf_pool_mutex_exit(buf_pool); mtr_memo_push(mtr, block, MTR_MEMO_BUF_FIX); + buf_page_set_accessed(&block->page); + mutex_exit(&block->mutex); /* Delete possible entries for the page from the insert buffer: diff --git a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c index 7cd09d6675e..c385dc793ab 100644 --- a/storage/innobase/buf/buf0flu.c +++ b/storage/innobase/buf/buf0flu.c @@ -79,6 +79,23 @@ static ulint buf_lru_flush_page_count = 0; /* @} */ +/******************************************************************//** +Increases flush_list size in bytes with zip_size for compressed page, +UNIV_PAGE_SIZE for uncompressed page in inline function */ +static inline +void +incr_flush_list_size_in_bytes( +/*==========================*/ + buf_block_t* block, /*!< in: control block */ + buf_pool_t* buf_pool) /*!< in: buffer pool instance */ +{ + ulint zip_size; + ut_ad(buf_flush_list_mutex_own(buf_pool)); + zip_size = page_zip_get_size(&block->page.zip); + buf_pool->stat.flush_list_bytes += zip_size ? zip_size : UNIV_PAGE_SIZE; + ut_ad(buf_pool->stat.flush_list_bytes <= buf_pool->curr_pool_size); +} + #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG /******************************************************************//** Validates the flush list. @@ -308,6 +325,7 @@ buf_flush_insert_into_flush_list( ut_d(block->page.in_flush_list = TRUE); block->page.oldest_modification = lsn; UT_LIST_ADD_FIRST(list, buf_pool->flush_list, &block->page); + incr_flush_list_size_in_bytes(block, buf_pool); #ifdef UNIV_DEBUG_VALGRIND { @@ -412,6 +430,8 @@ buf_flush_insert_sorted_into_flush_list( prev_b, &block->page); } + incr_flush_list_size_in_bytes(block, buf_pool); + #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG ut_a(buf_flush_validate_low(buf_pool)); #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ @@ -504,6 +524,7 @@ buf_flush_remove( buf_page_t* bpage) /*!< in: pointer to the block in question */ { buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); + ulint zip_size; ut_ad(buf_pool_mutex_own(buf_pool)); ut_ad(mutex_own(buf_page_get_mutex(bpage))); @@ -542,6 +563,9 @@ buf_flush_remove( because we assert on in_flush_list in comparison function. */ ut_d(bpage->in_flush_list = FALSE); + zip_size = page_zip_get_size(&bpage->zip); + buf_pool->stat.flush_list_bytes -= zip_size ? zip_size : UNIV_PAGE_SIZE; + bpage->oldest_modification = 0; #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG diff --git a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c index 60894cae6ad..b3e282d24b2 100644 --- a/storage/innobase/buf/buf0lru.c +++ b/storage/innobase/buf/buf0lru.c @@ -151,6 +151,23 @@ buf_LRU_block_free_hashed_page( be in a state where it can be freed */ /******************************************************************//** +Increases LRU size in bytes with zip_size for compressed page, +UNIV_PAGE_SIZE for uncompressed page in inline function */ +static inline +void +incr_LRU_size_in_bytes( +/*===================*/ + buf_page_t* bpage, /*!< in: control block */ + buf_pool_t* buf_pool) /*!< in: buffer pool instance */ +{ + ulint zip_size; + ut_ad(buf_pool_mutex_own(buf_pool)); + zip_size = page_zip_get_size(&bpage->zip); + buf_pool->stat.LRU_bytes += zip_size ? zip_size : UNIV_PAGE_SIZE; + ut_ad(buf_pool->stat.LRU_bytes <= buf_pool->curr_pool_size); +} + +/******************************************************************//** Determines if the unzip_LRU list should be used for evicting a victim instead of the general LRU list. @return TRUE if should use unzip_LRU */ @@ -1356,6 +1373,7 @@ buf_LRU_remove_block( buf_page_t* bpage) /*!< in: control block */ { buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); + ulint zip_size; ut_ad(buf_pool); ut_ad(bpage); @@ -1391,6 +1409,9 @@ buf_LRU_remove_block( UT_LIST_REMOVE(LRU, buf_pool->LRU, bpage); ut_d(bpage->in_LRU_list = FALSE); + zip_size = page_zip_get_size(&bpage->zip); + buf_pool->stat.LRU_bytes -= zip_size ? zip_size : UNIV_PAGE_SIZE; + buf_unzip_LRU_remove_block_if_needed(bpage); /* If the LRU list is so short that LRU_old is not defined, @@ -1451,7 +1472,10 @@ buf_unzip_LRU_add_block( } /******************************************************************//** -Adds a block to the LRU list end. */ +Adds a block to the LRU list end. Please make sure that the zip_size is +already set into the page zip when invoking the function, so that we +can get correct zip_size from the buffer page when adding a block +into LRU */ UNIV_INLINE void buf_LRU_add_block_to_end_low( @@ -1470,6 +1494,8 @@ buf_LRU_add_block_to_end_low( UT_LIST_ADD_LAST(LRU, buf_pool->LRU, bpage); ut_d(bpage->in_LRU_list = TRUE); + incr_LRU_size_in_bytes(bpage, buf_pool); + if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) { ut_ad(buf_pool->LRU_old); @@ -1498,7 +1524,10 @@ buf_LRU_add_block_to_end_low( } /******************************************************************//** -Adds a block to the LRU list. */ +Adds a block to the LRU list. Please make sure that the zip_size is +already set into the page zip when invoking the function, so that we +can get correct zip_size from the buffer page when adding a block +into LRU */ UNIV_INLINE void buf_LRU_add_block_low( @@ -1540,6 +1569,8 @@ buf_LRU_add_block_low( ut_d(bpage->in_LRU_list = TRUE); + incr_LRU_size_in_bytes(bpage, buf_pool); + if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) { ut_ad(buf_pool->LRU_old); @@ -1567,7 +1598,10 @@ buf_LRU_add_block_low( } /******************************************************************//** -Adds a block to the LRU list. */ +Adds a block to the LRU list. Please make sure that the zip_size is +already set into the page zip when invoking the function, so that we +can get correct zip_size from the buffer page when adding a block +into LRU */ UNIV_INTERN void buf_LRU_add_block( @@ -1753,6 +1787,8 @@ alloc: UT_LIST_INSERT_AFTER(LRU, buf_pool->LRU, prev_b, b); + incr_LRU_size_in_bytes(b, buf_pool); + if (buf_page_is_old(b)) { buf_pool->LRU_old_len++; if (UNIV_UNLIKELY diff --git a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load.c index 22f0d4456d5..208d013e82d 100644 --- a/storage/innobase/dict/dict0load.c +++ b/storage/innobase/dict/dict0load.c @@ -2328,7 +2328,8 @@ dict_load_foreigns( ibool check_charsets) /*!< in: TRUE=check charset compatibility */ { - char tuple_buf[DTUPLE_EST_ALLOC(1)]; + ulint tuple_buf[(DTUPLE_EST_ALLOC(1) + sizeof(ulint) - 1) + / sizeof(ulint)]; btr_pcur_t pcur; dtuple_t* tuple; dfield_t* dfield; diff --git a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c index 8fe33459994..2f875663039 100644 --- a/storage/innobase/fil/fil0fil.c +++ b/storage/innobase/fil/fil0fil.c @@ -1466,7 +1466,7 @@ fil_space_get_size( ut_ad(fil_system); - fil_mutex_enter_and_prepare_for_io(id); + mutex_enter(&fil_system->mutex); space = fil_space_get_by_id(id); @@ -1481,6 +1481,23 @@ fil_space_get_size( ut_a(1 == UT_LIST_GET_LEN(space->chain)); + mutex_exit(&fil_system->mutex); + + /* It is possible that the space gets evicted at this point + before the fil_mutex_enter_and_prepare_for_io() acquires + the fil_system->mutex. Check for this after completing the + call to fil_mutex_enter_and_prepare_for_io(). */ + fil_mutex_enter_and_prepare_for_io(id); + + /* We are still holding the fil_system->mutex. Check if + the space is still in memory cache. */ + space = fil_space_get_by_id(id); + + if (space == NULL) { + mutex_exit(&fil_system->mutex); + return(0); + } + node = UT_LIST_GET_FIRST(space->chain); /* It must be a single-table tablespace and we have not opened @@ -1518,7 +1535,7 @@ fil_space_get_flags( return(0); } - fil_mutex_enter_and_prepare_for_io(id); + mutex_enter(&fil_system->mutex); space = fil_space_get_by_id(id); @@ -1533,6 +1550,23 @@ fil_space_get_flags( ut_a(1 == UT_LIST_GET_LEN(space->chain)); + mutex_exit(&fil_system->mutex); + + /* It is possible that the space gets evicted at this point + before the fil_mutex_enter_and_prepare_for_io() acquires + the fil_system->mutex. Check for this after completing the + call to fil_mutex_enter_and_prepare_for_io(). */ + fil_mutex_enter_and_prepare_for_io(id); + + /* We are still holding the fil_system->mutex. Check if + the space is still in memory cache. */ + space = fil_space_get_by_id(id); + + if (space == NULL) { + mutex_exit(&fil_system->mutex); + return(0); + } + node = UT_LIST_GET_FIRST(space->chain); /* It must be a single-table tablespace and we have not opened @@ -2702,7 +2736,7 @@ retry: mutex_exit(&fil_system->mutex); #ifndef UNIV_HOTBACKUP - if (success) { + if (success && !recv_recovery_on) { mtr_t mtr; mtr_start(&mtr); @@ -4947,3 +4981,28 @@ fil_close(void) fil_system = NULL; } + +/****************************************************************//** +Generate redo logs for swapping two .ibd files */ +UNIV_INTERN +void +fil_mtr_rename_log( +/*===============*/ + ulint old_space_id, /*!< in: tablespace id of the old + table. */ + const char* old_name, /*!< in: old table name */ + ulint new_space_id, /*!< in: tablespace id of the new + table */ + const char* new_name, /*!< in: new table name */ + const char* tmp_name) /*!< in: temp table name used while + swapping */ +{ + mtr_t mtr; + mtr_start(&mtr); + fil_op_write_log(MLOG_FILE_RENAME, old_space_id, + 0, 0, old_name, tmp_name, &mtr); + fil_op_write_log(MLOG_FILE_RENAME, new_space_id, + 0, 0, new_name, old_name, &mtr); + mtr_commit(&mtr); +} + diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index bf7bfce6b5c..c5b59f6b404 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -607,8 +607,12 @@ innobase_commit_low( static SHOW_VAR innodb_status_variables[]= { {"buffer_pool_pages_data", (char*) &export_vars.innodb_buffer_pool_pages_data, SHOW_LONG}, + {"buffer_pool_bytes_data", + (char*) &export_vars.innodb_buffer_pool_bytes_data, SHOW_LONG}, {"buffer_pool_pages_dirty", (char*) &export_vars.innodb_buffer_pool_pages_dirty, SHOW_LONG}, + {"buffer_pool_bytes_dirty", + (char*) &export_vars.innodb_buffer_pool_bytes_dirty, SHOW_LONG}, {"buffer_pool_pages_flushed", (char*) &export_vars.innodb_buffer_pool_pages_flushed, SHOW_LONG}, {"buffer_pool_pages_free", @@ -699,6 +703,12 @@ static SHOW_VAR innodb_status_variables[]= { (char*) &export_vars.innodb_rows_updated, SHOW_LONG}, {"truncated_status_writes", (char*) &export_vars.innodb_truncated_status_writes, SHOW_LONG}, +#ifdef UNIV_DEBUG + {"purge_trx_id_age", + (char*) &export_vars.innodb_purge_trx_id_age, SHOW_LONG}, + {"purge_view_trx_id_age", + (char*) &export_vars.innodb_purge_view_trx_id_age, SHOW_LONG}, +#endif /* UNIV_DEBUG */ {NullS, NullS, SHOW_LONG} }; @@ -1068,6 +1078,8 @@ convert_error_code_to_mysql( return(HA_ERR_INDEX_CORRUPT); case DB_UNDO_RECORD_TOO_BIG: return(HA_ERR_UNDO_REC_TOO_BIG); + case DB_OUT_OF_MEMORY: + return(HA_ERR_OUT_OF_MEM); } } @@ -1245,16 +1257,6 @@ innobase_get_lower_case_table_names(void) return(lower_case_table_names); } -#if defined (__WIN__) && defined (MYSQL_DYNAMIC_PLUGIN) -extern MYSQL_PLUGIN_IMPORT MY_TMPDIR mysql_tmpdir_list; -/*******************************************************************//** -Map an OS error to an errno value. The OS error number is stored in -_doserrno and the mapped value is stored in errno) */ -extern "C" -void __cdecl -_dosmaperr( - unsigned long); /*!< in: OS error value */ - /*********************************************************************//** Creates a temporary file. @return temporary file descriptor, or < 0 on error */ @@ -1263,92 +1265,16 @@ int innobase_mysql_tmpfile(void) /*========================*/ { - int fd; /* handle of opened file */ - HANDLE osfh; /* OS handle of opened file */ - char* tmpdir; /* point to the directory - where to create file */ - TCHAR path_buf[MAX_PATH - 14]; /* buffer for tmp file path. - The length cannot be longer - than MAX_PATH - 14, or - GetTempFileName will fail. */ - char filename[MAX_PATH]; /* name of the tmpfile */ - DWORD fileaccess = GENERIC_READ /* OS file access */ - | GENERIC_WRITE - | DELETE; - DWORD fileshare = FILE_SHARE_READ /* OS file sharing mode */ - | FILE_SHARE_WRITE - | FILE_SHARE_DELETE; - DWORD filecreate = CREATE_ALWAYS; /* OS method of open/create */ - DWORD fileattrib = /* OS file attribute flags */ - FILE_ATTRIBUTE_NORMAL - | FILE_FLAG_DELETE_ON_CLOSE - | FILE_ATTRIBUTE_TEMPORARY - | FILE_FLAG_SEQUENTIAL_SCAN; - - DBUG_ENTER("innobase_mysql_tmpfile"); - - tmpdir = my_tmpdir(&mysql_tmpdir_list); - - /* The tmpdir parameter can not be NULL for GetTempFileName. */ - if (!tmpdir) { - uint ret; - - /* Use GetTempPath to determine path for temporary files. */ - ret = GetTempPath(sizeof(path_buf), path_buf); - if (ret > sizeof(path_buf) || (ret == 0)) { - - _dosmaperr(GetLastError()); /* map error */ - DBUG_RETURN(-1); - } - - tmpdir = path_buf; - } - - /* Use GetTempFileName to generate a unique filename. */ - if (!GetTempFileName(tmpdir, "ib", 0, filename)) { - - _dosmaperr(GetLastError()); /* map error */ - DBUG_RETURN(-1); - } - - DBUG_PRINT("info", ("filename: %s", filename)); - - /* Open/Create the file. */ - osfh = CreateFile(filename, fileaccess, fileshare, NULL, - filecreate, fileattrib, NULL); - if (osfh == INVALID_HANDLE_VALUE) { - - /* open/create file failed! */ - _dosmaperr(GetLastError()); /* map error */ - DBUG_RETURN(-1); - } - - do { - /* Associates a CRT file descriptor with the OS file handle. */ - fd = _open_osfhandle((intptr_t) osfh, 0); - } while (fd == -1 && errno == EINTR); + int fd2 = -1; + File fd; - if (fd == -1) { - /* Open failed, close the file handle. */ + DBUG_EXECUTE_IF( + "innobase_tmpfile_creation_failure", + return(-1); + ); - _dosmaperr(GetLastError()); /* map error */ - CloseHandle(osfh); /* no need to check if - CloseHandle fails */ - } + fd = mysql_tmpfile("ib"); - DBUG_RETURN(fd); -} -#else -/*********************************************************************//** -Creates a temporary file. -@return temporary file descriptor, or < 0 on error */ -extern "C" UNIV_INTERN -int -innobase_mysql_tmpfile(void) -/*========================*/ -{ - int fd2 = -1; - File fd = mysql_tmpfile("ib"); if (fd >= 0) { /* Copy the file descriptor, so that the additional resources allocated by create_temp_file() can be freed by invoking @@ -1392,7 +1318,6 @@ innobase_mysql_tmpfile(void) } return(fd2); } -#endif /* defined (__WIN__) && defined (MYSQL_DYNAMIC_PLUGIN) */ /*********************************************************************//** Wrapper around MySQL's copy_and_convert function. @@ -11924,13 +11849,30 @@ static MYSQL_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold, "trigger a readahead.", NULL, NULL, 56, 0, 64, 0); -#ifdef UNIV_DEBUG_never +#ifdef UNIV_DEBUG static MYSQL_SYSVAR_UINT(trx_rseg_n_slots_debug, trx_rseg_n_slots_debug, - PLUGIN_VAR_RQCMDARG, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_NOCMDOPT, "Debug flags for InnoDB to limit TRX_RSEG_N_SLOTS for trx_rsegf_undo_find_free()", NULL, NULL, 0, 0, 1024, 0); + +static MYSQL_SYSVAR_UINT(limit_optimistic_insert_debug, + btr_cur_limit_optimistic_insert_debug, PLUGIN_VAR_RQCMDARG, + "Artificially limit the number of records per B-tree page (0=unlimited).", + NULL, NULL, 0, 0, UINT_MAX32, 0); + +static MYSQL_SYSVAR_BOOL(trx_purge_view_update_only_debug, + srv_purge_view_update_only_debug, PLUGIN_VAR_NOCMDOPT, + "Pause actual purging any delete-marked records, but merely update the purge view. " + "It is to create artificially the situation the purge view have been updated " + "but the each purges were not done yet.", + NULL, NULL, FALSE); #endif /* UNIV_DEBUG */ +static MYSQL_SYSVAR_BOOL(print_all_deadlocks, srv_print_all_deadlocks, + PLUGIN_VAR_OPCMDARG, + "Print all deadlocks to MySQL error log (off by default)", + NULL, NULL, FALSE); + static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(additional_mem_pool_size), MYSQL_SYSVAR(autoextend_increment), @@ -12000,9 +11942,12 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(purge_threads), MYSQL_SYSVAR(purge_batch_size), MYSQL_SYSVAR(rollback_segments), -#ifdef UNIV_DEBUG_never /* disable this flag. --innodb-trx becomes ambiguous */ +#ifdef UNIV_DEBUG MYSQL_SYSVAR(trx_rseg_n_slots_debug), + MYSQL_SYSVAR(limit_optimistic_insert_debug), + MYSQL_SYSVAR(trx_purge_view_update_only_debug), #endif /* UNIV_DEBUG */ + MYSQL_SYSVAR(print_all_deadlocks), NULL }; diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 451e37f2136..cdd5078c262 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -101,8 +101,6 @@ innobase_col_to_mysql( ut_ad(flen >= len); ut_ad(DATA_MBMAXLEN(col->mbminmaxlen) >= DATA_MBMINLEN(col->mbminmaxlen)); - ut_ad(DATA_MBMAXLEN(col->mbminmaxlen) - > DATA_MBMINLEN(col->mbminmaxlen) || flen == len); memcpy(dest, data, len); break; diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index 6819f2bc2c5..283a6eec852 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -805,6 +805,11 @@ srv_printf_innodb_monitor(). */ extern ulint btr_cur_n_sea_old; #endif /* !UNIV_HOTBACKUP */ +#ifdef UNIV_DEBUG +/* Flag to limit optimistic insert records */ +extern uint btr_cur_limit_optimistic_insert_debug; +#endif /* UNIV_DEBUG */ + #ifndef UNIV_NONINL #include "btr0cur.ic" #endif diff --git a/storage/innobase/include/btr0cur.ic b/storage/innobase/include/btr0cur.ic index e31f77c77eb..5fc4651ca13 100644 --- a/storage/innobase/include/btr0cur.ic +++ b/storage/innobase/include/btr0cur.ic @@ -27,6 +27,16 @@ Created 10/16/1994 Heikki Tuuri #include "btr0btr.h" #ifdef UNIV_DEBUG +# define LIMIT_OPTIMISTIC_INSERT_DEBUG(NREC, CODE)\ +if (btr_cur_limit_optimistic_insert_debug\ + && (NREC) >= (ulint)btr_cur_limit_optimistic_insert_debug) {\ + CODE;\ +} +#else +# define LIMIT_OPTIMISTIC_INSERT_DEBUG(NREC, CODE) +#endif /* UNIV_DEBUG */ + +#ifdef UNIV_DEBUG /*********************************************************//** Returns the page cursor component of a tree cursor. @return pointer to page cursor component */ @@ -146,6 +156,9 @@ btr_cur_compress_recommendation( page = btr_cur_get_page(cursor); + LIMIT_OPTIMISTIC_INSERT_DEBUG(page_get_n_recs(page) * 2, + return(FALSE)); + if ((page_get_data_size(page) < BTR_CUR_PAGE_COMPRESS_LIMIT) || ((btr_page_get_next(page, mtr) == FIL_NULL) && (btr_page_get_prev(page, mtr) == FIL_NULL))) { diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index fd8620eab3b..b7f6eae3f09 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -198,6 +198,15 @@ struct buf_pool_info_struct{ typedef struct buf_pool_info_struct buf_pool_info_t; +/** The occupied bytes of lists in all buffer pools */ +struct buf_pools_list_size_struct { + ulint LRU_bytes; /*!< LRU size in bytes */ + ulint unzip_LRU_bytes; /*!< unzip_LRU size in bytes */ + ulint flush_list_bytes; /*!< flush_list size in bytes */ +}; + +typedef struct buf_pools_list_size_struct buf_pools_list_size_t; + #ifndef UNIV_HOTBACKUP /********************************************************************//** Acquire mutex on all buffer pool instances */ @@ -1024,8 +1033,7 @@ UNIV_INLINE void buf_page_set_accessed( /*==================*/ - buf_page_t* bpage, /*!< in/out: control block */ - ulint time_ms) /*!< in: ut_time_ms() */ + buf_page_t* bpage) /*!< in/out: control block */ __attribute__((nonnull)); /*********************************************************************//** Gets the buf_block_t handle of a buffered file block if an uncompressed @@ -1334,6 +1342,14 @@ buf_get_total_list_len( ulint* free_len, /*!< out: length of all free lists */ ulint* flush_list_len);/*!< out: length of all flush lists */ /********************************************************************//** +Get total list size in bytes from all buffer pools. */ +UNIV_INTERN +void +buf_get_total_list_size_in_bytes( +/*=============================*/ + buf_pools_list_size_t* buf_pools_list_size); /*!< out: list sizes + in all buffer pools */ +/********************************************************************//** Get total buffer pool statistics. */ UNIV_INTERN void @@ -1504,10 +1520,11 @@ struct buf_page_struct{ to read this for heuristic purposes without holding any mutex or latch */ - unsigned access_time:32; /*!< time of first access, or - 0 if the block was never accessed - in the buffer pool */ /* @} */ + unsigned access_time; /*!< time of first access, or + 0 if the block was never accessed + in the buffer pool. Protected by + block mutex */ # if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG ibool file_page_was_freed; /*!< this is set to TRUE when fsp @@ -1685,6 +1702,8 @@ struct buf_pool_stat_struct{ young because the first access was not long enough ago, in buf_page_peek_if_too_old() */ + ulint LRU_bytes; /*!< LRU size in bytes */ + ulint flush_list_bytes;/*!< flush_list size in bytes */ }; /** Statistics of buddy blocks of a given size. */ diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic index 84c0ab9d610..bcbe454b037 100644 --- a/storage/innobase/include/buf0buf.ic +++ b/storage/innobase/include/buf0buf.ic @@ -614,18 +614,18 @@ UNIV_INLINE void buf_page_set_accessed( /*==================*/ - buf_page_t* bpage, /*!< in/out: control block */ - ulint time_ms) /*!< in: ut_time_ms() */ + buf_page_t* bpage) /*!< in/out: control block */ { #ifdef UNIV_DEBUG buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); - ut_ad(buf_pool_mutex_own(buf_pool)); + ut_ad(!buf_pool_mutex_own(buf_pool)); + ut_ad(mutex_own(buf_page_get_mutex(bpage))); #endif ut_a(buf_page_in_file(bpage)); if (!bpage->access_time) { /* Make this the time of the first access. */ - bpage->access_time = time_ms; + bpage->access_time = ut_time_ms(); } } diff --git a/storage/innobase/include/buf0lru.h b/storage/innobase/include/buf0lru.h index 9ecb9de2afe..0e08f455800 100644 --- a/storage/innobase/include/buf0lru.h +++ b/storage/innobase/include/buf0lru.h @@ -149,7 +149,10 @@ buf_LRU_block_free_non_file_page( /*=============================*/ buf_block_t* block); /*!< in: block, must not contain a file page */ /******************************************************************//** -Adds a block to the LRU list. */ +Adds a block to the LRU list. Please make sure that the zip_size is +already set into the page zip when invoking the function, so that we +can get correct zip_size from the buffer page when adding a block +into LRU */ UNIV_INTERN void buf_LRU_add_block( diff --git a/storage/innobase/include/data0type.ic b/storage/innobase/include/data0type.ic index 757dd815c5e..7ec2cb6cf36 100644 --- a/storage/innobase/include/data0type.ic +++ b/storage/innobase/include/data0type.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. 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 @@ -459,36 +459,18 @@ dtype_get_fixed_size_low( } else if (!comp) { return(len); } else { - /* We play it safe here and ask MySQL for - mbminlen and mbmaxlen. Although - mbminlen and mbmaxlen are - initialized if and only if prtype - is (in one of the 3 functions in this file), - it could be that none of these functions - has been called. */ - +#ifdef UNIV_DEBUG ulint i_mbminlen, i_mbmaxlen; innobase_get_cset_width( dtype_get_charset_coll(prtype), &i_mbminlen, &i_mbmaxlen); - if (UNIV_UNLIKELY - (DATA_MBMINMAXLEN(i_mbminlen, i_mbmaxlen) - != mbminmaxlen)) { - - ut_print_timestamp(stderr); - fprintf(stderr, " InnoDB: " - "mbminlen=%lu, " - "mbmaxlen=%lu, " - "type->mbminlen=%lu, " - "type->mbmaxlen=%lu\n", - (ulong) i_mbminlen, - (ulong) i_mbmaxlen, - (ulong) DATA_MBMINLEN(mbminmaxlen), - (ulong) DATA_MBMAXLEN(mbminmaxlen)); - } - if (i_mbminlen == i_mbmaxlen) { + ut_ad(DATA_MBMINMAXLEN(i_mbminlen, i_mbmaxlen) + == mbminmaxlen); +#endif /* UNIV_DEBUG */ + if (DATA_MBMINLEN(mbminmaxlen) + == DATA_MBMAXLEN(mbminmaxlen)) { return(len); } } diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index ed47ccff052..a804c261447 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -734,6 +734,21 @@ fil_tablespace_is_being_deleted( /*============================*/ ulint id); /*!< in: space id */ +/****************************************************************//** +Generate redo logs for swapping two .ibd files */ +UNIV_INTERN +void +fil_mtr_rename_log( +/*===============*/ + ulint old_space_id, /*!< in: tablespace id of the old + table. */ + const char* old_name, /*!< in: old table name */ + ulint new_space_id, /*!< in: tablespace id of the new + table */ + const char* new_name, /*!< in: new table name */ + const char* tmp_name); /*!< in: temp table name used while + swapping */ + typedef struct fil_space_struct fil_space_t; #endif diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h index 29fdc3bbe97..b2a622296e0 100644 --- a/storage/innobase/include/lock0lock.h +++ b/storage/innobase/include/lock0lock.h @@ -797,14 +797,22 @@ lock_rec_get_page_no( remains set when the waiting lock is granted, or if the lock is inherited to a neighboring record */ -#if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION)&LOCK_MODE_MASK +#define LOCK_CONV_BY_OTHER 4096 /*!< this bit is set when the lock is created + by other transaction */ +#if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION|LOCK_CONV_BY_OTHER)&LOCK_MODE_MASK # error #endif -#if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION)&LOCK_TYPE_MASK +#if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION|LOCK_CONV_BY_OTHER)&LOCK_TYPE_MASK # error #endif /* @} */ +/** Checks if this is a waiting lock created by lock->trx itself. +@param type_mode lock->type_mode +@return whether it is a waiting lock belonging to lock->trx */ +#define lock_is_wait_not_by_other(type_mode) \ + ((type_mode & (LOCK_CONV_BY_OTHER | LOCK_WAIT)) == LOCK_WAIT) + /** Lock operation struct */ typedef struct lock_op_struct lock_op_t; /** Lock operation struct */ diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h index 10b74d18c13..98bf889b996 100644 --- a/storage/innobase/include/rem0rec.h +++ b/storage/innobase/include/rem0rec.h @@ -362,24 +362,6 @@ rec_get_offsets_func( rec_get_offsets_func(rec,index,offsets,n,heap,__FILE__,__LINE__) /******************************************************//** -Determine the offset to each field in a leaf-page record -in ROW_FORMAT=COMPACT. This is a special case of -rec_init_offsets() and rec_get_offsets_func(). */ -UNIV_INTERN -void -rec_init_offsets_comp_ordinary( -/*===========================*/ - const rec_t* rec, /*!< in: physical record in - ROW_FORMAT=COMPACT */ - ulint extra, /*!< in: number of bytes to reserve - between the record header and - the data payload - (usually REC_N_NEW_EXTRA_BYTES) */ - const dict_index_t* index, /*!< in: record descriptor */ - ulint* offsets);/*!< in/out: array of offsets; - in: n=rec_offs_n_fields(offsets) */ - -/******************************************************//** The following function determines the offsets to each field in the record. It can reuse a previously allocated array. */ UNIV_INTERN @@ -644,8 +626,48 @@ rec_copy( /*=====*/ void* buf, /*!< in: buffer */ const rec_t* rec, /*!< in: physical record */ - const ulint* offsets);/*!< in: array returned by rec_get_offsets() */ + const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ + __attribute__((nonnull)); #ifndef UNIV_HOTBACKUP +/**********************************************************//** +Determines the size of a data tuple prefix in a temporary file. +@return total size */ +UNIV_INTERN +ulint +rec_get_converted_size_temp( +/*========================*/ + const dict_index_t* index, /*!< in: record descriptor */ + const dfield_t* fields, /*!< in: array of data fields */ + ulint n_fields,/*!< in: number of data fields */ + ulint* extra) /*!< out: extra size */ + __attribute__((warn_unused_result, nonnull)); + +/******************************************************//** +Determine the offset to each field in temporary file. +@see rec_convert_dtuple_to_temp() */ +UNIV_INTERN +void +rec_init_offsets_temp( +/*==================*/ + const rec_t* rec, /*!< in: temporary file record */ + const dict_index_t* index, /*!< in: record descriptor */ + ulint* offsets)/*!< in/out: array of offsets; + in: n=rec_offs_n_fields(offsets) */ + __attribute__((nonnull)); + +/*********************************************************//** +Builds a temporary file record out of a data tuple. +@see rec_init_offsets_temp() */ +UNIV_INTERN +void +rec_convert_dtuple_to_temp( +/*=======================*/ + rec_t* rec, /*!< out: record */ + const dict_index_t* index, /*!< in: record descriptor */ + const dfield_t* fields, /*!< in: array of data fields */ + ulint n_fields) /*!< in: number of fields */ + __attribute__((nonnull)); + /**************************************************************//** Copies the first n fields of a physical record to a new physical record in a buffer. @@ -680,21 +702,6 @@ rec_fold( __attribute__((pure)); #endif /* !UNIV_HOTBACKUP */ /*********************************************************//** -Builds a ROW_FORMAT=COMPACT record out of a data tuple. */ -UNIV_INTERN -void -rec_convert_dtuple_to_rec_comp( -/*===========================*/ - rec_t* rec, /*!< in: origin of record */ - ulint extra, /*!< in: number of bytes to - reserve between the record - header and the data payload - (normally REC_N_NEW_EXTRA_BYTES) */ - const dict_index_t* index, /*!< in: record descriptor */ - ulint status, /*!< in: status bits of the record */ - const dfield_t* fields, /*!< in: array of data fields */ - ulint n_fields);/*!< in: number of data fields */ -/*********************************************************//** Builds a physical record out of a data tuple and stores it into the given buffer. @return pointer to the origin of physical record */ @@ -727,10 +734,7 @@ UNIV_INTERN ulint rec_get_converted_size_comp_prefix( /*===============================*/ - const dict_index_t* index, /*!< in: record descriptor; - dict_table_is_comp() is - assumed to hold, even if - it does not */ + const dict_index_t* index, /*!< in: record descriptor */ const dfield_t* fields, /*!< in: array of data fields */ ulint n_fields,/*!< in: number of data fields */ ulint* extra); /*!< out: extra size */ diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 5290ef5fe11..e2d061969f3 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -265,6 +265,10 @@ extern ulint srv_fatal_semaphore_wait_threshold; #define SRV_SEMAPHORE_WAIT_EXTENSION 7200 extern ulint srv_dml_needed_delay; +#ifdef UNIV_DEBUG +extern my_bool srv_purge_view_update_only_debug; +#endif /* UNIV_DEBUG */ + extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs, query threads, and lock table: we allocate it from dynamic memory to get it to the @@ -333,6 +337,9 @@ extern ulint srv_buf_pool_flushed; reading of a disk page */ extern ulint srv_buf_pool_reads; +/** print all user-level transactions deadlocks to mysqld stderr */ +extern my_bool srv_print_all_deadlocks; + /** Status variables to be passed to MySQL */ typedef struct export_var_struct export_struc; @@ -700,7 +707,9 @@ struct export_var_struct{ ulint innodb_data_reads; /*!< I/O read requests */ ulint innodb_buffer_pool_pages_total; /*!< Buffer pool size */ ulint innodb_buffer_pool_pages_data; /*!< Data pages */ + ulint innodb_buffer_pool_bytes_data; /*!< File bytes used */ ulint innodb_buffer_pool_pages_dirty; /*!< Dirty data pages */ + ulint innodb_buffer_pool_bytes_dirty; /*!< File bytes modified */ ulint innodb_buffer_pool_pages_misc; /*!< Miscellanous pages */ ulint innodb_buffer_pool_pages_free; /*!< Free pages */ #ifdef UNIV_DEBUG @@ -742,6 +751,11 @@ struct export_var_struct{ ulint innodb_rows_updated; /*!< srv_n_rows_updated */ ulint innodb_rows_deleted; /*!< srv_n_rows_deleted */ ulint innodb_truncated_status_writes; /*!< srv_truncated_status_writes */ +#ifdef UNIV_DEBUG + ulint innodb_purge_trx_id_age; /*!< max_trx_id - purged trx_id */ + ulint innodb_purge_view_trx_id_age; /*!< rw_max_trx_id + - purged view's min trx_id */ +#endif /* UNIV_DEBUG */ }; /** Thread slot in the thread table */ diff --git a/storage/innobase/include/trx0purge.h b/storage/innobase/include/trx0purge.h index 2bd9e64476b..1e8acd65e01 100644 --- a/storage/innobase/include/trx0purge.h +++ b/storage/innobase/include/trx0purge.h @@ -156,6 +156,10 @@ struct trx_purge_struct{ than this */ undo_no_t purge_undo_no; /*!< Purge has advanced past all records whose undo number is less than this */ +#ifdef UNIV_DEBUG + trx_id_t done_trx_no; /* Indicate 'purge pointer' which have + purged already accurately. */ +#endif /* UNIV_DEBUG */ /*-----------------------------*/ ibool next_stored; /*!< TRUE if the info of the next record to purge is stored below: if yes, then diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 0b0b4b8d04c..800f4359c8a 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -49,9 +49,10 @@ Created 1/20/1994 Heikki Tuuri #define _IB_TO_STR(s) #s #define IB_TO_STR(s) _IB_TO_STR(s) -#define INNODB_VERSION_MAJOR 1 -#define INNODB_VERSION_MINOR 1 -#define INNODB_VERSION_BUGFIX 8 +#include <mysql_version.h> + +#define INNODB_VERSION_MAJOR MYSQL_MAJOR_VERSION +#define INNODB_VERSION_MINOR MYSQL_MINOR_VERSION /* The following is the InnoDB version as shown in SELECT plugin_version FROM information_schema.plugins; @@ -62,10 +63,7 @@ component, i.e. we show M.N.P as M.N */ #define INNODB_VERSION_SHORT \ (INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR) -#define INNODB_VERSION_STR \ - IB_TO_STR(INNODB_VERSION_MAJOR) "." \ - IB_TO_STR(INNODB_VERSION_MINOR) "." \ - IB_TO_STR(INNODB_VERSION_BUGFIX) +#define INNODB_VERSION_STR MYSQL_SERVER_VERSION #define REFMAN "http://dev.mysql.com/doc/refman/" \ IB_TO_STR(MYSQL_MAJOR_VERSION) "." \ diff --git a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c index 66ec18aeee7..a72be540c1b 100644 --- a/storage/innobase/lock/lock0lock.c +++ b/storage/innobase/lock/lock0lock.c @@ -789,12 +789,16 @@ lock_reset_lock_and_trx_wait( /*=========================*/ lock_t* lock) /*!< in: record lock */ { - ut_ad((lock->trx)->wait_lock == lock); ut_ad(lock_get_wait(lock)); /* Reset the back pointer in trx to this waiting lock request */ - (lock->trx)->wait_lock = NULL; + if (!(lock->type_mode & LOCK_CONV_BY_OTHER)) { + ut_ad((lock->trx)->wait_lock == lock); + (lock->trx)->wait_lock = NULL; + } else { + ut_ad(lock_get_type_low(lock) == LOCK_REC); + } lock->type_mode &= ~LOCK_WAIT; } @@ -1430,9 +1434,9 @@ lock_rec_has_expl( while (lock) { if (lock->trx == trx + && !lock_is_wait_not_by_other(lock->type_mode) && lock_mode_stronger_or_eq(lock_get_mode(lock), precise_mode & LOCK_MODE_MASK) - && !lock_get_wait(lock) && (!lock_rec_get_rec_not_gap(lock) || (precise_mode & LOCK_REC_NOT_GAP) || heap_no == PAGE_HEAP_NO_SUPREMUM) @@ -1730,7 +1734,7 @@ lock_rec_create( HASH_INSERT(lock_t, hash, lock_sys->rec_hash, lock_rec_fold(space, page_no), lock); - if (UNIV_UNLIKELY(type_mode & LOCK_WAIT)) { + if (lock_is_wait_not_by_other(type_mode)) { lock_set_lock_and_trx_wait(lock, trx); } @@ -1761,10 +1765,11 @@ lock_rec_enqueue_waiting( const buf_block_t* block, /*!< in: buffer block containing the record */ ulint heap_no,/*!< in: heap number of the record */ + lock_t* lock, /*!< in: lock object; NULL if a new + one should be created. */ dict_index_t* index, /*!< in: index of record */ que_thr_t* thr) /*!< in: query thread */ { - lock_t* lock; trx_t* trx; ut_ad(mutex_own(&kernel_mutex)); @@ -1799,9 +1804,17 @@ lock_rec_enqueue_waiting( ut_ad(0); } - /* Enqueue the lock request that will wait to be granted */ - lock = lock_rec_create(type_mode | LOCK_WAIT, - block, heap_no, index, trx); + if (lock == NULL) { + /* Enqueue the lock request that will wait to be granted */ + lock = lock_rec_create(type_mode | LOCK_WAIT, + block, heap_no, index, trx); + } else { + ut_ad(lock->type_mode & LOCK_WAIT); + ut_ad(lock->type_mode & LOCK_CONV_BY_OTHER); + + lock->type_mode &= ~LOCK_CONV_BY_OTHER; + lock_set_lock_and_trx_wait(lock, trx); + } /* Check if a deadlock occurs: if yes, remove the lock request and return an error code */ @@ -2046,6 +2059,7 @@ lock_rec_lock_slow( que_thr_t* thr) /*!< in: query thread */ { trx_t* trx; + lock_t* lock; ut_ad(mutex_own(&kernel_mutex)); ut_ad((LOCK_MODE_MASK & mode) != LOCK_S @@ -2060,7 +2074,27 @@ lock_rec_lock_slow( trx = thr_get_trx(thr); - if (lock_rec_has_expl(mode, block, heap_no, trx)) { + lock = lock_rec_has_expl(mode, block, heap_no, trx); + if (lock) { + if (lock->type_mode & LOCK_CONV_BY_OTHER) { + /* This lock or lock waiting was created by the other + transaction, not by the transaction (trx) itself. + So, the transaction (trx) should treat it collectly + according as whether granted or not. */ + + if (lock->type_mode & LOCK_WAIT) { + /* This lock request was not granted yet. + Should wait for granted. */ + + goto enqueue_waiting; + } else { + /* This lock request was already granted. + Just clearing the flag. */ + + lock->type_mode &= ~LOCK_CONV_BY_OTHER; + } + } + /* The trx already has a strong enough lock on rec: do nothing */ @@ -2070,8 +2104,10 @@ lock_rec_lock_slow( the queue, as this transaction does not have a lock strong enough already granted on the record, we have to wait. */ + ut_ad(lock == NULL); +enqueue_waiting: return(lock_rec_enqueue_waiting(mode, block, heap_no, - index, thr)); + lock, index, thr)); } else if (!impl) { /* Set the requested lock on the record */ @@ -2213,7 +2249,8 @@ lock_grant( TRX_QUE_LOCK_WAIT state, and there is no need to end the lock wait for it */ - if (lock->trx->que_state == TRX_QUE_LOCK_WAIT) { + if (!(lock->type_mode & LOCK_CONV_BY_OTHER) + && lock->trx->que_state == TRX_QUE_LOCK_WAIT) { trx_end_lock_wait(lock->trx); } } @@ -2230,6 +2267,7 @@ lock_rec_cancel( { ut_ad(mutex_own(&kernel_mutex)); ut_ad(lock_get_type_low(lock) == LOCK_REC); + ut_ad(!(lock->type_mode & LOCK_CONV_BY_OTHER)); /* Reset the bit (there can be only one set bit) in the lock bitmap */ lock_rec_reset_nth_bit(lock, lock_rec_find_set_bit(lock)); @@ -2372,8 +2410,12 @@ lock_rec_reset_and_release_wait( lock = lock_rec_get_first(block, heap_no); while (lock != NULL) { - if (lock_get_wait(lock)) { + if (lock_is_wait_not_by_other(lock->type_mode)) { lock_rec_cancel(lock); + } else if (lock_get_wait(lock)) { + /* just reset LOCK_WAIT */ + lock_rec_reset_nth_bit(lock, heap_no); + lock_reset_lock_and_trx_wait(lock); } else { lock_rec_reset_nth_bit(lock, heap_no); } @@ -3261,6 +3303,80 @@ lock_rec_restore_from_page_infimum( /*=========== DEADLOCK CHECKING ======================================*/ +/*********************************************************************//** +rewind(3) the file used for storing the latest detected deadlock and +print a heading message to stderr if printing of all deadlocks to stderr +is enabled. */ +UNIV_INLINE +void +lock_deadlock_start_print() +/*=======================*/ +{ + rewind(lock_latest_err_file); + ut_print_timestamp(lock_latest_err_file); + + if (srv_print_all_deadlocks) { + fprintf(stderr, "InnoDB: transactions deadlock detected, " + "dumping detailed information.\n"); + ut_print_timestamp(stderr); + } +} + +/*********************************************************************//** +Print a message to the deadlock file and possibly to stderr. */ +UNIV_INLINE +void +lock_deadlock_fputs( +/*================*/ + const char* msg) /*!< in: message to print */ +{ + fputs(msg, lock_latest_err_file); + + if (srv_print_all_deadlocks) { + fputs(msg, stderr); + } +} + +/*********************************************************************//** +Print transaction data to the deadlock file and possibly to stderr. */ +UNIV_INLINE +void +lock_deadlock_trx_print( +/*====================*/ + trx_t* trx, /*!< in: transaction */ + ulint max_query_len) /*!< in: max query length to print, or 0 to + use the default max length */ +{ + trx_print(lock_latest_err_file, trx, max_query_len); + + if (srv_print_all_deadlocks) { + trx_print(stderr, trx, max_query_len); + } +} + +/*********************************************************************//** +Print lock data to the deadlock file and possibly to stderr. */ +UNIV_INLINE +void +lock_deadlock_lock_print( +/*=====================*/ + const lock_t* lock) /*!< in: record or table type lock */ +{ + if (lock_get_type_low(lock) == LOCK_REC) { + lock_rec_print(lock_latest_err_file, lock); + + if (srv_print_all_deadlocks) { + lock_rec_print(stderr, lock); + } + } else { + lock_table_print(lock_latest_err_file, lock); + + if (srv_print_all_deadlocks) { + lock_table_print(stderr, lock); + } + } +} + /********************************************************************//** Checks if a lock request results in a deadlock. @return TRUE if a deadlock was detected and we chose trx as a victim; @@ -3304,30 +3420,25 @@ retry: /* If the lock search exceeds the max step or the max depth, the current trx will be the victim. Print its information. */ - rewind(lock_latest_err_file); - ut_print_timestamp(lock_latest_err_file); + lock_deadlock_start_print(); - fputs("TOO DEEP OR LONG SEARCH IN THE LOCK TABLE" - " WAITS-FOR GRAPH, WE WILL ROLL BACK" - " FOLLOWING TRANSACTION \n", - lock_latest_err_file); + lock_deadlock_fputs( + "TOO DEEP OR LONG SEARCH IN THE LOCK TABLE" + " WAITS-FOR GRAPH, WE WILL ROLL BACK" + " FOLLOWING TRANSACTION \n\n" + "*** TRANSACTION:\n"); - fputs("\n*** TRANSACTION:\n", lock_latest_err_file); - trx_print(lock_latest_err_file, trx, 3000); + lock_deadlock_trx_print(trx, 3000); - fputs("*** WAITING FOR THIS LOCK TO BE GRANTED:\n", - lock_latest_err_file); + lock_deadlock_fputs( + "*** WAITING FOR THIS LOCK TO BE GRANTED:\n"); + + lock_deadlock_lock_print(lock); - if (lock_get_type(lock) == LOCK_REC) { - lock_rec_print(lock_latest_err_file, lock); - } else { - lock_table_print(lock_latest_err_file, lock); - } break; case LOCK_VICTIM_IS_START: - fputs("*** WE ROLL BACK TRANSACTION (2)\n", - lock_latest_err_file); + lock_deadlock_fputs("*** WE ROLL BACK TRANSACTION (2)\n"); break; default: @@ -3442,45 +3553,33 @@ lock_deadlock_recursive( point: a deadlock detected; or we have searched the waits-for graph too long */ - FILE* ef = lock_latest_err_file; + lock_deadlock_start_print(); - rewind(ef); - ut_print_timestamp(ef); + lock_deadlock_fputs("\n*** (1) TRANSACTION:\n"); - fputs("\n*** (1) TRANSACTION:\n", ef); + lock_deadlock_trx_print(wait_lock->trx, 3000); - trx_print(ef, wait_lock->trx, 3000); + lock_deadlock_fputs( + "*** (1) WAITING FOR THIS LOCK" + " TO BE GRANTED:\n"); - fputs("*** (1) WAITING FOR THIS LOCK" - " TO BE GRANTED:\n", ef); + lock_deadlock_lock_print(wait_lock); - if (lock_get_type_low(wait_lock) == LOCK_REC) { - lock_rec_print(ef, wait_lock); - } else { - lock_table_print(ef, wait_lock); - } + lock_deadlock_fputs("*** (2) TRANSACTION:\n"); - fputs("*** (2) TRANSACTION:\n", ef); + lock_deadlock_trx_print(lock->trx, 3000); - trx_print(ef, lock->trx, 3000); + lock_deadlock_fputs( + "*** (2) HOLDS THE LOCK(S):\n"); - fputs("*** (2) HOLDS THE LOCK(S):\n", ef); + lock_deadlock_lock_print(lock); - if (lock_get_type_low(lock) == LOCK_REC) { - lock_rec_print(ef, lock); - } else { - lock_table_print(ef, lock); - } + lock_deadlock_fputs( + "*** (2) WAITING FOR THIS LOCK" + " TO BE GRANTED:\n"); - fputs("*** (2) WAITING FOR THIS LOCK" - " TO BE GRANTED:\n", ef); + lock_deadlock_lock_print(start->wait_lock); - if (lock_get_type_low(start->wait_lock) - == LOCK_REC) { - lock_rec_print(ef, start->wait_lock); - } else { - lock_table_print(ef, start->wait_lock); - } #ifdef UNIV_DEBUG if (lock_print_waits) { fputs("Deadlock detected\n", @@ -3503,8 +3602,8 @@ lock_deadlock_recursive( as a victim to try to avoid deadlocking our recursion starting point transaction */ - fputs("*** WE ROLL BACK TRANSACTION (1)\n", - ef); + lock_deadlock_fputs( + "*** WE ROLL BACK TRANSACTION (1)\n"); wait_lock->trx->was_chosen_as_deadlock_victim = TRUE; @@ -3589,6 +3688,7 @@ lock_table_create( ut_ad(table && trx); ut_ad(mutex_own(&kernel_mutex)); + ut_ad(!(type_mode & LOCK_CONV_BY_OTHER)); if ((type_mode & LOCK_MODE_MASK) == LOCK_AUTO_INC) { ++table->n_waiting_or_granted_auto_inc_locks; @@ -4142,6 +4242,7 @@ lock_cancel_waiting_and_release( lock_t* lock) /*!< in: waiting lock request */ { ut_ad(mutex_own(&kernel_mutex)); + ut_ad(!(lock->type_mode & LOCK_CONV_BY_OTHER)); if (lock_get_type_low(lock) == LOCK_REC) { @@ -5183,7 +5284,7 @@ lock_rec_insert_check_and_lock( err = lock_rec_enqueue_waiting(LOCK_X | LOCK_GAP | LOCK_INSERT_INTENTION, block, next_rec_heap_no, - index, thr); + NULL, index, thr); } else { err = DB_SUCCESS; } @@ -5259,10 +5360,23 @@ lock_rec_convert_impl_to_expl( if (!lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP, block, heap_no, impl_trx)) { + ulint type_mode = (LOCK_REC | LOCK_X + | LOCK_REC_NOT_GAP); + + /* If the delete-marked record was locked already, + we should reserve lock waiting for impl_trx as + implicit lock. Because cannot lock at this moment.*/ + + if (rec_get_deleted_flag(rec, rec_offs_comp(offsets)) + && lock_rec_other_has_conflicting( + LOCK_X | LOCK_REC_NOT_GAP, block, + heap_no, impl_trx)) { + + type_mode |= (LOCK_WAIT | LOCK_CONV_BY_OTHER); + } lock_rec_add_to_queue( - LOCK_REC | LOCK_X | LOCK_REC_NOT_GAP, - block, heap_no, index, impl_trx); + type_mode, block, heap_no, index, impl_trx); } } } diff --git a/storage/innobase/log/log0recv.c b/storage/innobase/log/log0recv.c index 03ba4d12cd0..c4ad94a4906 100644 --- a/storage/innobase/log/log0recv.c +++ b/storage/innobase/log/log0recv.c @@ -965,8 +965,11 @@ recv_parse_or_apply_log_rec_body( not NULL, then the log record is applied to the page, and the log record should be complete then */ - mtr_t* mtr) /*!< in: mtr or NULL; should be non-NULL + mtr_t* mtr, /*!< in: mtr or NULL; should be non-NULL if and only if block is non-NULL */ + ulint space_id) + /*!< in: tablespace id obtained by + parsing initial log record */ { dict_index_t* index = NULL; page_t* page; @@ -1238,8 +1241,11 @@ recv_parse_or_apply_log_rec_body( ut_ad(!page || page_type != FIL_PAGE_TYPE_ALLOCATED); ptr = mlog_parse_string(ptr, end_ptr, page, page_zip); break; - case MLOG_FILE_CREATE: case MLOG_FILE_RENAME: + ptr = fil_op_log_parse_or_replay(ptr, end_ptr, type, + space_id, 0); + break; + case MLOG_FILE_CREATE: case MLOG_FILE_DELETE: case MLOG_FILE_CREATE2: ptr = fil_op_log_parse_or_replay(ptr, end_ptr, type, 0, 0); @@ -1611,7 +1617,8 @@ recv_recover_page_func( recv_parse_or_apply_log_rec_body(recv->type, buf, buf + recv->len, - block, &mtr); + block, &mtr, + recv_addr->space); end_lsn = recv->start_lsn + recv->len; mach_write_to_8(FIL_PAGE_LSN + page, end_lsn); @@ -2078,7 +2085,7 @@ recv_parse_log_rec( #endif /* UNIV_LOG_LSN_DEBUG */ new_ptr = recv_parse_or_apply_log_rec_body(*type, new_ptr, end_ptr, - NULL, NULL); + NULL, NULL, *space); if (UNIV_UNLIKELY(new_ptr == NULL)) { return(0); diff --git a/storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff b/storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff index c24594c5024..00cda7c4435 100644 --- a/storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff +++ b/storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff @@ -8,7 +8,7 @@ -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -1 --SELECT * FROM t1; +-SELECT a,b FROM t1; -a b -a 1 -a 2 diff --git a/storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff b/storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff index 62895fa928f..9e6cddf03f0 100644 --- a/storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff +++ b/storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/insert_delayed.result 2012-07-12 20:04:07.143544998 +0400 -+++ suite/storage_engine/insert_delayed.reject 2012-07-15 17:49:34.551810189 +0400 +--- suite/storage_engine/insert_delayed.result 2013-01-23 01:23:49.461254916 +0400 ++++ suite/storage_engine/insert_delayed.reject 2013-01-23 01:47:05.975698364 +0400 @@ -5,7 +5,16 @@ connect con0,localhost,root,,; SET lock_wait_timeout = 1; @@ -14,7 +14,7 @@ +# ------------------------------------------- INSERT DELAYED INTO t1 SET a=4, b='d'; +ERROR HY000: DELAYED option not supported for table 't1' - INSERT DELAYED INTO t1 SELECT 5, 'e'; + INSERT DELAYED INTO t1 (a,b) SELECT 5, 'e'; ERROR HY000: Lock wait timeout exceeded; try restarting transaction disconnect con0; @@ -20,6 +29,4 @@ diff --git a/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff b/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff index aab866fde83..7ddc57e0ead 100644 --- a/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff +++ b/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff @@ -1,12 +1,12 @@ ---- suite/storage_engine/parts/repair_table.result 2012-07-15 01:22:58.861853325 +0400 -+++ suite/storage_engine/parts/repair_table.reject 2012-07-15 20:07:11.268009209 +0400 +--- suite/storage_engine/parts/repair_table.result 2013-01-23 01:35:44.388267080 +0400 ++++ suite/storage_engine/parts/repair_table.reject 2013-01-23 01:44:40.337529283 +0400 @@ -9,27 +9,27 @@ INSERT INTO t2 (a,b) SELECT a, b FROM t1; ALTER TABLE t1 REPAIR PARTITION p0; Table Op Msg_type Msg_text -test.t1 repair status OK +test.t1 repair note The storage engine for the table doesn't support repair - INSERT INTO t1 VALUES (3,'c'); + INSERT INTO t1 (a,b) VALUES (3,'c'); ALTER TABLE t1 REPAIR PARTITION NO_WRITE_TO_BINLOG p0, p1; Table Op Msg_type Msg_text -test.t1 repair status OK @@ -21,7 +21,7 @@ Table Op Msg_type Msg_text -test.t1 repair status OK +test.t1 repair note The storage engine for the table doesn't support repair - INSERT INTO t1 VALUES (10,'j'); + INSERT INTO t1 (a,b) VALUES (10,'j'); ALTER TABLE t1 REPAIR PARTITION p1 QUICK USE_FRM; Table Op Msg_type Msg_text -test.t1 repair status OK @@ -112,7 +112,7 @@ -test.t1 check error Size of datafile is: 26 Should be: 39 -test.t1 check error Partition p0 returned error -test.t1 check error Corrupt --SELECT * FROM t1; +-SELECT a,b FROM t1; -a b -8 h -10 j @@ -136,7 +136,7 @@ -test.t1 check warning Found 3 key parts. Should be: 2 -test.t1 check error Partition p0 returned error -test.t1 check error Corrupt --SELECT * FROM t1; +-SELECT a,b FROM t1; -a b -8 h -10 j @@ -160,7 +160,7 @@ -test.t1 check error Size of datafile is: 39 Should be: 52 -test.t1 check error Partition p1 returned error -test.t1 check error Corrupt --SELECT * FROM t1; +-SELECT a,b FROM t1; -a b -8 h -10 j @@ -187,7 +187,7 @@ -test.t1 check warning Found 4 key parts. Should be: 3 -test.t1 check error Partition p1 returned error -test.t1 check error Corrupt --SELECT * FROM t1; +-SELECT a,b FROM t1; -a b -8 h -10 j diff --git a/storage/innobase/mysql-test/storage_engine/repair_table.rdiff b/storage/innobase/mysql-test/storage_engine/repair_table.rdiff index 9c51fea47ff..ae5b863eae1 100644 --- a/storage/innobase/mysql-test/storage_engine/repair_table.rdiff +++ b/storage/innobase/mysql-test/storage_engine/repair_table.rdiff @@ -57,7 +57,7 @@ -test.t1 check Error Incorrect file format 't1' -test.t1 check error Corrupt +test.t1 check status OK - SELECT * FROM t1; + SELECT a,b FROM t1; -ERROR HY000: Incorrect file format 't1' +a b +1 a @@ -107,7 +107,7 @@ -Table Op Msg_type Msg_text -test.t1 check error Size of datafile is: 39 Should be: 65 -test.t1 check error Corrupt --SELECT * FROM t1; +-SELECT a,b FROM t1; -ERROR HY000: Incorrect key file for table 't1'; try to repair it -# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144). -# If you got a difference in error message, just add it to rdiff file @@ -122,7 +122,7 @@ -test.t1 check warning Table is marked as crashed and last repair failed -test.t1 check error Size of datafile is: 39 Should be: 65 -test.t1 check error Corrupt --SELECT * FROM t1; +-SELECT a,b FROM t1; -ERROR HY000: Table './test/t1' is marked as crashed and last (automatic?) repair failed -# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144). -# If you got a difference in error message, just add it to rdiff file diff --git a/storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff b/storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff index 7fce0a108e9..53241fe331e 100644 --- a/storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff +++ b/storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff @@ -2,19 +2,19 @@ +++ suite/storage_engine/type_char_indexes.reject 2012-07-15 17:51:55.810034331 +0400 @@ -98,7 +98,7 @@ SET SESSION optimizer_switch = 'engine_condition_pushdown=on'; - EXPLAIN SELECT * FROM t1 WHERE c > 'a'; + EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE c > 'a'; id select_type table type possible_keys key key_len ref rows Extra -# # # range c_v c_v # # # Using index condition +# # # range c_v c_v # # # Using where - SELECT * FROM t1 WHERE c > 'a'; + SELECT c,c20,v16,v128 FROM t1 WHERE c > 'a'; c c20 v16 v128 b char3 varchar1a varchar1b @@ -135,7 +135,7 @@ r3a - EXPLAIN SELECT * FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16; + EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16; id select_type table type possible_keys key key_len ref rows Extra -# # # range # v16 # # # # +# # # ALL # NULL # # # # - SELECT * FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16; + SELECT c,c20,v16,v128 FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16; c c20 v16 v128 a char1 varchar1a varchar1b diff --git a/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff b/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff index 9a9566deafb..9061900182e 100644 --- a/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff +++ b/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/type_spatial_indexes.result 2012-07-12 04:52:40.840023344 +0400 -+++ suite/storage_engine/type_spatial_indexes.reject 2012-07-15 19:27:32.761911079 +0400 +--- suite/storage_engine/type_spatial_indexes.result 2013-01-23 01:25:45.367797786 +0400 ++++ suite/storage_engine/type_spatial_indexes.reject 2013-01-23 01:46:17.560307029 +0400 @@ -702,699 +702,15 @@ DROP DATABASE IF EXISTS gis_ogs; CREATE DATABASE gis_ogs; @@ -79,43 +79,43 @@ -Field Type Null Key Default Extra -fid int(11) YES NULL -g geometry NO NULL --INSERT INTO gis_point VALUES +-INSERT INTO gis_point (fid,g) VALUES -(101, PointFromText('POINT(10 10)')), -(102, PointFromText('POINT(20 10)')), -(103, PointFromText('POINT(20 20)')), -(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)')))); --INSERT INTO gis_line VALUES +-INSERT INTO gis_line (fid,g) VALUES -(105, LineFromText('LINESTRING(0 0,0 10,10 0)')), -(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), -(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10))))); --INSERT INTO gis_polygon VALUES +-INSERT INTO gis_polygon (fid,g) VALUES -(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), -(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), -(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))))); --INSERT INTO gis_multi_point VALUES +-INSERT INTO gis_multi_point (fid,g) VALUES -(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), -(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), -(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10))))); --INSERT INTO gis_multi_line VALUES +-INSERT INTO gis_multi_line (fid,g) VALUES -(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), -(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), -(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))))); --INSERT INTO gis_multi_polygon VALUES +-INSERT INTO gis_multi_polygon (fid,g) VALUES -(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), -(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), -(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))))); --INSERT INTO gis_geometrycollection VALUES +-INSERT INTO gis_geometrycollection (fid,g) VALUES -(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), -(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))), -(122, GeomFromText('GeometryCollection()')), -(123, GeomFromText('GeometryCollection EMPTY')); --INSERT into gis_geometry SELECT * FROM gis_point; --INSERT into gis_geometry SELECT * FROM gis_line; --INSERT into gis_geometry SELECT * FROM gis_polygon; --INSERT into gis_geometry SELECT * FROM gis_multi_point; --INSERT into gis_geometry SELECT * FROM gis_multi_line; --INSERT into gis_geometry SELECT * FROM gis_multi_polygon; --INSERT into gis_geometry SELECT * FROM gis_geometrycollection; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_point; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_line; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_polygon; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_point; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_line; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_polygon; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_geometrycollection; -SELECT fid, AsText(g) FROM gis_point; -fid AsText(g) -101 POINT(10 10) @@ -433,7 +433,7 @@ -DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; -USE gis_ogs; -# Lakes --INSERT INTO lakes VALUES ( +-INSERT INTO lakes (fid,name,shore) VALUES ( -101, 'BLUE LAKE', -PolyFromText( -'POLYGON( @@ -442,68 +442,68 @@ - )', -101)); -# Road Segments --INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2, +-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(102, 'Route 5', NULL, 2, -LineFromText( -'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101)); --INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4, +-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(103, 'Route 5', 'Main Street', 4, -LineFromText( -'LINESTRING( 44 31, 56 34, 70 38 )' ,101)); --INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2, +-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(104, 'Route 5', NULL, 2, -LineFromText( -'LINESTRING( 70 38, 72 48 )' ,101)); --INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4, +-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(105, 'Main Street', NULL, 4, -LineFromText( -'LINESTRING( 70 38, 84 42 )' ,101)); --INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL, +-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(106, 'Dirt Road by Green Forest', NULL, -1, -LineFromText( -'LINESTRING( 28 26, 28 0 )',101)); -# DividedRoutes --INSERT INTO divided_routes VALUES(119, 'Route 75', 4, +-INSERT INTO divided_routes (fid,name,num_lanes,centerlines) VALUES(119, 'Route 75', 4, -MLineFromText( -'MULTILINESTRING((10 48,10 21,10 0), - (16 0,16 23,16 48))', 101)); -# Forests --INSERT INTO forests VALUES(109, 'Green Forest', +-INSERT INTO forests (fid,name,boundary) VALUES(109, 'Green Forest', -MPolyFromText( -'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26), - (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))', -101)); -# Bridges --INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText( +-INSERT INTO bridges (fid,name,position) VALUES(110, 'Cam Bridge', PointFromText( -'POINT( 44 31 )', 101)); -# Streams --INSERT INTO streams VALUES(111, 'Cam Stream', +-INSERT INTO streams (fid,name,centerline) VALUES(111, 'Cam Stream', -LineFromText( -'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101)); --INSERT INTO streams VALUES(112, NULL, +-INSERT INTO streams (fid,name,centerline) VALUES(112, NULL, -LineFromText( -'LINESTRING( 76 0, 78 4, 73 9 )', 101)); -# Buildings --INSERT INTO buildings VALUES(113, '123 Main Street', +-INSERT INTO buildings (fid,name,position,footprint) VALUES(113, '123 Main Street', -PointFromText( -'POINT( 52 30 )', 101), -PolyFromText( -'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101)); --INSERT INTO buildings VALUES(114, '215 Main Street', +-INSERT INTO buildings (fid,name,position,footprint) VALUES(114, '215 Main Street', -PointFromText( -'POINT( 64 33 )', 101), -PolyFromText( -'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101)); -# Ponds --INSERT INTO ponds VALUES(120, NULL, 'Stock Pond', +-INSERT INTO ponds (fid,name,type,shores) VALUES(120, NULL, 'Stock Pond', -MPolyFromText( -'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ), - ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101)); -# Named Places --INSERT INTO named_places VALUES(117, 'Ashton', +-INSERT INTO named_places (fid,name,boundary) VALUES(117, 'Ashton', -PolyFromText( -'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101)); --INSERT INTO named_places VALUES(118, 'Goose Island', +-INSERT INTO named_places (fid,name,boundary) VALUES(118, 'Goose Island', -PolyFromText( -'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101)); -# Map Neatlines --INSERT INTO map_neatlines VALUES(115, +-INSERT INTO map_neatlines (fid,neatline) VALUES(115, -PolyFromText( -'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101)); -SELECT Dimension(shore) diff --git a/storage/innobase/mysql-test/storage_engine/vcol.rdiff b/storage/innobase/mysql-test/storage_engine/vcol.rdiff index 2226062834e..23b26a52228 100644 --- a/storage/innobase/mysql-test/storage_engine/vcol.rdiff +++ b/storage/innobase/mysql-test/storage_engine/vcol.rdiff @@ -12,7 +12,7 @@ -Warnings: -Warning 1906 The value specified for computed column 'b' in table 't1' ignored -Warning 1906 The value specified for computed column 'b' in table 't1' ignored --SELECT * FROM t1; +-SELECT a,b FROM t1; -a b -1 2 -2 3 @@ -29,7 +29,7 @@ -Warnings: -Warning 1906 The value specified for computed column 'b' in table 't1' ignored -Warning 1906 The value specified for computed column 'b' in table 't1' ignored --SELECT * FROM t1; +-SELECT a,b FROM t1; -a b -1 2 -2 3 @@ -46,7 +46,7 @@ -Warnings: -Warning 1906 The value specified for computed column 'b' in table 't1' ignored -Warning 1906 The value specified for computed column 'b' in table 't1' ignored --SELECT * FROM t1; +-SELECT a,b FROM t1; -a b -1 2 -2 3 @@ -63,7 +63,7 @@ -Warnings: -Warning 1906 The value specified for computed column 'b' in table 't1' ignored -Warning 1906 The value specified for computed column 'b' in table 't1' ignored --SELECT * FROM t1; +-SELECT a,b FROM t1; -a b -1 2 -2 3 diff --git a/storage/innobase/plugin_exports b/storage/innobase/plugin_exports index 03b8cf8c217..e059601c96e 100644 --- a/storage/innobase/plugin_exports +++ b/storage/innobase/plugin_exports @@ -6,6 +6,8 @@ thd_wait_service; my_snprintf_service; thd_alloc_service; + thd_kill_statement_service; + debug_sync_service; local: *; }; diff --git a/storage/innobase/rem/rem0rec.c b/storage/innobase/rem/rem0rec.c index 30fc28561fa..6bd40c54a0c 100644 --- a/storage/innobase/rem/rem0rec.c +++ b/storage/innobase/rem/rem0rec.c @@ -167,7 +167,6 @@ rec_get_n_extern_new( { const byte* nulls; const byte* lens; - dict_field_t* field; ulint null_mask; ulint n_extern; ulint i; @@ -188,10 +187,13 @@ rec_get_n_extern_new( /* read the lengths of fields 0..n */ do { - ulint len; + const dict_field_t* field + = dict_index_get_nth_field(index, i); + const dict_col_t* col + = dict_field_get_col(field); + ulint len; - field = dict_index_get_nth_field(index, i); - if (!(dict_field_get_col(field)->prtype & DATA_NOT_NULL)) { + if (!(col->prtype & DATA_NOT_NULL)) { /* nullable field => read the null flag */ if (UNIV_UNLIKELY(!(byte) null_mask)) { @@ -209,8 +211,6 @@ rec_get_n_extern_new( if (UNIV_UNLIKELY(!field->fixed_len)) { /* Variable-length field: read the length */ - const dict_col_t* col - = dict_field_get_col(field); len = *lens--; /* If the maximum length of the field is up to 255 bytes, the actual length is always @@ -239,16 +239,15 @@ rec_get_n_extern_new( Determine the offset to each field in a leaf-page record in ROW_FORMAT=COMPACT. This is a special case of rec_init_offsets() and rec_get_offsets_func(). */ -UNIV_INTERN +UNIV_INLINE __attribute__((nonnull)) void rec_init_offsets_comp_ordinary( /*===========================*/ const rec_t* rec, /*!< in: physical record in ROW_FORMAT=COMPACT */ - ulint extra, /*!< in: number of bytes to reserve - between the record header and - the data payload - (usually REC_N_NEW_EXTRA_BYTES) */ + ibool temp, /*!< in: whether to use the + format for temporary files in + index creation */ const dict_index_t* index, /*!< in: record descriptor */ ulint* offsets)/*!< in/out: array of offsets; in: n=rec_offs_n_fields(offsets) */ @@ -256,27 +255,38 @@ rec_init_offsets_comp_ordinary( ulint i = 0; ulint offs = 0; ulint any_ext = 0; - const byte* nulls = rec - (extra + 1); + const byte* nulls = temp + ? rec - 1 + : rec - (1 + REC_N_NEW_EXTRA_BYTES); const byte* lens = nulls - UT_BITS_IN_BYTES(index->n_nullable); - dict_field_t* field; ulint null_mask = 1; #ifdef UNIV_DEBUG - /* We cannot invoke rec_offs_make_valid() here, because it can hold - that extra != REC_N_NEW_EXTRA_BYTES. Similarly, rec_offs_validate() - will fail in that case, because it invokes rec_get_status(). */ + /* We cannot invoke rec_offs_make_valid() here if temp=TRUE. + Similarly, rec_offs_validate() will fail in that case, because + it invokes rec_get_status(). */ offsets[2] = (ulint) rec; offsets[3] = (ulint) index; #endif /* UNIV_DEBUG */ + ut_ad(temp || dict_table_is_comp(index->table)); + + if (temp && dict_table_is_comp(index->table)) { + /* No need to do adjust fixed_len=0. We only need to + adjust it for ROW_FORMAT=REDUNDANT. */ + temp = FALSE; + } + /* read the lengths of fields 0..n */ do { - ulint len; + const dict_field_t* field + = dict_index_get_nth_field(index, i); + const dict_col_t* col + = dict_field_get_col(field); + ulint len; - field = dict_index_get_nth_field(index, i); - if (!(dict_field_get_col(field)->prtype - & DATA_NOT_NULL)) { + if (!(col->prtype & DATA_NOT_NULL)) { /* nullable field => read the null flag */ if (UNIV_UNLIKELY(!(byte) null_mask)) { @@ -296,10 +306,9 @@ rec_init_offsets_comp_ordinary( null_mask <<= 1; } - if (UNIV_UNLIKELY(!field->fixed_len)) { + if (!field->fixed_len + || (temp && !dict_col_get_fixed_size(col, temp))) { /* Variable-length field: read the length */ - const dict_col_t* col - = dict_field_get_col(field); len = *lens--; /* If the maximum length of the field is up to 255 bytes, the actual length is always @@ -393,9 +402,8 @@ rec_init_offsets( = dict_index_get_n_unique_in_tree(index); break; case REC_STATUS_ORDINARY: - rec_init_offsets_comp_ordinary(rec, - REC_N_NEW_EXTRA_BYTES, - index, offsets); + rec_init_offsets_comp_ordinary( + rec, FALSE, index, offsets); return; } @@ -766,17 +774,19 @@ rec_get_nth_field_offs_old( /**********************************************************//** Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT. @return total size */ -UNIV_INTERN +UNIV_INLINE __attribute__((warn_unused_result, nonnull(1,2))) ulint -rec_get_converted_size_comp_prefix( -/*===============================*/ +rec_get_converted_size_comp_prefix_low( +/*===================================*/ const dict_index_t* index, /*!< in: record descriptor; dict_table_is_comp() is assumed to hold, even if it does not */ const dfield_t* fields, /*!< in: array of data fields */ ulint n_fields,/*!< in: number of data fields */ - ulint* extra) /*!< out: extra size */ + ulint* extra, /*!< out: extra size */ + ibool temp) /*!< in: whether this is a + temporary file record */ { ulint extra_size; ulint data_size; @@ -785,15 +795,25 @@ rec_get_converted_size_comp_prefix( ut_ad(fields); ut_ad(n_fields > 0); ut_ad(n_fields <= dict_index_get_n_fields(index)); + ut_ad(!temp || extra); - extra_size = REC_N_NEW_EXTRA_BYTES + extra_size = temp + ? UT_BITS_IN_BYTES(index->n_nullable) + : REC_N_NEW_EXTRA_BYTES + UT_BITS_IN_BYTES(index->n_nullable); data_size = 0; + if (temp && dict_table_is_comp(index->table)) { + /* No need to do adjust fixed_len=0. We only need to + adjust it for ROW_FORMAT=REDUNDANT. */ + temp = FALSE; + } + /* read the lengths of fields 0..n */ for (i = 0; i < n_fields; i++) { const dict_field_t* field; ulint len; + ulint fixed_len; const dict_col_t* col; field = dict_index_get_nth_field(index, i); @@ -809,8 +829,14 @@ rec_get_converted_size_comp_prefix( continue; } - ut_ad(len <= col->len || col->mtype == DATA_BLOB); + ut_ad(len <= col->len || col->mtype == DATA_BLOB + || (col->len == 0 && col->mtype == DATA_VARCHAR)); + fixed_len = field->fixed_len; + if (temp && fixed_len + && !dict_col_get_fixed_size(col, temp)) { + fixed_len = 0; + } /* If the maximum length of a variable-length field is up to 255 bytes, the actual length is always stored in one byte. If the maximum length is more than 255 @@ -818,11 +844,20 @@ rec_get_converted_size_comp_prefix( 0..127. The length will be encoded in two bytes when it is 128 or more, or when the field is stored externally. */ - if (field->fixed_len) { - ut_ad(len == field->fixed_len); + if (fixed_len) { +#ifdef UNIV_DEBUG + ulint mbminlen = DATA_MBMINLEN(col->mbminmaxlen); + ulint mbmaxlen = DATA_MBMAXLEN(col->mbminmaxlen); + + ut_ad(len <= fixed_len); + + ut_ad(!mbmaxlen || len >= mbminlen + * (fixed_len / mbmaxlen)); + /* dict_index_add_col() should guarantee this */ ut_ad(!field->prefix_len - || field->fixed_len == field->prefix_len); + || fixed_len == field->prefix_len); +#endif /* UNIV_DEBUG */ } else if (dfield_is_ext(&fields[i])) { ut_ad(col->len >= 256 || col->mtype == DATA_BLOB); extra_size += 2; @@ -839,7 +874,7 @@ rec_get_converted_size_comp_prefix( data_size += len; } - if (UNIV_LIKELY_NULL(extra)) { + if (extra) { *extra = extra_size; } @@ -847,6 +882,23 @@ rec_get_converted_size_comp_prefix( } /**********************************************************//** +Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT. +@return total size */ +UNIV_INTERN +ulint +rec_get_converted_size_comp_prefix( +/*===============================*/ + const dict_index_t* index, /*!< in: record descriptor */ + const dfield_t* fields, /*!< in: array of data fields */ + ulint n_fields,/*!< in: number of data fields */ + ulint* extra) /*!< out: extra size */ +{ + ut_ad(dict_table_is_comp(index->table)); + return(rec_get_converted_size_comp_prefix_low( + index, fields, n_fields, extra, FALSE)); +} + +/**********************************************************//** Determines the size of a data tuple in ROW_FORMAT=COMPACT. @return total size */ UNIV_INTERN @@ -890,8 +942,8 @@ rec_get_converted_size_comp( return(ULINT_UNDEFINED); } - return(size + rec_get_converted_size_comp_prefix(index, fields, - n_fields, extra)); + return(size + rec_get_converted_size_comp_prefix_low( + index, fields, n_fields, extra, FALSE)); } /***********************************************************//** @@ -1068,19 +1120,18 @@ rec_convert_dtuple_to_rec_old( /*********************************************************//** Builds a ROW_FORMAT=COMPACT record out of a data tuple. */ -UNIV_INTERN +UNIV_INLINE __attribute__((nonnull)) void rec_convert_dtuple_to_rec_comp( /*===========================*/ rec_t* rec, /*!< in: origin of record */ - ulint extra, /*!< in: number of bytes to - reserve between the record - header and the data payload - (normally REC_N_NEW_EXTRA_BYTES) */ const dict_index_t* index, /*!< in: record descriptor */ - ulint status, /*!< in: status bits of the record */ const dfield_t* fields, /*!< in: array of data fields */ - ulint n_fields)/*!< in: number of data fields */ + ulint n_fields,/*!< in: number of data fields */ + ulint status, /*!< in: status bits of the record */ + ibool temp) /*!< in: whether to use the + format for temporary files in + index creation */ { const dfield_t* field; const dtype_t* type; @@ -1092,31 +1143,44 @@ rec_convert_dtuple_to_rec_comp( ulint n_node_ptr_field; ulint fixed_len; ulint null_mask = 1; - ut_ad(extra == 0 || dict_table_is_comp(index->table)); - ut_ad(extra == 0 || extra == REC_N_NEW_EXTRA_BYTES); + ut_ad(temp || dict_table_is_comp(index->table)); ut_ad(n_fields > 0); - switch (UNIV_EXPECT(status, REC_STATUS_ORDINARY)) { - case REC_STATUS_ORDINARY: + if (temp) { + ut_ad(status == REC_STATUS_ORDINARY); ut_ad(n_fields <= dict_index_get_n_fields(index)); n_node_ptr_field = ULINT_UNDEFINED; - break; - case REC_STATUS_NODE_PTR: - ut_ad(n_fields == dict_index_get_n_unique_in_tree(index) + 1); - n_node_ptr_field = n_fields - 1; - break; - case REC_STATUS_INFIMUM: - case REC_STATUS_SUPREMUM: - ut_ad(n_fields == 1); - n_node_ptr_field = ULINT_UNDEFINED; - break; - default: - ut_error; - return; + nulls = rec - 1; + if (dict_table_is_comp(index->table)) { + /* No need to do adjust fixed_len=0. We only + need to adjust it for ROW_FORMAT=REDUNDANT. */ + temp = FALSE; + } + } else { + nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1); + + switch (UNIV_EXPECT(status, REC_STATUS_ORDINARY)) { + case REC_STATUS_ORDINARY: + ut_ad(n_fields <= dict_index_get_n_fields(index)); + n_node_ptr_field = ULINT_UNDEFINED; + break; + case REC_STATUS_NODE_PTR: + ut_ad(n_fields + == dict_index_get_n_unique_in_tree(index) + 1); + n_node_ptr_field = n_fields - 1; + break; + case REC_STATUS_INFIMUM: + case REC_STATUS_SUPREMUM: + ut_ad(n_fields == 1); + n_node_ptr_field = ULINT_UNDEFINED; + break; + default: + ut_error; + return; + } } end = rec; - nulls = rec - (extra + 1); lens = nulls - UT_BITS_IN_BYTES(index->n_nullable); /* clear the SQL-null flags */ memset(lens + 1, 0, nulls - lens); @@ -1162,6 +1226,10 @@ rec_convert_dtuple_to_rec_comp( ifield = dict_index_get_nth_field(index, i); fixed_len = ifield->fixed_len; + if (temp && fixed_len + && !dict_col_get_fixed_size(ifield->col, temp)) { + fixed_len = 0; + } /* If the maximum length of a variable-length field is up to 255 bytes, the actual length is always stored in one byte. If the maximum length is more than 255 @@ -1169,8 +1237,17 @@ rec_convert_dtuple_to_rec_comp( 0..127. The length will be encoded in two bytes when it is 128 or more, or when the field is stored externally. */ if (fixed_len) { - ut_ad(len == fixed_len); +#ifdef UNIV_DEBUG + ulint mbminlen = DATA_MBMINLEN( + ifield->col->mbminmaxlen); + ulint mbmaxlen = DATA_MBMAXLEN( + ifield->col->mbminmaxlen); + + ut_ad(len <= fixed_len); + ut_ad(!mbmaxlen || len >= mbminlen + * (fixed_len / mbmaxlen)); ut_ad(!dfield_is_ext(field)); +#endif /* UNIV_DEBUG */ } else if (dfield_is_ext(field)) { ut_ad(ifield->col->len >= 256 || ifield->col->mtype == DATA_BLOB); @@ -1222,8 +1299,7 @@ rec_convert_dtuple_to_rec_new( rec = buf + extra_size; rec_convert_dtuple_to_rec_comp( - rec, REC_N_NEW_EXTRA_BYTES, index, status, - dtuple->fields, dtuple->n_fields); + rec, index, dtuple->fields, dtuple->n_fields, status, FALSE); /* Set the info bits of the record */ rec_set_info_and_status_bits(rec, dtuple_get_info_bits(dtuple)); @@ -1285,6 +1361,54 @@ rec_convert_dtuple_to_rec( return(rec); } +#ifndef UNIV_HOTBACKUP +/**********************************************************//** +Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT. +@return total size */ +UNIV_INTERN +ulint +rec_get_converted_size_temp( +/*========================*/ + const dict_index_t* index, /*!< in: record descriptor */ + const dfield_t* fields, /*!< in: array of data fields */ + ulint n_fields,/*!< in: number of data fields */ + ulint* extra) /*!< out: extra size */ +{ + return(rec_get_converted_size_comp_prefix_low( + index, fields, n_fields, extra, TRUE)); +} + +/******************************************************//** +Determine the offset to each field in temporary file. +@see rec_convert_dtuple_to_temp() */ +UNIV_INTERN +void +rec_init_offsets_temp( +/*==================*/ + const rec_t* rec, /*!< in: temporary file record */ + const dict_index_t* index, /*!< in: record descriptor */ + ulint* offsets)/*!< in/out: array of offsets; + in: n=rec_offs_n_fields(offsets) */ +{ + rec_init_offsets_comp_ordinary(rec, TRUE, index, offsets); +} + +/*********************************************************//** +Builds a temporary file record out of a data tuple. +@see rec_init_offsets_temp() */ +UNIV_INTERN +void +rec_convert_dtuple_to_temp( +/*=======================*/ + rec_t* rec, /*!< out: record */ + const dict_index_t* index, /*!< in: record descriptor */ + const dfield_t* fields, /*!< in: array of data fields */ + ulint n_fields) /*!< in: number of fields */ +{ + rec_convert_dtuple_to_rec_comp(rec, index, fields, n_fields, + REC_STATUS_ORDINARY, TRUE); +} + /**************************************************************//** Copies the first n fields of a physical record to a data tuple. The fields are copied to the memory heap. */ @@ -1495,6 +1619,7 @@ rec_copy_prefix_to_buf( return(*buf + (rec - (lens + 1))); } +#endif /* UNIV_HOTBACKUP */ /***************************************************************//** Validates the consistency of an old-style physical record. diff --git a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c index 18486514267..21afa9eff0d 100644 --- a/storage/innobase/row/row0ins.c +++ b/storage/innobase/row/row0ins.c @@ -2254,7 +2254,10 @@ row_ins_index_entry( err = row_ins_index_entry_low(BTR_MODIFY_LEAF, index, entry, n_ext, thr); if (err != DB_FAIL) { - + if (index == dict_table_get_first_index(index->table) + && thr_get_trx(thr)->mysql_thd != 0) { + DEBUG_SYNC_C("row_ins_clust_index_entry_leaf_after"); + } return(err); } diff --git a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c index 7c9fb8812e6..d34ad467588 100644 --- a/storage/innobase/row/row0merge.c +++ b/storage/innobase/row/row0merge.c @@ -298,6 +298,7 @@ row_merge_buf_add( for (i = 0; i < n_fields; i++, field++, ifield++) { const dict_col_t* col; ulint col_no; + ulint fixed_len; const dfield_t* row_field; ulint len; @@ -346,9 +347,30 @@ row_merge_buf_add( ut_ad(len <= col->len || col->mtype == DATA_BLOB); - if (ifield->fixed_len) { - ut_ad(len == ifield->fixed_len); + fixed_len = ifield->fixed_len; + if (fixed_len && !dict_table_is_comp(index->table) + && DATA_MBMINLEN(col->mbminmaxlen) + != DATA_MBMAXLEN(col->mbminmaxlen)) { + /* CHAR in ROW_FORMAT=REDUNDANT is always + fixed-length, but in the temporary file it is + variable-length for variable-length character + sets. */ + fixed_len = 0; + } + + if (fixed_len) { +#ifdef UNIV_DEBUG + ulint mbminlen = DATA_MBMINLEN(col->mbminmaxlen); + ulint mbmaxlen = DATA_MBMAXLEN(col->mbminmaxlen); + + /* len should be between size calcualted base on + mbmaxlen and mbminlen */ + ut_ad(len <= fixed_len); + ut_ad(!mbmaxlen || len >= mbminlen + * (fixed_len / mbmaxlen)); + ut_ad(!dfield_is_ext(field)); +#endif /* UNIV_DEBUG */ } else if (dfield_is_ext(field)) { extra_size += 2; } else if (len < 128 @@ -369,12 +391,11 @@ row_merge_buf_add( ulint size; ulint extra; - size = rec_get_converted_size_comp(index, - REC_STATUS_ORDINARY, - entry, n_fields, &extra); + size = rec_get_converted_size_temp( + index, entry, n_fields, &extra); - ut_ad(data_size + extra_size + REC_N_NEW_EXTRA_BYTES == size); - ut_ad(extra_size + REC_N_NEW_EXTRA_BYTES == extra); + ut_ad(data_size + extra_size == size); + ut_ad(extra_size == extra); } #endif /* UNIV_DEBUG */ @@ -578,14 +599,9 @@ row_merge_buf_write( ulint extra_size; const dfield_t* entry = buf->tuples[i]; - size = rec_get_converted_size_comp(index, - REC_STATUS_ORDINARY, - entry, n_fields, - &extra_size); + size = rec_get_converted_size_temp( + index, entry, n_fields, &extra_size); ut_ad(size >= extra_size); - ut_ad(extra_size >= REC_N_NEW_EXTRA_BYTES); - extra_size -= REC_N_NEW_EXTRA_BYTES; - size -= REC_N_NEW_EXTRA_BYTES; /* Encode extra_size + 1 */ if (extra_size + 1 < 0x80) { @@ -598,9 +614,8 @@ row_merge_buf_write( ut_ad(b + size < block[1]); - rec_convert_dtuple_to_rec_comp(b + extra_size, 0, index, - REC_STATUS_ORDINARY, - entry, n_fields); + rec_convert_dtuple_to_temp(b + extra_size, index, + entry, n_fields); b += size; @@ -704,6 +719,8 @@ row_merge_read( ib_uint64_t ofs = ((ib_uint64_t) offset) * sizeof *buf; ibool success; + DBUG_EXECUTE_IF("row_merge_read_failure", return(FALSE);); + #ifdef UNIV_DEBUG if (row_merge_print_block_read) { fprintf(stderr, "row_merge_read fd=%d ofs=%lu\n", @@ -750,6 +767,8 @@ row_merge_write( (ulint) (ofs >> 32), buf_len); + DBUG_EXECUTE_IF("row_merge_write_failure", return(FALSE);); + #ifdef UNIV_DEBUG if (row_merge_print_block_write) { fprintf(stderr, "row_merge_write fd=%d ofs=%lu\n", @@ -862,7 +881,7 @@ err_exit: *mrec = *buf + extra_size; - rec_init_offsets_comp_ordinary(*mrec, 0, index, offsets); + rec_init_offsets_temp(*mrec, index, offsets); data_size = rec_offs_data_size(offsets); @@ -881,7 +900,7 @@ err_exit: *mrec = b + extra_size; - rec_init_offsets_comp_ordinary(*mrec, 0, index, offsets); + rec_init_offsets_temp(*mrec, index, offsets); data_size = rec_offs_data_size(offsets); ut_ad(extra_size + data_size < sizeof *buf); @@ -2214,7 +2233,7 @@ row_merge_drop_temp_indexes(void) /*********************************************************************//** Creates temperary merge files, and if UNIV_PFS_IO defined, register the file descriptor with Performance Schema. -@return File descriptor */ +@return file descriptor, or -1 on failure */ UNIV_INLINE int row_merge_file_create_low(void) @@ -2236,12 +2255,19 @@ row_merge_file_create_low(void) #ifdef UNIV_PFS_IO register_pfs_file_open_end(locker, fd); #endif + if (fd < 0) { + fprintf(stderr, + "InnoDB: Error: Cannot create temporary merge file\n"); + return(-1); + } return(fd); } + /*********************************************************************//** -Create a merge file. */ -static -void +Create a merge file. +@return file descriptor, or -1 on failure */ +static __attribute__((nonnull, warn_unused_result)) +int row_merge_file_create( /*==================*/ merge_file_t* merge_file) /*!< out: merge file structure */ @@ -2249,6 +2275,7 @@ row_merge_file_create( merge_file->fd = row_merge_file_create_low(); merge_file->offset = 0; merge_file->n_rec = 0; + return(merge_file->fd); } /*********************************************************************//** @@ -2494,6 +2521,28 @@ row_merge_rename_tables( goto err_exit; } + /* Generate the redo logs for file operations */ + fil_mtr_rename_log(old_table->space, old_name, + new_table->space, new_table->name, tmp_name); + + /* What if the redo logs are flushed to disk here? This is + tested with following crash point */ + DBUG_EXECUTE_IF("bug14669848_precommit", log_buffer_flush_to_disk(); + DBUG_SUICIDE();); + + /* File operations cannot be rolled back. So, before proceeding + with file operations, commit the dictionary changes.*/ + trx_commit_for_mysql(trx); + + /* If server crashes here, the dictionary in InnoDB and MySQL + will differ. The .ibd files and the .frm files must be swapped + manually by the administrator. No loss of data. */ + DBUG_EXECUTE_IF("bug14669848", DBUG_SUICIDE();); + + /* Ensure that the redo logs are flushed to disk. The config + innodb_flush_log_at_trx_commit must not affect this. */ + log_buffer_flush_to_disk(); + /* The following calls will also rename the .ibd data files if the tables are stored in a single-table tablespace */ @@ -2665,7 +2714,7 @@ row_merge_build_indexes( ulint block_size; ulint i; ulint error; - int tmpfd; + int tmpfd = -1; ut_ad(trx); ut_ad(old_table); @@ -2682,13 +2731,31 @@ row_merge_build_indexes( block_size = 3 * sizeof *block; block = os_mem_alloc_large(&block_size); + /* Initialize all the merge file descriptors, so that we + don't call row_merge_file_destroy() on uninitialized + merge file descriptor */ + + for (i = 0; i < n_indexes; i++) { + merge_files[i].fd = -1; + } + for (i = 0; i < n_indexes; i++) { - row_merge_file_create(&merge_files[i]); + if (row_merge_file_create(&merge_files[i]) < 0) + { + error = DB_OUT_OF_MEMORY; + goto func_exit; + } } tmpfd = row_merge_file_create_low(); + if (tmpfd < 0) + { + error = DB_OUT_OF_MEMORY; + goto func_exit; + } + /* Reset the MySQL row buffer that is used when reporting duplicate keys. */ innobase_rec_reset(table); diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index 7e1d18d41b6..73da6215f0d 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -4140,6 +4140,13 @@ end: trx->error_state = DB_SUCCESS; trx_general_rollback_for_mysql(trx, NULL); trx->error_state = DB_SUCCESS; + } else { + if (old_is_tmp && !new_is_tmp) { + /* After ALTER TABLE the table statistics + needs to be rebuilt. It will be rebuilt + when the table is loaded again. */ + table->stat_initialized = FALSE; + } } } diff --git a/storage/innobase/row/row0umod.c b/storage/innobase/row/row0umod.c index 9e5fb8686c6..3c933c87b27 100644 --- a/storage/innobase/row/row0umod.c +++ b/storage/innobase/row/row0umod.c @@ -519,6 +519,7 @@ row_undo_mod_upd_del_sec( ulint err = DB_SUCCESS; ut_ad(node->rec_type == TRX_UNDO_UPD_DEL_REC); + ut_ad(!node->undo_row); heap = mem_heap_create(1024); while (node->index != NULL) { @@ -580,6 +581,8 @@ row_undo_mod_del_mark_sec( dict_index_t* index; ulint err; + ut_ad(!node->undo_row); + heap = mem_heap_create(1024); while (node->index != NULL) { diff --git a/storage/innobase/row/row0undo.c b/storage/innobase/row/row0undo.c index a1c1d72f8c6..74fc1baf1d2 100644 --- a/storage/innobase/row/row0undo.c +++ b/storage/innobase/row/row0undo.c @@ -216,7 +216,7 @@ row_undo_search_clust_to_pcur( node->row = row_build(ROW_COPY_DATA, clust_index, rec, offsets, NULL, ext, node->heap); - if (node->update) { + if (node->rec_type == TRX_UNDO_UPD_EXIST_REC) { node->undo_row = dtuple_copy(node->row, node->heap); row_upd_replace(node->undo_row, &node->undo_ext, clust_index, node->update, node->heap); diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c index df89156baae..5872ff2c437 100644 --- a/storage/innobase/srv/srv0srv.c +++ b/storage/innobase/srv/srv0srv.c @@ -58,6 +58,8 @@ Created 10/8/1995 Heikki Tuuri *******************************************************/ /* Dummy comment */ +#include "m_string.h" /* for my_sys.h */ +#include "my_sys.h" /* DEBUG_SYNC_C */ #include "srv0srv.h" #include "ut0mem.h" @@ -83,6 +85,7 @@ Created 10/8/1995 Heikki Tuuri #include "ha_prototypes.h" #include "trx0i_s.h" #include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */ +#include "read0read.h" #include "mysql/plugin.h" #include "mysql/service_thd_wait.h" @@ -356,6 +359,9 @@ UNIV_INTERN lint srv_conc_n_threads = 0; InnoDB */ UNIV_INTERN ulint srv_conc_n_waiting_threads = 0; +/* print all user-level transactions deadlocks to mysqld stderr */ +UNIV_INTERN my_bool srv_print_all_deadlocks = FALSE; + typedef struct srv_conc_slot_struct srv_conc_slot_t; struct srv_conc_slot_struct{ os_event_t event; /*!< event to wait */ @@ -1568,6 +1574,10 @@ srv_suspend_mysql_thread( trx = thr_get_trx(thr); + if (trx->mysql_thd != 0) { + DEBUG_SYNC_C("srv_suspend_mysql_thread_enter"); + } + os_event_set(srv_lock_timeout_thread_event); mutex_enter(&kernel_mutex); @@ -2006,13 +2016,15 @@ void srv_export_innodb_status(void) /*==========================*/ { - buf_pool_stat_t stat; - ulint LRU_len; - ulint free_len; - ulint flush_list_len; + buf_pool_stat_t stat; + buf_pools_list_size_t buf_pools_list_size; + ulint LRU_len; + ulint free_len; + ulint flush_list_len; buf_get_total_stat(&stat); buf_get_total_list_len(&LRU_len, &free_len, &flush_list_len); + buf_get_total_list_size_in_bytes(&buf_pools_list_size); mutex_enter(&srv_innodb_monitor_mutex); @@ -2041,7 +2053,12 @@ srv_export_innodb_status(void) export_vars.innodb_buffer_pool_read_ahead_evicted = stat.n_ra_pages_evicted; export_vars.innodb_buffer_pool_pages_data = LRU_len; + export_vars.innodb_buffer_pool_bytes_data = + buf_pools_list_size.LRU_bytes + + buf_pools_list_size.unzip_LRU_bytes; export_vars.innodb_buffer_pool_pages_dirty = flush_list_len; + export_vars.innodb_buffer_pool_bytes_dirty = + buf_pools_list_size.flush_list_bytes; export_vars.innodb_buffer_pool_pages_free = free_len; #ifdef UNIV_DEBUG export_vars.innodb_buffer_pool_pages_latched @@ -2087,6 +2104,23 @@ srv_export_innodb_status(void) export_vars.innodb_rows_deleted = srv_n_rows_deleted; export_vars.innodb_truncated_status_writes = srv_truncated_status_writes; +#ifdef UNIV_DEBUG + if (trx_sys->max_trx_id < purge_sys->done_trx_no) { + export_vars.innodb_purge_trx_id_age = 0; + } else { + export_vars.innodb_purge_trx_id_age = + trx_sys->max_trx_id - purge_sys->done_trx_no; + } + + if (!purge_sys->view + || trx_sys->max_trx_id < purge_sys->view->up_limit_id) { + export_vars.innodb_purge_view_trx_id_age = 0; + } else { + export_vars.innodb_purge_view_trx_id_age = + trx_sys->max_trx_id - purge_sys->view->up_limit_id; + } +#endif /* UNIV_DEBUG */ + mutex_exit(&srv_innodb_monitor_mutex); } @@ -2773,6 +2807,26 @@ loop: for (i = 0; i < 10; i++) { ulint cur_time = ut_time_ms(); +#ifdef UNIV_DEBUG + if (btr_cur_limit_optimistic_insert_debug + && srv_n_purge_threads == 0) { + /* If btr_cur_limit_optimistic_insert_debug is enabled + and no purge_threads, purge opportunity is increased + by x100 (1purge/100msec), to speed up debug scripts + which should wait for purged. */ + next_itr_time -= 900; + + srv_main_thread_op_info = "master purging"; + + srv_master_do_purge(); + + if (srv_fast_shutdown && srv_shutdown_state > 0) { + + goto background_loop; + } + } +#endif /* UNIV_DEBUG */ + /* ALTER TABLE in MySQL requires on Unix that the table handler can drop tables lazily after there no longer are SELECT queries to them. */ diff --git a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c index 96f01ea81b5..719851218c3 100644 --- a/storage/innobase/trx/trx0purge.c +++ b/storage/innobase/trx/trx0purge.c @@ -61,6 +61,10 @@ UNIV_INTERN mysql_pfs_key_t trx_purge_latch_key; UNIV_INTERN mysql_pfs_key_t purge_sys_bh_mutex_key; #endif /* UNIV_PFS_MUTEX */ +#ifdef UNIV_DEBUG +UNIV_INTERN my_bool srv_purge_view_update_only_debug; +#endif /* UNIV_DEBUG */ + /*****************************************************************//** Checks if trx_id is >= purge_view: then it is guaranteed that its update undo log still exists in the system. @@ -236,6 +240,7 @@ trx_purge_sys_create( purge_sys->purge_trx_no = 0; purge_sys->purge_undo_no = 0; purge_sys->next_stored = FALSE; + ut_d(purge_sys->done_trx_no = 0); rw_lock_create(trx_purge_latch_key, &purge_sys->latch, SYNC_PURGE_LATCH); @@ -656,6 +661,12 @@ trx_purge_truncate_if_arr_empty(void) { static ulint count; +#ifdef UNIV_DEBUG + if (purge_sys->arr->n_used == 0) { + purge_sys->done_trx_no = purge_sys->purge_trx_no; + } +#endif /* UNIV_DEBUG */ + if (!(++count % TRX_SYS_N_RSEGS) && purge_sys->arr->n_used == 0) { trx_purge_truncate_history(); @@ -1173,6 +1184,12 @@ trx_purge( rw_lock_x_unlock(&(purge_sys->latch)); +#ifdef UNIV_DEBUG + if (srv_purge_view_update_only_debug) { + return(0); + } +#endif + purge_sys->state = TRX_PURGE_ON; purge_sys->handle_limit = purge_sys->n_pages_handled + limit; diff --git a/storage/innobase/trx/trx0rec.c b/storage/innobase/trx/trx0rec.c index 2f1389ae263..f80f58493aa 100644 --- a/storage/innobase/trx/trx0rec.c +++ b/storage/innobase/trx/trx0rec.c @@ -36,6 +36,7 @@ Created 3/26/1996 Heikki Tuuri #ifndef UNIV_HOTBACKUP #include "dict0dict.h" #include "ut0mem.h" +#include "read0read.h" #include "row0ext.h" #include "row0upd.h" #include "que0que.h" @@ -1634,6 +1635,25 @@ trx_undo_prev_version_build( if (row_upd_changes_field_size_or_external(index, offsets, update)) { ulint n_ext; + /* We should confirm the existence of disowned external data, + if the previous version record is delete marked. If the trx_id + of the previous record is seen by purge view, we should treat + it as missing history, because the disowned external data + might be purged already. + + The inherited external data (BLOBs) can be freed (purged) + after trx_id was committed, provided that no view was started + before trx_id. If the purge view can see the committed + delete-marked record by trx_id, no transactions need to access + the BLOB. */ + + if ((update->info_bits & REC_INFO_DELETED_FLAG) + && read_view_sees_trx_id(purge_sys->view, trx_id)) { + /* treat as a fresh insert, not to + cause assertion error at the caller. */ + return(DB_SUCCESS); + } + /* We have to set the appropriate extern storage bits in the old version of the record: the extern bits in rec for those fields that update does NOT update, as well as the bits for diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h index 36a6d36a45c..6240895ee97 100644 --- a/storage/maria/ha_maria.h +++ b/storage/maria/ha_maria.h @@ -35,7 +35,6 @@ C_MODE_START ICP_RESULT index_cond_func_maria(void *arg); C_MODE_END -extern ulong maria_sort_buffer_size; extern TYPELIB maria_recover_typelib; extern ulonglong maria_recover_options; diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index ab9080c40fb..192e2ed32a1 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -4025,8 +4025,8 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info, if (rep_quick && (param->testflag & T_FORCE_UNIQUENESS)) { - my_off_t skr= (share->state.state.data_file_length + - (sort_info.org_data_file_type == COMPRESSED_RECORD) ? + my_off_t skr= share->state.state.data_file_length + + ((sort_info.org_data_file_type == COMPRESSED_RECORD) ? MEMMAP_EXTRA_MARGIN : 0); #ifdef USE_RELOC if (sort_info.org_data_file_type == STATIC_RECORD && @@ -4545,8 +4545,8 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info, if (rep_quick && (param->testflag & T_FORCE_UNIQUENESS)) { - my_off_t skr= (share->state.state.data_file_length + - (sort_info.org_data_file_type == COMPRESSED_RECORD) ? + my_off_t skr= share->state.state.data_file_length + + ((sort_info.org_data_file_type == COMPRESSED_RECORD) ? MEMMAP_EXTRA_MARGIN : 0); #ifdef USE_RELOC if (sort_info.org_data_file_type == STATIC_RECORD && diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 2924903974f..c0221989891 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -77,7 +77,7 @@ static MYSQL_THDVAR_ULONG(repair_threads, PLUGIN_VAR_RQCMDARG, static MYSQL_THDVAR_ULONGLONG(sort_buffer_size, PLUGIN_VAR_RQCMDARG, "The buffer that is allocated when sorting the index when doing " "a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE", NULL, NULL, - 8192 * 1024, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), SIZE_T_MAX, 1); + 8192 * 1024, MIN_SORT_BUFFER + MALLOC_OVERHEAD, SIZE_T_MAX, 1); static MYSQL_SYSVAR_BOOL(use_mmap, opt_myisam_use_mmap, PLUGIN_VAR_NOCMDARG, "Use memory mapping for reading and writing MyISAM tables", NULL, NULL, FALSE); diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index 438057e22df..22225303bae 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -349,6 +349,12 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) } else if (pos->type == HA_KEYTYPE_BINARY) pos->charset= &my_charset_bin; + if (!(share->keyinfo[i].flag & HA_SPATIAL) && + pos->start > share->base.reclength) + { + my_errno= HA_ERR_CRASHED; + goto err; + } } if (share->keyinfo[i].flag & HA_SPATIAL) { diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c index 968cb9624a6..01fa10de7a3 100644 --- a/storage/myisam/mi_search.c +++ b/storage/myisam/mi_search.c @@ -949,9 +949,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, ("Found too long binary packed key: %u of %u at 0x%lx", length, keyinfo->maxlength, (long) *page_pos)); DBUG_DUMP("key", *page_pos, 16); - mi_print_error(keyinfo->share, HA_ERR_CRASHED); - my_errno=HA_ERR_CRASHED; - DBUG_RETURN(0); /* Wrong key */ + goto crashed; /* Wrong key */ } /* Key is packed against prev key, take prefix from prev key. */ from= key; @@ -994,6 +992,8 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, if (from == from_end) { from=page; from_end=page_end; } length+= (uint) ((*key++ = *from++)); } + if (length > keyseg->length) + goto crashed; } else length=keyseg->length; @@ -1033,15 +1033,18 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, if (from_end != page_end) { DBUG_PRINT("error",("Error when unpacking key")); - mi_print_error(keyinfo->share, HA_ERR_CRASHED); - my_errno=HA_ERR_CRASHED; - DBUG_RETURN(0); /* Error */ + goto crashed; /* Error */ } /* Copy data pointer and, if appropriate, key block pointer. */ memcpy((uchar*) key,(uchar*) from,(size_t) length); *page_pos= from+length; } DBUG_RETURN((uint) (key-start_key)+keyseg->length); + + crashed: + mi_print_error(keyinfo->share, HA_ERR_CRASHED); + my_errno= HA_ERR_CRASHED; + DBUG_RETURN(0); } diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index c8546ee56f5..7be84599d86 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -284,25 +284,25 @@ static struct my_option my_long_options[] = { "read_buffer_size", OPT_READ_BUFFER_SIZE, "", &check_param.read_buffer_length, &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG, - (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD, - INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0}, + READ_BUFFER_INIT, MALLOC_OVERHEAD, + INT_MAX32, MALLOC_OVERHEAD, 1L, 0}, { "write_buffer_size", OPT_WRITE_BUFFER_SIZE, "", &check_param.write_buffer_length, &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG, - (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD, - INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0}, + READ_BUFFER_INIT, MALLOC_OVERHEAD, + INT_MAX32, MALLOC_OVERHEAD, 1L, 0}, { "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "Deprecated. myisam_sort_buffer_size alias is being used", &check_param.sort_buffer_length, &check_param.sort_buffer_length, 0, GET_ULL, REQUIRED_ARG, - (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), - SIZE_T_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0}, + SORT_BUFFER_INIT, MIN_SORT_BUFFER + MALLOC_OVERHEAD, + SIZE_T_MAX, MALLOC_OVERHEAD, 1L, 0}, { "myisam_sort_buffer_size", OPT_SORT_BUFFER_SIZE, "Alias of sort_buffer_size parameter", &check_param.sort_buffer_length, &check_param.sort_buffer_length, 0, GET_ULL, REQUIRED_ARG, - (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), - SIZE_T_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0}, + SORT_BUFFER_INIT, MIN_SORT_BUFFER + MALLOC_OVERHEAD, + SIZE_T_MAX, MALLOC_OVERHEAD, 1L, 0}, { "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "", &check_param.sort_key_blocks, &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG, diff --git a/storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff b/storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff index 3caf2ad6c3a..07c03fc8d3e 100644 --- a/storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff +++ b/storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff @@ -7,15 +7,15 @@ -DROP TABLE t1; -CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -INSERT INTO t1 (a) VALUES (1),(2); --SELECT * FROM t1; +-SELECT a FROM t1; -a -1 -2 -ALTER TABLE t1 DISCARD TABLESPACE; --SELECT * FROM t1; +-SELECT a FROM t1; -ERROR HY000: Got error -1 from storage engine -ALTER TABLE t1 IMPORT TABLESPACE; --SELECT * FROM t1; +-SELECT a FROM t1; -a -1 -2 diff --git a/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff b/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff index 67157754c04..31da75e5ea5 100644 --- a/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff +++ b/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff @@ -44,12 +44,12 @@ +# Also, this problem may cause a chain effect (more errors of different kinds in the test). +# ------------------------------------------- DELETE FROM t2 WHERE a=2; - SELECT * FROM t1; + SELECT a,b FROM t1; a b 1 c -2 d +3 d - SELECT * FROM t2; + SELECT a,b FROM t2; a b -1 a +3 b @@ -90,7 +90,7 @@ +# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. +# Also, this problem may cause a chain effect (more errors of different kinds in the test). +# ------------------------------------------- - SELECT * FROM t2; + SELECT a,b FROM t2; a b -5 a -5 a @@ -117,7 +117,7 @@ +# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. +# Also, this problem may cause a chain effect (more errors of different kinds in the test). +# ------------------------------------------- - SELECT * FROM t2; + SELECT a,b FROM t2; a b +1 a +1 a diff --git a/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff b/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff index 8d1434ad2fe..b460b5b4763 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff @@ -1,9 +1,20 @@ -0a1,6 -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MyISAM does not support transactions. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file, or add the test to disabled.def. -> # If transactions should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- -13a20 -> 1 +--- suite/storage_engine/trx/cons_snapshot_repeatable_read.result 2013-01-22 22:05:05.246633000 +0400 ++++ suite/storage_engine/trx/cons_snapshot_repeatable_read.reject 2013-01-23 02:44:05.336711176 +0400 +@@ -1,3 +1,9 @@ ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MyISAM does not support transactions. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file, or add the test to disabled.def. ++# If transactions should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- + DROP TABLE IF EXISTS t1; + connect con1,localhost,root,,; + connect con2,localhost,root,,; +@@ -11,6 +17,7 @@ + # If consistent read works on this isolation level (REPEATABLE READ), the following SELECT should not return the value we inserted (1) + SELECT a FROM t1; + a ++1 + COMMIT; + connection default; + disconnect con1; diff --git a/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff b/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff index 8d1434ad2fe..d5f1a03084e 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff @@ -1,9 +1,20 @@ -0a1,6 -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MyISAM does not support transactions. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file, or add the test to disabled.def. -> # If transactions should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- -13a20 -> 1 +--- suite/storage_engine/trx/cons_snapshot_serializable.result 2013-01-22 22:05:05.246633000 +0400 ++++ suite/storage_engine/trx/cons_snapshot_serializable.reject 2013-01-23 02:44:05.928703734 +0400 +@@ -1,3 +1,9 @@ ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MyISAM does not support transactions. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file, or add the test to disabled.def. ++# If transactions should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- + DROP TABLE IF EXISTS t1; + connect con1,localhost,root,,; + connect con2,localhost,root,,; +@@ -11,6 +17,7 @@ + # If consistent read works on this isolation level (SERIALIZABLE), the following SELECT should not return the value we inserted (1) + SELECT a FROM t1; + a ++1 + COMMIT; + connection default; + disconnect con1; diff --git a/storage/myisam/mysql-test/storage_engine/trx/delete.rdiff b/storage/myisam/mysql-test/storage_engine/trx/delete.rdiff index 491b4636796..d7111ab28fc 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/delete.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/delete.rdiff @@ -22,7 +22,7 @@ ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back - SELECT * FROM t1; + SELECT a,b FROM t1; a b -10000 foobar -10000 foobar diff --git a/storage/myisam/mysql-test/storage_engine/trx/insert.rdiff b/storage/myisam/mysql-test/storage_engine/trx/insert.rdiff index 4619db1d095..cee69633860 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/insert.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/insert.rdiff @@ -22,7 +22,7 @@ ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back - SELECT * FROM t1; + SELECT a,b FROM t1; a b +0 test 1 a @@ -44,7 +44,7 @@ +Warning 1196 Some non-transactional changed tables couldn't be rolled back INSERT INTO t1 (b,a) VALUES ('test1',10); COMMIT; - SELECT * FROM t1; + SELECT a,b FROM t1; a b +0 test 1 a diff --git a/storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff b/storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff index c0cc9ff9351..94e3fc83e1e 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff @@ -1,44 +1,94 @@ -0a1,6 -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MyISAM does not support transactions. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file, or add the test to disabled.def. -> # If transactions should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- -18a25 -> 1 -25a33,34 -> 1 -> 2 -30a40,43 -> 1 -> 101 -> 102 -> 2 -34a48,49 -> 101 -> 102 -39a55,56 -> 101 -> 102 -44a62,63 -> 101 -> 102 -51a71,72 -> 101 -> 102 -54a76,77 -> 301 -> 302 -58a82,83 -> 101 -> 102 -61a87,88 -> 301 -> 302 -65a93,94 -> 101 -> 102 -68a98,99 -> 301 -> 302 +--- suite/storage_engine/trx/level_read_committed.result 2013-01-22 22:05:05.246633000 +0400 ++++ suite/storage_engine/trx/level_read_committed.reject 2013-01-23 02:44:06.572695636 +0400 +@@ -1,3 +1,9 @@ ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MyISAM does not support transactions. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file, or add the test to disabled.def. ++# If transactions should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- + DROP TABLE IF EXISTS t1; + connect con1,localhost,root,,; + SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +@@ -16,6 +22,7 @@ + connection con1; + SELECT a FROM t1; + a ++1 + connection con2; + INSERT INTO t1 (a) VALUES (2); + # WARNING: Statement ended with errno 0, errname ''. +@@ -23,25 +30,37 @@ + connection con1; + SELECT a FROM t1; + a ++1 ++2 + INSERT INTO t1 (a) SELECT a+100 FROM t1; + # WARNING: Statement ended with errno 0, errname ''. + # If it differs from the result file, it might indicate a problem. + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 + connection con2; + SELECT a FROM t1; + a + 1 ++101 ++102 + 2 + COMMIT; + SELECT a FROM t1; + a + 1 ++101 ++102 + 2 + connection con1; + SELECT a FROM t1; + a + 1 ++101 ++102 + 2 + INSERT INTO t1 (a) SELECT a+200 FROM t1; + # WARNING: Statement ended with errno 0, errname ''. +@@ -49,23 +68,35 @@ + SELECT a FROM t1; + a + 1 ++101 ++102 + 2 + 201 + 202 ++301 ++302 + COMMIT; + SELECT a FROM t1; + a + 1 ++101 ++102 + 2 + 201 + 202 ++301 ++302 + connection con2; + SELECT a FROM t1; + a + 1 ++101 ++102 + 2 + 201 + 202 ++301 ++302 + connection default; + disconnect con1; + disconnect con2; diff --git a/storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff b/storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff index 2a7ddd33c8c..91a2786cb68 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff @@ -1,7 +1,12 @@ -0a1,6 -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MyISAM does not support transactions. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file, or add the test to disabled.def. -> # If transactions should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- +--- suite/storage_engine/trx/level_read_uncommitted.result 2013-01-22 22:05:05.246633000 +0400 ++++ suite/storage_engine/trx/level_read_uncommitted.reject 2013-01-23 02:44:07.196687792 +0400 +@@ -1,3 +1,9 @@ ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MyISAM does not support transactions. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file, or add the test to disabled.def. ++# If transactions should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- + DROP TABLE IF EXISTS t1; + connect con1,localhost,root,,; + SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; diff --git a/storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff b/storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff index 8b8df802275..2c265900004 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff @@ -1,53 +1,96 @@ -0a1,6 -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MyISAM does not support transactions. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file, or add the test to disabled.def. -> # If transactions should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- -18a25 -> 1 -25a33,34 -> 1 -> 2 -27,28c36 -< ERROR HY000: Lock wait timeout exceeded; try restarting transaction -< # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'. ---- -> # WARNING: Statement ended with errno 0, errname ''. -31a40,43 -> 1 -> 101 -> 102 -> 2 -35a48,49 -> 101 -> 102 -40a55,56 -> 101 -> 102 -44a61,64 -> 1 -> 101 -> 102 -> 2 -49a70,73 -> 1 -> 101 -> 102 -> 2 -51a76,77 -> 301 -> 302 -55a82,83 -> 101 -> 102 -58a87,88 -> 301 -> 302 -62a93,94 -> 101 -> 102 -65a98,99 -> 301 -> 302 +--- suite/storage_engine/trx/level_repeatable_read.result 2013-01-22 22:05:05.246633000 +0400 ++++ suite/storage_engine/trx/level_repeatable_read.reject 2013-01-23 02:44:07.776680499 +0400 +@@ -1,3 +1,9 @@ ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MyISAM does not support transactions. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file, or add the test to disabled.def. ++# If transactions should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- + DROP TABLE IF EXISTS t1; + connect con1,localhost,root,,; + SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +@@ -16,6 +22,7 @@ + connection con1; + SELECT a FROM t1; + a ++1 + connection con2; + INSERT INTO t1 (a) VALUES (2); + # WARNING: Statement ended with errno 0, errname ''. +@@ -23,46 +30,73 @@ + connection con1; + SELECT a FROM t1; + a ++1 ++2 + INSERT INTO t1 (a) SELECT a+100 FROM t1; +-ERROR HY000: Lock wait timeout exceeded; try restarting transaction +-# WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'. ++# WARNING: Statement ended with errno 0, errname ''. + # If it differs from the result file, it might indicate a problem. + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 + connection con2; + SELECT a FROM t1; + a + 1 ++101 ++102 + 2 + COMMIT; + SELECT a FROM t1; + a + 1 ++101 ++102 + 2 + connection con1; + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 + INSERT INTO t1 (a) SELECT a+200 FROM t1; + # WARNING: Statement ended with errno 0, errname ''. + # If it differs from the result file, it might indicate a problem. + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 + 201 + 202 ++301 ++302 + COMMIT; + SELECT a FROM t1; + a + 1 ++101 ++102 + 2 + 201 + 202 ++301 ++302 + connection con2; + SELECT a FROM t1; + a + 1 ++101 ++102 + 2 + 201 + 202 ++301 ++302 + connection default; + disconnect con1; + disconnect con2; diff --git a/storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff b/storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff index bbcb8ac1838..7955036e000 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff @@ -1,69 +1,103 @@ -0a1,6 -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MyISAM does not support transactions. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file, or add the test to disabled.def. -> # If transactions should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- -14,15c20 -< ERROR HY000: Lock wait timeout exceeded; try restarting transaction -< # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'. ---- -> # WARNING: Statement ended with errno 0, errname ''. -19a25 -> 1 -22,23c28 -< ERROR HY000: Lock wait timeout exceeded; try restarting transaction -< # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'. ---- -> # WARNING: Statement ended with errno 0, errname ''. -27a33,34 -> 1 -> 2 -32a40,43 -> 1 -> 101 -> 102 -> 2 -35a47,50 -> 1 -> 101 -> 102 -> 2 -38a54,57 -> 1 -> 101 -> 102 -> 2 -41a61,64 -> 1 -> 101 -> 102 -> 2 -46a70,77 -> 1 -> 101 -> 102 -> 2 -> 201 -> 202 -> 301 -> 302 -49a81,88 -> 1 -> 101 -> 102 -> 2 -> 201 -> 202 -> 301 -> 302 -52a92,99 -> 1 -> 101 -> 102 -> 2 -> 201 -> 202 -> 301 -> 302 +--- suite/storage_engine/trx/level_serializable.result 2013-01-22 22:05:05.246633000 +0400 ++++ suite/storage_engine/trx/level_serializable.reject 2013-01-23 02:44:08.384672856 +0400 +@@ -1,3 +1,9 @@ ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MyISAM does not support transactions. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file, or add the test to disabled.def. ++# If transactions should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- + DROP TABLE IF EXISTS t1; + connect con1,localhost,root,,; + SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +@@ -11,45 +17,86 @@ + connection con2; + BEGIN; + INSERT INTO t1 (a) VALUES(1); +-ERROR HY000: Lock wait timeout exceeded; try restarting transaction +-# WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'. ++# WARNING: Statement ended with errno 0, errname ''. + # If it differs from the result file, it might indicate a problem. + connection con1; + SELECT a FROM t1; + a ++1 + connection con2; + INSERT INTO t1 (a) VALUES (2); +-ERROR HY000: Lock wait timeout exceeded; try restarting transaction +-# WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'. ++# WARNING: Statement ended with errno 0, errname ''. + # If it differs from the result file, it might indicate a problem. + connection con1; + SELECT a FROM t1; + a ++1 ++2 + INSERT INTO t1 (a) SELECT a+100 FROM t1; + # WARNING: Statement ended with errno 0, errname ''. + # If it differs from the result file, it might indicate a problem. + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 + connection con2; + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 + COMMIT; + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 + connection con1; + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 + INSERT INTO t1 (a) SELECT a+200 FROM t1; + # WARNING: Statement ended with errno 0, errname ''. + # If it differs from the result file, it might indicate a problem. + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 ++201 ++202 ++301 ++302 + COMMIT; + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 ++201 ++202 ++301 ++302 + connection con2; + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 ++201 ++202 ++301 ++302 + connection default; + disconnect con1; + disconnect con2; diff --git a/storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff b/storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff index 08e0802a28f..044ce56da43 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff @@ -13,7 +13,7 @@ @@ -14,16 +20,33 @@ 1 a 3 a - SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE; + SELECT a,b FROM t1 WHERE b='a' LOCK IN SHARE MODE; -ERROR HY000: Lock wait timeout exceeded; try restarting transaction +a b +1 a @@ -38,7 +38,7 @@ +# ------------------------------------------- connection con1; COMMIT; - SELECT * FROM t1; + SELECT a,b FROM t1; a b -1 a +1 c diff --git a/storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff b/storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff index 97941bbdb13..e1e8d3050e7 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff @@ -25,7 +25,7 @@ +# ------------------------------------------- connection con1; COMMIT; - SELECT * FROM t1; + SELECT a,b FROM t1; a b -1 a +1 c diff --git a/storage/myisam/mysql-test/storage_engine/trx/update.rdiff b/storage/myisam/mysql-test/storage_engine/trx/update.rdiff index 131286d613c..ca3b77e7cec 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/update.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/update.rdiff @@ -31,7 +31,7 @@ +Warning 1196 Some non-transactional changed tables couldn't be rolled back UPDATE t1 SET b = 'upd' WHERE a = 10050; COMMIT; - SELECT * FROM t1; + SELECT a,b FROM t1; a b 10050 upd 10050 upd diff --git a/storage/myisam/mysql-test/storage_engine/trx/xa.rdiff b/storage/myisam/mysql-test/storage_engine/trx/xa.rdiff index f445ad909f3..73c3796b13b 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/xa.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/xa.rdiff @@ -12,21 +12,21 @@ connect con2,localhost,root,,; @@ -9,17 +15,22 @@ connection con1; - SELECT * FROM t1; + SELECT a FROM t1; a +1 connection con2; INSERT INTO t1 (a) VALUES (2); XA END 'xa1'; connection con1; - SELECT * FROM t1; + SELECT a FROM t1; a +1 +2 connection con2; XA PREPARE 'xa1'; connection con1; - SELECT * FROM t1; + SELECT a FROM t1; a +1 +2 @@ -78,7 +78,7 @@ +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back connection con1; - SELECT * FROM t1; + SELECT a FROM t1; a @@ -93,4 +114,6 @@ 2 diff --git a/storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff b/storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff index f4629fb19a0..e637643d59d 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff @@ -20,7 +20,7 @@ +ERROR XAE04: XAER_NOTA: Unknown XID XA COMMIT 'xa2'; +ERROR XAE04: XAER_NOTA: Unknown XID - SELECT * FROM t1; + SELECT a FROM t1; a +1 +2 diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index 1883a3955cc..8cb74c5df44 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -331,6 +331,19 @@ extern "C" int myisammrg_parent_open_callback(void *callback_param, CPP_UNNAMED_NS_END +/* + Set external_ref for the child MyISAM tables. They need this to be set in + order to check for killed status. +*/ +static void myrg_set_external_ref(MYRG_INFO *m_info, void *ext_ref_arg) +{ + int i; + for (i= 0; i < (int)m_info->tables; i++) + { + m_info->open_tables[i].table->external_ref= ext_ref_arg; + } +} + /** Open a MERGE parent table, but not its children. @@ -394,6 +407,7 @@ int ha_myisammrg::open(const char *name, int mode __attribute__((unused)), } file->children_attached= TRUE; + myrg_set_external_ref(file, (void*)table); info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST); } diff --git a/storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff index 447a38a5b2b..b2ec2129d04 100644 --- a/storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff @@ -1,68 +1,151 @@ -11c11 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -19c19 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -27c27 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -35c35 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -43c43 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -51c51 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -59c59 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -67c67 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -75c75 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -82c82 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -91c91 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t2`) -100c100 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -107c107 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -122c122 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -130c130 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -138c138 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -146c146 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci INSERT_METHOD=LAST UNION=(`mrg`.`t1`) +--- alter_table.result 2013-01-22 22:05:05.246633000 +0400 ++++ alter_table.reject 2013-01-23 02:50:10.652118538 +0400 +@@ -8,7 +8,7 @@ + `a` int(11) DEFAULT NULL, + `c` char(8) DEFAULT NULL, + `b` int(11) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 ALTER COLUMN a SET DEFAULT '0'; + SHOW CREATE TABLE t1; + Table Create Table +@@ -16,7 +16,7 @@ + `a` int(11) DEFAULT '0', + `c` char(8) DEFAULT NULL, + `b` int(11) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 ALTER a DROP DEFAULT; + SHOW CREATE TABLE t1; + Table Create Table +@@ -24,7 +24,7 @@ + `a` int(11), + `c` char(8) DEFAULT NULL, + `b` int(11) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 CHANGE COLUMN b b1 <CHAR_COLUMN> FIRST; + SHOW CREATE TABLE t1; + Table Create Table +@@ -32,7 +32,7 @@ + `b1` char(8) DEFAULT NULL, + `a` int(11), + `c` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 CHANGE b1 b <INT_COLUMN> AFTER c; + SHOW CREATE TABLE t1; + Table Create Table +@@ -40,7 +40,7 @@ + `a` int(11), + `c` char(8) DEFAULT NULL, + `b` int(11) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 CHANGE b b <CHAR_COLUMN>; + SHOW CREATE TABLE t1; + Table Create Table +@@ -48,7 +48,7 @@ + `a` int(11), + `c` char(8) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 MODIFY COLUMN b <INT_COLUMN>; + SHOW CREATE TABLE t1; + Table Create Table +@@ -56,7 +56,7 @@ + `a` int(11), + `c` char(8) DEFAULT NULL, + `b` int(11) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 MODIFY COLUMN b <CHAR_COLUMN> FIRST; + SHOW CREATE TABLE t1; + Table Create Table +@@ -64,7 +64,7 @@ + `b` char(8) DEFAULT NULL, + `a` int(11), + `c` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 MODIFY COLUMN b <INT_COLUMN> AFTER a; + SHOW CREATE TABLE t1; + Table Create Table +@@ -72,14 +72,14 @@ + `a` int(11), + `b` int(11) DEFAULT NULL, + `c` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 DROP COLUMN b; + SHOW CREATE TABLE t1; + Table Create Table + t1 CREATE TABLE `t1` ( + `a` int(11), + `c` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 RENAME TO t2; + SHOW CREATE TABLE t1; + ERROR 42S02: Table 'test.t1' doesn't exist +@@ -88,7 +88,7 @@ + t2 CREATE TABLE `t2` ( + `a` int(11), + `c` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t2`) + DROP TABLE t2; + CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + INSERT INTO t1 (a,b) VALUES (1,5),(2,2),(4,3); +@@ -97,14 +97,14 @@ + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 ORDER BY b ASC, a DESC; + SHOW CREATE TABLE t1; + Table Create Table + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + SELECT a,b FROM t1; + a b + 2 2 +@@ -119,7 +119,7 @@ + `a` int(11) DEFAULT NULL, + `b` char(8) COLLATE latin1_general_cs DEFAULT NULL, + `c` char(8) COLLATE latin1_general_cs DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 CONVERT TO CHARACTER SET utf8; + SHOW CREATE TABLE t1; + Table Create Table +@@ -127,7 +127,7 @@ + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL, + `c` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 DEFAULT CHARACTER SET = latin1 COLLATE latin1_general_ci; + SHOW CREATE TABLE t1; + Table Create Table +@@ -135,7 +135,7 @@ + `a` int(11) DEFAULT NULL, + `b` char(8) CHARACTER SET utf8 DEFAULT NULL, + `c` char(8) CHARACTER SET utf8 DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 FORCE; + SHOW CREATE TABLE t1; + Table Create Table +@@ -143,5 +143,5 @@ + `a` int(11) DEFAULT NULL, + `b` char(8) CHARACTER SET utf8 DEFAULT NULL, + `c` char(8) CHARACTER SET utf8 DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff b/storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff index cfc821582ed..1091d6250b9 100644 --- a/storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff @@ -1,27 +1,32 @@ -4,18c4,13 -< DROP TABLE t1; -< CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< INSERT INTO t1 (a) VALUES (1),(2); -< SELECT * FROM t1; -< a -< 1 -< 2 -< ALTER TABLE t1 DISCARD TABLESPACE; -< SELECT * FROM t1; -< ERROR HY000: Got error -1 from storage engine -< ALTER TABLE t1 IMPORT TABLESPACE; -< SELECT * FROM t1; -< a -< 1 -< 2 ---- -> ERROR HY000: 'test.t1' is not BASE TABLE -> # ERROR: Statement ended with errno 1347, errname ER_WRONG_OBJECT (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ ALTER TABLE t1 DISCARD TABLESPACE ] -> # The statement|command finished with ER_WRONG_OBJECT. -> # Tablespace operations or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- +--- alter_tablespace.result 2013-01-22 22:05:05.246633000 +0400 ++++ alter_tablespace.reject 2013-01-23 02:50:11.288110543 +0400 +@@ -1,19 +1,14 @@ + DROP TABLE IF EXISTS t1, t2; + CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + ALTER TABLE t1 DISCARD TABLESPACE; +-DROP TABLE t1; +-CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-INSERT INTO t1 (a) VALUES (1),(2); +-SELECT a FROM t1; +-a +-1 +-2 +-ALTER TABLE t1 DISCARD TABLESPACE; +-SELECT a FROM t1; +-ERROR HY000: Got error -1 from storage engine +-ALTER TABLE t1 IMPORT TABLESPACE; +-SELECT a FROM t1; +-a +-1 +-2 ++ERROR HY000: 'test.t1' is not BASE TABLE ++# ERROR: Statement ended with errno 1347, errname ER_WRONG_OBJECT (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ ALTER TABLE t1 DISCARD TABLESPACE ] ++# The statement|command finished with ER_WRONG_OBJECT. ++# Tablespace operations or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff index 139bcc00a81..9854a986cc5 100644 --- a/storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff @@ -1,22 +1,34 @@ -8c8 -< test.t1 analyze status OK ---- -> test.t1 analyze note The storage engine for the table doesn't support analyze -12c12 -< test.t2 analyze status OK ---- -> test.t2 analyze note The storage engine for the table doesn't support analyze -17,18c17,18 -< test.t1 analyze status OK -< test.t2 analyze status OK ---- -> test.t1 analyze note The storage engine for the table doesn't support analyze -> test.t2 analyze note The storage engine for the table doesn't support analyze -24c24 -< test.t1 analyze status OK ---- -> test.t1 analyze note The storage engine for the table doesn't support analyze -28c28 -< test.t1 analyze status OK ---- -> test.t1 analyze note The storage engine for the table doesn't support analyze +--- analyze_table.result 2013-01-22 22:05:05.246633000 +0400 ++++ analyze_table.reject 2013-01-23 02:50:11.912102699 +0400 +@@ -5,25 +5,25 @@ + INSERT INTO t1 (a,b) VALUES (3,'c'); + ANALYZE TABLE t1; + Table Op Msg_type Msg_text +-test.t1 analyze status OK ++test.t1 analyze note The storage engine for the table doesn't support analyze + INSERT INTO t2 (a,b) VALUES (4,'d'); + ANALYZE NO_WRITE_TO_BINLOG TABLE t2; + Table Op Msg_type Msg_text +-test.t2 analyze status OK ++test.t2 analyze note The storage engine for the table doesn't support analyze + INSERT INTO t1 (a,b) VALUES (5,'e'); + INSERT INTO t2 (a,b) VALUES (6,'f'); + ANALYZE LOCAL TABLE t1, t2; + Table Op Msg_type Msg_text +-test.t1 analyze status OK +-test.t2 analyze status OK ++test.t1 analyze note The storage engine for the table doesn't support analyze ++test.t2 analyze note The storage engine for the table doesn't support analyze + DROP TABLE t1, t2; + CREATE TABLE t1 (a <INT_COLUMN>, <CUSTOM_INDEX>(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + INSERT INTO t1 (a) VALUES (1),(2),(4),(7); + ANALYZE TABLE t1; + Table Op Msg_type Msg_text +-test.t1 analyze status OK ++test.t1 analyze note The storage engine for the table doesn't support analyze + INSERT INTO t1 (a) VALUES (8),(10),(11),(12); + ANALYZE TABLE t1; + Table Op Msg_type Msg_text +-test.t1 analyze status OK ++test.t1 analyze note The storage engine for the table doesn't support analyze + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff b/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff index e9095aa3944..68264bdeb8d 100644 --- a/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff @@ -1,34 +1,64 @@ -9c9 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -55c55 -< t1 <STORAGE_ENGINE> # # # # # # # # 6 # # # # # # # ---- -> t1 <STORAGE_ENGINE> # # # # # # # # 0 # # # # # # # -62c62 -< t1 # # # # # # # # # 8 # # # # # # # ---- -> t1 # # # # # # # # # 0 # # # # # # # -81c81 -< t1 # # # # # # # # # 10 # # # # # # # ---- -> t1 # # # # # # # # # 0 # # # # # # # -85c85 -< t1 # # # # # # # # # 21 # # # # # # # ---- -> t1 # # # # # # # # # 0 # # # # # # # -106c106 -< t1 # # # # # # # # # 22 # # # # # # # ---- -> t1 # # # # # # # # # 0 # # # # # # # -128,129c128,129 -< 100 a -< 101 b ---- -> 1 a -> 2 b -132c132 -< 100 ---- -> 1 +--- autoincrement.result 2013-01-22 22:05:05.246633000 +0400 ++++ autoincrement.reject 2013-01-23 02:50:12.848090932 +0400 +@@ -6,7 +6,7 @@ + `a` int(11) NOT NULL AUTO_INCREMENT, + `b` char(8) DEFAULT NULL, + KEY `a` (`a`) +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + INSERT INTO t1 (b) VALUES ('a'),('b'); + SELECT a,b FROM t1 ORDER BY a; + a b +@@ -52,14 +52,14 @@ + SET sql_mode = '<INITIAL_SQL_MODE>'; + SHOW TABLE STATUS FROM test LIKE 't1'; + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +-t1 <STORAGE_ENGINE> # # # # # # # # 6 # # # # # # # ++t1 <STORAGE_ENGINE> # # # # # # # # 0 # # # # # # # + INSERT INTO t1 (a,b) VALUES (6,'g'),(7,'h'); + SELECT LAST_INSERT_ID(); + LAST_INSERT_ID() + 5 + SHOW TABLE STATUS FROM test LIKE 't1'; + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +-t1 # # # # # # # # # 8 # # # # # # # ++t1 # # # # # # # # # 0 # # # # # # # + INSERT INTO t1 (a,b) VALUES (NULL,'i'),(9,'j'); + SELECT a,b FROM t1 ORDER BY a; + a b +@@ -78,11 +78,11 @@ + 8 + SHOW TABLE STATUS FROM test LIKE 't1'; + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +-t1 # # # # # # # # # 10 # # # # # # # ++t1 # # # # # # # # # 0 # # # # # # # + INSERT INTO t1 (a,b) VALUES (20,'k'); + SHOW TABLE STATUS FROM test LIKE 't1'; + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +-t1 # # # # # # # # # 21 # # # # # # # ++t1 # # # # # # # # # 0 # # # # # # # + INSERT INTO t1 (a,b) VALUES (NULL,'l'); + SELECT a,b FROM t1 ORDER BY a; + a b +@@ -103,7 +103,7 @@ + 21 + SHOW TABLE STATUS FROM test LIKE 't1'; + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +-t1 # # # # # # # # # 22 # # # # # # # ++t1 # # # # # # # # # 0 # # # # # # # + INSERT INTO t1 (a,b) VALUES (-5,'m'); + SELECT a,b FROM t1 ORDER BY a; + a b +@@ -125,9 +125,9 @@ + INSERT INTO t1 (a,b) VALUES (NULL,'a'),(NULL,'b'); + SELECT a,b FROM t1; + a b +-100 a +-101 b ++1 a ++2 b + SELECT LAST_INSERT_ID(); + LAST_INSERT_ID() +-100 ++1 + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff b/storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff index e10b22a8e66..612c8d38311 100644 --- a/storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff @@ -1,46 +1,71 @@ -15,16c15,16 -< test.t1 assign_to_keycache status OK -< test.t2 assign_to_keycache status OK ---- -> test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache -> test.t2 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache -19,20c19,20 -< test.t1 preload_keys status OK -< test.t2 preload_keys status OK ---- -> test.t1 preload_keys note The storage engine for the table doesn't support preload_keys -> test.t2 preload_keys note The storage engine for the table doesn't support preload_keys -25,26c25,26 -< test.t1 preload_keys status OK -< test.t2 preload_keys status OK ---- -> test.t1 preload_keys note The storage engine for the table doesn't support preload_keys -> test.t2 preload_keys note The storage engine for the table doesn't support preload_keys -31c31 -< test.t1 preload_keys status OK ---- -> test.t1 preload_keys note The storage engine for the table doesn't support preload_keys -35c35 -< test.t1 assign_to_keycache status OK ---- -> test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache -39c39 -< test.t1 preload_keys status OK ---- -> test.t1 preload_keys note The storage engine for the table doesn't support preload_keys -50c50 -< test.t1 assign_to_keycache status OK ---- -> test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache -54c54 -< test.t1 preload_keys status OK ---- -> test.t1 preload_keys note The storage engine for the table doesn't support preload_keys -62c62 -< test.t1 assign_to_keycache status OK ---- -> test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache -66c66 -< test.t1 preload_keys status OK ---- -> test.t1 preload_keys note The storage engine for the table doesn't support preload_keys +--- cache_index.result 2013-01-22 22:05:05.246633000 +0400 ++++ cache_index.reject 2013-01-23 02:50:13.468083137 +0400 +@@ -12,31 +12,31 @@ + SET GLOBAL <CACHE_NAME>.key_buffer_size=128*1024; + CACHE INDEX t1 INDEX (a), t2 IN <CACHE_NAME>; + Table Op Msg_type Msg_text +-test.t1 assign_to_keycache status OK +-test.t2 assign_to_keycache status OK ++test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache ++test.t2 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache + LOAD INDEX INTO CACHE t1, t2; + Table Op Msg_type Msg_text +-test.t1 preload_keys status OK +-test.t2 preload_keys status OK ++test.t1 preload_keys note The storage engine for the table doesn't support preload_keys ++test.t2 preload_keys note The storage engine for the table doesn't support preload_keys + INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d'); + SET GLOBAL <CACHE_NAME>.key_buffer_size=8*1024; + LOAD INDEX INTO CACHE t1, t2 IGNORE LEAVES; + Table Op Msg_type Msg_text +-test.t1 preload_keys status OK +-test.t2 preload_keys status OK ++test.t1 preload_keys note The storage engine for the table doesn't support preload_keys ++test.t2 preload_keys note The storage engine for the table doesn't support preload_keys + SET GLOBAL <CACHE_NAME>.key_cache_age_threshold = 100, <CACHE_NAME>.key_cache_block_size = 512, <CACHE_NAME>.key_cache_division_limit = 1, <CACHE_NAME>.key_cache_segments=2; + INSERT INTO t1 (a,b) VALUES (5,'e'),(6,'f'); + LOAD INDEX INTO CACHE t1; + Table Op Msg_type Msg_text +-test.t1 preload_keys status OK ++test.t1 preload_keys note The storage engine for the table doesn't support preload_keys + SET GLOBAL new_<CACHE_NAME>.key_buffer_size=128*1024; + CACHE INDEX t1 IN new_<CACHE_NAME>; + Table Op Msg_type Msg_text +-test.t1 assign_to_keycache status OK ++test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache + INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h'); + LOAD INDEX INTO CACHE t1 IGNORE LEAVES; + Table Op Msg_type Msg_text +-test.t1 preload_keys status OK ++test.t1 preload_keys note The storage engine for the table doesn't support preload_keys + INSERT INTO t1 (a,b) VALUES (9,'i'); + DROP TABLE t2; + DROP TABLE t1; +@@ -47,11 +47,11 @@ + ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + CACHE INDEX t1 IN <CACHE_NAME>; + Table Op Msg_type Msg_text +-test.t1 assign_to_keycache status OK ++test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache + INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); + LOAD INDEX INTO CACHE t1; + Table Op Msg_type Msg_text +-test.t1 preload_keys status OK ++test.t1 preload_keys note The storage engine for the table doesn't support preload_keys + DROP TABLE t1; + CREATE TABLE t1 (a <INT_COLUMN>, + b <CHAR_COLUMN>, +@@ -59,11 +59,11 @@ + ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + CACHE INDEX t1 IN <CACHE_NAME>; + Table Op Msg_type Msg_text +-test.t1 assign_to_keycache status OK ++test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache + INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); + LOAD INDEX INTO CACHE t1; + Table Op Msg_type Msg_text +-test.t1 preload_keys status OK ++test.t1 preload_keys note The storage engine for the table doesn't support preload_keys + DROP TABLE t1; + SET GLOBAL <CACHE_NAME>.key_buffer_size=0; + SET GLOBAL new_<CACHE_NAME>.key_buffer_size=0; diff --git a/storage/myisammrg/mysql-test/storage_engine/char_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/char_indexes.rdiff deleted file mode 100644 index e69de29bb2d..00000000000 --- a/storage/myisammrg/mysql-test/storage_engine/char_indexes.rdiff +++ /dev/null diff --git a/storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff b/storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff index 1710cc18fea..f09aec971a9 100644 --- a/storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff @@ -1,6 +1,13 @@ -14,15c14,15 -< test.t1 4272806499 -< test.t2 0 ---- -> test.t1 NULL -> test.t2 NULL +--- checksum_table_live.result 2013-01-22 22:05:05.246633000 +0400 ++++ checksum_table_live.reject 2013-01-23 02:50:14.440070917 +0400 +@@ -11,8 +11,8 @@ + test.t1 4272806499 + CHECKSUM TABLE t1, t2 QUICK; + Table Checksum +-test.t1 4272806499 +-test.t2 0 ++test.t1 NULL ++test.t2 NULL + CHECKSUM TABLE t1, t2 EXTENDED; + Table Checksum + test.t1 4272806499 diff --git a/storage/myisammrg/mysql-test/storage_engine/create_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/create_table.rdiff index 5d3578ad3cd..585e5c915ba 100644 --- a/storage/myisammrg/mysql-test/storage_engine/create_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/create_table.rdiff @@ -1,37 +1,57 @@ -7c7 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -16c16 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -22c22 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -27,36c27,35 -< SHOW CREATE TABLE t1; -< Table Create Table -< t1 CREATE TABLE `t1` ( -< `1` bigint(20) NOT NULL DEFAULT '0' -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 -< SELECT * FROM t1; -< 1 -< 1 -< 2 -< DROP TABLE t1; ---- -> ERROR HY000: 'test.t1' is not BASE TABLE -> # ERROR: Statement ended with errno 1347, errname ER_WRONG_OBJECT (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # The statement|command finished with ER_WRONG_OBJECT. -> # CREATE TABLE .. AS SELECT or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -43c42 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) +--- create_table.result 2013-01-22 22:05:05.246633000 +0400 ++++ create_table.reject 2013-01-23 02:50:19.544006752 +0400 +@@ -4,7 +4,7 @@ + Table Create Table + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + CREATE TABLE IF NOT EXISTS t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + Warnings: + Note 1050 Table 't1' already exists +@@ -13,33 +13,32 @@ + Table Create Table + t2 CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + CREATE TEMPORARY TABLE t2 LIKE t1; + SHOW CREATE TABLE t2; + Table Create Table + t2 CREATE TEMPORARY TABLE `t2` ( + `a` int(11) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + DROP TEMPORARY TABLE t2; + DROP TABLE t2; + DROP TABLE IF EXISTS t1; + CREATE TABLE t1 ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> AS SELECT 1 UNION SELECT 2; +-SHOW CREATE TABLE t1; +-Table Create Table +-t1 CREATE TABLE `t1` ( +- `1` bigint(20) NOT NULL DEFAULT '0' +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 +-SELECT * FROM t1; +-1 +-1 +-2 +-DROP TABLE t1; ++ERROR HY000: 'test.t1' is not BASE TABLE ++# ERROR: Statement ended with errno 1347, errname ER_WRONG_OBJECT (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# The statement|command finished with ER_WRONG_OBJECT. ++# CREATE TABLE .. AS SELECT or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + SET storage_engine = <STORAGE_ENGINE>; + CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + SHOW CREATE TABLE t1; + Table Create Table + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + FLUSH LOGS; + DROP TABLE IF EXISTS t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff b/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff index 7362bd282a5..f716b7f2fe8 100644 --- a/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff @@ -1,138 +1,147 @@ -15,17c15,16 -< KEY `a` (`a`), -< CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> KEY `a` (`a`) -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t2`) -19c18,25 -< ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) ---- -> # ERROR: Statement succeeded (expected results: ER_NO_REFERENCED_ROW_2) -> # ------------ UNEXPECTED RESULT ------------ -> # The statement|command succeeded unexpectedly. -> # Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -23c29,36 -< ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) ---- -> # ERROR: Statement succeeded (expected results: ER_NO_REFERENCED_ROW_2) -> # ------------ UNEXPECTED RESULT ------------ -> # The statement|command succeeded unexpectedly. -> # Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -25c38 -< ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) ---- -> # ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED_2) -27c40,47 -< ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) ---- -> # ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED_2) -> # ------------ UNEXPECTED RESULT ------------ -> # The statement|command succeeded unexpectedly. -> # Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -32c52 -< 2 d ---- -> 3 d -35c55,56 -< 1 a ---- -> 3 b -> 3 b -37c58,65 -< ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails ---- -> # ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED) -> # ------------ UNEXPECTED RESULT ------------ -> # The statement|command succeeded unexpectedly. -> # Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -49,51c77,78 -< KEY `a` (`a`), -< CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> KEY `a` (`a`) -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t2`) -53c80 -< ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE) ---- -> # ERROR: Statement succeeded (expected results: ER_NO_REFERENCED_ROW_2) -54a82 -> ERROR 42S02: Table 'test.t1' doesn't exist -56a85,92 -> ERROR 42S02: Table 'test.t1' doesn't exist -> # ------------ UNEXPECTED RESULT ------------ -> # The statement|command finished with ER_NO_SUCH_TABLE. -> # UPDATE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -59,64c95,104 -< 5 a -< 5 a -< 5 b -< 5 c -< 5 d -< 5 e ---- -> 1 a -> 1 a -> 2 b -> 2 b -> 3 a -> 3 c -> 3 c -> 4 d -> 4 d -> 4 e -65a106,113 -> ERROR 42S02: Table 'test.t1' doesn't exist -> # ------------ UNEXPECTED RESULT ------------ -> # The statement|command finished with ER_NO_SUCH_TABLE. -> # DELETE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -67a116,125 -> 1 a -> 1 a -> 2 b -> 2 b -> 3 a -> 3 c -> 3 c -> 4 d -> 4 d -> 4 e -69c127,135 -< ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`t1` (`a`)) ---- -> ERROR 42S02: Table 'test.t1' doesn't exist -> # ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: ER_TRUNCATE_ILLEGAL_FK) -> # ------------ UNEXPECTED RESULT ------------ -> # The statement|command finished with ER_NO_SUCH_TABLE. -> # Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -71a138 -> ERROR 42S02: Unknown table 't1' +--- foreign_keys.result 2013-01-22 22:05:05.246633000 +0400 ++++ foreign_keys.reject 2013-01-23 02:50:28.187898084 +0400 +@@ -12,29 +12,57 @@ + t2 CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL, +- KEY `a` (`a`), +- CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++ KEY `a` (`a`) ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t2`) + INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b'); +-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) ++# ERROR: Statement succeeded (expected results: ER_NO_REFERENCED_ROW_2) ++# ------------ UNEXPECTED RESULT ------------ ++# The statement|command succeeded unexpectedly. ++# Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + INSERT INTO t1 (a,b) VALUES (1,'c'),(2,'d'); + INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b'); + UPDATE t2 SET a=a+1; +-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) ++# ERROR: Statement succeeded (expected results: ER_NO_REFERENCED_ROW_2) ++# ------------ UNEXPECTED RESULT ------------ ++# The statement|command succeeded unexpectedly. ++# Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + UPDATE t1 SET a=3 WHERE a=2; +-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) ++# ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED_2) + DELETE FROM t1 WHERE a=2; +-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) ++# ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED_2) ++# ------------ UNEXPECTED RESULT ------------ ++# The statement|command succeeded unexpectedly. ++# Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + DELETE FROM t2 WHERE a=2; + SELECT a,b FROM t1; + a b + 1 c +-2 d ++3 d + SELECT a,b FROM t2; + a b +-1 a ++3 b ++3 b + DROP TABLE t1; +-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails ++# ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED) ++# ------------ UNEXPECTED RESULT ------------ ++# The statement|command succeeded unexpectedly. ++# Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + DROP TABLE t2; + CREATE TABLE t2 (a <INT_COLUMN>, + b <CHAR_COLUMN>, +@@ -46,26 +74,65 @@ + t2 CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL, +- KEY `a` (`a`), +- CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++ KEY `a` (`a`) ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t2`) + INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'); +-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE) ++# ERROR: Statement succeeded (expected results: ER_NO_REFERENCED_ROW_2) + INSERT INTO t1 (a,b) VALUES (3,'a'),(4,'a'); ++ERROR 42S02: Table 'test.t1' doesn't exist + INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(4,'e'),(3,'a'); + UPDATE t1 SET a=a+1; ++ERROR 42S02: Table 'test.t1' doesn't exist ++# ------------ UNEXPECTED RESULT ------------ ++# The statement|command finished with ER_NO_SUCH_TABLE. ++# UPDATE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + SELECT a,b FROM t2; + a b +-5 a +-5 a +-5 b +-5 c +-5 d +-5 e ++1 a ++1 a ++2 b ++2 b ++3 a ++3 c ++3 c ++4 d ++4 d ++4 e + DELETE FROM t1 WHERE b='a' LIMIT 2; ++ERROR 42S02: Table 'test.t1' doesn't exist ++# ------------ UNEXPECTED RESULT ------------ ++# The statement|command finished with ER_NO_SUCH_TABLE. ++# DELETE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + SELECT a,b FROM t2; + a b ++1 a ++1 a ++2 b ++2 b ++3 a ++3 c ++3 c ++4 d ++4 d ++4 e + TRUNCATE TABLE t1; +-ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`t1` (`a`)) ++ERROR 42S02: Table 'test.t1' doesn't exist ++# ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: ER_TRUNCATE_ILLEGAL_FK) ++# ------------ UNEXPECTED RESULT ------------ ++# The statement|command finished with ER_NO_SUCH_TABLE. ++# Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + DROP TABLE t2; + DROP TABLE t1; ++ERROR 42S02: Unknown table 't1' diff --git a/storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff b/storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff index 262370f01ed..7234cdfd2fa 100644 --- a/storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff @@ -1,142 +1,150 @@ -7,64c7,15 -< SHOW INDEXES IN t1; -< Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -< t1 1 v1 1 v1 # # NULL NULL YES FULLTEXT -< INSERT INTO t1 (v0,v1,v2) VALUES ('text1','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off. -< If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment. -< For developers who want to code on MariaDB or MySQL -< * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB. -< o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB! -< o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic. -< * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings -< o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB! -< For MariaDB / MySQL end users -< * MariaDB Crash Course by Ben Forta -< o First MariaDB book! -< o For people who want to learn SQL and the basics of MariaDB. -< o Now shipping. Purchase at Amazon.com or your favorite bookseller. -< * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer. -< o Everything you wanted to know about the SQL 99 standard. Excellent reference book! -< o Free to read in the Knowledgebase! -< * MySQL (4th Edition) by Paul DuBois -< o The \'default\' book to read if you wont to learn to use MySQL / MariaDB. -< * MySQL Cookbook by Paul DuBois -< o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject. -< * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al. -< o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly) -< -< * MySQL Admin Cookbook -< o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration -< -< * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen -< o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ', -< 'There are several reasons why contributing code is one of the easiest and most rewarding ways to contribute to MariaDB: -< -< 1. We are very responsive toward reviews of submitted code and as soon as the review is done, the submitted code is merged into an existing MariaDB tree and made available to everyone, not just select customers. -< 2. Code reviews are performed by the MariaDB core development team and the quality, detail, and timeliness of our reviews are better than you will find elsewhere. -< 3. With MariaDB everyone has access to the latest code. -< 4. If a patch is very safe and/or very useful we are willing to push it into the stable code (as long as it can\'t break any existing applications). We are willing to do this to ensure the freedom to add small, needed fixes on a stable release so users don\'t have to wait a year for something to be added which is critical to their business. -< 5. If you are an active contributor, you can become a member of maria-captains, even if you aren\'t working for Monty Program Ab. All captains have the same rights as any other captain to accept and reject patches. Our development model is truly open for everyone. -< The Contributing Code page details many of the actual steps involved in working with the MariaDB source code. It\'s important that you use the same tools and submit patches in the same way as other developers to keep development running smoothly.' -< ), ('text2','test1','test2'); -< SELECT v0 FROM t1 WHERE MATCH(v1) AGAINST ('contributing' IN NATURAL LANGUAGE MODE); -< v0 -< INSERT INTO t1 (v0,v1,v2) VALUES ('text3','test','test'); -< SELECT v0, MATCH(v1) AGAINST('contributing' IN NATURAL LANGUAGE MODE) AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing' IN NATURAL LANGUAGE MODE); -< v0 rating -< INSERT INTO t1 (v0,v1,v2) VALUES ('text4','Contributing more...','...is a good idea'),('text5','test','test'); -< SELECT v0, MATCH(v1) AGAINST('contributing') AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing'); -< v0 rating -< text4 1.3705332279205322 -< SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-test1 +critical +Cook*' IN BOOLEAN MODE); -< v0 -< text1 -< SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-patch +critical +Cook*' IN BOOLEAN MODE); -< v0 -< SELECT v0, MATCH(v1) AGAINST('database' WITH QUERY EXPANSION) AS rating FROM t1 WHERE MATCH(v1) AGAINST ('database' WITH QUERY EXPANSION); -< v0 rating -< text1 178.11756896972656 -< DROP TABLE t1; ---- -> ERROR HY000: The used table type doesn't support FULLTEXT indexes -> # ERROR: Statement ended with errno 1214, errname ER_TABLE_CANT_HANDLE_FT (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # The statement|command finished with ER_TABLE_CANT_HANDLE_FT. -> # FULLTEXT indexes or VARCHAR|TEXT data types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -71,132c22,30 -< SHOW INDEXES IN t1; -< Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -< t1 1 v1 1 v1 # # NULL NULL YES FULLTEXT -< t1 1 v1_v2 1 v1 # # NULL NULL YES FULLTEXT -< t1 1 v1_v2 2 v2 # # NULL NULL YES FULLTEXT -< INSERT INTO t1 (v0,v1,v2) VALUES ('text1','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off. -< If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment. -< For developers who want to code on MariaDB or MySQL -< * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB. -< o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB! -< o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic. -< * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings -< o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB! -< For MariaDB / MySQL end users -< * MariaDB Crash Course by Ben Forta -< o First MariaDB book! -< o For people who want to learn SQL and the basics of MariaDB. -< o Now shipping. Purchase at Amazon.com or your favorite bookseller. -< * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer. -< o Everything you wanted to know about the SQL 99 standard. Excellent reference book! -< o Free to read in the Knowledgebase! -< * MySQL (4th Edition) by Paul DuBois -< o The \'default\' book to read if you wont to learn to use MySQL / MariaDB. -< * MySQL Cookbook by Paul DuBois -< o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject. -< * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al. -< o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly) -< -< * MySQL Admin Cookbook -< o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration -< -< * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen -< o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ', -< 'There are several reasons why contributing code is one of the easiest and most rewarding ways to contribute to MariaDB: -< -< 1. We are very responsive toward reviews of submitted code and as soon as the review is done, the submitted code is merged into an existing MariaDB tree and made available to everyone, not just select customers. -< 2. Code reviews are performed by the MariaDB core development team and the quality, detail, and timeliness of our reviews are better than you will find elsewhere. -< 3. With MariaDB everyone has access to the latest code. -< 4. If a patch is very safe and/or very useful we are willing to push it into the stable code (as long as it can\'t break any existing applications). We are willing to do this to ensure the freedom to add small, needed fixes on a stable release so users don\'t have to wait a year for something to be added which is critical to their business. -< 5. If you are an active contributor, you can become a member of maria-captains, even if you aren\'t working for Monty Program Ab. All captains have the same rights as any other captain to accept and reject patches. Our development model is truly open for everyone. -< The Contributing Code page details many of the actual steps involved in working with the MariaDB source code. It\'s important that you use the same tools and submit patches in the same way as other developers to keep development running smoothly.' -< ), ('text2','test1','test2'); -< SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('contributing' IN NATURAL LANGUAGE MODE); -< v0 -< INSERT INTO t1 (v0,v1,v2) VALUES ('text3','test','test'); -< SELECT v0, MATCH(v1,v2) AGAINST('contributing' IN NATURAL LANGUAGE MODE) AS rating FROM t1 WHERE MATCH(v1,v2) AGAINST ('contributing' IN NATURAL LANGUAGE MODE); -< v0 rating -< text1 0.2809644043445587 -< INSERT INTO t1 (v0,v1,v2) VALUES ('text4','Contributing more...','...is a good idea'),('text5','test','test'); -< SELECT v0, MATCH(v1) AGAINST('contributing') AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing'); -< v0 rating -< text4 1.3705332279205322 -< SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-test1 +critical +Cook*' IN BOOLEAN MODE); -< v0 -< text1 -< SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-patch +critical +Cook*' IN BOOLEAN MODE); -< v0 -< SELECT v0, MATCH(v1,v2) AGAINST('database' WITH QUERY EXPANSION) AS rating FROM t1 WHERE MATCH(v1,v2) AGAINST ('database' WITH QUERY EXPANSION); -< v0 rating -< text1 190.56150817871094 -< text4 1.1758291721343994 -< DROP TABLE t1; ---- -> ERROR HY000: The used table type doesn't support FULLTEXT indexes -> # ERROR: Statement ended with errno 1214, errname ER_TABLE_CANT_HANDLE_FT (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # The statement|command finished with ER_TABLE_CANT_HANDLE_FT. -> # FULLTEXT indexes or multiple keys or VARCHAR|TEXT data types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- +--- fulltext_search.result 2013-01-22 22:05:05.246633000 +0400 ++++ fulltext_search.reject 2013-01-23 02:50:28.807890289 +0400 +@@ -4,129 +4,27 @@ + v2 TEXT <CUSTOM_COL_OPTIONS>, + FULLTEXT v1 (v1) + ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-SHOW INDEXES IN t1; +-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +-t1 1 v1 1 v1 # # NULL NULL YES FULLTEXT +-INSERT INTO t1 (v0,v1,v2) VALUES ('text1','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off. +-If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment. +-For developers who want to code on MariaDB or MySQL +-* Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB. +-o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB! +-o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic. +-* MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings +-o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB! +-For MariaDB / MySQL end users +-* MariaDB Crash Course by Ben Forta +-o First MariaDB book! +-o For people who want to learn SQL and the basics of MariaDB. +-o Now shipping. Purchase at Amazon.com or your favorite bookseller. +-* SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer. +-o Everything you wanted to know about the SQL 99 standard. Excellent reference book! +-o Free to read in the Knowledgebase! +-* MySQL (4th Edition) by Paul DuBois +-o The \'default\' book to read if you wont to learn to use MySQL / MariaDB. +-* MySQL Cookbook by Paul DuBois +-o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject. +-* High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al. +-o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly) +- +- * MySQL Admin Cookbook +- o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration +- +- * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen +- o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ', +-'There are several reasons why contributing code is one of the easiest and most rewarding ways to contribute to MariaDB: +- +- 1. We are very responsive toward reviews of submitted code and as soon as the review is done, the submitted code is merged into an existing MariaDB tree and made available to everyone, not just select customers. +- 2. Code reviews are performed by the MariaDB core development team and the quality, detail, and timeliness of our reviews are better than you will find elsewhere. +- 3. With MariaDB everyone has access to the latest code. +- 4. If a patch is very safe and/or very useful we are willing to push it into the stable code (as long as it can\'t break any existing applications). We are willing to do this to ensure the freedom to add small, needed fixes on a stable release so users don\'t have to wait a year for something to be added which is critical to their business. +- 5. If you are an active contributor, you can become a member of maria-captains, even if you aren\'t working for Monty Program Ab. All captains have the same rights as any other captain to accept and reject patches. Our development model is truly open for everyone. +-The Contributing Code page details many of the actual steps involved in working with the MariaDB source code. It\'s important that you use the same tools and submit patches in the same way as other developers to keep development running smoothly.' +- ), ('text2','test1','test2'); +-SELECT v0 FROM t1 WHERE MATCH(v1) AGAINST ('contributing' IN NATURAL LANGUAGE MODE); +-v0 +-INSERT INTO t1 (v0,v1,v2) VALUES ('text3','test','test'); +-SELECT v0, MATCH(v1) AGAINST('contributing' IN NATURAL LANGUAGE MODE) AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing' IN NATURAL LANGUAGE MODE); +-v0 rating +-INSERT INTO t1 (v0,v1,v2) VALUES ('text4','Contributing more...','...is a good idea'),('text5','test','test'); +-SELECT v0, MATCH(v1) AGAINST('contributing') AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing'); +-v0 rating +-text4 1.3705332279205322 +-SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-test1 +critical +Cook*' IN BOOLEAN MODE); +-v0 +-text1 +-SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-patch +critical +Cook*' IN BOOLEAN MODE); +-v0 +-SELECT v0, MATCH(v1) AGAINST('database' WITH QUERY EXPANSION) AS rating FROM t1 WHERE MATCH(v1) AGAINST ('database' WITH QUERY EXPANSION); +-v0 rating +-text1 178.11756896972656 +-DROP TABLE t1; ++ERROR HY000: The used table type doesn't support FULLTEXT indexes ++# ERROR: Statement ended with errno 1214, errname ER_TABLE_CANT_HANDLE_FT (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# The statement|command finished with ER_TABLE_CANT_HANDLE_FT. ++# FULLTEXT indexes or VARCHAR|TEXT data types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + CREATE TABLE t1 (v0 VARCHAR(64) <CUSTOM_COL_OPTIONS>, + v1 VARCHAR(16384) <CUSTOM_COL_OPTIONS>, + v2 TEXT <CUSTOM_COL_OPTIONS>, + FULLTEXT v1 (v1), + FULLTEXT v1_v2 (v1,v2) + ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-SHOW INDEXES IN t1; +-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +-t1 1 v1 1 v1 # # NULL NULL YES FULLTEXT +-t1 1 v1_v2 1 v1 # # NULL NULL YES FULLTEXT +-t1 1 v1_v2 2 v2 # # NULL NULL YES FULLTEXT +-INSERT INTO t1 (v0,v1,v2) VALUES ('text1','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off. +-If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment. +-For developers who want to code on MariaDB or MySQL +-* Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB. +-o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB! +-o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic. +-* MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings +-o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB! +-For MariaDB / MySQL end users +-* MariaDB Crash Course by Ben Forta +-o First MariaDB book! +-o For people who want to learn SQL and the basics of MariaDB. +-o Now shipping. Purchase at Amazon.com or your favorite bookseller. +-* SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer. +-o Everything you wanted to know about the SQL 99 standard. Excellent reference book! +-o Free to read in the Knowledgebase! +-* MySQL (4th Edition) by Paul DuBois +-o The \'default\' book to read if you wont to learn to use MySQL / MariaDB. +-* MySQL Cookbook by Paul DuBois +-o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject. +-* High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al. +-o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly) +- +- * MySQL Admin Cookbook +- o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration +- +- * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen +- o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ', +-'There are several reasons why contributing code is one of the easiest and most rewarding ways to contribute to MariaDB: +- +- 1. We are very responsive toward reviews of submitted code and as soon as the review is done, the submitted code is merged into an existing MariaDB tree and made available to everyone, not just select customers. +- 2. Code reviews are performed by the MariaDB core development team and the quality, detail, and timeliness of our reviews are better than you will find elsewhere. +- 3. With MariaDB everyone has access to the latest code. +- 4. If a patch is very safe and/or very useful we are willing to push it into the stable code (as long as it can\'t break any existing applications). We are willing to do this to ensure the freedom to add small, needed fixes on a stable release so users don\'t have to wait a year for something to be added which is critical to their business. +- 5. If you are an active contributor, you can become a member of maria-captains, even if you aren\'t working for Monty Program Ab. All captains have the same rights as any other captain to accept and reject patches. Our development model is truly open for everyone. +-The Contributing Code page details many of the actual steps involved in working with the MariaDB source code. It\'s important that you use the same tools and submit patches in the same way as other developers to keep development running smoothly.' +- ), ('text2','test1','test2'); +-SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('contributing' IN NATURAL LANGUAGE MODE); +-v0 +-INSERT INTO t1 (v0,v1,v2) VALUES ('text3','test','test'); +-SELECT v0, MATCH(v1,v2) AGAINST('contributing' IN NATURAL LANGUAGE MODE) AS rating FROM t1 WHERE MATCH(v1,v2) AGAINST ('contributing' IN NATURAL LANGUAGE MODE); +-v0 rating +-text1 0.2809644043445587 +-INSERT INTO t1 (v0,v1,v2) VALUES ('text4','Contributing more...','...is a good idea'),('text5','test','test'); +-SELECT v0, MATCH(v1) AGAINST('contributing') AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing'); +-v0 rating +-text4 1.3705332279205322 +-SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-test1 +critical +Cook*' IN BOOLEAN MODE); +-v0 +-text1 +-SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-patch +critical +Cook*' IN BOOLEAN MODE); +-v0 +-SELECT v0, MATCH(v1,v2) AGAINST('database' WITH QUERY EXPANSION) AS rating FROM t1 WHERE MATCH(v1,v2) AGAINST ('database' WITH QUERY EXPANSION); +-v0 rating +-text1 190.56150817871094 +-text4 1.1758291721343994 +-DROP TABLE t1; ++ERROR HY000: The used table type doesn't support FULLTEXT indexes ++# ERROR: Statement ended with errno 1214, errname ER_TABLE_CANT_HANDLE_FT (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# The statement|command finished with ER_TABLE_CANT_HANDLE_FT. ++# FULLTEXT indexes or multiple keys or VARCHAR|TEXT data types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- diff --git a/storage/myisammrg/mysql-test/storage_engine/handler.rdiff b/storage/myisammrg/mysql-test/storage_engine/handler.rdiff index f0c01085ad9..c56cfae0e3a 100644 --- a/storage/myisammrg/mysql-test/storage_engine/handler.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/handler.rdiff @@ -1,79 +1,88 @@ -5,47c5,12 -< HANDLER t1 READ FIRST; -< ERROR 42S02: Unknown table 't1' in HANDLER -< HANDLER h1 READ FIRST; -< a b -< foobar 1000 -< HANDLER h1 READ NEXT; -< a b -< a 1 -< HANDLER h1 READ FIRST WHERE a < 'foo'; -< a b -< a 1 -< HANDLER h1 READ NEXT; -< a b -< bar 200 -< HANDLER h1 READ NEXT; -< a b -< foo 100 -< HANDLER h1 READ NEXT; -< a b -< HANDLER h1 READ FIRST LIMIT 2; -< a b -< foobar 1000 -< a 1 -< HANDLER h1 READ NEXT; -< a b -< bar 200 -< HANDLER h1 READ NEXT WHERE b>500 LIMIT 2; -< a b -< HANDLER t1 OPEN; -< HANDLER h1 READ FIRST WHERE b>500 LIMIT 5; -< a b -< foobar 1000 -< HANDLER t1 READ NEXT; -< a b -< foobar 1000 -< HANDLER h1 READ NEXT WHERE b<100; -< a b -< HANDLER t1 CLOSE; -< HANDLER h1 READ FIRST; -< a b -< foobar 1000 -< HANDLER t1 CLOSE; -< ERROR 42S02: Unknown table 't1' in HANDLER ---- -> ERROR HY000: Table storage engine for 'h1' doesn't have this option -> # ------------ UNEXPECTED RESULT ------------ -> # The statement|command finished with ER_ILLEGAL_HA. -> # Functionality or the syntax or the mix could be unsupported. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -54,76c19 -< HANDLER h1 READ a = (100); -< a b -< 100 f -< HANDLER h1 READ a <= (100) WHERE b < 'f'; -< a b -< 2 c -< HANDLER h1 READ a > (2) WHERE b IS NOT NULL LIMIT 2; -< a b -< 100 f -< 101 b -< HANDLER h1 READ a FIRST; -< a b -< 1 a -< HANDLER h1 READ a LAST; -< a b -< 200 b -< HANDLER h1 READ a PREV; -< a b -< 101 b -< HANDLER h1 READ a NEXT; -< a b -< 200 b -< HANDLER h1 CLOSE; ---- -> ERROR HY000: Table storage engine for 'h1' doesn't have this option +--- handler.result 2013-01-22 22:05:05.246633000 +0400 ++++ handler.reject 2013-01-23 02:50:29.411882697 +0400 +@@ -2,76 +2,19 @@ + CREATE TABLE t1 (a <CHAR_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + INSERT INTO t1 (a,b) VALUES ('foobar',1000),('a',1),('bar',200),('foo',100); + HANDLER t1 OPEN AS h1; +-HANDLER t1 READ FIRST; +-ERROR 42S02: Unknown table 't1' in HANDLER +-HANDLER h1 READ FIRST; +-a b +-foobar 1000 +-HANDLER h1 READ NEXT; +-a b +-a 1 +-HANDLER h1 READ FIRST WHERE a < 'foo'; +-a b +-a 1 +-HANDLER h1 READ NEXT; +-a b +-bar 200 +-HANDLER h1 READ NEXT; +-a b +-foo 100 +-HANDLER h1 READ NEXT; +-a b +-HANDLER h1 READ FIRST LIMIT 2; +-a b +-foobar 1000 +-a 1 +-HANDLER h1 READ NEXT; +-a b +-bar 200 +-HANDLER h1 READ NEXT WHERE b>500 LIMIT 2; +-a b +-HANDLER t1 OPEN; +-HANDLER h1 READ FIRST WHERE b>500 LIMIT 5; +-a b +-foobar 1000 +-HANDLER t1 READ NEXT; +-a b +-foobar 1000 +-HANDLER h1 READ NEXT WHERE b<100; +-a b +-HANDLER t1 CLOSE; +-HANDLER h1 READ FIRST; +-a b +-foobar 1000 +-HANDLER t1 CLOSE; +-ERROR 42S02: Unknown table 't1' in HANDLER ++ERROR HY000: Table storage engine for 'h1' doesn't have this option ++# ------------ UNEXPECTED RESULT ------------ ++# The statement|command finished with ER_ILLEGAL_HA. ++# Functionality or the syntax or the mix could be unsupported. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + DROP TABLE t1; + HANDLER h1 CLOSE; + ERROR 42S02: Unknown table 'h1' in HANDLER + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + INSERT INTO t1 (b,a) VALUES ('a',1),('b',200),('f',100),('b',101),('c',2); + HANDLER t1 OPEN AS h1; +-HANDLER h1 READ a = (100); +-a b +-100 f +-HANDLER h1 READ a <= (100) WHERE b < 'f'; +-a b +-2 c +-HANDLER h1 READ a > (2) WHERE b IS NOT NULL LIMIT 2; +-a b +-100 f +-101 b +-HANDLER h1 READ a FIRST; +-a b +-1 a +-HANDLER h1 READ a LAST; +-a b +-200 b +-HANDLER h1 READ a PREV; +-a b +-101 b +-HANDLER h1 READ a NEXT; +-a b +-200 b +-HANDLER h1 CLOSE; ++ERROR HY000: Table storage engine for 'h1' doesn't have this option + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/index.rdiff b/storage/myisammrg/mysql-test/storage_engine/index.rdiff index 6e6f18e39bc..bf6806979ec 100644 --- a/storage/myisammrg/mysql-test/storage_engine/index.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/index.rdiff @@ -1,6 +1,11 @@ -64,66c64 -< ERROR 23000: Duplicate entry '1' for key 'a' -< # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). -< # If you got a difference in error message, just add it to rdiff file ---- -> # ERROR: Statement succeeded (expected results: ER_DUP_ENTRY,ER_DUP_KEY) +--- index.result 2013-01-22 22:05:05.246633000 +0400 ++++ index.reject 2013-01-23 02:50:30.111873897 +0400 +@@ -61,7 +61,5 @@ + ALTER TABLE t1 DROP INDEX a; + INSERT INTO t1 (a,b) VALUES (1,'c'); + ALTER TABLE t1 ADD UNIQUE INDEX a(a) ; +-ERROR 23000: Duplicate entry '1' for key 'a' +-# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). +-# If you got a difference in error message, just add it to rdiff file ++# ERROR: Statement succeeded (expected results: ER_DUP_ENTRY,ER_DUP_KEY) + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff b/storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff index 8913f17a2a6..7b89e177ffb 100644 --- a/storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff @@ -1,17 +1,33 @@ -13a14,15 -> Warnings: -> Note 1031 Table storage engine for 't1' doesn't have this option -16c18 -< t1 1 a 1 a # # NULL NULL YES BTREE disabled ---- -> t1 1 a 1 a # # NULL NULL YES BTREE -19c21 -< 1 SIMPLE t1 ALL NULL NULL NULL NULL 19 Using filesort ---- -> 1 SIMPLE t1 index NULL a 5 NULL 19 Using index -22a25,26 -> Warnings: -> Note 1031 Table storage engine for 't1' doesn't have this option -34a39,40 -> Warnings: -> Note 1031 Table storage engine for 't1' doesn't have this option +--- index_enable_disable.result 2013-01-22 22:05:05.246633000 +0400 ++++ index_enable_disable.reject 2013-01-23 02:50:30.723866202 +0400 +@@ -11,15 +11,19 @@ + Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment + t1 1 a 1 a # # NULL NULL YES BTREE + ALTER TABLE t1 DISABLE KEYS; ++Warnings: ++Note 1031 Table storage engine for 't1' doesn't have this option + SHOW INDEX IN t1; + Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +-t1 1 a 1 a # # NULL NULL YES BTREE disabled ++t1 1 a 1 a # # NULL NULL YES BTREE + EXPLAIN SELECT a FROM t1 ORDER BY a; + id select_type table type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 ALL NULL NULL NULL NULL 19 Using filesort ++1 SIMPLE t1 index NULL a 5 NULL 19 Using index + INSERT INTO t1 (a) VALUES + (11),(12),(13),(14),(15),(16),(17),(18),(19),(20); + ALTER TABLE t1 ENABLE KEYS; ++Warnings: ++Note 1031 Table storage engine for 't1' doesn't have this option + SHOW INDEX IN t1; + Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment + t1 1 a 1 a # # NULL NULL YES BTREE +@@ -32,6 +36,8 @@ + (1),(2),(3),(4),(5),(6),(7),(8),(9), + (21),(22),(23),(24),(25),(26),(27),(28),(29); + ALTER TABLE t1 DISABLE KEYS; ++Warnings: ++Note 1031 Table storage engine for 't1' doesn't have this option + INSERT INTO t1 (a) VALUES (29); + ERROR 23000: Duplicate entry '29' for key 'a' + # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). diff --git a/storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff b/storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff index 6e6f18e39bc..1874b0d5891 100644 --- a/storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff @@ -1,6 +1,11 @@ -64,66c64 -< ERROR 23000: Duplicate entry '1' for key 'a' -< # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). -< # If you got a difference in error message, just add it to rdiff file ---- -> # ERROR: Statement succeeded (expected results: ER_DUP_ENTRY,ER_DUP_KEY) +--- index_type_btree.result 2013-01-22 22:05:05.246633000 +0400 ++++ index_type_btree.reject 2013-01-23 02:50:31.963850614 +0400 +@@ -61,7 +61,5 @@ + ALTER TABLE t1 DROP INDEX a; + INSERT INTO t1 (a,b) VALUES (1,'c'); + ALTER TABLE t1 ADD UNIQUE INDEX a(a) USING BTREE; +-ERROR 23000: Duplicate entry '1' for key 'a' +-# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). +-# If you got a difference in error message, just add it to rdiff file ++# ERROR: Statement succeeded (expected results: ER_DUP_ENTRY,ER_DUP_KEY) + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff b/storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff index 1b57afe5b64..f6fd1e391aa 100644 --- a/storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff @@ -1,34 +1,69 @@ -7c7 -< t1 1 a 1 a # # NULL NULL # HASH ---- -> t1 1 a 1 a # # NULL NULL # BTREE -15,16c15,16 -< t1 1 a_b 1 a # # NULL NULL # HASH a_b index -< t1 1 a_b 2 b # # NULL NULL # HASH a_b index ---- -> t1 1 a_b 1 a # # NULL NULL # BTREE a_b index -> t1 1 a_b 2 b # # NULL NULL # BTREE a_b index -25,26c25,26 -< t1 1 a 1 a # # NULL NULL # HASH -< t1 1 b 1 b # # NULL NULL # HASH ---- -> t1 1 a 1 a # # NULL NULL # BTREE -> t1 1 b 1 b # # NULL NULL # BTREE -34c34 -< t1 0 a 1 a # # NULL NULL # HASH ---- -> t1 0 a 1 a # # NULL NULL # BTREE -46c46 -< t1 1 a 1 a # # NULL NULL # HASH simple index on a ---- -> t1 1 a 1 a # # NULL NULL # BTREE simple index on a -55c55 -< t1 0 a 1 a # # NULL NULL # HASH ---- -> t1 0 a 1 a # # NULL NULL # BTREE -64,66c64 -< ERROR 23000: Duplicate entry '1' for key 'a' -< # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). -< # If you got a difference in error message, just add it to rdiff file ---- -> # ERROR: Statement succeeded (expected results: ER_DUP_ENTRY,ER_DUP_KEY) +--- index_type_hash.result 2013-01-22 22:05:05.246633000 +0400 ++++ index_type_hash.reject 2013-01-23 02:50:32.647842015 +0400 +@@ -4,7 +4,7 @@ + ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + SHOW KEYS IN t1; + Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +-t1 1 a 1 a # # NULL NULL # HASH ++t1 1 a 1 a # # NULL NULL # BTREE + DROP TABLE t1; + CREATE TABLE t1 (a <INT_COLUMN>, + b <CHAR_COLUMN>, +@@ -12,8 +12,8 @@ + ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + SHOW KEYS IN t1; + Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +-t1 1 a_b 1 a # # NULL NULL # HASH a_b index +-t1 1 a_b 2 b # # NULL NULL # HASH a_b index ++t1 1 a_b 1 a # # NULL NULL # BTREE a_b index ++t1 1 a_b 2 b # # NULL NULL # BTREE a_b index + DROP TABLE t1; + CREATE TABLE t1 (a <INT_COLUMN>, + b <CHAR_COLUMN>, +@@ -22,8 +22,8 @@ + ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + SHOW KEYS IN t1; + Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +-t1 1 a 1 a # # NULL NULL # HASH +-t1 1 b 1 b # # NULL NULL # HASH ++t1 1 a 1 a # # NULL NULL # BTREE ++t1 1 b 1 b # # NULL NULL # BTREE + DROP TABLE t1; + CREATE TABLE t1 (a <INT_COLUMN>, + b <CHAR_COLUMN>, +@@ -31,7 +31,7 @@ + ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + SHOW KEYS IN t1; + Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +-t1 0 a 1 a # # NULL NULL # HASH ++t1 0 a 1 a # # NULL NULL # BTREE + INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); + INSERT INTO t1 (a,b) VALUES (1,'c'); + ERROR 23000: Duplicate entry '1' for key 'a' +@@ -43,7 +43,7 @@ + ALTER TABLE t1 ADD <CUSTOM_INDEX> (a) USING HASH COMMENT 'simple index on a'; + SHOW INDEX FROM t1; + Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +-t1 1 a 1 a # # NULL NULL # HASH simple index on a ++t1 1 a 1 a # # NULL NULL # BTREE simple index on a + ALTER TABLE t1 DROP KEY a; + DROP TABLE t1; + CREATE TABLE t1 (a <INT_COLUMN>, +@@ -52,7 +52,7 @@ + ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + SHOW KEYS IN t1; + Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +-t1 0 a 1 a # # NULL NULL # HASH ++t1 0 a 1 a # # NULL NULL # BTREE + INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); + INSERT INTO t1 (a,b) VALUES (1,'c'); + ERROR 23000: Duplicate entry '1' for key 'a' +@@ -61,7 +61,5 @@ + ALTER TABLE t1 DROP INDEX a; + INSERT INTO t1 (a,b) VALUES (1,'c'); + ALTER TABLE t1 ADD UNIQUE INDEX a(a) USING HASH; +-ERROR 23000: Duplicate entry '1' for key 'a' +-# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). +-# If you got a difference in error message, just add it to rdiff file ++# ERROR: Statement succeeded (expected results: ER_DUP_ENTRY,ER_DUP_KEY) + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff b/storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff index e0d0eefabe4..24ffa2ab82f 100644 --- a/storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff @@ -1,14 +1,26 @@ -7a8,15 -> ERROR HY000: DELAYED option not supported for table 't1' -> # ------------ UNEXPECTED RESULT ------------ -> # The statement|command finished with ER_DELAYED_NOT_SUPPORTED. -> # INSERT DELAYED or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -8a17 -> ERROR HY000: DELAYED option not supported for table 't1' -23,24d31 -< 3 c -< 4 d +--- insert_delayed.result 2013-01-23 01:23:49.461254916 +0400 ++++ insert_delayed.reject 2013-01-23 02:50:34.475819034 +0400 +@@ -5,7 +5,16 @@ + connect con0,localhost,root,,; + SET lock_wait_timeout = 1; + INSERT DELAYED INTO t1 (a,b) VALUES (3,'c'); ++ERROR HY000: DELAYED option not supported for table 't1' ++# ------------ UNEXPECTED RESULT ------------ ++# The statement|command finished with ER_DELAYED_NOT_SUPPORTED. ++# INSERT DELAYED or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + INSERT DELAYED INTO t1 SET a=4, b='d'; ++ERROR HY000: DELAYED option not supported for table 't1' + INSERT DELAYED INTO t1 (a,b) SELECT 5, 'e'; + ERROR HY000: Lock wait timeout exceeded; try restarting transaction + disconnect con0; +@@ -20,6 +29,4 @@ + a b + 1 f + 2 b +-3 c +-4 d + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/lock.rdiff b/storage/myisammrg/mysql-test/storage_engine/lock.rdiff index d035648551a..598e47b6883 100644 --- a/storage/myisammrg/mysql-test/storage_engine/lock.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/lock.rdiff @@ -1,62 +1,80 @@ -44a45,46 -> ERROR HY000: Table 't1' was not locked with LOCK TABLES -> # ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed) -45a48,49 -> ERROR HY000: Table 't2' was not locked with LOCK TABLES -> # ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed) -46a51 -> ERROR HY000: Table 't2' was not locked with LOCK TABLES -47a53 -> ERROR HY000: Table 't2' was not locked with LOCK TABLES -48a55 -> ERROR 42S02: Table 'test.t1' doesn't exist -49a57 -> ERROR 42S02: Table 'test.t1' doesn't exist -50a59 -> ERROR 42S02: Table 'test.t1' doesn't exist -52a62 -> ERROR 42S02: Table 'test.t1' doesn't exist -54c64,65 -< ERROR HY000: Table 't1' was not locked with LOCK TABLES ---- -> ERROR 42S02: Table 'test.t1' doesn't exist -> # ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: ER_TABLE_NOT_LOCKED) -56a68 -> ERROR 42S02: Table 'test.t1' doesn't exist -57a70 -> ERROR 42S02: Table 'test.t1' doesn't exist -59c72,73 -< ERROR HY000: Table 't2' was not locked with LOCK TABLES ---- -> ERROR 42S02: Unknown table 't1,t2' -> # ERROR: Statement ended with errno 1051, errname ER_BAD_TABLE_ERROR (expected results: ER_TABLE_NOT_LOCKED) -61a76 -> ERROR 42S02: Unknown table 't1,t2' -67a83,84 -> ERROR HY000: Table 't1' was not locked with LOCK TABLES -> # ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed) -68a86,87 -> ERROR HY000: Table 't2' was not locked with LOCK TABLES -> # ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed) -69a89,90 -> ERROR HY000: Table 't3' was not locked with LOCK TABLES -> # ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed) -70a92 -> ERROR 42S02: Table 'test.t1' doesn't exist -71a94,103 -> ERROR 42S02: Table 'test.t2' doesn't exist -> # ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ ALTER TABLE t2 ADD COLUMN c2 INT(11) /*!*/ /*Custom column options*/ ] -> # The statement|command finished with ER_NO_SUCH_TABLE. -> # ALTER TABLE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -72a105 -> ERROR 42S02: Unknown table 't1,t2,t3' -109c142 -< a b ---- -> ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist +--- lock.result 2013-01-23 01:24:01.797100027 +0400 ++++ lock.reject 2013-01-23 02:50:53.291582487 +0400 +@@ -42,34 +42,67 @@ + UPDATE t1 SET id=1 WHERE id=-1; + DROP TABLE t1,t2; + CREATE TABLE t1 (i1 <INT_COLUMN>, nr <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; ++ERROR HY000: Table 't1' was not locked with LOCK TABLES ++# ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed) + CREATE TABLE t2 (nr <INT_COLUMN>, nm <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; ++ERROR HY000: Table 't2' was not locked with LOCK TABLES ++# ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed) + INSERT INTO t2 (nr,nm) VALUES (1,3); ++ERROR HY000: Table 't2' was not locked with LOCK TABLES + INSERT INTO t2 (nr,nm) VALUES (2,4); ++ERROR HY000: Table 't2' was not locked with LOCK TABLES + lock tables t1 write, t2 read; ++ERROR 42S02: Table 'test.t1' doesn't exist + INSERT INTO t1 (i1,nr) SELECT 1, nr FROM t2 WHERE nm=3; ++ERROR 42S02: Table 'test.t1' doesn't exist + INSERT INTO t1 (i1,nr) SELECT 2, nr FROM t2 WHERE nm=4; ++ERROR 42S02: Table 'test.t1' doesn't exist + UNLOCK TABLES; + LOCK TABLES t1 WRITE; ++ERROR 42S02: Table 'test.t1' doesn't exist + INSERT INTO t1 (i1,nr) SELECT i1, nr FROM t1; +-ERROR HY000: Table 't1' was not locked with LOCK TABLES ++ERROR 42S02: Table 'test.t1' doesn't exist ++# ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: ER_TABLE_NOT_LOCKED) + UNLOCK TABLES; + LOCK TABLES t1 WRITE, t1 AS t1_alias READ; ++ERROR 42S02: Table 'test.t1' doesn't exist + INSERT INTO t1 (i1,nr) SELECT i1, nr FROM t1 AS t1_alias; ++ERROR 42S02: Table 'test.t1' doesn't exist + DROP TABLE t1,t2; +-ERROR HY000: Table 't2' was not locked with LOCK TABLES ++ERROR 42S02: Unknown table 't1,t2' ++# ERROR: Statement ended with errno 1051, errname ER_BAD_TABLE_ERROR (expected results: ER_TABLE_NOT_LOCKED) + UNLOCK TABLES; + DROP TABLE t1,t2; ++ERROR 42S02: Unknown table 't1,t2' + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + CREATE TABLE t3 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + LOCK TABLES t1 WRITE, t2 WRITE, t3 WRITE; + DROP TABLE t2, t3, t1; + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; ++ERROR HY000: Table 't1' was not locked with LOCK TABLES ++# ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed) + CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; ++ERROR HY000: Table 't2' was not locked with LOCK TABLES ++# ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed) + CREATE TABLE t3 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; ++ERROR HY000: Table 't3' was not locked with LOCK TABLES ++# ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed) + LOCK TABLES t1 WRITE, t2 WRITE, t3 WRITE, t1 AS t4 READ; ++ERROR 42S02: Table 'test.t1' doesn't exist + ALTER TABLE t2 ADD COLUMN c2 <INT_COLUMN>; ++ERROR 42S02: Table 'test.t2' doesn't exist ++# ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ ALTER TABLE t2 ADD COLUMN c2 INT(11) /*!*/ /*Custom column options*/ ] ++# The statement|command finished with ER_NO_SUCH_TABLE. ++# ALTER TABLE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + DROP TABLE t1, t2, t3; ++ERROR 42S02: Unknown table 't1,t2,t3' + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + LOCK TABLE t1 READ, t2 READ; +@@ -106,6 +139,6 @@ + FLUSH TABLE t1; + DROP TEMPORARY TABLE t1; + SELECT a,b FROM t1; +-a b ++ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist + UNLOCK TABLES; + DROP TABLE t1, t2; diff --git a/storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff index f74c49cedea..1b611adf25a 100644 --- a/storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff @@ -1,24 +1,35 @@ -8c8 -< test.t1 optimize status OK ---- -> test.t1 optimize note The storage engine for the table doesn't support optimize -12c12 -< test.t2 optimize status OK ---- -> test.t2 optimize note The storage engine for the table doesn't support optimize -17,18c17,18 -< test.t1 optimize status OK -< test.t2 optimize status OK ---- -> test.t1 optimize note The storage engine for the table doesn't support optimize -> test.t2 optimize note The storage engine for the table doesn't support optimize -21,22c21,22 -< test.t1 optimize status Table is already up to date -< test.t2 optimize status Table is already up to date ---- -> test.t1 optimize note The storage engine for the table doesn't support optimize -> test.t2 optimize note The storage engine for the table doesn't support optimize -28c28 -< test.t1 optimize status OK ---- -> test.t1 optimize note The storage engine for the table doesn't support optimize +--- optimize_table.result 2013-01-22 22:05:05.246633000 +0400 ++++ optimize_table.reject 2013-01-23 02:50:54.339569313 +0400 +@@ -5,25 +5,25 @@ + INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d'); + OPTIMIZE TABLE t1; + Table Op Msg_type Msg_text +-test.t1 optimize status OK ++test.t1 optimize note The storage engine for the table doesn't support optimize + INSERT INTO t2 (a,b) VALUES (4,'d'); + OPTIMIZE NO_WRITE_TO_BINLOG TABLE t2; + Table Op Msg_type Msg_text +-test.t2 optimize status OK ++test.t2 optimize note The storage engine for the table doesn't support optimize + INSERT INTO t2 (a,b) VALUES (5,'e'); + INSERT INTO t1 (a,b) VALUES (6,'f'); + OPTIMIZE LOCAL TABLE t1, t2; + Table Op Msg_type Msg_text +-test.t1 optimize status OK +-test.t2 optimize status OK ++test.t1 optimize note The storage engine for the table doesn't support optimize ++test.t2 optimize note The storage engine for the table doesn't support optimize + OPTIMIZE TABLE t1, t2; + Table Op Msg_type Msg_text +-test.t1 optimize status Table is already up to date +-test.t2 optimize status Table is already up to date ++test.t1 optimize note The storage engine for the table doesn't support optimize ++test.t2 optimize note The storage engine for the table doesn't support optimize + DROP TABLE t1, t2; + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + INSERT INTO t1 (a,b) VALUES (1,'a'),(100,'b'),(2,'c'),(3,'d'); + OPTIMIZE TABLE t1; + Table Op Msg_type Msg_text +-test.t1 optimize status OK ++test.t1 optimize note The storage engine for the table doesn't support optimize + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff index a2cb0c1dcb1..4c7ba7d8232 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff @@ -1,63 +1,68 @@ -3,36c3,12 -< INSERT INTO t1 (a) VALUES (1),(2),(2),(3),(4); -< ALTER TABLE t1 ADD PARTITION PARTITIONS 2; -< EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 3; -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE t1 p3 # # # # # # # -< ALTER TABLE t1 COALESCE PARTITION 1; -< EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 3; -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE t1 p0 # # # # # # # -< ALTER TABLE t1 REORGANIZE PARTITION; -< EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 2; -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE t1 p0 # # # # # # # -< ALTER TABLE t1 REBUILD PARTITION p0; -< EXPLAIN PARTiTIONS SELECT a FROM t1; -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE t1 p0 # # # # # # # -< ALTER TABLE t1 REMOVE PARTITIONING; -< EXPLAIN PARTiTIONS SELECT a FROM t1; -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE t1 NULL # # # # # # # -< ALTER TABLE t1 PARTITION BY LIST(a) (PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (101,102)); -< ERROR HY000: Table has no partition for value 4 -< ALTER TABLE t1 PARTITION BY LIST(a) (PARTITION p0 VALUES IN (1,2,3,4), PARTITION p1 VALUES IN (101,102)); -< INSERT INTO t1 (a) VALUES (50); -< ERROR HY000: Table has no partition for value 50 -< ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (50,51)); -< INSERT INTO t1 (a) VALUES (50); -< ALTER TABLE t1 DROP PARTITION p1; -< ALTER TABLE t1 REORGANIZE PARTITION p0, p2 INTO (PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (4), PARTITION p2 VALUES IN (50,51), PARTITION p3 VALUES IN (101,102)); -< EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 2; -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE t1 p0 # # # # # # # -< DROP TABLE t1; ---- -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ] -> # The statement|command finished with ER_PARTITION_MERGE_ERROR. -> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -41,42c17,29 -< ALTER TABLE t1 DROP PARTITION abc; -< DROP TABLE t1; ---- -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY LIST(a) SUBPARTITION by HASH(b) ( -> PARTITION abc VALUES IN (1,2,3), -> PARTITION def VALUES IN (100,101,102) -> ) ] -> # The statement|command finished with ER_PARTITION_MERGE_ERROR. -> # Partitions or subpartitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- +--- alter_table.result 2013-01-22 22:05:05.246633000 +0400 ++++ alter_table.reject 2013-01-23 03:16:22.620356221 +0400 +@@ -1,42 +1,29 @@ + DROP TABLE IF EXISTS t1; + CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; +-INSERT INTO t1 (a) VALUES (1),(2),(2),(3),(4); +-ALTER TABLE t1 ADD PARTITION PARTITIONS 2; +-EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 3; +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 p3 # # # # # # # +-ALTER TABLE t1 COALESCE PARTITION 1; +-EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 3; +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 p0 # # # # # # # +-ALTER TABLE t1 REORGANIZE PARTITION; +-EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 2; +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 p0 # # # # # # # +-ALTER TABLE t1 REBUILD PARTITION p0; +-EXPLAIN PARTiTIONS SELECT a FROM t1; +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 p0 # # # # # # # +-ALTER TABLE t1 REMOVE PARTITIONING; +-EXPLAIN PARTiTIONS SELECT a FROM t1; +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 NULL # # # # # # # +-ALTER TABLE t1 PARTITION BY LIST(a) (PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (101,102)); +-ERROR HY000: Table has no partition for value 4 +-ALTER TABLE t1 PARTITION BY LIST(a) (PARTITION p0 VALUES IN (1,2,3,4), PARTITION p1 VALUES IN (101,102)); +-INSERT INTO t1 (a) VALUES (50); +-ERROR HY000: Table has no partition for value 50 +-ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (50,51)); +-INSERT INTO t1 (a) VALUES (50); +-ALTER TABLE t1 DROP PARTITION p1; +-ALTER TABLE t1 REORGANIZE PARTITION p0, p2 INTO (PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (4), PARTITION p2 VALUES IN (50,51), PARTITION p3 VALUES IN (101,102)); +-EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 2; +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 p0 # # # # # # # +-DROP TABLE t1; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ] ++# The statement|command finished with ER_PARTITION_MERGE_ERROR. ++# Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) SUBPARTITION by HASH(b) ( + PARTITION abc VALUES IN (1,2,3), + PARTITION def VALUES IN (100,101,102) + ); +-ALTER TABLE t1 DROP PARTITION abc; +-DROP TABLE t1; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY LIST(a) SUBPARTITION by HASH(b) ( ++PARTITION abc VALUES IN (1,2,3), ++PARTITION def VALUES IN (100,101,102) ++) ] ++# The statement|command finished with ER_PARTITION_MERGE_ERROR. ++# Partitions or subpartitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff index ce29f3dcf52..d1934b9d2ac 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff @@ -1,83 +1,87 @@ -3,18c3,12 -< INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g'); -< CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< INSERT INTO t2 (a,b) SELECT a,b FROM t1; -< INSERT INTO t1 (a,b) VALUES (3,'c'); -< ALTER TABLE t1 ANALYZE PARTITION p0; -< Table Op Msg_type Msg_text -< test.t1 analyze status OK -< INSERT INTO t2 (a,b) VALUES (4,'d'), (1000,'e'); -< ALTER TABLE t1 ANALYZE PARTITION LOCAL ALL; -< Table Op Msg_type Msg_text -< test.t1 analyze status OK -< INSERT INTO t1 (a,b) VALUES (5,'f'),(50,'g'); -< ALTER TABLE t1 ANALYZE PARTITION NO_WRITE_TO_BINLOG p1,p0; -< Table Op Msg_type Msg_text -< test.t1 analyze status OK -< DROP TABLE t1, t2; ---- -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ] -> # The statement|command finished with ER_PARTITION_MERGE_ERROR. -> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -20a15,16 -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -21a18 -> ERROR 42S02: Table 'test.t1' doesn't exist -22a20,21 -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -23a23 -> ERROR 42S02: Table 'test.t1' doesn't exist -26c26,27 -< test.t1 analyze status OK ---- -> test.t1 analyze Error Table 'test.t1' doesn't exist -> test.t1 analyze status Operation failed -27a29 -> ERROR 42S02: Table 'test.t2' doesn't exist -30c32,33 -< test.t2 analyze status OK ---- -> test.t2 analyze Error Table 'test.t2' doesn't exist -> test.t2 analyze status Operation failed -31a35 -> ERROR 42S02: Table 'test.t1' doesn't exist -32a37 -> ERROR 42S02: Table 'test.t2' doesn't exist -35,36c40,43 -< test.t1 analyze status OK -< test.t2 analyze status OK ---- -> test.t1 analyze Error Table 'test.t1' doesn't exist -> test.t1 analyze status Operation failed -> test.t2 analyze Error Table 'test.t2' doesn't exist -> test.t2 analyze status Operation failed -37a45 -> ERROR 42S02: Unknown table 't1,t2' -38a47,48 -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -39a50 -> ERROR 42S02: Table 'test.t1' doesn't exist -42c53,54 -< test.t1 analyze status OK ---- -> test.t1 analyze Error Table 'test.t1' doesn't exist -> test.t1 analyze status Operation failed -43a56 -> ERROR 42S02: Table 'test.t1' doesn't exist -46c59,60 -< test.t1 analyze status OK ---- -> test.t1 analyze Error Table 'test.t1' doesn't exist -> test.t1 analyze status Operation failed -47a62 -> ERROR 42S02: Unknown table 't1' +--- analyze_table.result 2013-01-22 22:05:05.246633000 +0400 ++++ analyze_table.reject 2013-01-23 03:16:23.240348427 +0400 +@@ -1,47 +1,62 @@ + DROP TABLE IF EXISTS t1,t2; + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; +-INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g'); +-CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-INSERT INTO t2 (a,b) SELECT a,b FROM t1; +-INSERT INTO t1 (a,b) VALUES (3,'c'); +-ALTER TABLE t1 ANALYZE PARTITION p0; +-Table Op Msg_type Msg_text +-test.t1 analyze status OK +-INSERT INTO t2 (a,b) VALUES (4,'d'), (1000,'e'); +-ALTER TABLE t1 ANALYZE PARTITION LOCAL ALL; +-Table Op Msg_type Msg_text +-test.t1 analyze status OK +-INSERT INTO t1 (a,b) VALUES (5,'f'),(50,'g'); +-ALTER TABLE t1 ANALYZE PARTITION NO_WRITE_TO_BINLOG p1,p0; +-Table Op Msg_type Msg_text +-test.t1 analyze status OK +-DROP TABLE t1, t2; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ] ++# The statement|command finished with ER_PARTITION_MERGE_ERROR. ++# Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + DROP TABLE IF EXISTS t1,t2; + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) + INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); ++ERROR 42S02: Table 'test.t1' doesn't exist + CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) + INSERT INTO t1 (a,b) VALUES (3,'c'); ++ERROR 42S02: Table 'test.t1' doesn't exist + ANALYZE TABLE t1; + Table Op Msg_type Msg_text +-test.t1 analyze status OK ++test.t1 analyze Error Table 'test.t1' doesn't exist ++test.t1 analyze status Operation failed + INSERT INTO t2 (a,b) VALUES (4,'d'); ++ERROR 42S02: Table 'test.t2' doesn't exist + ANALYZE NO_WRITE_TO_BINLOG TABLE t2; + Table Op Msg_type Msg_text +-test.t2 analyze status OK ++test.t2 analyze Error Table 'test.t2' doesn't exist ++test.t2 analyze status Operation failed + INSERT INTO t1 (a,b) VALUES (5,'e'); ++ERROR 42S02: Table 'test.t1' doesn't exist + INSERT INTO t2 (a,b) VALUES (6,'f'); ++ERROR 42S02: Table 'test.t2' doesn't exist + ANALYZE LOCAL TABLE t1, t2; + Table Op Msg_type Msg_text +-test.t1 analyze status OK +-test.t2 analyze status OK ++test.t1 analyze Error Table 'test.t1' doesn't exist ++test.t1 analyze status Operation failed ++test.t2 analyze Error Table 'test.t2' doesn't exist ++test.t2 analyze status Operation failed + DROP TABLE t1, t2; ++ERROR 42S02: Unknown table 't1,t2' + CREATE TABLE t1 (a <INT_COLUMN>, <CUSTOM_INDEX>(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) + INSERT INTO t1 (a) VALUES (1),(2),(4),(7); ++ERROR 42S02: Table 'test.t1' doesn't exist + ANALYZE TABLE t1; + Table Op Msg_type Msg_text +-test.t1 analyze status OK ++test.t1 analyze Error Table 'test.t1' doesn't exist ++test.t1 analyze status Operation failed + INSERT INTO t1 (a) VALUES (8),(10),(11),(12); ++ERROR 42S02: Table 'test.t1' doesn't exist + ANALYZE TABLE t1; + Table Op Msg_type Msg_text +-test.t1 analyze status OK ++test.t1 analyze Error Table 'test.t1' doesn't exist ++test.t1 analyze status Operation failed + DROP TABLE t1; ++ERROR 42S02: Unknown table 't1' diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff index 3f3db85a23e..21ccf192e08 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff @@ -1,172 +1,176 @@ -3,36c3,12 -< INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g'); -< CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) ( -< PARTITION p0 VALUES LESS THAN (100), -< PARTITION p1 VALUES LESS THAN MAXVALUE -< ); -< INSERT INTO t2 (a,b) SELECT a, b FROM t1; -< ALTER TABLE t1 CHECK PARTITION p0; -< Table Op Msg_type Msg_text -< test.t1 check status OK -< INSERT INTO t1 (a,b) VALUES (3,'c'); -< ALTER TABLE t1 CHECK PARTITION p0, p1 FOR UPGRADE; -< Table Op Msg_type Msg_text -< test.t1 check status OK -< INSERT INTO t2 (a,b) VALUES (10000,'e'); -< ALTER TABLE t2 CHECK PARTITION p0 QUICK; -< Table Op Msg_type Msg_text -< test.t2 check status OK -< INSERT INTO t1 (a,b) VALUES (6,'f'); -< ALTER TABLE t1 CHECK PARTITION p1 FAST; -< Table Op Msg_type Msg_text -< test.t1 check status OK -< INSERT INTO t2 (a,b) VALUES (8,'h'); -< ALTER TABLE t2 CHECK PARTITION p1 MEDIUM; -< Table Op Msg_type Msg_text -< test.t2 check status OK -< INSERT INTO t1 (a,b) VALUES (9,'i'); -< ALTER TABLE t1 CHECK PARTITION ALL EXTENDED; -< Table Op Msg_type Msg_text -< test.t1 check status OK -< INSERT INTO t1 (a,b) VALUES (11,'k'); -< ALTER TABLE t1 CHECK PARTITION p0 CHANGED; -< Table Op Msg_type Msg_text -< test.t1 check status OK -< DROP TABLE t1, t2; ---- -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ] -> # The statement|command finished with ER_PARTITION_MERGE_ERROR. -> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -38a15,16 -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -39a18 -> ERROR 42S02: Table 'test.t1' doesn't exist -40a20,21 -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -43c24,25 -< test.t1 check status OK ---- -> test.t1 check Error Table 'test.t1' doesn't exist -> test.t1 check status Operation failed -44a27 -> ERROR 42S02: Table 'test.t1' doesn't exist -45a29 -> ERROR 42S02: Table 'test.t2' doesn't exist -48,49c32,35 -< test.t1 check status OK -< test.t2 check status OK ---- -> test.t1 check Error Table 'test.t1' doesn't exist -> test.t1 check status Operation failed -> test.t2 check Error Table 'test.t2' doesn't exist -> test.t2 check status Operation failed -50a37 -> ERROR 42S02: Table 'test.t2' doesn't exist -53c40,41 -< test.t2 check status OK ---- -> test.t2 check Error Table 'test.t2' doesn't exist -> test.t2 check status Operation failed -54a43 -> ERROR 42S02: Table 'test.t1' doesn't exist -57c46,47 -< test.t1 check status OK ---- -> test.t1 check Error Table 'test.t1' doesn't exist -> test.t1 check status Operation failed -58a49 -> ERROR 42S02: Table 'test.t1' doesn't exist -59a51 -> ERROR 42S02: Table 'test.t2' doesn't exist -62,63c54,57 -< test.t2 check status OK -< test.t1 check status OK ---- -> test.t2 check Error Table 'test.t2' doesn't exist -> test.t2 check status Operation failed -> test.t1 check Error Table 'test.t1' doesn't exist -> test.t1 check status Operation failed -64a59 -> ERROR 42S02: Table 'test.t1' doesn't exist -65a61 -> ERROR 42S02: Table 'test.t2' doesn't exist -68,69c64,67 -< test.t1 check status OK -< test.t2 check status OK ---- -> test.t1 check Error Table 'test.t1' doesn't exist -> test.t1 check status Operation failed -> test.t2 check Error Table 'test.t2' doesn't exist -> test.t2 check status Operation failed -70a69 -> ERROR 42S02: Table 'test.t1' doesn't exist -73c72,73 -< test.t1 check status OK ---- -> test.t1 check Error Table 'test.t1' doesn't exist -> test.t1 check status Operation failed -74a75 -> ERROR 42S02: Unknown table 't1,t2' -75a77,78 -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -76a80 -> ERROR 42S02: Table 'test.t1' doesn't exist -79c83,84 -< test.t1 check status OK ---- -> test.t1 check Error Table 'test.t1' doesn't exist -> test.t1 check status Operation failed -80a86 -> ERROR 42S02: Table 'test.t1' doesn't exist -83c89,90 -< test.t1 check status OK ---- -> test.t1 check Error Table 'test.t1' doesn't exist -> test.t1 check status Operation failed -84a92 -> ERROR 42S02: Table 'test.t1' doesn't exist -87c95,96 -< test.t1 check status OK ---- -> test.t1 check Error Table 'test.t1' doesn't exist -> test.t1 check status Operation failed -88a98 -> ERROR 42S02: Table 'test.t1' doesn't exist -91c101,102 -< test.t1 check status OK ---- -> test.t1 check Error Table 'test.t1' doesn't exist -> test.t1 check status Operation failed -92a104 -> ERROR 42S02: Table 'test.t1' doesn't exist -95c107,108 -< test.t1 check status OK ---- -> test.t1 check Error Table 'test.t1' doesn't exist -> test.t1 check status Operation failed -96a110 -> ERROR 42S02: Table 'test.t1' doesn't exist -99c113,114 -< test.t1 check status OK ---- -> test.t1 check Error Table 'test.t1' doesn't exist -> test.t1 check status Operation failed -100a116 -> ERROR 42S02: Table 'test.t1' doesn't exist -103c119,120 -< test.t1 check status OK ---- -> test.t1 check Error Table 'test.t1' doesn't exist -> test.t1 check status Operation failed -104a122 -> ERROR 42S02: Unknown table 't1' +--- check_table.result 2013-01-22 22:05:05.246633000 +0400 ++++ check_table.reject 2013-01-23 03:16:23.872340482 +0400 +@@ -1,104 +1,122 @@ + DROP TABLE IF EXISTS t1, t2; + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; +-INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g'); +-CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) ( +-PARTITION p0 VALUES LESS THAN (100), +-PARTITION p1 VALUES LESS THAN MAXVALUE +-); +-INSERT INTO t2 (a,b) SELECT a, b FROM t1; +-ALTER TABLE t1 CHECK PARTITION p0; +-Table Op Msg_type Msg_text +-test.t1 check status OK +-INSERT INTO t1 (a,b) VALUES (3,'c'); +-ALTER TABLE t1 CHECK PARTITION p0, p1 FOR UPGRADE; +-Table Op Msg_type Msg_text +-test.t1 check status OK +-INSERT INTO t2 (a,b) VALUES (10000,'e'); +-ALTER TABLE t2 CHECK PARTITION p0 QUICK; +-Table Op Msg_type Msg_text +-test.t2 check status OK +-INSERT INTO t1 (a,b) VALUES (6,'f'); +-ALTER TABLE t1 CHECK PARTITION p1 FAST; +-Table Op Msg_type Msg_text +-test.t1 check status OK +-INSERT INTO t2 (a,b) VALUES (8,'h'); +-ALTER TABLE t2 CHECK PARTITION p1 MEDIUM; +-Table Op Msg_type Msg_text +-test.t2 check status OK +-INSERT INTO t1 (a,b) VALUES (9,'i'); +-ALTER TABLE t1 CHECK PARTITION ALL EXTENDED; +-Table Op Msg_type Msg_text +-test.t1 check status OK +-INSERT INTO t1 (a,b) VALUES (11,'k'); +-ALTER TABLE t1 CHECK PARTITION p0 CHANGED; +-Table Op Msg_type Msg_text +-test.t1 check status OK +-DROP TABLE t1, t2; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ] ++# The statement|command finished with ER_PARTITION_MERGE_ERROR. ++# Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + DROP TABLE IF EXISTS t1,t2; + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) + INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); ++ERROR 42S02: Table 'test.t1' doesn't exist + CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) + CHECK TABLE t1; + Table Op Msg_type Msg_text +-test.t1 check status OK ++test.t1 check Error Table 'test.t1' doesn't exist ++test.t1 check status Operation failed + INSERT INTO t1 (a,b) VALUES (3,'c'); ++ERROR 42S02: Table 'test.t1' doesn't exist + INSERT INTO t2 (a,b) VALUES (4,'d'); ++ERROR 42S02: Table 'test.t2' doesn't exist + CHECK TABLE t1, t2 FOR UPGRADE; + Table Op Msg_type Msg_text +-test.t1 check status OK +-test.t2 check status OK ++test.t1 check Error Table 'test.t1' doesn't exist ++test.t1 check status Operation failed ++test.t2 check Error Table 'test.t2' doesn't exist ++test.t2 check status Operation failed + INSERT INTO t2 (a,b) VALUES (5,'e'); ++ERROR 42S02: Table 'test.t2' doesn't exist + CHECK TABLE t2 QUICK; + Table Op Msg_type Msg_text +-test.t2 check status OK ++test.t2 check Error Table 'test.t2' doesn't exist ++test.t2 check status Operation failed + INSERT INTO t1 (a,b) VALUES (6,'f'); ++ERROR 42S02: Table 'test.t1' doesn't exist + CHECK TABLE t1 FAST; + Table Op Msg_type Msg_text +-test.t1 check status OK ++test.t1 check Error Table 'test.t1' doesn't exist ++test.t1 check status Operation failed + INSERT INTO t1 (a,b) VALUES (7,'g'); ++ERROR 42S02: Table 'test.t1' doesn't exist + INSERT INTO t2 (a,b) VALUES (8,'h'); ++ERROR 42S02: Table 'test.t2' doesn't exist + CHECK TABLE t2, t1 MEDIUM; + Table Op Msg_type Msg_text +-test.t2 check status OK +-test.t1 check status OK ++test.t2 check Error Table 'test.t2' doesn't exist ++test.t2 check status Operation failed ++test.t1 check Error Table 'test.t1' doesn't exist ++test.t1 check status Operation failed + INSERT INTO t1 (a,b) VALUES (9,'i'); ++ERROR 42S02: Table 'test.t1' doesn't exist + INSERT INTO t2 (a,b) VALUES (10,'j'); ++ERROR 42S02: Table 'test.t2' doesn't exist + CHECK TABLE t1, t2 EXTENDED; + Table Op Msg_type Msg_text +-test.t1 check status OK +-test.t2 check status OK ++test.t1 check Error Table 'test.t1' doesn't exist ++test.t1 check status Operation failed ++test.t2 check Error Table 'test.t2' doesn't exist ++test.t2 check status Operation failed + INSERT INTO t1 (a,b) VALUES (11,'k'); ++ERROR 42S02: Table 'test.t1' doesn't exist + CHECK TABLE t1 CHANGED; + Table Op Msg_type Msg_text +-test.t1 check status OK ++test.t1 check Error Table 'test.t1' doesn't exist ++test.t1 check status Operation failed + DROP TABLE t1, t2; ++ERROR 42S02: Unknown table 't1,t2' + CREATE TABLE t1 (a <INT_COLUMN>, <CUSTOM_INDEX>(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) + INSERT INTO t1 (a) VALUES (1),(2),(5); ++ERROR 42S02: Table 'test.t1' doesn't exist + CHECK TABLE t1; + Table Op Msg_type Msg_text +-test.t1 check status OK ++test.t1 check Error Table 'test.t1' doesn't exist ++test.t1 check status Operation failed + INSERT INTO t1 (a) VALUES (6),(8),(12); ++ERROR 42S02: Table 'test.t1' doesn't exist + CHECK TABLE t1 FOR UPGRADE; + Table Op Msg_type Msg_text +-test.t1 check status OK ++test.t1 check Error Table 'test.t1' doesn't exist ++test.t1 check status Operation failed + INSERT INTO t1 (a) VALUES (13),(15),(16); ++ERROR 42S02: Table 'test.t1' doesn't exist + CHECK TABLE t1 QUICK; + Table Op Msg_type Msg_text +-test.t1 check status OK ++test.t1 check Error Table 'test.t1' doesn't exist ++test.t1 check status Operation failed + INSERT INTO t1 (a) VALUES (17),(120),(132); ++ERROR 42S02: Table 'test.t1' doesn't exist + CHECK TABLE t1 FAST; + Table Op Msg_type Msg_text +-test.t1 check status OK ++test.t1 check Error Table 'test.t1' doesn't exist ++test.t1 check status Operation failed + INSERT INTO t1 (a) VALUES (801),(900),(7714); ++ERROR 42S02: Table 'test.t1' doesn't exist + CHECK TABLE t1 MEDIUM; + Table Op Msg_type Msg_text +-test.t1 check status OK ++test.t1 check Error Table 'test.t1' doesn't exist ++test.t1 check status Operation failed + INSERT INTO t1 (a) VALUES (8760),(10023),(12000); ++ERROR 42S02: Table 'test.t1' doesn't exist + CHECK TABLE t1 EXTENDED; + Table Op Msg_type Msg_text +-test.t1 check status OK ++test.t1 check Error Table 'test.t1' doesn't exist ++test.t1 check status Operation failed + INSERT INTO t1 (a) VALUES (13345),(24456),(78302),(143028); ++ERROR 42S02: Table 'test.t1' doesn't exist + CHECK TABLE t1 CHANGED; + Table Op Msg_type Msg_text +-test.t1 check status OK ++test.t1 check Error Table 'test.t1' doesn't exist ++test.t1 check status Operation failed + DROP TABLE t1; ++ERROR 42S02: Unknown table 't1' diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff index bc5b07686bf..3d9ebdfe5c4 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff @@ -1,81 +1,89 @@ -2a3,4 -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -3a6 -> ERROR 42S02: Table 'test.t1' doesn't exist -4a8,9 -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -7c12,14 -< test.t1 4272806499 ---- -> test.t1 NULL -> Warnings: -> Error 1146 Table 'test.t1' doesn't exist -10,11c17,21 -< test.t2 0 -< test.t1 4272806499 ---- -> test.t2 NULL -> test.t1 NULL -> Warnings: -> Error 1146 Table 'test.t2' doesn't exist -> Error 1146 Table 'test.t1' doesn't exist -15a26,28 -> Warnings: -> Error 1146 Table 'test.t1' doesn't exist -> Error 1146 Table 'test.t2' doesn't exist -18,19c31,35 -< test.t1 4272806499 -< test.t2 0 ---- -> test.t1 NULL -> test.t2 NULL -> Warnings: -> Error 1146 Table 'test.t1' doesn't exist -> Error 1146 Table 'test.t2' doesn't exist -20a37 -> ERROR 42S02: Unknown table 't1,t2' -22a40,41 -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -23a43 -> ERROR 42S02: Table 'test.t1' doesn't exist -24a45,46 -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -27c49,51 -< test.t1 0 ---- -> test.t1 NULL -> Warnings: -> Error 1146 Table 'test.t1' doesn't exist -30,31c54,58 -< test.t2 0 -< test.t1 0 ---- -> test.t2 NULL -> test.t1 NULL -> Warnings: -> Error 1146 Table 'test.t2' doesn't exist -> Error 1146 Table 'test.t1' doesn't exist -34,35c61,65 -< test.t1 0 -< test.t2 0 ---- -> test.t1 NULL -> test.t2 NULL -> Warnings: -> Error 1146 Table 'test.t1' doesn't exist -> Error 1146 Table 'test.t2' doesn't exist -38,39c68,72 -< test.t1 4272806499 -< test.t2 0 ---- -> test.t1 NULL -> test.t2 NULL -> Warnings: -> Error 1146 Table 'test.t1' doesn't exist -> Error 1146 Table 'test.t2' doesn't exist -40a74 -> ERROR 42S02: Unknown table 't1,t2' +--- checksum_table.result 2013-01-22 22:05:05.246633000 +0400 ++++ checksum_table.reject 2013-01-23 03:16:24.496332636 +0400 +@@ -1,40 +1,74 @@ + DROP TABLE IF EXISTS t1,t2; + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHECKSUM=0 PARTITION BY HASH(a) PARTITIONS 2; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) + INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); ++ERROR 42S02: Table 'test.t1' doesn't exist + CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHECKSUM=0 PARTITION BY HASH(a) PARTITIONS 2; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) + CHECKSUM TABLE t1; + Table Checksum +-test.t1 4272806499 ++test.t1 NULL ++Warnings: ++Error 1146 Table 'test.t1' doesn't exist + CHECKSUM TABLE t2, t1; + Table Checksum +-test.t2 0 +-test.t1 4272806499 ++test.t2 NULL ++test.t1 NULL ++Warnings: ++Error 1146 Table 'test.t2' doesn't exist ++Error 1146 Table 'test.t1' doesn't exist + CHECKSUM TABLE t1, t2 QUICK; + Table Checksum + test.t1 NULL + test.t2 NULL ++Warnings: ++Error 1146 Table 'test.t1' doesn't exist ++Error 1146 Table 'test.t2' doesn't exist + CHECKSUM TABLE t1, t2 EXTENDED; + Table Checksum +-test.t1 4272806499 +-test.t2 0 ++test.t1 NULL ++test.t2 NULL ++Warnings: ++Error 1146 Table 'test.t1' doesn't exist ++Error 1146 Table 'test.t2' doesn't exist + DROP TABLE t1, t2; ++ERROR 42S02: Unknown table 't1,t2' + DROP TABLE IF EXISTS t1,t2; + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHECKSUM=1 PARTITION BY HASH(a) PARTITIONS 2; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) + INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); ++ERROR 42S02: Table 'test.t1' doesn't exist + CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHECKSUM=1 PARTITION BY HASH(a) PARTITIONS 2; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) + CHECKSUM TABLE t1; + Table Checksum +-test.t1 0 ++test.t1 NULL ++Warnings: ++Error 1146 Table 'test.t1' doesn't exist + CHECKSUM TABLE t2, t1; + Table Checksum +-test.t2 0 +-test.t1 0 ++test.t2 NULL ++test.t1 NULL ++Warnings: ++Error 1146 Table 'test.t2' doesn't exist ++Error 1146 Table 'test.t1' doesn't exist + CHECKSUM TABLE t1, t2 QUICK; + Table Checksum +-test.t1 0 +-test.t2 0 ++test.t1 NULL ++test.t2 NULL ++Warnings: ++Error 1146 Table 'test.t1' doesn't exist ++Error 1146 Table 'test.t2' doesn't exist + CHECKSUM TABLE t1, t2 EXTENDED; + Table Checksum +-test.t1 4272806499 +-test.t2 0 ++test.t1 NULL ++test.t2 NULL ++Warnings: ++Error 1146 Table 'test.t1' doesn't exist ++Error 1146 Table 'test.t2' doesn't exist + DROP TABLE t1, t2; ++ERROR 42S02: Unknown table 't1,t2' diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff index 11fbc4812dc..d6aa75f1c44 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff @@ -1,156 +1,159 @@ -3,10c3,12 -< INSERT INTO t1 (a) VALUES (1),(2),(3),(2); -< EXPLAIN PARTITIONS SELECT a FROM t1; -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE t1 p0,p1 # # # # # # # -< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a=2; -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE t1 p0 # # # # # # # -< DROP TABLE t1; ---- -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ] -> # The statement|command finished with ER_PARTITION_MERGE_ERROR. -> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -12,19c14,23 -< INSERT INTO t1 (a) VALUES ('a'),('b'),('c'); -< EXPLAIN PARTITIONS SELECT a FROM t1; -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE t1 p0,p1 # # # # # # # -< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 'b'; -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE t1 p1 # # # # # # # -< DROP TABLE t1; ---- -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ CREATE TABLE t1 (a CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY KEY(a) PARTITIONS 2 ] -> # The statement|command finished with ER_PARTITION_MERGE_ERROR. -> # Partitions or CHAR types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -21,31c25,34 -< SHOW INDEX IN t1; -< Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -< t1 1 a 1 a # # NULL NULL # # -< INSERT INTO t1 (a) VALUES (1),(2),(3),(5); -< EXPLAIN PARTITIONS SELECT a FROM t1; -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE t1 p0,p1 # # # # # # # -< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a IN (1,3); -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE t1 p0 # # # # # # # -< DROP TABLE t1; ---- -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom indexed column options*/, /*!INDEX*/ /*Custom index*/ (a)) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY KEY(a) PARTITIONS 2 ] -> # The statement|command finished with ER_PARTITION_MERGE_ERROR. -> # Partitions or indexes or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -33,43c36,45 -< SHOW INDEX IN t1; -< Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -< t1 0 PRIMARY 1 a # # NULL NULL # # -< INSERT INTO t1 (a) VALUES (1),(200),(3),(2); -< EXPLAIN PARTITIONS SELECT a FROM t1; -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE t1 p0,p1 # # # # # # # -< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a=2; -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE t1 p1 # # # # # # # -< DROP TABLE t1; ---- -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom indexed column options*/ PRIMARY KEY) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY KEY() PARTITIONS 2 ] -> # The statement|command finished with ER_PARTITION_MERGE_ERROR. -> # PK or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -48,58c50,63 -< INSERT INTO t1 (a) VALUES (1),(2),(400); -< EXPLAIN PARTITIONS SELECT a FROM t1; -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE t1 p0,p1 # # # # # # # -< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 2; -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE t1 p0 # # # # # # # -< INSERT INTO t1 (a) VALUES (10000); -< ERROR HY000: Table has no partition for value 10000 -< DROP TABLE t1; -< CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) ( ---- -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY RANGE(a) ( -> PARTITION p0 VALUES LESS THAN (10), -> PARTITION p1 VALUES LESS THAN (1000) -> ) ] -> # The statement|command finished with ER_PARTITION_MERGE_ERROR. -> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -> CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) SUBPARTITION by HASH(b) ( -62,72c67,70 -< INSERT INTO t1 (a) VALUES (1),(101),(1); -< EXPLAIN PARTITIONS SELECT a FROM t1; -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE t1 abc,def # # # # # # # -< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100; -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE NULL NULL # # # # # # # -< INSERT INTO t1 (a) VALUES (50); -< ERROR HY000: Table has no partition for value 50 -< DROP TABLE t1; -< CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) SUBPARTITION by HASH(b) ( ---- -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY LIST(a) SUBPARTITION by HASH(b) ( -75,91c73,79 -< ); -< SHOW INDEX IN t1; -< Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -< INSERT INTO t1 (a,b) VALUES (1,1),(101,2),(1,3); -< EXPLAIN PARTITIONS SELECT a FROM t1; -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE t1 abc_abcsp0,def_defsp0 # # # # # # # -< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100; -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE NULL NULL # # # # # # # -< SELECT TABLE_SCHEMA, TABLE_NAME, PARTITION_NAME, SUBPARTITION_NAME, PARTITION_METHOD, SUBPARTITION_METHOD -< FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1'; -< TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_METHOD SUBPARTITION_METHOD -< test t1 abc abcsp0 LIST HASH -< test t1 def defsp0 LIST HASH -< SELECT * FROM INFORMATION_SCHEMA.PARTITIONS; -< DROP TABLE t1; ---- -> ) ] -> # The statement|command finished with ER_PARTITION_MERGE_ERROR. -> # Partitions or subpartitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- +--- create_table.result 2013-01-22 22:05:05.246633000 +0400 ++++ create_table.reject 2013-01-23 03:16:25.160324290 +0400 +@@ -1,91 +1,79 @@ + DROP TABLE IF EXISTS t1; + CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; +-INSERT INTO t1 (a) VALUES (1),(2),(3),(2); +-EXPLAIN PARTITIONS SELECT a FROM t1; +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 p0,p1 # # # # # # # +-EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a=2; +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 p0 # # # # # # # +-DROP TABLE t1; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ] ++# The statement|command finished with ER_PARTITION_MERGE_ERROR. ++# Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + CREATE TABLE t1 (a <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY KEY(a) PARTITIONS 2; +-INSERT INTO t1 (a) VALUES ('a'),('b'),('c'); +-EXPLAIN PARTITIONS SELECT a FROM t1; +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 p0,p1 # # # # # # # +-EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 'b'; +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 p1 # # # # # # # +-DROP TABLE t1; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ CREATE TABLE t1 (a CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY KEY(a) PARTITIONS 2 ] ++# The statement|command finished with ER_PARTITION_MERGE_ERROR. ++# Partitions or CHAR types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + CREATE TABLE t1 (a <INT_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY KEY(a) PARTITIONS 2; +-SHOW INDEX IN t1; +-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +-t1 1 a 1 a # # NULL NULL # # +-INSERT INTO t1 (a) VALUES (1),(2),(3),(5); +-EXPLAIN PARTITIONS SELECT a FROM t1; +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 p0,p1 # # # # # # # +-EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a IN (1,3); +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 p0 # # # # # # # +-DROP TABLE t1; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom indexed column options*/, /*!INDEX*/ /*Custom index*/ (a)) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY KEY(a) PARTITIONS 2 ] ++# The statement|command finished with ER_PARTITION_MERGE_ERROR. ++# Partitions or indexes or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + CREATE TABLE t1 (a <INT_COLUMN> PRIMARY KEY) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY KEY() PARTITIONS 2; +-SHOW INDEX IN t1; +-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +-t1 0 PRIMARY 1 a # # NULL NULL # # +-INSERT INTO t1 (a) VALUES (1),(200),(3),(2); +-EXPLAIN PARTITIONS SELECT a FROM t1; +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 p0,p1 # # # # # # # +-EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a=2; +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 p1 # # # # # # # +-DROP TABLE t1; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom indexed column options*/ PRIMARY KEY) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY KEY() PARTITIONS 2 ] ++# The statement|command finished with ER_PARTITION_MERGE_ERROR. ++# PK or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) ( + PARTITION p0 VALUES LESS THAN (10), + PARTITION p1 VALUES LESS THAN (1000) + ); +-INSERT INTO t1 (a) VALUES (1),(2),(400); +-EXPLAIN PARTITIONS SELECT a FROM t1; +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 p0,p1 # # # # # # # +-EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 2; +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 p0 # # # # # # # +-INSERT INTO t1 (a) VALUES (10000); +-ERROR HY000: Table has no partition for value 10000 +-DROP TABLE t1; +-CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) ( ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY RANGE(a) ( ++PARTITION p0 VALUES LESS THAN (10), ++PARTITION p1 VALUES LESS THAN (1000) ++) ] ++# The statement|command finished with ER_PARTITION_MERGE_ERROR. ++# Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- ++CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) SUBPARTITION by HASH(b) ( + PARTITION abc VALUES IN (1,2,3), + PARTITION def VALUES IN (100,101,102) + ); +-INSERT INTO t1 (a) VALUES (1),(101),(1); +-EXPLAIN PARTITIONS SELECT a FROM t1; +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 abc,def # # # # # # # +-EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100; +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE NULL NULL # # # # # # # +-INSERT INTO t1 (a) VALUES (50); +-ERROR HY000: Table has no partition for value 50 +-DROP TABLE t1; +-CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) SUBPARTITION by HASH(b) ( ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY LIST(a) SUBPARTITION by HASH(b) ( + PARTITION abc VALUES IN (1,2,3), + PARTITION def VALUES IN (100,101,102) +-); +-SHOW INDEX IN t1; +-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +-INSERT INTO t1 (a,b) VALUES (1,1),(101,2),(1,3); +-EXPLAIN PARTITIONS SELECT a FROM t1; +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 abc_abcsp0,def_defsp0 # # # # # # # +-EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100; +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE NULL NULL # # # # # # # +-SELECT TABLE_SCHEMA, TABLE_NAME, PARTITION_NAME, SUBPARTITION_NAME, PARTITION_METHOD, SUBPARTITION_METHOD +-FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1'; +-TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_METHOD SUBPARTITION_METHOD +-test t1 abc abcsp0 LIST HASH +-test t1 def defsp0 LIST HASH +-SELECT * FROM INFORMATION_SCHEMA.PARTITIONS; +-DROP TABLE t1; ++) ] ++# The statement|command finished with ER_PARTITION_MERGE_ERROR. ++# Partitions or subpartitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff index 350d93fe91f..242b3778846 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff @@ -1,91 +1,95 @@ -3,25c3,12 -< INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g'); -< CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) ( -< PARTITION p0 VALUES LESS THAN (100), -< PARTITION p1 VALUES LESS THAN MAXVALUE -< ); -< INSERT INTO t2 (a,b) SELECT a, b FROM t1; -< INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d'); -< ALTER TABLE t1 OPTIMIZE PARTITION p1; -< Table Op Msg_type Msg_text -< test.t1 optimize status OK -< INSERT INTO t2 (a,b) VALUES (4,'d'); -< ALTER TABLE t2 OPTIMIZE PARTITION p0 NO_WRITE_TO_BINLOG; -< Table Op Msg_type Msg_text -< test.t2 optimize status OK -< INSERT INTO t1 (a,b) VALUES (6,'f'); -< ALTER TABLE t1 OPTIMIZE PARTITION ALL LOCAL; -< Table Op Msg_type Msg_text -< test.t1 optimize status OK -< INSERT INTO t2 (a,b) VALUES (5,'e'); -< ALTER TABLE t2 OPTIMIZE PARTITION p1,p0; -< Table Op Msg_type Msg_text -< test.t2 optimize status OK -< DROP TABLE t1, t2; ---- -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ] -> # The statement|command finished with ER_PARTITION_MERGE_ERROR. -> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -27a15,16 -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -28a18 -> ERROR 42S02: Table 'test.t1' doesn't exist -29a20,21 -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -30a23 -> ERROR 42S02: Table 'test.t1' doesn't exist -33c26,27 -< test.t1 optimize status OK ---- -> test.t1 optimize Error Table 'test.t1' doesn't exist -> test.t1 optimize status Operation failed -34a29 -> ERROR 42S02: Table 'test.t2' doesn't exist -37c32,33 -< test.t2 optimize status OK ---- -> test.t2 optimize Error Table 'test.t2' doesn't exist -> test.t2 optimize status Operation failed -38a35 -> ERROR 42S02: Table 'test.t2' doesn't exist -39a37 -> ERROR 42S02: Table 'test.t1' doesn't exist -42,43c40,43 -< test.t1 optimize status OK -< test.t2 optimize status OK ---- -> test.t1 optimize Error Table 'test.t1' doesn't exist -> test.t1 optimize status Operation failed -> test.t2 optimize Error Table 'test.t2' doesn't exist -> test.t2 optimize status Operation failed -46,47c46,49 -< test.t1 optimize status OK -< test.t2 optimize status OK ---- -> test.t1 optimize Error Table 'test.t1' doesn't exist -> test.t1 optimize status Operation failed -> test.t2 optimize Error Table 'test.t2' doesn't exist -> test.t2 optimize status Operation failed -48a51 -> ERROR 42S02: Unknown table 't1,t2' -49a53,54 -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -50a56 -> ERROR 42S02: Table 'test.t1' doesn't exist -53c59,60 -< test.t1 optimize status OK ---- -> test.t1 optimize Error Table 'test.t1' doesn't exist -> test.t1 optimize status Operation failed -54a62 -> ERROR 42S02: Unknown table 't1' +--- optimize_table.result 2013-01-22 22:05:05.246633000 +0400 ++++ optimize_table.reject 2013-01-23 03:16:25.780316495 +0400 +@@ -1,54 +1,62 @@ + DROP TABLE IF EXISTS t1,t2; + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; +-INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g'); +-CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) ( +-PARTITION p0 VALUES LESS THAN (100), +-PARTITION p1 VALUES LESS THAN MAXVALUE +-); +-INSERT INTO t2 (a,b) SELECT a, b FROM t1; +-INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d'); +-ALTER TABLE t1 OPTIMIZE PARTITION p1; +-Table Op Msg_type Msg_text +-test.t1 optimize status OK +-INSERT INTO t2 (a,b) VALUES (4,'d'); +-ALTER TABLE t2 OPTIMIZE PARTITION p0 NO_WRITE_TO_BINLOG; +-Table Op Msg_type Msg_text +-test.t2 optimize status OK +-INSERT INTO t1 (a,b) VALUES (6,'f'); +-ALTER TABLE t1 OPTIMIZE PARTITION ALL LOCAL; +-Table Op Msg_type Msg_text +-test.t1 optimize status OK +-INSERT INTO t2 (a,b) VALUES (5,'e'); +-ALTER TABLE t2 OPTIMIZE PARTITION p1,p0; +-Table Op Msg_type Msg_text +-test.t2 optimize status OK +-DROP TABLE t1, t2; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ] ++# The statement|command finished with ER_PARTITION_MERGE_ERROR. ++# Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + DROP TABLE IF EXISTS t1,t2; + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) + INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); ++ERROR 42S02: Table 'test.t1' doesn't exist + CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) + INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d'); ++ERROR 42S02: Table 'test.t1' doesn't exist + OPTIMIZE TABLE t1; + Table Op Msg_type Msg_text +-test.t1 optimize status OK ++test.t1 optimize Error Table 'test.t1' doesn't exist ++test.t1 optimize status Operation failed + INSERT INTO t2 (a,b) VALUES (4,'d'); ++ERROR 42S02: Table 'test.t2' doesn't exist + OPTIMIZE NO_WRITE_TO_BINLOG TABLE t2; + Table Op Msg_type Msg_text +-test.t2 optimize status OK ++test.t2 optimize Error Table 'test.t2' doesn't exist ++test.t2 optimize status Operation failed + INSERT INTO t2 (a,b) VALUES (5,'e'); ++ERROR 42S02: Table 'test.t2' doesn't exist + INSERT INTO t1 (a,b) VALUES (6,'f'); ++ERROR 42S02: Table 'test.t1' doesn't exist + OPTIMIZE LOCAL TABLE t1, t2; + Table Op Msg_type Msg_text +-test.t1 optimize status OK +-test.t2 optimize status OK ++test.t1 optimize Error Table 'test.t1' doesn't exist ++test.t1 optimize status Operation failed ++test.t2 optimize Error Table 'test.t2' doesn't exist ++test.t2 optimize status Operation failed + OPTIMIZE TABLE t1, t2; + Table Op Msg_type Msg_text +-test.t1 optimize status OK +-test.t2 optimize status OK ++test.t1 optimize Error Table 'test.t1' doesn't exist ++test.t1 optimize status Operation failed ++test.t2 optimize Error Table 'test.t2' doesn't exist ++test.t2 optimize status Operation failed + DROP TABLE t1, t2; ++ERROR 42S02: Unknown table 't1,t2' + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) + INSERT INTO t1 (a,b) VALUES (1,'a'),(100,'b'),(2,'c'),(3,'d'); ++ERROR 42S02: Table 'test.t1' doesn't exist + OPTIMIZE TABLE t1; + Table Op Msg_type Msg_text +-test.t1 optimize status OK ++test.t1 optimize Error Table 'test.t1' doesn't exist ++test.t1 optimize status Operation failed + DROP TABLE t1; ++ERROR 42S02: Unknown table 't1' diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff index 4c39421261c..2b5d5f68346 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff @@ -1,295 +1,303 @@ -4,33c4,13 -< INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g'); -< CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) ( -< PARTITION p0 VALUES LESS THAN (100), -< PARTITION p1 VALUES LESS THAN MAXVALUE -< ); -< INSERT INTO t2 (a,b) SELECT a, b FROM t1; -< ALTER TABLE t1 REPAIR PARTITION p0; -< Table Op Msg_type Msg_text -< test.t1 repair status OK -< INSERT INTO t1 VALUES (3,'c'); -< ALTER TABLE t1 REPAIR PARTITION NO_WRITE_TO_BINLOG p0, p1; -< Table Op Msg_type Msg_text -< test.t1 repair status OK -< INSERT INTO t2 (a,b) VALUES (5,'e'),(6,'f'); -< ALTER TABLE t2 REPAIR PARTITION LOCAL p1; -< Table Op Msg_type Msg_text -< test.t2 repair status OK -< INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h'); -< ALTER TABLE t1 REPAIR PARTITION LOCAL ALL EXTENDED; -< Table Op Msg_type Msg_text -< test.t1 repair status OK -< INSERT INTO t1 VALUES (10,'j'); -< ALTER TABLE t1 REPAIR PARTITION p1 QUICK USE_FRM; -< Table Op Msg_type Msg_text -< test.t1 repair status OK -< INSERT INTO t2 (a,b) VALUES (12,'l'); -< ALTER TABLE t2 REPAIR PARTITION NO_WRITE_TO_BINLOG ALL QUICK EXTENDED USE_FRM; -< Table Op Msg_type Msg_text -< test.t2 repair status OK -< DROP TABLE t1, t2; ---- -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ] -> # The statement|command finished with ER_PARTITION_MERGE_ERROR. -> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -35a16,17 -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -36a19 -> ERROR 42S02: Table 'test.t1' doesn't exist -37a21,22 -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -40c25,26 -< test.t1 repair status OK ---- -> test.t1 repair Error Table 'test.t1' doesn't exist -> test.t1 repair status Operation failed -41a28 -> ERROR 42S02: Table 'test.t1' doesn't exist -42a30 -> ERROR 42S02: Table 'test.t2' doesn't exist -45,46c33,36 -< test.t1 repair status OK -< test.t2 repair status OK ---- -> test.t1 repair Error Table 'test.t1' doesn't exist -> test.t1 repair status Operation failed -> test.t2 repair Error Table 'test.t2' doesn't exist -> test.t2 repair status Operation failed -47a38 -> ERROR 42S02: Table 'test.t2' doesn't exist -50c41,42 -< test.t2 repair status OK ---- -> test.t2 repair Error Table 'test.t2' doesn't exist -> test.t2 repair status Operation failed -51a44 -> ERROR 42S02: Table 'test.t1' doesn't exist -52a46 -> ERROR 42S02: Table 'test.t2' doesn't exist -55,56c49,52 -< test.t2 repair status OK -< test.t1 repair status OK ---- -> test.t2 repair Error Table 'test.t2' doesn't exist -> test.t2 repair status Operation failed -> test.t1 repair Error Table 'test.t1' doesn't exist -> test.t1 repair status Operation failed -57a54 -> ERROR 42S02: Table 'test.t1' doesn't exist -58a56 -> ERROR 42S02: Table 'test.t2' doesn't exist -61,62c59,62 -< test.t1 repair status OK -< test.t2 repair status OK ---- -> test.t1 repair Error Table 'test.t1' doesn't exist -> test.t1 repair status Operation failed -> test.t2 repair Error Table 'test.t2' doesn't exist -> test.t2 repair status Operation failed -63a64 -> ERROR 42S02: Table 'test.t1' doesn't exist -64a66 -> ERROR 42S02: Table 'test.t2' doesn't exist -67,68c69,72 -< test.t1 repair status OK -< test.t2 repair status OK ---- -> test.t1 repair Error Table 'test.t1' doesn't exist -> test.t1 repair status Operation failed -> test.t2 repair Error Table 'test.t2' doesn't exist -> test.t2 repair status Operation failed -71,73c75,76 -< ERROR HY000: Failed to read from the .par file -< # Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY). -< # If you got a difference in error message, just add it to rdiff file ---- -> ERROR 42S02: Table 'test.t1' doesn't exist -> # ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: 0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY) -76,78c79,80 -< test.t1 check Error Failed to read from the .par file -< test.t1 check Error Incorrect information in file: './test/t1.frm' -< test.t1 check error Corrupt ---- -> test.t1 check Error Table 'test.t1' doesn't exist -> test.t1 check status Operation failed -80,82c82,83 -< ERROR HY000: Failed to read from the .par file -< # Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY). -< # If you got a difference in error message, just add it to rdiff file ---- -> ERROR 42S02: Table 'test.t1' doesn't exist -> # ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: 0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY) -85,87c86,87 -< test.t1 repair Error Failed to read from the .par file -< test.t1 repair Error Incorrect information in file: './test/t1.frm' -< test.t1 repair error Corrupt ---- -> test.t1 repair Error Table 'test.t1' doesn't exist -> test.t1 repair status Operation failed -88a89 -> ERROR 42S02: Unknown table 't1,t2' -93a95,96 -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -96c99,100 -< test.t1 repair status OK ---- -> test.t1 repair Error Table 'test.t1' doesn't exist -> test.t1 repair status Operation failed -97a102 -> ERROR 42S02: Table 'test.t1' doesn't exist -100c105,106 -< test.t1 repair status OK ---- -> test.t1 repair Error Table 'test.t1' doesn't exist -> test.t1 repair status Operation failed -101a108 -> ERROR 42S02: Table 'test.t1' doesn't exist -104,235c111,112 -< test.t1 repair status OK -< t1#P#p0.MYD -< t1#P#p0.MYI -< t1#P#p1.MYD -< t1#P#p1.MYI -< t1.frm -< t1.par -< INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o'); -< # Statement ended with one of expected results (0,144). -< # If you got a difference in error message, just add it to rdiff file -< FLUSH TABLE t1; -< Restoring <DATADIR>/test/t1#P#p0.MYD -< CHECK TABLE t1; -< Table Op Msg_type Msg_text -< test.t1 check error Size of datafile is: 26 Should be: 39 -< test.t1 check error Partition p0 returned error -< test.t1 check error Corrupt -< SELECT * FROM t1; -< a b -< 8 h -< 10 j -< 7 g -< 15 o -< Warnings: -< Error 145 Table './test/t1#P#p0' is marked as crashed and should be repaired -< Error 1194 Table 't1' is marked as crashed and should be repaired -< Error 1034 Number of rows changed from 3 to 2 -< # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144). -< # If you got a difference in error message, just add it to rdiff file -< INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o'); -< # Statement ended with one of expected results (0,144). -< # If you got a difference in error message, just add it to rdiff file -< FLUSH TABLE t1; -< Restoring <DATADIR>/test/t1#P#p0.MYI -< CHECK TABLE t1; -< Table Op Msg_type Msg_text -< test.t1 check warning Size of datafile is: 39 Should be: 26 -< test.t1 check error Record-count is not ok; is 3 Should be: 2 -< test.t1 check warning Found 3 key parts. Should be: 2 -< test.t1 check error Partition p0 returned error -< test.t1 check error Corrupt -< SELECT * FROM t1; -< a b -< 8 h -< 10 j -< 14 n -< 7 g -< 15 o -< 15 o -< Warnings: -< Error 145 Table './test/t1#P#p0' is marked as crashed and should be repaired -< Error 1194 Table 't1' is marked as crashed and should be repaired -< Error 1034 Number of rows changed from 2 to 3 -< # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144). -< # If you got a difference in error message, just add it to rdiff file -< INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o'); -< # Statement ended with one of expected results (0,144). -< # If you got a difference in error message, just add it to rdiff file -< FLUSH TABLE t1; -< Restoring <DATADIR>/test/t1#P#p1.MYD -< CHECK TABLE t1; -< Table Op Msg_type Msg_text -< test.t1 check error Size of datafile is: 39 Should be: 52 -< test.t1 check error Partition p1 returned error -< test.t1 check error Corrupt -< SELECT * FROM t1; -< a b -< 8 h -< 10 j -< 14 n -< 14 n -< 7 g -< 15 o -< 15 o -< Warnings: -< Error 145 Table './test/t1#P#p1' is marked as crashed and should be repaired -< Error 1194 Table 't1' is marked as crashed and should be repaired -< Error 1034 Number of rows changed from 4 to 3 -< # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144). -< # If you got a difference in error message, just add it to rdiff file -< INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o'); -< # Statement ended with one of expected results (0,144). -< # If you got a difference in error message, just add it to rdiff file -< FLUSH TABLE t1; -< Restoring <DATADIR>/test/t1#P#p1.MYI -< CHECK TABLE t1; -< Table Op Msg_type Msg_text -< test.t1 check warning Size of datafile is: 52 Should be: 39 -< test.t1 check error Record-count is not ok; is 4 Should be: 3 -< test.t1 check warning Found 4 key parts. Should be: 3 -< test.t1 check error Partition p1 returned error -< test.t1 check error Corrupt -< SELECT * FROM t1; -< a b -< 8 h -< 10 j -< 14 n -< 14 n -< 14 n -< 7 g -< 15 o -< 15 o -< 15 o -< Warnings: -< Error 145 Table './test/t1#P#p1' is marked as crashed and should be repaired -< Error 1194 Table 't1' is marked as crashed and should be repaired -< Error 1034 Number of rows changed from 3 to 4 -< # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144). -< # If you got a difference in error message, just add it to rdiff file -< INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o'); -< # Statement ended with one of expected results (0,144). -< # If you got a difference in error message, just add it to rdiff file -< FLUSH TABLE t1; -< Restoring <DATADIR>/test/t1.par -< CHECK TABLE t1; -< Table Op Msg_type Msg_text -< test.t1 check status OK -< SELECT * FROM t1; -< a b -< 8 h -< 10 j -< 14 n -< 14 n -< 14 n -< 14 n -< 7 g -< 15 o -< 15 o -< 15 o -< 15 o -< # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144). -< # If you got a difference in error message, just add it to rdiff file ---- -> test.t1 repair Error Table 'test.t1' doesn't exist -> test.t1 repair status Operation failed -236a114 -> ERROR 42S02: Unknown table 't1' +--- repair_table.result 2013-01-23 01:35:44.388267080 +0400 ++++ repair_table.reject 2013-01-23 03:16:26.468307847 +0400 +@@ -1,236 +1,114 @@ + call mtr.add_suppression("Table '.*t1.*' is marked as crashed and should be repaired"); + DROP TABLE IF EXISTS t1, t2; + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; +-INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g'); +-CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) ( +-PARTITION p0 VALUES LESS THAN (100), +-PARTITION p1 VALUES LESS THAN MAXVALUE +-); +-INSERT INTO t2 (a,b) SELECT a, b FROM t1; +-ALTER TABLE t1 REPAIR PARTITION p0; +-Table Op Msg_type Msg_text +-test.t1 repair status OK +-INSERT INTO t1 (a,b) VALUES (3,'c'); +-ALTER TABLE t1 REPAIR PARTITION NO_WRITE_TO_BINLOG p0, p1; +-Table Op Msg_type Msg_text +-test.t1 repair status OK +-INSERT INTO t2 (a,b) VALUES (5,'e'),(6,'f'); +-ALTER TABLE t2 REPAIR PARTITION LOCAL p1; +-Table Op Msg_type Msg_text +-test.t2 repair status OK +-INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h'); +-ALTER TABLE t1 REPAIR PARTITION LOCAL ALL EXTENDED; +-Table Op Msg_type Msg_text +-test.t1 repair status OK +-INSERT INTO t1 (a,b) VALUES (10,'j'); +-ALTER TABLE t1 REPAIR PARTITION p1 QUICK USE_FRM; +-Table Op Msg_type Msg_text +-test.t1 repair status OK +-INSERT INTO t2 (a,b) VALUES (12,'l'); +-ALTER TABLE t2 REPAIR PARTITION NO_WRITE_TO_BINLOG ALL QUICK EXTENDED USE_FRM; +-Table Op Msg_type Msg_text +-test.t2 repair status OK +-DROP TABLE t1, t2; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ] ++# The statement|command finished with ER_PARTITION_MERGE_ERROR. ++# Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + DROP TABLE IF EXISTS t1,t2; + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) + INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); ++ERROR 42S02: Table 'test.t1' doesn't exist + CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) + REPAIR TABLE t1; + Table Op Msg_type Msg_text +-test.t1 repair status OK ++test.t1 repair Error Table 'test.t1' doesn't exist ++test.t1 repair status Operation failed + INSERT INTO t1 (a,b) VALUES (3,'c'); ++ERROR 42S02: Table 'test.t1' doesn't exist + INSERT INTO t2 (a,b) VALUES (4,'d'); ++ERROR 42S02: Table 'test.t2' doesn't exist + REPAIR NO_WRITE_TO_BINLOG TABLE t1, t2; + Table Op Msg_type Msg_text +-test.t1 repair status OK +-test.t2 repair status OK ++test.t1 repair Error Table 'test.t1' doesn't exist ++test.t1 repair status Operation failed ++test.t2 repair Error Table 'test.t2' doesn't exist ++test.t2 repair status Operation failed + INSERT INTO t2 (a,b) VALUES (5,'e'),(6,'f'); ++ERROR 42S02: Table 'test.t2' doesn't exist + REPAIR LOCAL TABLE t2; + Table Op Msg_type Msg_text +-test.t2 repair status OK ++test.t2 repair Error Table 'test.t2' doesn't exist ++test.t2 repair status Operation failed + INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h'); ++ERROR 42S02: Table 'test.t1' doesn't exist + INSERT INTO t2 (a,b) VALUES (9,'i'); ++ERROR 42S02: Table 'test.t2' doesn't exist + REPAIR LOCAL TABLE t2, t1 EXTENDED; + Table Op Msg_type Msg_text +-test.t2 repair status OK +-test.t1 repair status OK ++test.t2 repair Error Table 'test.t2' doesn't exist ++test.t2 repair status Operation failed ++test.t1 repair Error Table 'test.t1' doesn't exist ++test.t1 repair status Operation failed + INSERT INTO t1 (a,b) VALUES (10,'j'); ++ERROR 42S02: Table 'test.t1' doesn't exist + INSERT INTO t2 (a,b) VALUES (11,'k'); ++ERROR 42S02: Table 'test.t2' doesn't exist + REPAIR TABLE t1, t2 QUICK USE_FRM; + Table Op Msg_type Msg_text +-test.t1 repair status OK +-test.t2 repair status OK ++test.t1 repair Error Table 'test.t1' doesn't exist ++test.t1 repair status Operation failed ++test.t2 repair Error Table 'test.t2' doesn't exist ++test.t2 repair status Operation failed + INSERT INTO t1 (a,b) VALUES (12,'l'); ++ERROR 42S02: Table 'test.t1' doesn't exist + INSERT INTO t2 (a,b) VALUES (13,'m'); ++ERROR 42S02: Table 'test.t2' doesn't exist + REPAIR NO_WRITE_TO_BINLOG TABLE t1, t2 QUICK EXTENDED USE_FRM; + Table Op Msg_type Msg_text +-test.t1 repair status OK +-test.t2 repair status OK ++test.t1 repair Error Table 'test.t1' doesn't exist ++test.t1 repair status Operation failed ++test.t2 repair Error Table 'test.t2' doesn't exist ++test.t2 repair status Operation failed + FLUSH TABLE t1; + INSERT INTO t1 (a,b) VALUES (14,'n'); +-ERROR HY000: Failed to read from the .par file +-# Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY). +-# If you got a difference in error message, just add it to rdiff file ++ERROR 42S02: Table 'test.t1' doesn't exist ++# ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: 0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY) + CHECK TABLE t1; + Table Op Msg_type Msg_text +-test.t1 check Error Failed to read from the .par file +-test.t1 check Error Incorrect information in file: './test/t1.frm' +-test.t1 check error Corrupt ++test.t1 check Error Table 'test.t1' doesn't exist ++test.t1 check status Operation failed + SELECT a,b FROM t1; +-ERROR HY000: Failed to read from the .par file +-# Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY). +-# If you got a difference in error message, just add it to rdiff file ++ERROR 42S02: Table 'test.t1' doesn't exist ++# ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: 0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY) + REPAIR TABLE t1; + Table Op Msg_type Msg_text +-test.t1 repair Error Failed to read from the .par file +-test.t1 repair Error Incorrect information in file: './test/t1.frm' +-test.t1 repair error Corrupt ++test.t1 repair Error Table 'test.t1' doesn't exist ++test.t1 repair status Operation failed + DROP TABLE t1, t2; ++ERROR 42S02: Unknown table 't1,t2' + call mtr.add_suppression("Got an error from thread_id=.*"); + call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table"); + call mtr.add_suppression(" '\..test.t1'"); + call mtr.add_suppression("Couldn't repair table: test.t1"); + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) + REPAIR TABLE t1; + Table Op Msg_type Msg_text +-test.t1 repair status OK ++test.t1 repair Error Table 'test.t1' doesn't exist ++test.t1 repair status Operation failed + INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h'); ++ERROR 42S02: Table 'test.t1' doesn't exist + REPAIR TABLE t1 EXTENDED; + Table Op Msg_type Msg_text +-test.t1 repair status OK ++test.t1 repair Error Table 'test.t1' doesn't exist ++test.t1 repair status Operation failed + INSERT INTO t1 (a,b) VALUES (10,'j'); ++ERROR 42S02: Table 'test.t1' doesn't exist + REPAIR TABLE t1 USE_FRM; + Table Op Msg_type Msg_text +-test.t1 repair status OK +-t1#P#p0.MYD +-t1#P#p0.MYI +-t1#P#p1.MYD +-t1#P#p1.MYI +-t1.frm +-t1.par +-INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o'); +-# Statement ended with one of expected results (0,144). +-# If you got a difference in error message, just add it to rdiff file +-FLUSH TABLE t1; +-Restoring <DATADIR>/test/t1#P#p0.MYD +-CHECK TABLE t1; +-Table Op Msg_type Msg_text +-test.t1 check error Size of datafile is: 26 Should be: 39 +-test.t1 check error Partition p0 returned error +-test.t1 check error Corrupt +-SELECT a,b FROM t1; +-a b +-8 h +-10 j +-7 g +-15 o +-Warnings: +-Error 145 Table './test/t1#P#p0' is marked as crashed and should be repaired +-Error 1194 Table 't1' is marked as crashed and should be repaired +-Error 1034 Number of rows changed from 3 to 2 +-# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144). +-# If you got a difference in error message, just add it to rdiff file +-INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o'); +-# Statement ended with one of expected results (0,144). +-# If you got a difference in error message, just add it to rdiff file +-FLUSH TABLE t1; +-Restoring <DATADIR>/test/t1#P#p0.MYI +-CHECK TABLE t1; +-Table Op Msg_type Msg_text +-test.t1 check warning Size of datafile is: 39 Should be: 26 +-test.t1 check error Record-count is not ok; is 3 Should be: 2 +-test.t1 check warning Found 3 key parts. Should be: 2 +-test.t1 check error Partition p0 returned error +-test.t1 check error Corrupt +-SELECT a,b FROM t1; +-a b +-8 h +-10 j +-14 n +-7 g +-15 o +-15 o +-Warnings: +-Error 145 Table './test/t1#P#p0' is marked as crashed and should be repaired +-Error 1194 Table 't1' is marked as crashed and should be repaired +-Error 1034 Number of rows changed from 2 to 3 +-# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144). +-# If you got a difference in error message, just add it to rdiff file +-INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o'); +-# Statement ended with one of expected results (0,144). +-# If you got a difference in error message, just add it to rdiff file +-FLUSH TABLE t1; +-Restoring <DATADIR>/test/t1#P#p1.MYD +-CHECK TABLE t1; +-Table Op Msg_type Msg_text +-test.t1 check error Size of datafile is: 39 Should be: 52 +-test.t1 check error Partition p1 returned error +-test.t1 check error Corrupt +-SELECT a,b FROM t1; +-a b +-8 h +-10 j +-14 n +-14 n +-7 g +-15 o +-15 o +-Warnings: +-Error 145 Table './test/t1#P#p1' is marked as crashed and should be repaired +-Error 1194 Table 't1' is marked as crashed and should be repaired +-Error 1034 Number of rows changed from 4 to 3 +-# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144). +-# If you got a difference in error message, just add it to rdiff file +-INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o'); +-# Statement ended with one of expected results (0,144). +-# If you got a difference in error message, just add it to rdiff file +-FLUSH TABLE t1; +-Restoring <DATADIR>/test/t1#P#p1.MYI +-CHECK TABLE t1; +-Table Op Msg_type Msg_text +-test.t1 check warning Size of datafile is: 52 Should be: 39 +-test.t1 check error Record-count is not ok; is 4 Should be: 3 +-test.t1 check warning Found 4 key parts. Should be: 3 +-test.t1 check error Partition p1 returned error +-test.t1 check error Corrupt +-SELECT a,b FROM t1; +-a b +-8 h +-10 j +-14 n +-14 n +-14 n +-7 g +-15 o +-15 o +-15 o +-Warnings: +-Error 145 Table './test/t1#P#p1' is marked as crashed and should be repaired +-Error 1194 Table 't1' is marked as crashed and should be repaired +-Error 1034 Number of rows changed from 3 to 4 +-# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144). +-# If you got a difference in error message, just add it to rdiff file +-INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o'); +-# Statement ended with one of expected results (0,144). +-# If you got a difference in error message, just add it to rdiff file +-FLUSH TABLE t1; +-Restoring <DATADIR>/test/t1.par +-CHECK TABLE t1; +-Table Op Msg_type Msg_text +-test.t1 check status OK +-SELECT a,b FROM t1; +-a b +-8 h +-10 j +-14 n +-14 n +-14 n +-14 n +-7 g +-15 o +-15 o +-15 o +-15 o +-# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144). +-# If you got a difference in error message, just add it to rdiff file ++test.t1 repair Error Table 'test.t1' doesn't exist ++test.t1 repair status Operation failed + DROP TABLE t1; ++ERROR 42S02: Unknown table 't1' diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff index 2c1364d52e1..01bf3702a3f 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff @@ -1,100 +1,101 @@ -3,8c3,12 -< TRUNCATE TABLE t1; -< INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c'); -< TRUNCATE TABLE t1; -< SELECT * FROM t1; -< a b -< DROP TABLE t1; ---- -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ] -> # The statement|command finished with ER_PARTITION_MERGE_ERROR. -> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -10,52c14,23 -< SHOW CREATE TABLE t1; -< Table Create Table -< t1 CREATE TABLE `t1` ( -< `a` int(11) NOT NULL AUTO_INCREMENT, -< `c` char(8) DEFAULT NULL, -< PRIMARY KEY (`a`) -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 -< /*!50100 PARTITION BY HASH (a) -< PARTITIONS 2 */ -< INSERT INTO t1 (c) VALUES ('a'),('b'),('c'); -< SHOW CREATE TABLE t1; -< Table Create Table -< t1 CREATE TABLE `t1` ( -< `a` int(11) NOT NULL AUTO_INCREMENT, -< `c` char(8) DEFAULT NULL, -< PRIMARY KEY (`a`) -< ) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 -< /*!50100 PARTITION BY HASH (a) -< PARTITIONS 2 */ -< TRUNCATE TABLE t1; -< SHOW CREATE TABLE t1; -< Table Create Table -< t1 CREATE TABLE `t1` ( -< `a` int(11) NOT NULL AUTO_INCREMENT, -< `c` char(8) DEFAULT NULL, -< PRIMARY KEY (`a`) -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 -< /*!50100 PARTITION BY HASH (a) -< PARTITIONS 2 */ -< INSERT INTO t1 (c) VALUES ('d'); -< SHOW CREATE TABLE t1; -< Table Create Table -< t1 CREATE TABLE `t1` ( -< `a` int(11) NOT NULL AUTO_INCREMENT, -< `c` char(8) DEFAULT NULL, -< PRIMARY KEY (`a`) -< ) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -< /*!50100 PARTITION BY HASH (a) -< PARTITIONS 2 */ -< SELECT * FROM t1; -< a c -< 1 d -< DROP TABLE t1; ---- -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom indexed column options*/ KEY AUTO_INCREMENT, c CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ] -> # The statement|command finished with ER_PARTITION_MERGE_ERROR. -> # Partitions or PK or auto-increment or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -54,68c25,34 -< INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g'); -< ALTER TABLE t1 TRUNCATE PARTITION p0; -< SELECT * FROM t1; -< a b -< 1 a -< 101 g -< 3 c -< EXPLAIN PARTITIONS SELECT * FROM t1; -< id select_type table partitions type possible_keys key key_len ref rows Extra -< 1 SIMPLE t1 p0,p1 # # # # # # -< INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c'); -< ALTER TABLE t1 TRUNCATE PARTITION ALL; -< SELECT * FROM t1; -< a b -< DROP TABLE t1; ---- -> ERROR HY000: Engine cannot be used in partitioned tables -> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ] -> # The statement|command finished with ER_PARTITION_MERGE_ERROR. -> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- +--- truncate_table.result 2013-01-22 22:05:05.246633000 +0400 ++++ truncate_table.reject 2013-01-23 03:16:27.076300201 +0400 +@@ -1,68 +1,34 @@ + DROP TABLE IF EXISTS t1; + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; +-TRUNCATE TABLE t1; +-INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c'); +-TRUNCATE TABLE t1; +-SELECT a,b FROM t1; +-a b +-DROP TABLE t1; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ] ++# The statement|command finished with ER_PARTITION_MERGE_ERROR. ++# Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + CREATE TABLE t1 (a <INT_COLUMN> KEY AUTO_INCREMENT, c <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; +-SHOW CREATE TABLE t1; +-Table Create Table +-t1 CREATE TABLE `t1` ( +- `a` int(11) NOT NULL AUTO_INCREMENT, +- `c` char(8) DEFAULT NULL, +- PRIMARY KEY (`a`) +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 +-/*!50100 PARTITION BY HASH (a) +-PARTITIONS 2 */ +-INSERT INTO t1 (c) VALUES ('a'),('b'),('c'); +-SHOW CREATE TABLE t1; +-Table Create Table +-t1 CREATE TABLE `t1` ( +- `a` int(11) NOT NULL AUTO_INCREMENT, +- `c` char(8) DEFAULT NULL, +- PRIMARY KEY (`a`) +-) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 +-/*!50100 PARTITION BY HASH (a) +-PARTITIONS 2 */ +-TRUNCATE TABLE t1; +-SHOW CREATE TABLE t1; +-Table Create Table +-t1 CREATE TABLE `t1` ( +- `a` int(11) NOT NULL AUTO_INCREMENT, +- `c` char(8) DEFAULT NULL, +- PRIMARY KEY (`a`) +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 +-/*!50100 PARTITION BY HASH (a) +-PARTITIONS 2 */ +-INSERT INTO t1 (c) VALUES ('d'); +-SHOW CREATE TABLE t1; +-Table Create Table +-t1 CREATE TABLE `t1` ( +- `a` int(11) NOT NULL AUTO_INCREMENT, +- `c` char(8) DEFAULT NULL, +- PRIMARY KEY (`a`) +-) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +-/*!50100 PARTITION BY HASH (a) +-PARTITIONS 2 */ +-SELECT a,c FROM t1; +-a c +-1 d +-DROP TABLE t1; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom indexed column options*/ KEY AUTO_INCREMENT, c CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ] ++# The statement|command finished with ER_PARTITION_MERGE_ERROR. ++# Partitions or PK or auto-increment or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; +-INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g'); +-ALTER TABLE t1 TRUNCATE PARTITION p0; +-SELECT a,b FROM t1; +-a b +-1 a +-101 g +-3 c +-EXPLAIN PARTITIONS SELECT a,b FROM t1; +-id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 p0,p1 # # # # # # +-INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c'); +-ALTER TABLE t1 TRUNCATE PARTITION ALL; +-SELECT a,b FROM t1; +-a b +-DROP TABLE t1; ++ERROR HY000: Engine cannot be used in partitioned tables ++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ] ++# The statement|command finished with ER_PARTITION_MERGE_ERROR. ++# Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- diff --git a/storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff index 180647323bc..9ff8f906511 100644 --- a/storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff @@ -1,103 +1,131 @@ -7c7 -< test.t1 repair status OK ---- -> test.t1 repair note The storage engine for the table doesn't support repair -12,13c12,13 -< test.t1 repair status OK -< test.t2 repair status OK ---- -> test.t1 repair note The storage engine for the table doesn't support repair -> test.t2 repair note The storage engine for the table doesn't support repair -17c17 -< test.t2 repair status OK ---- -> test.t2 repair note The storage engine for the table doesn't support repair -22,23c22,23 -< test.t2 repair status OK -< test.t1 repair status OK ---- -> test.t2 repair note The storage engine for the table doesn't support repair -> test.t1 repair note The storage engine for the table doesn't support repair -28,31c28,29 -< test.t1 repair warning Number of rows changed from 0 to 6 -< test.t1 repair status OK -< test.t2 repair warning Number of rows changed from 0 to 5 -< test.t2 repair status OK ---- -> test.t1 repair note The storage engine for the table doesn't support repair -> test.t2 repair note The storage engine for the table doesn't support repair -36,39c34,35 -< test.t1 repair warning Number of rows changed from 0 to 7 -< test.t1 repair status OK -< test.t2 repair warning Number of rows changed from 0 to 6 -< test.t2 repair status OK ---- -> test.t1 repair note The storage engine for the table doesn't support repair -> test.t2 repair note The storage engine for the table doesn't support repair -42c38 -< ERROR HY000: Incorrect file format 't1' ---- -> ERROR HY000: Table 't1' is read only -47,48c43 -< test.t1 check Error Incorrect file format 't1' -< test.t1 check error Corrupt ---- -> test.t1 check status OK -50c45 -< ERROR HY000: Incorrect file format 't1' ---- -> a b -55,56c50 -< test.t1 repair Error Incorrect file format 't1' -< test.t1 repair error Corrupt ---- -> test.t1 repair note The storage engine for the table doesn't support repair -65c59 -< test.t1 repair status OK ---- -> test.t1 repair note The storage engine for the table doesn't support repair -69c63 -< test.t1 repair status OK ---- -> test.t1 repair note The storage engine for the table doesn't support repair -73,76c67,68 -< test.t1 repair warning Number of rows changed from 0 to 3 -< test.t1 repair status OK -< t1.MYD -< t1.MYI ---- -> test.t1 repair note The storage engine for the table doesn't support repair -> t1.MRG -82c74 -< Restoring <DATADIR>/test/t1.MYD ---- -> Restoring <DATADIR>/test/t1.MRG -85,86c77 -< test.t1 check error Size of datafile is: 39 Should be: 65 -< test.t1 check error Corrupt ---- -> test.t1 check status OK -88,103c79,84 -< ERROR HY000: Incorrect key file for table 't1'; try to repair it -< # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144). -< # If you got a difference in error message, just add it to rdiff file -< INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o'); -< ERROR HY000: Table './test/t1' is marked as crashed and last (automatic?) repair failed -< # Statement ended with one of expected results (0,144). -< # If you got a difference in error message, just add it to rdiff file -< FLUSH TABLE t1; -< Restoring <DATADIR>/test/t1.MYI -< CHECK TABLE t1; -< Table Op Msg_type Msg_text -< test.t1 check warning Table is marked as crashed and last repair failed -< test.t1 check error Size of datafile is: 39 Should be: 65 -< test.t1 check error Corrupt -< SELECT * FROM t1; -< ERROR HY000: Table './test/t1' is marked as crashed and last (automatic?) repair failed ---- -> a b -> 7 g -> 8 h -> 10 j -> 14 n -> 15 o +--- repair_table.result 2013-01-23 01:26:05.995538460 +0400 ++++ repair_table.reject 2013-01-23 02:50:55.035560564 +0400 +@@ -4,56 +4,50 @@ + CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + REPAIR TABLE t1; + Table Op Msg_type Msg_text +-test.t1 repair status OK ++test.t1 repair note The storage engine for the table doesn't support repair + INSERT INTO t1 (a,b) VALUES (3,'c'); + INSERT INTO t2 (a,b) VALUES (4,'d'); + REPAIR NO_WRITE_TO_BINLOG TABLE t1, t2; + Table Op Msg_type Msg_text +-test.t1 repair status OK +-test.t2 repair status OK ++test.t1 repair note The storage engine for the table doesn't support repair ++test.t2 repair note The storage engine for the table doesn't support repair + INSERT INTO t2 (a,b) VALUES (5,'e'),(6,'f'); + REPAIR LOCAL TABLE t2; + Table Op Msg_type Msg_text +-test.t2 repair status OK ++test.t2 repair note The storage engine for the table doesn't support repair + INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h'); + INSERT INTO t2 (a,b) VALUES (9,'i'); + REPAIR LOCAL TABLE t2, t1 EXTENDED; + Table Op Msg_type Msg_text +-test.t2 repair status OK +-test.t1 repair status OK ++test.t2 repair note The storage engine for the table doesn't support repair ++test.t1 repair note The storage engine for the table doesn't support repair + INSERT INTO t1 (a,b) VALUES (10,'j'); + INSERT INTO t2 (a,b) VALUES (11,'k'); + REPAIR TABLE t1, t2 QUICK USE_FRM; + Table Op Msg_type Msg_text +-test.t1 repair warning Number of rows changed from 0 to 6 +-test.t1 repair status OK +-test.t2 repair warning Number of rows changed from 0 to 5 +-test.t2 repair status OK ++test.t1 repair note The storage engine for the table doesn't support repair ++test.t2 repair note The storage engine for the table doesn't support repair + INSERT INTO t1 (a,b) VALUES (12,'l'); + INSERT INTO t2 (a,b) VALUES (13,'m'); + REPAIR NO_WRITE_TO_BINLOG TABLE t1, t2 QUICK EXTENDED USE_FRM; + Table Op Msg_type Msg_text +-test.t1 repair warning Number of rows changed from 0 to 7 +-test.t1 repair status OK +-test.t2 repair warning Number of rows changed from 0 to 6 +-test.t2 repair status OK ++test.t1 repair note The storage engine for the table doesn't support repair ++test.t2 repair note The storage engine for the table doesn't support repair + FLUSH TABLE t1; + INSERT INTO t1 (a,b) VALUES (14,'n'); +-ERROR HY000: Incorrect file format 't1' ++ERROR HY000: Table 't1' is read only + # Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY). + # If you got a difference in error message, just add it to rdiff file + CHECK TABLE t1; + Table Op Msg_type Msg_text +-test.t1 check Error Incorrect file format 't1' +-test.t1 check error Corrupt ++test.t1 check status OK + SELECT a,b FROM t1; +-ERROR HY000: Incorrect file format 't1' ++a b + # Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY). + # If you got a difference in error message, just add it to rdiff file + REPAIR TABLE t1; + Table Op Msg_type Msg_text +-test.t1 repair Error Incorrect file format 't1' +-test.t1 repair error Corrupt ++test.t1 repair note The storage engine for the table doesn't support repair + DROP TABLE t1, t2; + call mtr.add_suppression("Got an error from thread_id=.*"); + call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table"); +@@ -62,45 +56,32 @@ + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + REPAIR TABLE t1; + Table Op Msg_type Msg_text +-test.t1 repair status OK ++test.t1 repair note The storage engine for the table doesn't support repair + INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h'); + REPAIR TABLE t1 EXTENDED; + Table Op Msg_type Msg_text +-test.t1 repair status OK ++test.t1 repair note The storage engine for the table doesn't support repair + INSERT INTO t1 (a,b) VALUES (10,'j'); + REPAIR TABLE t1 USE_FRM; + Table Op Msg_type Msg_text +-test.t1 repair warning Number of rows changed from 0 to 3 +-test.t1 repair status OK +-t1.MYD +-t1.MYI ++test.t1 repair note The storage engine for the table doesn't support repair ++t1.MRG + t1.frm + INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o'); + # Statement ended with one of expected results (0,144). + # If you got a difference in error message, just add it to rdiff file + FLUSH TABLE t1; +-Restoring <DATADIR>/test/t1.MYD ++Restoring <DATADIR>/test/t1.MRG + CHECK TABLE t1; + Table Op Msg_type Msg_text +-test.t1 check error Size of datafile is: 39 Should be: 65 +-test.t1 check error Corrupt ++test.t1 check status OK + SELECT a,b FROM t1; +-ERROR HY000: Incorrect key file for table 't1'; try to repair it +-# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144). +-# If you got a difference in error message, just add it to rdiff file +-INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o'); +-ERROR HY000: Table './test/t1' is marked as crashed and last (automatic?) repair failed +-# Statement ended with one of expected results (0,144). +-# If you got a difference in error message, just add it to rdiff file +-FLUSH TABLE t1; +-Restoring <DATADIR>/test/t1.MYI +-CHECK TABLE t1; +-Table Op Msg_type Msg_text +-test.t1 check warning Table is marked as crashed and last repair failed +-test.t1 check error Size of datafile is: 39 Should be: 65 +-test.t1 check error Corrupt +-SELECT a,b FROM t1; +-ERROR HY000: Table './test/t1' is marked as crashed and last (automatic?) repair failed ++a b ++7 g ++8 h ++10 j ++14 n ++15 o + # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144). + # If you got a difference in error message, just add it to rdiff file + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff b/storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff index e7c9b0176b6..e78e6fdad53 100644 --- a/storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff @@ -1,2 +1,10 @@ -7d6 -< <STORAGE_ENGINE> ### Engine status, can be long and changeable ### +--- show_engine.result 2013-01-22 22:05:05.246633000 +0400 ++++ show_engine.reject 2013-01-23 02:50:56.871537482 +0400 +@@ -4,7 +4,6 @@ + # volatile data (timestamps, memory info, etc.) + SHOW ENGINE <STORAGE_ENGINE> STATUS; + Type Name Status +-<STORAGE_ENGINE> ### Engine status, can be long and changeable ### + # For SHOW MUTEX even the number of lines is volatile, so the result logging is disabled, + # the test only checks that the command does not produce any errors + SHOW ENGINE <STORAGE_ENGINE> MUTEX; diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff index bca6fa60d13..4de7e81ffba 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff @@ -1,8 +1,16 @@ -7c7 -< ) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -13c13 -< ) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) +--- tbl_opt_ai.result 2013-01-22 22:05:05.246633000 +0400 ++++ tbl_opt_ai.reject 2013-01-23 02:50:57.547528984 +0400 +@@ -4,11 +4,11 @@ + Table Create Table + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 AUTO_INCREMENT=100; + SHOW CREATE TABLE t1; + Table Create Table + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff index 7a3ac54fd3e..2632fabf89d 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff @@ -1,8 +1,17 @@ -8c8 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=300 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=300 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -15c15 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=30000000 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=30000000 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) +--- tbl_opt_avg_row_length.result 2013-01-22 22:05:05.246633000 +0400 ++++ tbl_opt_avg_row_length.reject 2013-01-23 02:50:58.123521742 +0400 +@@ -5,12 +5,12 @@ + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=300 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=300 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 AVG_ROW_LENGTH=30000000; + SHOW CREATE TABLE t1; + Table Create Table + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=30000000 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=30000000 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff index ecb3fadb479..baad32dd4db 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff @@ -1,8 +1,17 @@ -8c8 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CHECKSUM=1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CHECKSUM=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -15c15 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) +--- tbl_opt_checksum.result 2013-01-22 22:05:05.246633000 +0400 ++++ tbl_opt_checksum.reject 2013-01-23 02:50:58.739513998 +0400 +@@ -5,12 +5,12 @@ + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CHECKSUM=1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CHECKSUM=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 CHECKSUM=0; + SHOW CREATE TABLE t1; + Table Create Table + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff index d3ebd87ad1e..3dc06fb2704 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff @@ -1,8 +1,19 @@ -13c13 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CONNECTION='test_connection' ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) CONNECTION='test_connection' -20c20 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CONNECTION='test_connection2' ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) CONNECTION='test_connection2' +--- tbl_opt_connection.result 2013-01-22 22:05:05.246633000 +0400 ++++ tbl_opt_connection.reject 2013-01-23 02:50:59.335506506 +0400 +@@ -10,14 +10,14 @@ + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CONNECTION='test_connection' ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) CONNECTION='test_connection' + ALTER TABLE t1 CONNECTION='test_connection2'; + SHOW CREATE TABLE t1; + Table Create Table + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CONNECTION='test_connection2' ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) CONNECTION='test_connection2' + DROP TABLE t1; + DROP SERVER test_connection; + DROP SERVER test_connection2; diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_index_dir.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_index_dir.rdiff index 3c15e10d1f1..e6055278b3c 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_index_dir.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_index_dir.rdiff @@ -1,8 +1,18 @@ -7c7 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DATA DIRECTORY='<DATA_DIR>' INDEX DIRECTORY='<INDEX_DIR>' ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -15c15 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DATA DIRECTORY='<DATA_DIR>' INDEX DIRECTORY='<INDEX_DIR>' ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) +--- tbl_opt_data_index_dir.result 2013-01-22 22:05:05.246633000 +0400 ++++ tbl_opt_data_index_dir.reject 2013-01-23 02:50:59.951498762 +0400 +@@ -4,7 +4,7 @@ + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DATA DIRECTORY='<DATA_DIR>' INDEX DIRECTORY='<INDEX_DIR>' ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + Warnings: + Warning 1618 <INDEX DIRECTORY> option ignored + SHOW CREATE TABLE t1; +@@ -12,5 +12,5 @@ + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DATA DIRECTORY='<DATA_DIR>' INDEX DIRECTORY='<INDEX_DIR>' ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff index 5723e425b4d..2c2e40fa4b7 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff @@ -1,8 +1,17 @@ -8c8 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -15c15 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) +--- tbl_opt_delay_key_write.result 2013-01-22 22:05:05.246633000 +0400 ++++ tbl_opt_delay_key_write.reject 2013-01-23 02:51:00.591490716 +0400 +@@ -5,12 +5,12 @@ + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 DELAY_KEY_WRITE=0; + SHOW CREATE TABLE t1; + Table Create Table + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff index 2ced7647483..f5dc536c7ee 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff @@ -1,8 +1,17 @@ -8c8 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`mrg`.`t1`) -15c15 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`mrg`.`t1`) +--- tbl_opt_insert_method.result 2013-01-22 22:05:05.246633000 +0400 ++++ tbl_opt_insert_method.reject 2013-01-23 02:51:01.211482922 +0400 +@@ -5,12 +5,12 @@ + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`mrg`.`t1`) + ALTER TABLE t1 INSERT_METHOD=NO; + SHOW CREATE TABLE t1; + Table Create Table + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`mrg`.`t1`) + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff index 8378f04ebcb..be90252f0b9 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff @@ -1,8 +1,17 @@ -8c8 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=8 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=8 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -15c15 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) +--- tbl_opt_key_block_size.result 2013-01-22 22:05:05.246633000 +0400 ++++ tbl_opt_key_block_size.reject 2013-01-23 02:51:01.787475681 +0400 +@@ -5,12 +5,12 @@ + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=8 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=8 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 KEY_BLOCK_SIZE=1; + SHOW CREATE TABLE t1; + Table Create Table + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff index f89147826c6..3eebf8cce9b 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff @@ -1,8 +1,17 @@ -8c8 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=10000000 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=10000000 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -15c15 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=30000000 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=30000000 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) +--- tbl_opt_max_rows.result 2013-01-22 22:05:05.246633000 +0400 ++++ tbl_opt_max_rows.reject 2013-01-23 02:51:02.403467936 +0400 +@@ -5,12 +5,12 @@ + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=10000000 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=10000000 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 MAX_ROWS=30000000; + SHOW CREATE TABLE t1; + Table Create Table + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=30000000 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=30000000 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff index 3ce28480dcf..48c7124ca36 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff @@ -1,8 +1,17 @@ -8c8 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -15c15 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=10000 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=10000 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) +--- tbl_opt_min_rows.result 2013-01-22 22:05:05.246633000 +0400 ++++ tbl_opt_min_rows.reject 2013-01-23 02:51:02.983460644 +0400 +@@ -5,12 +5,12 @@ + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 MIN_ROWS=10000; + SHOW CREATE TABLE t1; + Table Create Table + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=10000 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=10000 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff index 246c7397a96..ab16cbcb0dc 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff @@ -1,8 +1,17 @@ -8c8 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -15c15 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=0 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=0 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) +--- tbl_opt_pack_keys.result 2013-01-22 22:05:05.246633000 +0400 ++++ tbl_opt_pack_keys.reject 2013-01-23 02:51:03.563453353 +0400 +@@ -5,12 +5,12 @@ + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 PACK_KEYS=0; + SHOW CREATE TABLE t1; + Table Create Table + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=0 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=0 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff index b1ef20c6f30..dc8303682db 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff @@ -1,8 +1,17 @@ -8c8 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -15c15 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) +--- tbl_opt_password.result 2013-01-22 22:05:05.246633000 +0400 ++++ tbl_opt_password.reject 2013-01-23 02:51:04.155445910 +0400 +@@ -5,12 +5,12 @@ + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 PASSWORD='new_password'; + SHOW CREATE TABLE t1; + Table Create Table + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff index 9c72c7c06ba..f7e0905d4e7 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff @@ -1,8 +1,17 @@ -8c8 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED INSERT_METHOD=LAST UNION=(`mrg`.`t1`) -15c15 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC INSERT_METHOD=LAST UNION=(`mrg`.`t1`) +--- tbl_opt_row_format.result 2013-01-22 22:05:05.246633000 +0400 ++++ tbl_opt_row_format.reject 2013-01-23 02:51:04.743438518 +0400 +@@ -5,12 +5,12 @@ + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + ALTER TABLE t1 ROW_FORMAT=DYNAMIC; + SHOW CREATE TABLE t1; + Table Create Table + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff index f77753f4d6b..e4e098a1b94 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff @@ -1,8 +1,16 @@ -7c7 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`child1`) ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`child1`) -13c13 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`child1`,`child2`) ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`child1`,`child2`) +--- tbl_opt_union.result 2013-01-22 22:05:05.246633000 +0400 ++++ tbl_opt_union.reject 2013-01-23 02:51:05.375430573 +0400 +@@ -4,11 +4,11 @@ + Table Create Table + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`child1`) ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`child1`) + ALTER TABLE t1 UNION = (child1,child2); + SHOW CREATE TABLE t1; + Table Create Table + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`child1`,`child2`) ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`child1`,`child2`) + DROP TABLE t1, child1, child2; diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff index 9b7ffc6af76..a929b6df54b 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff @@ -1,8 +1,19 @@ -11c11 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 COMMENT='standard table options' ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) COMMENT='standard table options' -18c18 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 COMMENT='table altered' ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) COMMENT='table altered' +--- tbl_standard_opts.result 2013-01-22 22:05:05.246633000 +0400 ++++ tbl_standard_opts.reject 2013-01-23 02:51:05.991422829 +0400 +@@ -8,14 +8,14 @@ + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 COMMENT='standard table options' ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) COMMENT='standard table options' + ALTER TABLE t1 COMMENT = 'table altered'; + SHOW CREATE TABLE t1; + Table Create Table + t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 COMMENT='table altered' ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) COMMENT='table altered' + ALTER TABLE t1 ENGINE=MEMORY; + SHOW CREATE TABLE t1; + Table Create Table diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff index 45a229c98eb..d2c7d4f2836 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff @@ -1,4 +1,10 @@ -9c9 -< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ---- -> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) +--- tbl_temporary.result 2013-01-22 22:05:05.246633000 +0400 ++++ tbl_temporary.reject 2013-01-23 02:51:06.599415185 +0400 +@@ -6,6 +6,6 @@ + t1 CREATE TEMPORARY TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(8) DEFAULT NULL +-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) + DROP TEMPORARY TABLE t1; + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff index 3a89f730540..e4de81bae70 100644 --- a/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff @@ -1,35 +1,48 @@ -12c12 -< t1 # # # # # # # # # 1 # # # # # # # ---- -> t1 # # # # # # # # # 0 # # # # # # # -16c16 -< t1 # # # # # # # # # 4 # # # # # # # ---- -> t1 # # # # # # # # # 0 # # # # # # # -20c20 -< t1 # # # # # # # # # 1 # # # # # # # ---- -> t1 # # # # # # # # # 0 # # # # # # # -24c24 -< t1 # # # # # # # # # 2 # # # # # # # ---- -> t1 # # # # # # # # # 0 # # # # # # # -32,40c32,39 -< HANDLER h1 READ FIRST; -< a b -< 1 a -< TRUNCATE TABLE t1; -< HANDLER h1 READ NEXT; -< ERROR 42S02: Unknown table 'h1' in HANDLER -< HANDLER t1 OPEN AS h2; -< HANDLER h2 READ FIRST; -< a b ---- -> ERROR HY000: Table storage engine for 'h1' doesn't have this option -> # ------------ UNEXPECTED RESULT ------------ -> # The statement|command finished with ER_ILLEGAL_HA. -> # HANDLER or the syntax or the mix could be unsupported. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- +--- truncate_table.result 2013-01-22 22:05:05.246633000 +0400 ++++ truncate_table.reject 2013-01-23 02:51:07.507403770 +0400 +@@ -9,19 +9,19 @@ + CREATE TABLE t1 (a <INT_COLUMN> KEY AUTO_INCREMENT, c <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + SHOW TABLE STATUS LIKE 't1'; + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +-t1 # # # # # # # # # 1 # # # # # # # ++t1 # # # # # # # # # 0 # # # # # # # + INSERT INTO t1 (c) VALUES ('a'),('b'),('c'); + SHOW TABLE STATUS LIKE 't1'; + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +-t1 # # # # # # # # # 4 # # # # # # # ++t1 # # # # # # # # # 0 # # # # # # # + TRUNCATE TABLE t1; + SHOW TABLE STATUS LIKE 't1'; + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +-t1 # # # # # # # # # 1 # # # # # # # ++t1 # # # # # # # # # 0 # # # # # # # + INSERT INTO t1 (c) VALUES ('d'); + SHOW TABLE STATUS LIKE 't1'; + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +-t1 # # # # # # # # # 2 # # # # # # # ++t1 # # # # # # # # # 0 # # # # # # # + SELECT a,c FROM t1; + a c + 1 d +@@ -29,13 +29,12 @@ + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'); + HANDLER t1 OPEN AS h1; +-HANDLER h1 READ FIRST; +-a b +-1 a +-TRUNCATE TABLE t1; +-HANDLER h1 READ NEXT; +-ERROR 42S02: Unknown table 'h1' in HANDLER +-HANDLER t1 OPEN AS h2; +-HANDLER h2 READ FIRST; +-a b ++ERROR HY000: Table storage engine for 'h1' doesn't have this option ++# ------------ UNEXPECTED RESULT ------------ ++# The statement|command finished with ER_ILLEGAL_HA. ++# HANDLER or the syntax or the mix could be unsupported. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff index 018b28bd24c..94cfa74f384 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff @@ -1,9 +1,20 @@ -0a1,6 -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MRG_MYISAM does not support transactions. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file, or add the test to disabled.def. -> # If transactions should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- -13a20 -> 1 +--- cons_snapshot_repeatable_read.result 2013-01-22 22:05:05.246633000 +0400 ++++ cons_snapshot_repeatable_read.reject 2013-01-23 03:22:34.255684132 +0400 +@@ -1,3 +1,9 @@ ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MRG_MYISAM does not support transactions. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file, or add the test to disabled.def. ++# If transactions should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- + DROP TABLE IF EXISTS t1; + connect con1,localhost,root,,; + connect con2,localhost,root,,; +@@ -11,6 +17,7 @@ + # If consistent read works on this isolation level (REPEATABLE READ), the following SELECT should not return the value we inserted (1) + SELECT a FROM t1; + a ++1 + COMMIT; + connection default; + disconnect con1; diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff index 018b28bd24c..a9b9ba7f94b 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff @@ -1,9 +1,20 @@ -0a1,6 -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MRG_MYISAM does not support transactions. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file, or add the test to disabled.def. -> # If transactions should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- -13a20 -> 1 +--- cons_snapshot_serializable.result 2013-01-22 22:05:05.246633000 +0400 ++++ cons_snapshot_serializable.reject 2013-01-23 03:22:34.847676690 +0400 +@@ -1,3 +1,9 @@ ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MRG_MYISAM does not support transactions. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file, or add the test to disabled.def. ++# If transactions should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- + DROP TABLE IF EXISTS t1; + connect con1,localhost,root,,; + connect con2,localhost,root,,; +@@ -11,6 +17,7 @@ + # If consistent read works on this isolation level (SERIALIZABLE), the following SELECT should not return the value we inserted (1) + SELECT a FROM t1; + a ++1 + COMMIT; + connection default; + disconnect con1; diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff index 45a3e5fb52d..e4249478c76 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff @@ -1,34 +1,50 @@ -0a1,12 -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MRG_MYISAM does not support transactions. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file, or add the test to disabled.def. -> # If transactions should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MRG_MYISAM does not support savepoints. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file (recommended), or add the test to disabled.def. -> # If savepoints should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- -48a61,62 -> Warnings: -> Warning 1196 Some non-transactional changed tables couldn't be rolled back -51,64d64 -< 10000 foobar -< 10000 foobar -< 2 b -< 2 b -< 4 d -< 4 d -< 5 e -< 5 e -< 6 f -< 6 f -< 7 g -< 7 g -< 8 h -< 8 h -70a71,72 -> Warnings: -> Warning 1196 Some non-transactional changed tables couldn't be rolled back +--- delete.result 2013-01-22 22:05:05.246633000 +0400 ++++ delete.reject 2013-01-23 03:22:35.419669500 +0400 +@@ -1,3 +1,15 @@ ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MRG_MYISAM does not support transactions. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file, or add the test to disabled.def. ++# If transactions should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MRG_MYISAM does not support savepoints. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file (recommended), or add the test to disabled.def. ++# If savepoints should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- + DROP TABLE IF EXISTS t1; + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'f'),(7,'g'),(8,'h'),(10000,'foobar'); +@@ -46,27 +58,17 @@ + DELETE FROM t1; + RELEASE SAVEPOINT spt1; + ROLLBACK; ++Warnings: ++Warning 1196 Some non-transactional changed tables couldn't be rolled back + SELECT a,b FROM t1; + a b +-10000 foobar +-10000 foobar +-2 b +-2 b +-4 d +-4 d +-5 e +-5 e +-6 f +-6 f +-7 g +-7 g +-8 h +-8 h + BEGIN; + DELETE FROM t1 WHERE a <= 4 ORDER BY b DESC LIMIT 1; + SAVEPOINT spt1; + DELETE FROM t1; + INSERT INTO t1 (a,b) VALUES (1,'a'); + ROLLBACK TO SAVEPOINT spt1; ++Warnings: ++Warning 1196 Some non-transactional changed tables couldn't be rolled back + COMMIT; + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff index 69981f90e13..d5e99b6d7dc 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff @@ -1,32 +1,65 @@ -0a1,12 -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MRG_MYISAM does not support transactions. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file, or add the test to disabled.def. -> # If transactions should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MRG_MYISAM does not support savepoints. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file (recommended), or add the test to disabled.def. -> # If savepoints should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- -23a36,37 -> Warnings: -> Warning 1196 Some non-transactional changed tables couldn't be rolled back -25a40 -> 0 test -33a49,50 -> NULL NULL -> NULL NULL -39a57,58 -> Warnings: -> Warning 1196 Some non-transactional changed tables couldn't be rolled back -43a63 -> 0 test -49a70 -> 11 f -54a76,78 -> NULL NULL -> NULL NULL -> NULL NULL +--- insert.result 2013-01-22 22:05:05.246633000 +0400 ++++ insert.reject 2013-01-23 03:22:35.987662359 +0400 +@@ -1,3 +1,15 @@ ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MRG_MYISAM does not support transactions. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file, or add the test to disabled.def. ++# If transactions should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MRG_MYISAM does not support savepoints. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file (recommended), or add the test to disabled.def. ++# If savepoints should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- + DROP TABLE IF EXISTS t1; + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + BEGIN; +@@ -21,8 +33,11 @@ + RELEASE SAVEPOINT spt1; + INSERT INTO t1 (a,b) VALUES (DEFAULT,DEFAULT); + ROLLBACK; ++Warnings: ++Warning 1196 Some non-transactional changed tables couldn't be rolled back + SELECT a,b FROM t1; + a b ++0 test + 1 a + 10 foo + 100 foo +@@ -31,25 +46,34 @@ + 3 c + 4 d + 5 e ++NULL NULL ++NULL NULL + BEGIN; + INSERT t1 (a) VALUE (10),(20); + SAVEPOINT spt1; + INSERT INTO t1 SET a = 11, b = 'f'; + INSERT t1 SET b = DEFAULT; + ROLLBACK TO SAVEPOINT spt1; ++Warnings: ++Warning 1196 Some non-transactional changed tables couldn't be rolled back + INSERT INTO t1 (b,a) VALUES ('test1',10); + COMMIT; + SELECT a,b FROM t1; + a b ++0 test + 1 a + 10 NULL + 10 foo + 10 test1 + 100 foo + 11 abc ++11 f + 2 b + 20 NULL + 3 c + 4 d + 5 e ++NULL NULL ++NULL NULL ++NULL NULL + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff index 0837c74f5ff..9e7c340c524 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff @@ -1,44 +1,94 @@ -0a1,6 -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MRG_MYISAM does not support transactions. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file, or add the test to disabled.def. -> # If transactions should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- -18a25 -> 1 -25a33,34 -> 1 -> 2 -30a40,43 -> 1 -> 101 -> 102 -> 2 -34a48,49 -> 101 -> 102 -39a55,56 -> 101 -> 102 -44a62,63 -> 101 -> 102 -51a71,72 -> 101 -> 102 -54a76,77 -> 301 -> 302 -58a82,83 -> 101 -> 102 -61a87,88 -> 301 -> 302 -65a93,94 -> 101 -> 102 -68a98,99 -> 301 -> 302 +--- level_read_committed.result 2013-01-22 22:05:05.246633000 +0400 ++++ level_read_committed.reject 2013-01-23 03:22:36.603654615 +0400 +@@ -1,3 +1,9 @@ ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MRG_MYISAM does not support transactions. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file, or add the test to disabled.def. ++# If transactions should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- + DROP TABLE IF EXISTS t1; + connect con1,localhost,root,,; + SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +@@ -16,6 +22,7 @@ + connection con1; + SELECT a FROM t1; + a ++1 + connection con2; + INSERT INTO t1 (a) VALUES (2); + # WARNING: Statement ended with errno 0, errname ''. +@@ -23,25 +30,37 @@ + connection con1; + SELECT a FROM t1; + a ++1 ++2 + INSERT INTO t1 (a) SELECT a+100 FROM t1; + # WARNING: Statement ended with errno 0, errname ''. + # If it differs from the result file, it might indicate a problem. + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 + connection con2; + SELECT a FROM t1; + a + 1 ++101 ++102 + 2 + COMMIT; + SELECT a FROM t1; + a + 1 ++101 ++102 + 2 + connection con1; + SELECT a FROM t1; + a + 1 ++101 ++102 + 2 + INSERT INTO t1 (a) SELECT a+200 FROM t1; + # WARNING: Statement ended with errno 0, errname ''. +@@ -49,23 +68,35 @@ + SELECT a FROM t1; + a + 1 ++101 ++102 + 2 + 201 + 202 ++301 ++302 + COMMIT; + SELECT a FROM t1; + a + 1 ++101 ++102 + 2 + 201 + 202 ++301 ++302 + connection con2; + SELECT a FROM t1; + a + 1 ++101 ++102 + 2 + 201 + 202 ++301 ++302 + connection default; + disconnect con1; + disconnect con2; diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff index bd9569267e5..d44e4aa7a12 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff @@ -1,7 +1,12 @@ -0a1,6 -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MRG_MYISAM does not support transactions. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file, or add the test to disabled.def. -> # If transactions should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- +--- level_read_uncommitted.result 2013-01-22 22:05:05.246633000 +0400 ++++ level_read_uncommitted.reject 2013-01-23 03:22:37.263646318 +0400 +@@ -1,3 +1,9 @@ ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MRG_MYISAM does not support transactions. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file, or add the test to disabled.def. ++# If transactions should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- + DROP TABLE IF EXISTS t1; + connect con1,localhost,root,,; + SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff index 82f7c5c5ba6..b24376a9c28 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff @@ -1,53 +1,96 @@ -0a1,6 -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MRG_MYISAM does not support transactions. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file, or add the test to disabled.def. -> # If transactions should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- -18a25 -> 1 -25a33,34 -> 1 -> 2 -27,28c36 -< ERROR HY000: Lock wait timeout exceeded; try restarting transaction -< # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'. ---- -> # WARNING: Statement ended with errno 0, errname ''. -31a40,43 -> 1 -> 101 -> 102 -> 2 -35a48,49 -> 101 -> 102 -40a55,56 -> 101 -> 102 -44a61,64 -> 1 -> 101 -> 102 -> 2 -49a70,73 -> 1 -> 101 -> 102 -> 2 -51a76,77 -> 301 -> 302 -55a82,83 -> 101 -> 102 -58a87,88 -> 301 -> 302 -62a93,94 -> 101 -> 102 -65a98,99 -> 301 -> 302 +--- level_repeatable_read.result 2013-01-22 22:05:05.246633000 +0400 ++++ level_repeatable_read.reject 2013-01-23 03:22:37.867638724 +0400 +@@ -1,3 +1,9 @@ ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MRG_MYISAM does not support transactions. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file, or add the test to disabled.def. ++# If transactions should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- + DROP TABLE IF EXISTS t1; + connect con1,localhost,root,,; + SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +@@ -16,6 +22,7 @@ + connection con1; + SELECT a FROM t1; + a ++1 + connection con2; + INSERT INTO t1 (a) VALUES (2); + # WARNING: Statement ended with errno 0, errname ''. +@@ -23,46 +30,73 @@ + connection con1; + SELECT a FROM t1; + a ++1 ++2 + INSERT INTO t1 (a) SELECT a+100 FROM t1; +-ERROR HY000: Lock wait timeout exceeded; try restarting transaction +-# WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'. ++# WARNING: Statement ended with errno 0, errname ''. + # If it differs from the result file, it might indicate a problem. + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 + connection con2; + SELECT a FROM t1; + a + 1 ++101 ++102 + 2 + COMMIT; + SELECT a FROM t1; + a + 1 ++101 ++102 + 2 + connection con1; + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 + INSERT INTO t1 (a) SELECT a+200 FROM t1; + # WARNING: Statement ended with errno 0, errname ''. + # If it differs from the result file, it might indicate a problem. + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 + 201 + 202 ++301 ++302 + COMMIT; + SELECT a FROM t1; + a + 1 ++101 ++102 + 2 + 201 + 202 ++301 ++302 + connection con2; + SELECT a FROM t1; + a + 1 ++101 ++102 + 2 + 201 + 202 ++301 ++302 + connection default; + disconnect con1; + disconnect con2; diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff index 3924b3784a9..3567e718459 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff @@ -1,69 +1,103 @@ -0a1,6 -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MRG_MYISAM does not support transactions. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file, or add the test to disabled.def. -> # If transactions should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- -14,15c20 -< ERROR HY000: Lock wait timeout exceeded; try restarting transaction -< # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'. ---- -> # WARNING: Statement ended with errno 0, errname ''. -19a25 -> 1 -22,23c28 -< ERROR HY000: Lock wait timeout exceeded; try restarting transaction -< # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'. ---- -> # WARNING: Statement ended with errno 0, errname ''. -27a33,34 -> 1 -> 2 -32a40,43 -> 1 -> 101 -> 102 -> 2 -35a47,50 -> 1 -> 101 -> 102 -> 2 -38a54,57 -> 1 -> 101 -> 102 -> 2 -41a61,64 -> 1 -> 101 -> 102 -> 2 -46a70,77 -> 1 -> 101 -> 102 -> 2 -> 201 -> 202 -> 301 -> 302 -49a81,88 -> 1 -> 101 -> 102 -> 2 -> 201 -> 202 -> 301 -> 302 -52a92,99 -> 1 -> 101 -> 102 -> 2 -> 201 -> 202 -> 301 -> 302 +--- level_serializable.result 2013-01-22 22:05:05.246633000 +0400 ++++ level_serializable.reject 2013-01-23 03:22:38.471631132 +0400 +@@ -1,3 +1,9 @@ ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MRG_MYISAM does not support transactions. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file, or add the test to disabled.def. ++# If transactions should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- + DROP TABLE IF EXISTS t1; + connect con1,localhost,root,,; + SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +@@ -11,45 +17,86 @@ + connection con2; + BEGIN; + INSERT INTO t1 (a) VALUES(1); +-ERROR HY000: Lock wait timeout exceeded; try restarting transaction +-# WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'. ++# WARNING: Statement ended with errno 0, errname ''. + # If it differs from the result file, it might indicate a problem. + connection con1; + SELECT a FROM t1; + a ++1 + connection con2; + INSERT INTO t1 (a) VALUES (2); +-ERROR HY000: Lock wait timeout exceeded; try restarting transaction +-# WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'. ++# WARNING: Statement ended with errno 0, errname ''. + # If it differs from the result file, it might indicate a problem. + connection con1; + SELECT a FROM t1; + a ++1 ++2 + INSERT INTO t1 (a) SELECT a+100 FROM t1; + # WARNING: Statement ended with errno 0, errname ''. + # If it differs from the result file, it might indicate a problem. + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 + connection con2; + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 + COMMIT; + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 + connection con1; + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 + INSERT INTO t1 (a) SELECT a+200 FROM t1; + # WARNING: Statement ended with errno 0, errname ''. + # If it differs from the result file, it might indicate a problem. + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 ++201 ++202 ++301 ++302 + COMMIT; + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 ++201 ++202 ++301 ++302 + connection con2; + SELECT a FROM t1; + a ++1 ++101 ++102 ++2 ++201 ++202 ++301 ++302 + connection default; + disconnect con1; + disconnect con2; diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff index f8ffe67586d..bad014d87ed 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff @@ -1,40 +1,50 @@ -0a1,6 -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MRG_MYISAM does not support transactions. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file, or add the test to disabled.def. -> # If transactions should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- -17c23,33 -< ERROR HY000: Lock wait timeout exceeded; try restarting transaction ---- -> a b -> 1 a -> 3 a -> # ERROR: Statement succeeded (expected results: ER_LOCK_WAIT_TIMEOUT) -> # ------------ UNEXPECTED RESULT ------------ -> # The statement|command succeeded unexpectedly. -> # SELECT .. FOR UPDATE or LOCK IN SHARE MODE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -19c35,42 -< ERROR HY000: Lock wait timeout exceeded; try restarting transaction ---- -> # ERROR: Statement succeeded (expected results: ER_LOCK_WAIT_TIMEOUT) -> # ------------ UNEXPECTED RESULT ------------ -> # The statement|command succeeded unexpectedly. -> # UPDATE or SELECT .. FOR UPDATE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -24c47 -< 1 a ---- -> 1 c -26c49 -< 3 a ---- -> 3 c +--- select_for_update.result 2013-01-22 22:05:05.246633000 +0400 ++++ select_for_update.reject 2013-01-23 03:22:39.123622935 +0400 +@@ -1,3 +1,9 @@ ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MRG_MYISAM does not support transactions. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file, or add the test to disabled.def. ++# If transactions should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- + DROP TABLE IF EXISTS t1; + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'a'); +@@ -14,16 +20,33 @@ + 1 a + 3 a + SELECT a,b FROM t1 WHERE b='a' LOCK IN SHARE MODE; +-ERROR HY000: Lock wait timeout exceeded; try restarting transaction ++a b ++1 a ++3 a ++# ERROR: Statement succeeded (expected results: ER_LOCK_WAIT_TIMEOUT) ++# ------------ UNEXPECTED RESULT ------------ ++# The statement|command succeeded unexpectedly. ++# SELECT .. FOR UPDATE or LOCK IN SHARE MODE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + UPDATE t1 SET b='c' WHERE b='a'; +-ERROR HY000: Lock wait timeout exceeded; try restarting transaction ++# ERROR: Statement succeeded (expected results: ER_LOCK_WAIT_TIMEOUT) ++# ------------ UNEXPECTED RESULT ------------ ++# The statement|command succeeded unexpectedly. ++# UPDATE or SELECT .. FOR UPDATE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + connection con1; + COMMIT; + SELECT a,b FROM t1; + a b +-1 a ++1 c + 2 b +-3 a ++3 c + disconnect con1; + connection default; + UPDATE t1 SET b='c' WHERE b='a'; diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff index e316993830a..db3eec1bc24 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff @@ -1,26 +1,37 @@ -0a1,6 -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MRG_MYISAM does not support transactions. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file, or add the test to disabled.def. -> # If transactions should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- -21c27,34 -< ERROR HY000: Lock wait timeout exceeded; try restarting transaction ---- -> # ERROR: Statement succeeded (expected results: ER_LOCK_WAIT_TIMEOUT) -> # ------------ UNEXPECTED RESULT ------------ -> # The statement|command succeeded unexpectedly. -> # LOCK IN SHARE MODE or UPDATE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -26c39 -< 1 a ---- -> 1 c -28c41 -< 3 a ---- -> 3 c +--- select_lock_in_share_mode.result 2013-01-22 22:05:05.246633000 +0400 ++++ select_lock_in_share_mode.reject 2013-01-23 03:22:39.739615191 +0400 +@@ -1,3 +1,9 @@ ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MRG_MYISAM does not support transactions. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file, or add the test to disabled.def. ++# If transactions should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- + DROP TABLE IF EXISTS t1; + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'a'); +@@ -18,14 +24,21 @@ + 1 a + 3 a + UPDATE t1 SET b='c' WHERE b='a'; +-ERROR HY000: Lock wait timeout exceeded; try restarting transaction ++# ERROR: Statement succeeded (expected results: ER_LOCK_WAIT_TIMEOUT) ++# ------------ UNEXPECTED RESULT ------------ ++# The statement|command succeeded unexpectedly. ++# LOCK IN SHARE MODE or UPDATE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + connection con1; + COMMIT; + SELECT a,b FROM t1; + a b +-1 a ++1 c + 2 b +-3 a ++3 c + disconnect con1; + connection default; + UPDATE t1 SET b='c' WHERE b='a'; diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff index 7ad463053eb..baac054766b 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff @@ -1,41 +1,58 @@ -0a1,12 -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MRG_MYISAM does not support transactions. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file, or add the test to disabled.def. -> # If transactions should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MRG_MYISAM does not support savepoints. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file (recommended), or add the test to disabled.def. -> # If savepoints should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- -26a39,40 -> Warnings: -> Warning 1196 Some non-transactional changed tables couldn't be rolled back -31a46,47 -> Warnings: -> Warning 1196 Some non-transactional changed tables couldn't be rolled back -38,47c54,63 -< 51 update2 -< 51 update2 -< 52 update2 -< 52 update2 -< 53 update2 -< 53 update2 -< 54 update2 -< 54 update2 -< 55 update2 -< 55 update2 ---- -> 51 -> 51 -> 52 -> 52 -> 53 -> 53 -> 54 -> 54 -> 55 -> 55 +--- update.result 2013-01-22 22:05:05.246633000 +0400 ++++ update.reject 2013-01-23 03:22:40.355607446 +0400 +@@ -1,3 +1,15 @@ ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MRG_MYISAM does not support transactions. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file, or add the test to disabled.def. ++# If transactions should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MRG_MYISAM does not support savepoints. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file (recommended), or add the test to disabled.def. ++# If savepoints should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- + DROP TABLE IF EXISTS t1; + CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; + INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(10000,'foobar'); +@@ -24,25 +36,29 @@ + UPDATE t1 SET b = 'update' WHERE a <= 4 ORDER BY a DESC, b ASC LIMIT 3; + UPDATE t1 SET b = ''; + ROLLBACK; ++Warnings: ++Warning 1196 Some non-transactional changed tables couldn't be rolled back + BEGIN; + UPDATE t1 SET b = 'update2' WHERE a <= 100; + SAVEPOINT spt1; + UPDATE t1 SET b = ''; + ROLLBACK TO SAVEPOINT spt1; ++Warnings: ++Warning 1196 Some non-transactional changed tables couldn't be rolled back + UPDATE t1 SET b = 'upd' WHERE a = 10050; + COMMIT; + SELECT a,b FROM t1; + a b + 10050 upd + 10050 upd +-51 update2 +-51 update2 +-52 update2 +-52 update2 +-53 update2 +-53 update2 +-54 update2 +-54 update2 +-55 update2 +-55 update2 ++51 ++51 ++52 ++52 ++53 ++53 ++54 ++54 ++55 ++55 + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff index ee7c2a984be..a491287337d 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff @@ -1,34 +1,89 @@ -0a1,6 -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MRG_MYISAM does not support XA. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file, or add the test to disabled.def. -> # If XA should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- -11a18 -> 1 -17a25,26 -> 1 -> 2 -22a32,33 -> 1 -> 2 -40a52 -> 3 -48a61,62 -> 3 -> 4 -67a82 -> 5 -77a93,94 -> 5 -> 6 -86a104,105 -> 5 -> 6 -88a108,109 -> Warnings: -> Warning 1196 Some non-transactional changed tables couldn't be rolled back -95a117,118 -> 5 -> 6 +--- xa.result 2013-01-22 22:05:05.246633000 +0400 ++++ xa.reject 2013-01-23 03:22:41.047598747 +0400 +@@ -1,3 +1,9 @@ ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MRG_MYISAM does not support XA. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file, or add the test to disabled.def. ++# If XA should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- + DROP TABLE IF EXISTS t1; + connect con1,localhost,root,,; + connect con2,localhost,root,,; +@@ -9,17 +15,22 @@ + connection con1; + SELECT a FROM t1; + a ++1 + connection con2; + INSERT INTO t1 (a) VALUES (2); + XA END 'xa1'; + connection con1; + SELECT a FROM t1; + a ++1 ++2 + connection con2; + XA PREPARE 'xa1'; + connection con1; + SELECT a FROM t1; + a ++1 ++2 + connection con2; + XA RECOVER; + formatID gtrid_length bqual_length data +@@ -38,6 +49,7 @@ + a + 1 + 2 ++3 + connection con2; + INSERT INTO t1 (a) VALUES (4); + XA END 'xa2'; +@@ -46,6 +58,8 @@ + a + 1 + 2 ++3 ++4 + connection con2; + XA COMMIT 'xa2' ONE PHASE; + connection con1; +@@ -65,6 +79,7 @@ + 2 + 3 + 4 ++5 + connection con2; + INSERT INTO t1 (a) VALUES (6); + XA END 'xa3'; +@@ -75,6 +90,8 @@ + 2 + 3 + 4 ++5 ++6 + connection con2; + XA PREPARE 'xa3'; + connection con1; +@@ -84,8 +101,12 @@ + 2 + 3 + 4 ++5 ++6 + connection con2; + XA ROLLBACK 'xa3'; ++Warnings: ++Warning 1196 Some non-transactional changed tables couldn't be rolled back + connection con1; + SELECT a FROM t1; + a +@@ -93,4 +114,6 @@ + 2 + 3 + 4 ++5 ++6 + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff index 362e3a8914a..8dc888a1d58 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff @@ -1,22 +1,33 @@ -0a1,6 -> # -- WARNING ---------------------------------------------------------------- -> # According to I_S.ENGINES, MRG_MYISAM does not support XA. -> # If it is true, the test will most likely fail; you can -> # either create an rdiff file, or add the test to disabled.def. -> # If XA should be supported, check the data in Information Schema. -> # --------------------------------------------------------------------------- -21,22d26 -< 1 3 0 xa1 -< 1 3 0 xa2 -23a28 -> ERROR XAE04: XAER_NOTA: Unknown XID -24a30 -> ERROR XAE04: XAER_NOTA: Unknown XID -26a33,34 -> 1 -> 2 -28a37,40 -> Warnings: -> Error 145 Table './mrg/t1' is marked as crashed and should be repaired -> Error 1194 Table 't1' is marked as crashed and should be repaired -> Error 1034 1 client is using or hasn't closed the table properly +--- xa_recovery.result 2013-01-22 22:05:05.246633000 +0400 ++++ xa_recovery.reject 2013-01-23 03:22:43.247571090 +0400 +@@ -1,3 +1,9 @@ ++# -- WARNING ---------------------------------------------------------------- ++# According to I_S.ENGINES, MRG_MYISAM does not support XA. ++# If it is true, the test will most likely fail; you can ++# either create an rdiff file, or add the test to disabled.def. ++# If XA should be supported, check the data in Information Schema. ++# --------------------------------------------------------------------------- + call mtr.add_suppression("Found 2 prepared XA transactions"); + FLUSH TABLES; + DROP TABLE IF EXISTS t1; +@@ -18,12 +24,18 @@ + connection default; + XA RECOVER; + formatID gtrid_length bqual_length data +-1 3 0 xa1 +-1 3 0 xa2 + XA ROLLBACK 'xa1'; ++ERROR XAE04: XAER_NOTA: Unknown XID + XA COMMIT 'xa2'; ++ERROR XAE04: XAER_NOTA: Unknown XID + SELECT a FROM t1; + a ++1 ++2 + 3 + 4 ++Warnings: ++Error 145 Table './mrg/t1' is marked as crashed and should be repaired ++Error 1194 Table 't1' is marked as crashed and should be repaired ++Error 1034 1 client is using or hasn't closed the table properly + DROP TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff index a0a418e0bcc..c80d4acced5 100644 --- a/storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff @@ -1,8 +1,20 @@ -101c101 -< # # # range c_v c_v # # # Using index condition ---- -> # # # ALL c_v NULL # # # Using where -138c138 -< # # # range # v16 # # # # ---- -> # # # ALL # NULL # # # # +--- type_char_indexes.result 2013-01-22 22:05:05.246633000 +0400 ++++ type_char_indexes.reject 2013-01-23 02:51:10.055371738 +0400 +@@ -98,7 +98,7 @@ + SET SESSION optimizer_switch = 'engine_condition_pushdown=on'; + EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE c > 'a'; + id select_type table type possible_keys key key_len ref rows Extra +-# # # range c_v c_v # # # Using index condition ++# # # ALL c_v NULL # # # Using where + SELECT c,c20,v16,v128 FROM t1 WHERE c > 'a'; + c c20 v16 v128 + b char3 varchar1a varchar1b +@@ -135,7 +135,7 @@ + r3a + EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16; + id select_type table type possible_keys key key_len ref rows Extra +-# # # range # v16 # # # # ++# # # ALL # NULL # # # # + SELECT c,c20,v16,v128 FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16; + c c20 v16 v128 + a char1 varchar1a varchar1b diff --git a/storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff index 640e1050a99..eb4da4db951 100644 --- a/storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff @@ -1,4 +1,11 @@ -63c63 -< # # # # # d # # # # ---- -> # # # # # NULL # # # # +--- type_float_indexes.result 2013-01-22 22:05:05.246633000 +0400 ++++ type_float_indexes.reject 2013-01-23 02:51:13.059333973 +0400 +@@ -60,7 +60,7 @@ + ALTER TABLE t1 ADD UNIQUE KEY(d); + EXPLAIN SELECT d FROM t1 WHERE r > 0 and d > 0 ORDER BY d; + id select_type table type possible_keys key key_len ref rows Extra +-# # # # # d # # # # ++# # # # # NULL # # # # + SELECT d FROM t1 WHERE r > 0 and d > 0 ORDER BY d; + d + 1.2345 diff --git a/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff index a4d7d4390b8..dbf29fb8d00 100644 --- a/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff @@ -1,706 +1,712 @@ -5,698c5,14 -< CREATE TABLE gis_line (fid <INT_COLUMN>, g LINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE gis_polygon (fid <INT_COLUMN>, g POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE gis_multi_point (fid <INT_COLUMN>, g MULTIPOINT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE gis_multi_line (fid <INT_COLUMN>, g MULTILINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE gis_multi_polygon (fid <INT_COLUMN>, g MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE gis_geometrycollection (fid <INT_COLUMN>, g GEOMETRYCOLLECTION) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE gis_geometry (fid <INT_COLUMN>, g GEOMETRY) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< USE gis_ogs; -< CREATE TABLE lakes (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< shore POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE road_segments (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< aliases CHAR(64) <CUSTOM_COL_OPTIONS>, -< num_lanes INT <CUSTOM_COL_OPTIONS>, -< centerline LINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE divided_routes (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< num_lanes INT <CUSTOM_COL_OPTIONS>, -< centerlines MULTILINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE forests (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< boundary MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE bridges (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< position POINT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE streams (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< centerline LINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE buildings (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< position POINT, -< footprint POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE ponds (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< type CHAR(64) <CUSTOM_COL_OPTIONS>, -< shores MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE named_places (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< boundary POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE map_neatlines (fid INT <CUSTOM_COL_OPTIONS>, -< neatline POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< USE test; -< SHOW FIELDS FROM gis_point; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g point YES NULL -< SHOW FIELDS FROM gis_line; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g linestring YES NULL -< SHOW FIELDS FROM gis_polygon; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g polygon YES NULL -< SHOW FIELDS FROM gis_multi_point; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g multipoint YES NULL -< SHOW FIELDS FROM gis_multi_line; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g multilinestring YES NULL -< SHOW FIELDS FROM gis_multi_polygon; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g multipolygon YES NULL -< SHOW FIELDS FROM gis_geometrycollection; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g geometrycollection YES NULL -< SHOW FIELDS FROM gis_geometry; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g geometry YES NULL -< INSERT INTO gis_point VALUES -< (101, PointFromText('POINT(10 10)')), -< (102, PointFromText('POINT(20 10)')), -< (103, PointFromText('POINT(20 20)')), -< (104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)')))); -< INSERT INTO gis_line VALUES -< (105, LineFromText('LINESTRING(0 0,0 10,10 0)')), -< (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), -< (107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10))))); -< INSERT INTO gis_polygon VALUES -< (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), -< (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), -< (110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))))); -< INSERT INTO gis_multi_point VALUES -< (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), -< (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), -< (113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10))))); -< INSERT INTO gis_multi_line VALUES -< (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), -< (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), -< (116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))))); -< INSERT INTO gis_multi_polygon VALUES -< (117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), -< (118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), -< (119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))))); -< INSERT INTO gis_geometrycollection VALUES -< (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), -< (121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))), -< (122, GeomFromText('GeometryCollection()')), -< (123, GeomFromText('GeometryCollection EMPTY')); -< INSERT into gis_geometry SELECT * FROM gis_point; -< INSERT into gis_geometry SELECT * FROM gis_line; -< INSERT into gis_geometry SELECT * FROM gis_polygon; -< INSERT into gis_geometry SELECT * FROM gis_multi_point; -< INSERT into gis_geometry SELECT * FROM gis_multi_line; -< INSERT into gis_geometry SELECT * FROM gis_multi_polygon; -< INSERT into gis_geometry SELECT * FROM gis_geometrycollection; -< SELECT fid, AsText(g) FROM gis_point; -< fid AsText(g) -< 101 POINT(10 10) -< 102 POINT(20 10) -< 103 POINT(20 20) -< 104 POINT(10 20) -< SELECT fid, AsText(g) FROM gis_line; -< fid AsText(g) -< 105 LINESTRING(0 0,0 10,10 0) -< 106 LINESTRING(10 10,20 10,20 20,10 20,10 10) -< 107 LINESTRING(10 10,40 10) -< SELECT fid, AsText(g) FROM gis_polygon; -< fid AsText(g) -< 108 POLYGON((10 10,20 10,20 20,10 20,10 10)) -< 109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) -< 110 POLYGON((0 0,30 0,30 30,0 0)) -< SELECT fid, AsText(g) FROM gis_multi_point; -< fid AsText(g) -< 111 MULTIPOINT(0 0,10 10,10 20,20 20) -< 112 MULTIPOINT(1 1,11 11,11 21,21 21) -< 113 MULTIPOINT(3 6,4 10) -< SELECT fid, AsText(g) FROM gis_multi_line; -< fid AsText(g) -< 114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) -< 115 MULTILINESTRING((10 48,10 21,10 0)) -< 116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) -< SELECT fid, AsText(g) FROM gis_multi_polygon; -< fid AsText(g) -< 117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) -< 118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) -< 119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) -< SELECT fid, AsText(g) FROM gis_geometrycollection; -< fid AsText(g) -< 120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) -< 121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) -< 122 GEOMETRYCOLLECTION EMPTY -< 123 GEOMETRYCOLLECTION EMPTY -< SELECT fid, AsText(g) FROM gis_geometry; -< fid AsText(g) -< 101 POINT(10 10) -< 102 POINT(20 10) -< 103 POINT(20 20) -< 104 POINT(10 20) -< 105 LINESTRING(0 0,0 10,10 0) -< 106 LINESTRING(10 10,20 10,20 20,10 20,10 10) -< 107 LINESTRING(10 10,40 10) -< 108 POLYGON((10 10,20 10,20 20,10 20,10 10)) -< 109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) -< 110 POLYGON((0 0,30 0,30 30,0 0)) -< 111 MULTIPOINT(0 0,10 10,10 20,20 20) -< 112 MULTIPOINT(1 1,11 11,11 21,21 21) -< 113 MULTIPOINT(3 6,4 10) -< 114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) -< 115 MULTILINESTRING((10 48,10 21,10 0)) -< 116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) -< 117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) -< 118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) -< 119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) -< 120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) -< 121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) -< 122 GEOMETRYCOLLECTION EMPTY -< 123 GEOMETRYCOLLECTION EMPTY -< SELECT fid, Dimension(g) FROM gis_geometry; -< fid Dimension(g) -< 101 0 -< 102 0 -< 103 0 -< 104 0 -< 105 1 -< 106 1 -< 107 1 -< 108 2 -< 109 2 -< 110 2 -< 111 0 -< 112 0 -< 113 0 -< 114 1 -< 115 1 -< 116 1 -< 117 2 -< 118 2 -< 119 2 -< 120 1 -< 121 1 -< 122 0 -< 123 0 -< SELECT fid, GeometryType(g) FROM gis_geometry; -< fid GeometryType(g) -< 101 POINT -< 102 POINT -< 103 POINT -< 104 POINT -< 105 LINESTRING -< 106 LINESTRING -< 107 LINESTRING -< 108 POLYGON -< 109 POLYGON -< 110 POLYGON -< 111 MULTIPOINT -< 112 MULTIPOINT -< 113 MULTIPOINT -< 114 MULTILINESTRING -< 115 MULTILINESTRING -< 116 MULTILINESTRING -< 117 MULTIPOLYGON -< 118 MULTIPOLYGON -< 119 MULTIPOLYGON -< 120 GEOMETRYCOLLECTION -< 121 GEOMETRYCOLLECTION -< 122 GEOMETRYCOLLECTION -< 123 GEOMETRYCOLLECTION -< SELECT fid, IsEmpty(g) FROM gis_geometry; -< fid IsEmpty(g) -< 101 0 -< 102 0 -< 103 0 -< 104 0 -< 105 0 -< 106 0 -< 107 0 -< 108 0 -< 109 0 -< 110 0 -< 111 0 -< 112 0 -< 113 0 -< 114 0 -< 115 0 -< 116 0 -< 117 0 -< 118 0 -< 119 0 -< 120 0 -< 121 0 -< 122 0 -< 123 0 -< SELECT fid, AsText(Envelope(g)) FROM gis_geometry; -< fid AsText(Envelope(g)) -< 101 POLYGON((10 10,10 10,10 10,10 10,10 10)) -< 102 POLYGON((20 10,20 10,20 10,20 10,20 10)) -< 103 POLYGON((20 20,20 20,20 20,20 20,20 20)) -< 104 POLYGON((10 20,10 20,10 20,10 20,10 20)) -< 105 POLYGON((0 0,10 0,10 10,0 10,0 0)) -< 106 POLYGON((10 10,20 10,20 20,10 20,10 10)) -< 107 POLYGON((10 10,40 10,40 10,10 10,10 10)) -< 108 POLYGON((10 10,20 10,20 20,10 20,10 10)) -< 109 POLYGON((0 0,50 0,50 50,0 50,0 0)) -< 110 POLYGON((0 0,30 0,30 30,0 30,0 0)) -< 111 POLYGON((0 0,20 0,20 20,0 20,0 0)) -< 112 POLYGON((1 1,21 1,21 21,1 21,1 1)) -< 113 POLYGON((3 6,4 6,4 10,3 10,3 6)) -< 114 POLYGON((10 0,16 0,16 48,10 48,10 0)) -< 115 POLYGON((10 0,10 0,10 48,10 48,10 0)) -< 116 POLYGON((1 2,21 2,21 8,1 8,1 2)) -< 117 POLYGON((28 0,84 0,84 42,28 42,28 0)) -< 118 POLYGON((28 0,84 0,84 42,28 42,28 0)) -< 119 POLYGON((0 0,3 0,3 3,0 3,0 0)) -< 120 POLYGON((0 0,10 0,10 10,0 10,0 0)) -< 121 POLYGON((3 6,44 6,44 9,3 9,3 6)) -< 122 GEOMETRYCOLLECTION EMPTY -< 123 GEOMETRYCOLLECTION EMPTY -< SELECT fid, X(g) FROM gis_point; -< fid X(g) -< 101 10 -< 102 20 -< 103 20 -< 104 10 -< SELECT fid, Y(g) FROM gis_point; -< fid Y(g) -< 101 10 -< 102 10 -< 103 20 -< 104 20 -< SELECT fid, AsText(StartPoint(g)) FROM gis_line; -< fid AsText(StartPoint(g)) -< 105 POINT(0 0) -< 106 POINT(10 10) -< 107 POINT(10 10) -< SELECT fid, AsText(EndPoint(g)) FROM gis_line; -< fid AsText(EndPoint(g)) -< 105 POINT(10 0) -< 106 POINT(10 10) -< 107 POINT(40 10) -< SELECT fid, GLength(g) FROM gis_line; -< fid GLength(g) -< 105 24.14213562373095 -< 106 40 -< 107 30 -< SELECT fid, NumPoints(g) FROM gis_line; -< fid NumPoints(g) -< 105 3 -< 106 5 -< 107 2 -< SELECT fid, AsText(PointN(g, 2)) FROM gis_line; -< fid AsText(PointN(g, 2)) -< 105 POINT(0 10) -< 106 POINT(20 10) -< 107 POINT(40 10) -< SELECT fid, IsClosed(g) FROM gis_line; -< fid IsClosed(g) -< 105 0 -< 106 1 -< 107 0 -< SELECT fid, AsText(Centroid(g)) FROM gis_polygon; -< fid AsText(Centroid(g)) -< 108 POINT(15 15) -< 109 POINT(25.416666666666668 25.416666666666668) -< 110 POINT(20 10) -< SELECT fid, Area(g) FROM gis_polygon; -< fid Area(g) -< 108 100 -< 109 2400 -< 110 450 -< SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon; -< fid AsText(ExteriorRing(g)) -< 108 LINESTRING(10 10,20 10,20 20,10 20,10 10) -< 109 LINESTRING(0 0,50 0,50 50,0 50,0 0) -< 110 LINESTRING(0 0,30 0,30 30,0 0) -< SELECT fid, NumInteriorRings(g) FROM gis_polygon; -< fid NumInteriorRings(g) -< 108 0 -< 109 1 -< 110 0 -< SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon; -< fid AsText(InteriorRingN(g, 1)) -< 108 NULL -< 109 LINESTRING(10 10,20 10,20 20,10 20,10 10) -< 110 NULL -< SELECT fid, IsClosed(g) FROM gis_multi_line; -< fid IsClosed(g) -< 114 0 -< 115 0 -< 116 0 -< SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon; -< fid AsText(Centroid(g)) -< 117 POINT(55.58852775304245 17.426536064113982) -< 118 POINT(55.58852775304245 17.426536064113982) -< 119 POINT(2 2) -< SELECT fid, Area(g) FROM gis_multi_polygon; -< fid Area(g) -< 117 1684.5 -< 118 1684.5 -< 119 4.5 -< SELECT fid, NumGeometries(g) from gis_multi_point; -< fid NumGeometries(g) -< 111 4 -< 112 4 -< 113 2 -< SELECT fid, NumGeometries(g) from gis_multi_line; -< fid NumGeometries(g) -< 114 2 -< 115 1 -< 116 2 -< SELECT fid, NumGeometries(g) from gis_multi_polygon; -< fid NumGeometries(g) -< 117 2 -< 118 2 -< 119 1 -< SELECT fid, NumGeometries(g) from gis_geometrycollection; -< fid NumGeometries(g) -< 120 2 -< 121 2 -< 122 0 -< 123 0 -< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point; -< fid AsText(GeometryN(g, 2)) -< 111 POINT(10 10) -< 112 POINT(11 11) -< 113 POINT(4 10) -< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line; -< fid AsText(GeometryN(g, 2)) -< 114 LINESTRING(16 0,16 23,16 48) -< 115 NULL -< 116 LINESTRING(2 5,5 8,21 7) -< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon; -< fid AsText(GeometryN(g, 2)) -< 117 POLYGON((59 18,67 18,67 13,59 13,59 18)) -< 118 POLYGON((59 18,67 18,67 13,59 13,59 18)) -< 119 NULL -< SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection; -< fid AsText(GeometryN(g, 2)) -< 120 LINESTRING(0 0,10 10) -< 121 LINESTRING(3 6,7 9) -< 122 NULL -< 123 NULL -< SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection; -< fid AsText(GeometryN(g, 1)) -< 120 POINT(0 0) -< 121 POINT(44 6) -< 122 NULL -< 123 NULL -< SELECT g1.fid as first, g2.fid as second, -< Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o, -< Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, -< Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r -< FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; -< first second w c o e d t i r -< 120 120 1 1 0 1 0 1 1 0 -< 120 121 0 0 1 0 0 0 1 0 -< 120 122 0 1 NULL 0 NULL 0 NULL 0 -< 120 123 0 1 NULL 0 NULL 0 NULL 0 -< 121 120 0 0 1 0 0 0 1 0 -< 121 121 1 1 0 1 0 1 1 0 -< 121 122 0 1 NULL 0 NULL 0 NULL 0 -< 121 123 0 1 NULL 0 NULL 0 NULL 0 -< 122 120 1 0 NULL 0 NULL 0 NULL 0 -< 122 121 1 0 NULL 0 NULL 0 NULL 0 -< 122 122 1 1 NULL 1 NULL 0 NULL 0 -< 122 123 1 1 NULL 1 NULL 0 NULL 0 -< 123 120 1 0 NULL 0 NULL 0 NULL 0 -< 123 121 1 0 NULL 0 NULL 0 NULL 0 -< 123 122 1 1 NULL 1 NULL 0 NULL 0 -< 123 123 1 1 NULL 1 NULL 0 NULL 0 -< DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; -< USE gis_ogs; -< # Lakes -< INSERT INTO lakes VALUES ( -< 101, 'BLUE LAKE', -< PolyFromText( -< 'POLYGON( -< (52 18,66 23,73 9,48 6,52 18), -< (59 18,67 18,67 13,59 13,59 18) -< )', -< 101)); -< # Road Segments -< INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2, -< LineFromText( -< 'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101)); -< INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4, -< LineFromText( -< 'LINESTRING( 44 31, 56 34, 70 38 )' ,101)); -< INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2, -< LineFromText( -< 'LINESTRING( 70 38, 72 48 )' ,101)); -< INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4, -< LineFromText( -< 'LINESTRING( 70 38, 84 42 )' ,101)); -< INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL, -< 1, -< LineFromText( -< 'LINESTRING( 28 26, 28 0 )',101)); -< # DividedRoutes -< INSERT INTO divided_routes VALUES(119, 'Route 75', 4, -< MLineFromText( -< 'MULTILINESTRING((10 48,10 21,10 0), -< (16 0,16 23,16 48))', 101)); -< # Forests -< INSERT INTO forests VALUES(109, 'Green Forest', -< MPolyFromText( -< 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26), -< (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))', -< 101)); -< # Bridges -< INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText( -< 'POINT( 44 31 )', 101)); -< # Streams -< INSERT INTO streams VALUES(111, 'Cam Stream', -< LineFromText( -< 'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101)); -< INSERT INTO streams VALUES(112, NULL, -< LineFromText( -< 'LINESTRING( 76 0, 78 4, 73 9 )', 101)); -< # Buildings -< INSERT INTO buildings VALUES(113, '123 Main Street', -< PointFromText( -< 'POINT( 52 30 )', 101), -< PolyFromText( -< 'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101)); -< INSERT INTO buildings VALUES(114, '215 Main Street', -< PointFromText( -< 'POINT( 64 33 )', 101), -< PolyFromText( -< 'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101)); -< # Ponds -< INSERT INTO ponds VALUES(120, NULL, 'Stock Pond', -< MPolyFromText( -< 'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ), -< ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101)); -< # Named Places -< INSERT INTO named_places VALUES(117, 'Ashton', -< PolyFromText( -< 'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101)); -< INSERT INTO named_places VALUES(118, 'Goose Island', -< PolyFromText( -< 'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101)); -< # Map Neatlines -< INSERT INTO map_neatlines VALUES(115, -< PolyFromText( -< 'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101)); -< SELECT Dimension(shore) -< FROM lakes -< WHERE name = 'Blue Lake'; -< Dimension(shore) -< 2 -< SELECT GeometryType(centerlines) -< FROM divided_routes -< WHERE name = 'Route 75'; -< GeometryType(centerlines) -< MULTILINESTRING -< SELECT AsText(boundary) -< FROM named_places -< WHERE name = 'Goose Island'; -< AsText(boundary) -< POLYGON((67 13,67 18,59 18,59 13,67 13)) -< SELECT AsText(PolyFromWKB(AsBinary(boundary),101)) -< FROM named_places -< WHERE name = 'Goose Island'; -< AsText(PolyFromWKB(AsBinary(boundary),101)) -< POLYGON((67 13,67 18,59 18,59 13,67 13)) -< SELECT SRID(boundary) -< FROM named_places -< WHERE name = 'Goose Island'; -< SRID(boundary) -< 101 -< SELECT IsEmpty(centerline) -< FROM road_segments -< WHERE name = 'Route 5' -< AND aliases = 'Main Street'; -< IsEmpty(centerline) -< 0 -< SELECT AsText(Envelope(boundary)) -< FROM named_places -< WHERE name = 'Goose Island'; -< AsText(Envelope(boundary)) -< POLYGON((59 13,67 13,67 18,59 18,59 13)) -< SELECT X(position) -< FROM bridges -< WHERE name = 'Cam Bridge'; -< X(position) -< 44 -< SELECT Y(position) -< FROM bridges -< WHERE name = 'Cam Bridge'; -< Y(position) -< 31 -< SELECT AsText(StartPoint(centerline)) -< FROM road_segments -< WHERE fid = 102; -< AsText(StartPoint(centerline)) -< POINT(0 18) -< SELECT AsText(EndPoint(centerline)) -< FROM road_segments -< WHERE fid = 102; -< AsText(EndPoint(centerline)) -< POINT(44 31) -< SELECT GLength(centerline) -< FROM road_segments -< WHERE fid = 106; -< GLength(centerline) -< 26 -< SELECT NumPoints(centerline) -< FROM road_segments -< WHERE fid = 102; -< NumPoints(centerline) -< 5 -< SELECT AsText(PointN(centerline, 1)) -< FROM road_segments -< WHERE fid = 102; -< AsText(PointN(centerline, 1)) -< POINT(0 18) -< SELECT AsText(Centroid(boundary)) -< FROM named_places -< WHERE name = 'Goose Island'; -< AsText(Centroid(boundary)) -< POINT(63 15.5) -< SELECT Area(boundary) -< FROM named_places -< WHERE name = 'Goose Island'; -< Area(boundary) -< 40 -< SELECT AsText(ExteriorRing(shore)) -< FROM lakes -< WHERE name = 'Blue Lake'; -< AsText(ExteriorRing(shore)) -< LINESTRING(52 18,66 23,73 9,48 6,52 18) -< SELECT NumInteriorRings(shore) -< FROM lakes -< WHERE name = 'Blue Lake'; -< NumInteriorRings(shore) -< 1 -< SELECT AsText(InteriorRingN(shore, 1)) -< FROM lakes -< WHERE name = 'Blue Lake'; -< AsText(InteriorRingN(shore, 1)) -< LINESTRING(59 18,67 18,67 13,59 13,59 18) -< SELECT NumGeometries(centerlines) -< FROM divided_routes -< WHERE name = 'Route 75'; -< NumGeometries(centerlines) -< 2 -< SELECT AsText(GeometryN(centerlines, 2)) -< FROM divided_routes -< WHERE name = 'Route 75'; -< AsText(GeometryN(centerlines, 2)) -< LINESTRING(16 0,16 23,16 48) -< SELECT IsClosed(centerlines) -< FROM divided_routes -< WHERE name = 'Route 75'; -< IsClosed(centerlines) -< 0 -< SELECT GLength(centerlines) -< FROM divided_routes -< WHERE name = 'Route 75'; -< GLength(centerlines) -< 96 -< SELECT AsText(Centroid(shores)) -< FROM ponds -< WHERE fid = 120; -< AsText(Centroid(shores)) -< POINT(25 42) -< SELECT Area(shores) -< FROM ponds -< WHERE fid = 120; -< Area(shores) -< 8 -< SELECT ST_Equals(boundary, -< PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) -< FROM named_places -< WHERE name = 'Goose Island'; -< ST_Equals(boundary, -< PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) -< 1 -< SELECT ST_Disjoint(centerlines, boundary) -< FROM divided_routes, named_places -< WHERE divided_routes.name = 'Route 75' -< AND named_places.name = 'Ashton'; -< ST_Disjoint(centerlines, boundary) -< 1 -< SELECT ST_Touches(centerline, shore) -< FROM streams, lakes -< WHERE streams.name = 'Cam Stream' -< AND lakes.name = 'Blue Lake'; -< ST_Touches(centerline, shore) -< 1 -< SELECT Crosses(road_segments.centerline, divided_routes.centerlines) -< FROM road_segments, divided_routes -< WHERE road_segments.fid = 102 -< AND divided_routes.name = 'Route 75'; -< Crosses(road_segments.centerline, divided_routes.centerlines) -< 1 -< SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines) -< FROM road_segments, divided_routes -< WHERE road_segments.fid = 102 -< AND divided_routes.name = 'Route 75'; -< ST_Intersects(road_segments.centerline, divided_routes.centerlines) -< 1 -< SELECT ST_Contains(forests.boundary, named_places.boundary) -< FROM forests, named_places -< WHERE forests.name = 'Green Forest' -< AND named_places.name = 'Ashton'; -< ST_Contains(forests.boundary, named_places.boundary) -< 0 -< SELECT ST_Distance(position, boundary) -< FROM bridges, named_places -< WHERE bridges.name = 'Cam Bridge' -< AND named_places.name = 'Ashton'; -< ST_Distance(position, boundary) -< 12 -< SELECT AsText(ST_Difference(named_places.boundary, forests.boundary)) -< FROM named_places, forests -< WHERE named_places.name = 'Ashton' -< AND forests.name = 'Green Forest'; -< AsText(ST_Difference(named_places.boundary, forests.boundary)) -< POLYGON((56 34,62 48,84 48,84 42,56 34)) -< SELECT AsText(ST_Union(shore, boundary)) -< FROM lakes, named_places -< WHERE lakes.name = 'Blue Lake' -< AND named_places.name = 'Goose Island'; -< AsText(ST_Union(shore, boundary)) -< POLYGON((48 6,52 18,66 23,73 9,48 6)) -< SELECT AsText(ST_SymDifference(shore, boundary)) -< FROM lakes, named_places -< WHERE lakes.name = 'Blue Lake' -< AND named_places.name = 'Ashton'; -< AsText(ST_SymDifference(shore, boundary)) -< MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30))) -< SELECT count(*) -< FROM buildings, bridges -< WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1; -< count(*) -< 1 ---- -> ERROR 42000: The storage engine for the table doesn't support GEOMETRY -> # ERROR: Statement ended with errno 1178, errname ER_CHECK_NOT_IMPLEMENTED (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ CREATE TABLE gis_point (fid INT(11) /*!*/ /*Custom column options*/, g POINT) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.gis_point) INSERT_METHOD=LAST ] -> # The statement|command finished with ER_CHECK_NOT_IMPLEMENTED. -> # Geometry types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- +--- type_spatial.result 2013-01-23 01:25:39.143876032 +0400 ++++ type_spatial.reject 2013-01-23 02:51:14.535315418 +0400 +@@ -2,699 +2,15 @@ + DROP DATABASE IF EXISTS gis_ogs; + CREATE DATABASE gis_ogs; + CREATE TABLE gis_point (fid <INT_COLUMN>, g POINT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_line (fid <INT_COLUMN>, g LINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_polygon (fid <INT_COLUMN>, g POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_multi_point (fid <INT_COLUMN>, g MULTIPOINT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_multi_line (fid <INT_COLUMN>, g MULTILINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_multi_polygon (fid <INT_COLUMN>, g MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_geometrycollection (fid <INT_COLUMN>, g GEOMETRYCOLLECTION) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_geometry (fid <INT_COLUMN>, g GEOMETRY) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-USE gis_ogs; +-CREATE TABLE lakes (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-shore POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE road_segments (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-aliases CHAR(64) <CUSTOM_COL_OPTIONS>, +-num_lanes INT <CUSTOM_COL_OPTIONS>, +-centerline LINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE divided_routes (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-num_lanes INT <CUSTOM_COL_OPTIONS>, +-centerlines MULTILINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE forests (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-boundary MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE bridges (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-position POINT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE streams (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-centerline LINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE buildings (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-position POINT, +-footprint POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE ponds (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-type CHAR(64) <CUSTOM_COL_OPTIONS>, +-shores MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE named_places (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-boundary POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE map_neatlines (fid INT <CUSTOM_COL_OPTIONS>, +-neatline POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-USE test; +-SHOW FIELDS FROM gis_point; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g point YES NULL +-SHOW FIELDS FROM gis_line; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g linestring YES NULL +-SHOW FIELDS FROM gis_polygon; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g polygon YES NULL +-SHOW FIELDS FROM gis_multi_point; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g multipoint YES NULL +-SHOW FIELDS FROM gis_multi_line; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g multilinestring YES NULL +-SHOW FIELDS FROM gis_multi_polygon; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g multipolygon YES NULL +-SHOW FIELDS FROM gis_geometrycollection; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g geometrycollection YES NULL +-SHOW FIELDS FROM gis_geometry; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g geometry YES NULL +-INSERT INTO gis_point (fid,g) VALUES +-(101, PointFromText('POINT(10 10)')), +-(102, PointFromText('POINT(20 10)')), +-(103, PointFromText('POINT(20 20)')), +-(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)')))); +-INSERT INTO gis_line (fid,g) VALUES +-(105, LineFromText('LINESTRING(0 0,0 10,10 0)')), +-(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), +-(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10))))); +-INSERT INTO gis_polygon (fid,g) VALUES +-(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), +-(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), +-(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))))); +-INSERT INTO gis_multi_point (fid,g) VALUES +-(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), +-(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), +-(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10))))); +-INSERT INTO gis_multi_line (fid,g) VALUES +-(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), +-(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), +-(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))))); +-INSERT INTO gis_multi_polygon (fid,g) VALUES +-(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), +-(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), +-(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))))); +-INSERT INTO gis_geometrycollection (fid,g) VALUES +-(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), +-(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))), +-(122, GeomFromText('GeometryCollection()')), +-(123, GeomFromText('GeometryCollection EMPTY')); +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_point; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_line; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_polygon; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_point; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_line; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_polygon; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_geometrycollection; +-SELECT fid, AsText(g) FROM gis_point; +-fid AsText(g) +-101 POINT(10 10) +-102 POINT(20 10) +-103 POINT(20 20) +-104 POINT(10 20) +-SELECT fid, AsText(g) FROM gis_line; +-fid AsText(g) +-105 LINESTRING(0 0,0 10,10 0) +-106 LINESTRING(10 10,20 10,20 20,10 20,10 10) +-107 LINESTRING(10 10,40 10) +-SELECT fid, AsText(g) FROM gis_polygon; +-fid AsText(g) +-108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +-109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) +-110 POLYGON((0 0,30 0,30 30,0 0)) +-SELECT fid, AsText(g) FROM gis_multi_point; +-fid AsText(g) +-111 MULTIPOINT(0 0,10 10,10 20,20 20) +-112 MULTIPOINT(1 1,11 11,11 21,21 21) +-113 MULTIPOINT(3 6,4 10) +-SELECT fid, AsText(g) FROM gis_multi_line; +-fid AsText(g) +-114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) +-115 MULTILINESTRING((10 48,10 21,10 0)) +-116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) +-SELECT fid, AsText(g) FROM gis_multi_polygon; +-fid AsText(g) +-117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +-118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +-119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) +-SELECT fid, AsText(g) FROM gis_geometrycollection; +-fid AsText(g) +-120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) +-121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) +-122 GEOMETRYCOLLECTION EMPTY +-123 GEOMETRYCOLLECTION EMPTY +-SELECT fid, AsText(g) FROM gis_geometry; +-fid AsText(g) +-101 POINT(10 10) +-102 POINT(20 10) +-103 POINT(20 20) +-104 POINT(10 20) +-105 LINESTRING(0 0,0 10,10 0) +-106 LINESTRING(10 10,20 10,20 20,10 20,10 10) +-107 LINESTRING(10 10,40 10) +-108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +-109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) +-110 POLYGON((0 0,30 0,30 30,0 0)) +-111 MULTIPOINT(0 0,10 10,10 20,20 20) +-112 MULTIPOINT(1 1,11 11,11 21,21 21) +-113 MULTIPOINT(3 6,4 10) +-114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) +-115 MULTILINESTRING((10 48,10 21,10 0)) +-116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) +-117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +-118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +-119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) +-120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) +-121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) +-122 GEOMETRYCOLLECTION EMPTY +-123 GEOMETRYCOLLECTION EMPTY +-SELECT fid, Dimension(g) FROM gis_geometry; +-fid Dimension(g) +-101 0 +-102 0 +-103 0 +-104 0 +-105 1 +-106 1 +-107 1 +-108 2 +-109 2 +-110 2 +-111 0 +-112 0 +-113 0 +-114 1 +-115 1 +-116 1 +-117 2 +-118 2 +-119 2 +-120 1 +-121 1 +-122 0 +-123 0 +-SELECT fid, GeometryType(g) FROM gis_geometry; +-fid GeometryType(g) +-101 POINT +-102 POINT +-103 POINT +-104 POINT +-105 LINESTRING +-106 LINESTRING +-107 LINESTRING +-108 POLYGON +-109 POLYGON +-110 POLYGON +-111 MULTIPOINT +-112 MULTIPOINT +-113 MULTIPOINT +-114 MULTILINESTRING +-115 MULTILINESTRING +-116 MULTILINESTRING +-117 MULTIPOLYGON +-118 MULTIPOLYGON +-119 MULTIPOLYGON +-120 GEOMETRYCOLLECTION +-121 GEOMETRYCOLLECTION +-122 GEOMETRYCOLLECTION +-123 GEOMETRYCOLLECTION +-SELECT fid, IsEmpty(g) FROM gis_geometry; +-fid IsEmpty(g) +-101 0 +-102 0 +-103 0 +-104 0 +-105 0 +-106 0 +-107 0 +-108 0 +-109 0 +-110 0 +-111 0 +-112 0 +-113 0 +-114 0 +-115 0 +-116 0 +-117 0 +-118 0 +-119 0 +-120 0 +-121 0 +-122 0 +-123 0 +-SELECT fid, AsText(Envelope(g)) FROM gis_geometry; +-fid AsText(Envelope(g)) +-101 POLYGON((10 10,10 10,10 10,10 10,10 10)) +-102 POLYGON((20 10,20 10,20 10,20 10,20 10)) +-103 POLYGON((20 20,20 20,20 20,20 20,20 20)) +-104 POLYGON((10 20,10 20,10 20,10 20,10 20)) +-105 POLYGON((0 0,10 0,10 10,0 10,0 0)) +-106 POLYGON((10 10,20 10,20 20,10 20,10 10)) +-107 POLYGON((10 10,40 10,40 10,10 10,10 10)) +-108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +-109 POLYGON((0 0,50 0,50 50,0 50,0 0)) +-110 POLYGON((0 0,30 0,30 30,0 30,0 0)) +-111 POLYGON((0 0,20 0,20 20,0 20,0 0)) +-112 POLYGON((1 1,21 1,21 21,1 21,1 1)) +-113 POLYGON((3 6,4 6,4 10,3 10,3 6)) +-114 POLYGON((10 0,16 0,16 48,10 48,10 0)) +-115 POLYGON((10 0,10 0,10 48,10 48,10 0)) +-116 POLYGON((1 2,21 2,21 8,1 8,1 2)) +-117 POLYGON((28 0,84 0,84 42,28 42,28 0)) +-118 POLYGON((28 0,84 0,84 42,28 42,28 0)) +-119 POLYGON((0 0,3 0,3 3,0 3,0 0)) +-120 POLYGON((0 0,10 0,10 10,0 10,0 0)) +-121 POLYGON((3 6,44 6,44 9,3 9,3 6)) +-122 GEOMETRYCOLLECTION EMPTY +-123 GEOMETRYCOLLECTION EMPTY +-SELECT fid, X(g) FROM gis_point; +-fid X(g) +-101 10 +-102 20 +-103 20 +-104 10 +-SELECT fid, Y(g) FROM gis_point; +-fid Y(g) +-101 10 +-102 10 +-103 20 +-104 20 +-SELECT fid, AsText(StartPoint(g)) FROM gis_line; +-fid AsText(StartPoint(g)) +-105 POINT(0 0) +-106 POINT(10 10) +-107 POINT(10 10) +-SELECT fid, AsText(EndPoint(g)) FROM gis_line; +-fid AsText(EndPoint(g)) +-105 POINT(10 0) +-106 POINT(10 10) +-107 POINT(40 10) +-SELECT fid, GLength(g) FROM gis_line; +-fid GLength(g) +-105 24.14213562373095 +-106 40 +-107 30 +-SELECT fid, NumPoints(g) FROM gis_line; +-fid NumPoints(g) +-105 3 +-106 5 +-107 2 +-SELECT fid, AsText(PointN(g, 2)) FROM gis_line; +-fid AsText(PointN(g, 2)) +-105 POINT(0 10) +-106 POINT(20 10) +-107 POINT(40 10) +-SELECT fid, IsClosed(g) FROM gis_line; +-fid IsClosed(g) +-105 0 +-106 1 +-107 0 +-SELECT fid, AsText(Centroid(g)) FROM gis_polygon; +-fid AsText(Centroid(g)) +-108 POINT(15 15) +-109 POINT(25.416666666666668 25.416666666666668) +-110 POINT(20 10) +-SELECT fid, Area(g) FROM gis_polygon; +-fid Area(g) +-108 100 +-109 2400 +-110 450 +-SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon; +-fid AsText(ExteriorRing(g)) +-108 LINESTRING(10 10,20 10,20 20,10 20,10 10) +-109 LINESTRING(0 0,50 0,50 50,0 50,0 0) +-110 LINESTRING(0 0,30 0,30 30,0 0) +-SELECT fid, NumInteriorRings(g) FROM gis_polygon; +-fid NumInteriorRings(g) +-108 0 +-109 1 +-110 0 +-SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon; +-fid AsText(InteriorRingN(g, 1)) +-108 NULL +-109 LINESTRING(10 10,20 10,20 20,10 20,10 10) +-110 NULL +-SELECT fid, IsClosed(g) FROM gis_multi_line; +-fid IsClosed(g) +-114 0 +-115 0 +-116 0 +-SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon; +-fid AsText(Centroid(g)) +-117 POINT(55.58852775304245 17.426536064113982) +-118 POINT(55.58852775304245 17.426536064113982) +-119 POINT(2 2) +-SELECT fid, Area(g) FROM gis_multi_polygon; +-fid Area(g) +-117 1684.5 +-118 1684.5 +-119 4.5 +-SELECT fid, NumGeometries(g) from gis_multi_point; +-fid NumGeometries(g) +-111 4 +-112 4 +-113 2 +-SELECT fid, NumGeometries(g) from gis_multi_line; +-fid NumGeometries(g) +-114 2 +-115 1 +-116 2 +-SELECT fid, NumGeometries(g) from gis_multi_polygon; +-fid NumGeometries(g) +-117 2 +-118 2 +-119 1 +-SELECT fid, NumGeometries(g) from gis_geometrycollection; +-fid NumGeometries(g) +-120 2 +-121 2 +-122 0 +-123 0 +-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point; +-fid AsText(GeometryN(g, 2)) +-111 POINT(10 10) +-112 POINT(11 11) +-113 POINT(4 10) +-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line; +-fid AsText(GeometryN(g, 2)) +-114 LINESTRING(16 0,16 23,16 48) +-115 NULL +-116 LINESTRING(2 5,5 8,21 7) +-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon; +-fid AsText(GeometryN(g, 2)) +-117 POLYGON((59 18,67 18,67 13,59 13,59 18)) +-118 POLYGON((59 18,67 18,67 13,59 13,59 18)) +-119 NULL +-SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection; +-fid AsText(GeometryN(g, 2)) +-120 LINESTRING(0 0,10 10) +-121 LINESTRING(3 6,7 9) +-122 NULL +-123 NULL +-SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection; +-fid AsText(GeometryN(g, 1)) +-120 POINT(0 0) +-121 POINT(44 6) +-122 NULL +-123 NULL +-SELECT g1.fid as first, g2.fid as second, +-Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o, +-Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, +-Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r +-FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; +-first second w c o e d t i r +-120 120 1 1 0 1 0 1 1 0 +-120 121 0 0 1 0 0 0 1 0 +-120 122 0 1 NULL 0 NULL 0 NULL 0 +-120 123 0 1 NULL 0 NULL 0 NULL 0 +-121 120 0 0 1 0 0 0 1 0 +-121 121 1 1 0 1 0 1 1 0 +-121 122 0 1 NULL 0 NULL 0 NULL 0 +-121 123 0 1 NULL 0 NULL 0 NULL 0 +-122 120 1 0 NULL 0 NULL 0 NULL 0 +-122 121 1 0 NULL 0 NULL 0 NULL 0 +-122 122 1 1 NULL 1 NULL 0 NULL 0 +-122 123 1 1 NULL 1 NULL 0 NULL 0 +-123 120 1 0 NULL 0 NULL 0 NULL 0 +-123 121 1 0 NULL 0 NULL 0 NULL 0 +-123 122 1 1 NULL 1 NULL 0 NULL 0 +-123 123 1 1 NULL 1 NULL 0 NULL 0 +-DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; +-USE gis_ogs; +-# Lakes +-INSERT INTO lakes (fid,name,shore) VALUES ( +-101, 'BLUE LAKE', +-PolyFromText( +-'POLYGON( +- (52 18,66 23,73 9,48 6,52 18), +- (59 18,67 18,67 13,59 13,59 18) +- )', +-101)); +-# Road Segments +-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(102, 'Route 5', NULL, 2, +-LineFromText( +-'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101)); +-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(103, 'Route 5', 'Main Street', 4, +-LineFromText( +-'LINESTRING( 44 31, 56 34, 70 38 )' ,101)); +-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(104, 'Route 5', NULL, 2, +-LineFromText( +-'LINESTRING( 70 38, 72 48 )' ,101)); +-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(105, 'Main Street', NULL, 4, +-LineFromText( +-'LINESTRING( 70 38, 84 42 )' ,101)); +-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(106, 'Dirt Road by Green Forest', NULL, +-1, +-LineFromText( +-'LINESTRING( 28 26, 28 0 )',101)); +-# DividedRoutes +-INSERT INTO divided_routes (fid,name,num_lanes,centerlines) VALUES(119, 'Route 75', 4, +-MLineFromText( +-'MULTILINESTRING((10 48,10 21,10 0), +- (16 0,16 23,16 48))', 101)); +-# Forests +-INSERT INTO forests (fid,name,boundary) VALUES(109, 'Green Forest', +-MPolyFromText( +-'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26), +- (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))', +-101)); +-# Bridges +-INSERT INTO bridges (fid,name,position) VALUES(110, 'Cam Bridge', PointFromText( +-'POINT( 44 31 )', 101)); +-# Streams +-INSERT INTO streams (fid,name,centerline) VALUES(111, 'Cam Stream', +-LineFromText( +-'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101)); +-INSERT INTO streams (fid,name,centerline) VALUES(112, NULL, +-LineFromText( +-'LINESTRING( 76 0, 78 4, 73 9 )', 101)); +-# Buildings +-INSERT INTO buildings (fid,name,position,footprint) VALUES(113, '123 Main Street', +-PointFromText( +-'POINT( 52 30 )', 101), +-PolyFromText( +-'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101)); +-INSERT INTO buildings (fid,name,position,footprint) VALUES(114, '215 Main Street', +-PointFromText( +-'POINT( 64 33 )', 101), +-PolyFromText( +-'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101)); +-# Ponds +-INSERT INTO ponds (fid,name,type,shores) VALUES(120, NULL, 'Stock Pond', +-MPolyFromText( +-'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ), +- ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101)); +-# Named Places +-INSERT INTO named_places (fid,name,boundary) VALUES(117, 'Ashton', +-PolyFromText( +-'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101)); +-INSERT INTO named_places (fid,name,boundary) VALUES(118, 'Goose Island', +-PolyFromText( +-'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101)); +-# Map Neatlines +-INSERT INTO map_neatlines (fid,neatline) VALUES(115, +-PolyFromText( +-'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101)); +-SELECT Dimension(shore) +-FROM lakes +-WHERE name = 'Blue Lake'; +-Dimension(shore) +-2 +-SELECT GeometryType(centerlines) +-FROM divided_routes +-WHERE name = 'Route 75'; +-GeometryType(centerlines) +-MULTILINESTRING +-SELECT AsText(boundary) +-FROM named_places +-WHERE name = 'Goose Island'; +-AsText(boundary) +-POLYGON((67 13,67 18,59 18,59 13,67 13)) +-SELECT AsText(PolyFromWKB(AsBinary(boundary),101)) +-FROM named_places +-WHERE name = 'Goose Island'; +-AsText(PolyFromWKB(AsBinary(boundary),101)) +-POLYGON((67 13,67 18,59 18,59 13,67 13)) +-SELECT SRID(boundary) +-FROM named_places +-WHERE name = 'Goose Island'; +-SRID(boundary) +-101 +-SELECT IsEmpty(centerline) +-FROM road_segments +-WHERE name = 'Route 5' +-AND aliases = 'Main Street'; +-IsEmpty(centerline) +-0 +-SELECT AsText(Envelope(boundary)) +-FROM named_places +-WHERE name = 'Goose Island'; +-AsText(Envelope(boundary)) +-POLYGON((59 13,67 13,67 18,59 18,59 13)) +-SELECT X(position) +-FROM bridges +-WHERE name = 'Cam Bridge'; +-X(position) +-44 +-SELECT Y(position) +-FROM bridges +-WHERE name = 'Cam Bridge'; +-Y(position) +-31 +-SELECT AsText(StartPoint(centerline)) +-FROM road_segments +-WHERE fid = 102; +-AsText(StartPoint(centerline)) +-POINT(0 18) +-SELECT AsText(EndPoint(centerline)) +-FROM road_segments +-WHERE fid = 102; +-AsText(EndPoint(centerline)) +-POINT(44 31) +-SELECT GLength(centerline) +-FROM road_segments +-WHERE fid = 106; +-GLength(centerline) +-26 +-SELECT NumPoints(centerline) +-FROM road_segments +-WHERE fid = 102; +-NumPoints(centerline) +-5 +-SELECT AsText(PointN(centerline, 1)) +-FROM road_segments +-WHERE fid = 102; +-AsText(PointN(centerline, 1)) +-POINT(0 18) +-SELECT AsText(Centroid(boundary)) +-FROM named_places +-WHERE name = 'Goose Island'; +-AsText(Centroid(boundary)) +-POINT(63 15.5) +-SELECT Area(boundary) +-FROM named_places +-WHERE name = 'Goose Island'; +-Area(boundary) +-40 +-SELECT AsText(ExteriorRing(shore)) +-FROM lakes +-WHERE name = 'Blue Lake'; +-AsText(ExteriorRing(shore)) +-LINESTRING(52 18,66 23,73 9,48 6,52 18) +-SELECT NumInteriorRings(shore) +-FROM lakes +-WHERE name = 'Blue Lake'; +-NumInteriorRings(shore) +-1 +-SELECT AsText(InteriorRingN(shore, 1)) +-FROM lakes +-WHERE name = 'Blue Lake'; +-AsText(InteriorRingN(shore, 1)) +-LINESTRING(59 18,67 18,67 13,59 13,59 18) +-SELECT NumGeometries(centerlines) +-FROM divided_routes +-WHERE name = 'Route 75'; +-NumGeometries(centerlines) +-2 +-SELECT AsText(GeometryN(centerlines, 2)) +-FROM divided_routes +-WHERE name = 'Route 75'; +-AsText(GeometryN(centerlines, 2)) +-LINESTRING(16 0,16 23,16 48) +-SELECT IsClosed(centerlines) +-FROM divided_routes +-WHERE name = 'Route 75'; +-IsClosed(centerlines) +-0 +-SELECT GLength(centerlines) +-FROM divided_routes +-WHERE name = 'Route 75'; +-GLength(centerlines) +-96 +-SELECT AsText(Centroid(shores)) +-FROM ponds +-WHERE fid = 120; +-AsText(Centroid(shores)) +-POINT(25 42) +-SELECT Area(shores) +-FROM ponds +-WHERE fid = 120; +-Area(shores) +-8 +-SELECT ST_Equals(boundary, +-PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) +-FROM named_places +-WHERE name = 'Goose Island'; +-ST_Equals(boundary, +-PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) +-1 +-SELECT ST_Disjoint(centerlines, boundary) +-FROM divided_routes, named_places +-WHERE divided_routes.name = 'Route 75' +-AND named_places.name = 'Ashton'; +-ST_Disjoint(centerlines, boundary) +-1 +-SELECT ST_Touches(centerline, shore) +-FROM streams, lakes +-WHERE streams.name = 'Cam Stream' +-AND lakes.name = 'Blue Lake'; +-ST_Touches(centerline, shore) +-1 +-SELECT Crosses(road_segments.centerline, divided_routes.centerlines) +-FROM road_segments, divided_routes +-WHERE road_segments.fid = 102 +-AND divided_routes.name = 'Route 75'; +-Crosses(road_segments.centerline, divided_routes.centerlines) +-1 +-SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines) +-FROM road_segments, divided_routes +-WHERE road_segments.fid = 102 +-AND divided_routes.name = 'Route 75'; +-ST_Intersects(road_segments.centerline, divided_routes.centerlines) +-1 +-SELECT ST_Contains(forests.boundary, named_places.boundary) +-FROM forests, named_places +-WHERE forests.name = 'Green Forest' +-AND named_places.name = 'Ashton'; +-ST_Contains(forests.boundary, named_places.boundary) +-0 +-SELECT ST_Distance(position, boundary) +-FROM bridges, named_places +-WHERE bridges.name = 'Cam Bridge' +-AND named_places.name = 'Ashton'; +-ST_Distance(position, boundary) +-12 +-SELECT AsText(ST_Difference(named_places.boundary, forests.boundary)) +-FROM named_places, forests +-WHERE named_places.name = 'Ashton' +-AND forests.name = 'Green Forest'; +-AsText(ST_Difference(named_places.boundary, forests.boundary)) +-POLYGON((56 34,62 48,84 48,84 42,56 34)) +-SELECT AsText(ST_Union(shore, boundary)) +-FROM lakes, named_places +-WHERE lakes.name = 'Blue Lake' +-AND named_places.name = 'Goose Island'; +-AsText(ST_Union(shore, boundary)) +-POLYGON((48 6,52 18,66 23,73 9,48 6)) +-SELECT AsText(ST_SymDifference(shore, boundary)) +-FROM lakes, named_places +-WHERE lakes.name = 'Blue Lake' +-AND named_places.name = 'Ashton'; +-AsText(ST_SymDifference(shore, boundary)) +-MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30))) +-SELECT count(*) +-FROM buildings, bridges +-WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1; +-count(*) +-1 ++ERROR 42000: The storage engine for the table doesn't support GEOMETRY ++# ERROR: Statement ended with errno 1178, errname ER_CHECK_NOT_IMPLEMENTED (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ CREATE TABLE gis_point (fid INT(11) /*!*/ /*Custom column options*/, g POINT) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.gis_point) INSERT_METHOD=LAST ] ++# The statement|command finished with ER_CHECK_NOT_IMPLEMENTED. ++# Geometry types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + DROP DATABASE gis_ogs; + USE test; diff --git a/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff index 89f1100f550..20d98db1ff2 100644 --- a/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff @@ -1,1412 +1,1422 @@ -5,698c5,14 -< CREATE TABLE gis_line (fid <INT_COLUMN>, g LINESTRING, <CUSTOM_INDEX> g(g(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE gis_polygon (fid <INT_COLUMN>, g POLYGON, <CUSTOM_INDEX> g(g(512))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE gis_multi_point (fid <INT_COLUMN>, g MULTIPOINT, <CUSTOM_INDEX> g(g(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE gis_multi_line (fid <INT_COLUMN>, g MULTILINESTRING, <CUSTOM_INDEX> g(g(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE gis_multi_polygon (fid <INT_COLUMN>, g MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE gis_geometrycollection (fid <INT_COLUMN>, g GEOMETRYCOLLECTION) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE gis_geometry (fid <INT_COLUMN>, g GEOMETRY) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< USE gis_ogs; -< CREATE TABLE lakes (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< shore POLYGON, <CUSTOM_INDEX> s(shore(64))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE road_segments (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< aliases CHAR(64) <CUSTOM_COL_OPTIONS>, -< num_lanes INT <CUSTOM_COL_OPTIONS>, -< centerline LINESTRING, <CUSTOM_INDEX> c(centerline(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE divided_routes (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< num_lanes INT <CUSTOM_COL_OPTIONS>, -< centerlines MULTILINESTRING, <CUSTOM_INDEX> c(centerlines(512))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE forests (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< boundary MULTIPOLYGON, <CUSTOM_INDEX> b(boundary(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE bridges (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< position POINT, <CUSTOM_INDEX> p(`position`(64))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE streams (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< centerline LINESTRING, <CUSTOM_INDEX> c(centerline(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE buildings (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< position POINT, -< footprint POLYGON, <CUSTOM_INDEX> p(`position`(64)), <CUSTOM_INDEX> f(footprint(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE ponds (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< type CHAR(64) <CUSTOM_COL_OPTIONS>, -< shores MULTIPOLYGON, <CUSTOM_INDEX> s(shores(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE named_places (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< boundary POLYGON, <CUSTOM_INDEX> b(boundary(512))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE map_neatlines (fid INT <CUSTOM_COL_OPTIONS>, -< neatline POLYGON, <CUSTOM_INDEX> n(neatline(700))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< USE test; -< SHOW FIELDS FROM gis_point; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g point YES MUL NULL -< SHOW FIELDS FROM gis_line; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g linestring YES MUL NULL -< SHOW FIELDS FROM gis_polygon; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g polygon YES MUL NULL -< SHOW FIELDS FROM gis_multi_point; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g multipoint YES MUL NULL -< SHOW FIELDS FROM gis_multi_line; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g multilinestring YES MUL NULL -< SHOW FIELDS FROM gis_multi_polygon; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g multipolygon YES NULL -< SHOW FIELDS FROM gis_geometrycollection; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g geometrycollection YES NULL -< SHOW FIELDS FROM gis_geometry; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g geometry YES NULL -< INSERT INTO gis_point VALUES -< (101, PointFromText('POINT(10 10)')), -< (102, PointFromText('POINT(20 10)')), -< (103, PointFromText('POINT(20 20)')), -< (104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)')))); -< INSERT INTO gis_line VALUES -< (105, LineFromText('LINESTRING(0 0,0 10,10 0)')), -< (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), -< (107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10))))); -< INSERT INTO gis_polygon VALUES -< (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), -< (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), -< (110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))))); -< INSERT INTO gis_multi_point VALUES -< (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), -< (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), -< (113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10))))); -< INSERT INTO gis_multi_line VALUES -< (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), -< (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), -< (116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))))); -< INSERT INTO gis_multi_polygon VALUES -< (117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), -< (118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), -< (119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))))); -< INSERT INTO gis_geometrycollection VALUES -< (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), -< (121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))), -< (122, GeomFromText('GeometryCollection()')), -< (123, GeomFromText('GeometryCollection EMPTY')); -< INSERT into gis_geometry SELECT * FROM gis_point; -< INSERT into gis_geometry SELECT * FROM gis_line; -< INSERT into gis_geometry SELECT * FROM gis_polygon; -< INSERT into gis_geometry SELECT * FROM gis_multi_point; -< INSERT into gis_geometry SELECT * FROM gis_multi_line; -< INSERT into gis_geometry SELECT * FROM gis_multi_polygon; -< INSERT into gis_geometry SELECT * FROM gis_geometrycollection; -< SELECT fid, AsText(g) FROM gis_point; -< fid AsText(g) -< 101 POINT(10 10) -< 102 POINT(20 10) -< 103 POINT(20 20) -< 104 POINT(10 20) -< SELECT fid, AsText(g) FROM gis_line; -< fid AsText(g) -< 105 LINESTRING(0 0,0 10,10 0) -< 106 LINESTRING(10 10,20 10,20 20,10 20,10 10) -< 107 LINESTRING(10 10,40 10) -< SELECT fid, AsText(g) FROM gis_polygon; -< fid AsText(g) -< 108 POLYGON((10 10,20 10,20 20,10 20,10 10)) -< 109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) -< 110 POLYGON((0 0,30 0,30 30,0 0)) -< SELECT fid, AsText(g) FROM gis_multi_point; -< fid AsText(g) -< 111 MULTIPOINT(0 0,10 10,10 20,20 20) -< 112 MULTIPOINT(1 1,11 11,11 21,21 21) -< 113 MULTIPOINT(3 6,4 10) -< SELECT fid, AsText(g) FROM gis_multi_line; -< fid AsText(g) -< 114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) -< 115 MULTILINESTRING((10 48,10 21,10 0)) -< 116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) -< SELECT fid, AsText(g) FROM gis_multi_polygon; -< fid AsText(g) -< 117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) -< 118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) -< 119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) -< SELECT fid, AsText(g) FROM gis_geometrycollection; -< fid AsText(g) -< 120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) -< 121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) -< 122 GEOMETRYCOLLECTION EMPTY -< 123 GEOMETRYCOLLECTION EMPTY -< SELECT fid, AsText(g) FROM gis_geometry; -< fid AsText(g) -< 101 POINT(10 10) -< 102 POINT(20 10) -< 103 POINT(20 20) -< 104 POINT(10 20) -< 105 LINESTRING(0 0,0 10,10 0) -< 106 LINESTRING(10 10,20 10,20 20,10 20,10 10) -< 107 LINESTRING(10 10,40 10) -< 108 POLYGON((10 10,20 10,20 20,10 20,10 10)) -< 109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) -< 110 POLYGON((0 0,30 0,30 30,0 0)) -< 111 MULTIPOINT(0 0,10 10,10 20,20 20) -< 112 MULTIPOINT(1 1,11 11,11 21,21 21) -< 113 MULTIPOINT(3 6,4 10) -< 114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) -< 115 MULTILINESTRING((10 48,10 21,10 0)) -< 116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) -< 117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) -< 118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) -< 119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) -< 120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) -< 121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) -< 122 GEOMETRYCOLLECTION EMPTY -< 123 GEOMETRYCOLLECTION EMPTY -< SELECT fid, Dimension(g) FROM gis_geometry; -< fid Dimension(g) -< 101 0 -< 102 0 -< 103 0 -< 104 0 -< 105 1 -< 106 1 -< 107 1 -< 108 2 -< 109 2 -< 110 2 -< 111 0 -< 112 0 -< 113 0 -< 114 1 -< 115 1 -< 116 1 -< 117 2 -< 118 2 -< 119 2 -< 120 1 -< 121 1 -< 122 0 -< 123 0 -< SELECT fid, GeometryType(g) FROM gis_geometry; -< fid GeometryType(g) -< 101 POINT -< 102 POINT -< 103 POINT -< 104 POINT -< 105 LINESTRING -< 106 LINESTRING -< 107 LINESTRING -< 108 POLYGON -< 109 POLYGON -< 110 POLYGON -< 111 MULTIPOINT -< 112 MULTIPOINT -< 113 MULTIPOINT -< 114 MULTILINESTRING -< 115 MULTILINESTRING -< 116 MULTILINESTRING -< 117 MULTIPOLYGON -< 118 MULTIPOLYGON -< 119 MULTIPOLYGON -< 120 GEOMETRYCOLLECTION -< 121 GEOMETRYCOLLECTION -< 122 GEOMETRYCOLLECTION -< 123 GEOMETRYCOLLECTION -< SELECT fid, IsEmpty(g) FROM gis_geometry; -< fid IsEmpty(g) -< 101 0 -< 102 0 -< 103 0 -< 104 0 -< 105 0 -< 106 0 -< 107 0 -< 108 0 -< 109 0 -< 110 0 -< 111 0 -< 112 0 -< 113 0 -< 114 0 -< 115 0 -< 116 0 -< 117 0 -< 118 0 -< 119 0 -< 120 0 -< 121 0 -< 122 0 -< 123 0 -< SELECT fid, AsText(Envelope(g)) FROM gis_geometry; -< fid AsText(Envelope(g)) -< 101 POLYGON((10 10,10 10,10 10,10 10,10 10)) -< 102 POLYGON((20 10,20 10,20 10,20 10,20 10)) -< 103 POLYGON((20 20,20 20,20 20,20 20,20 20)) -< 104 POLYGON((10 20,10 20,10 20,10 20,10 20)) -< 105 POLYGON((0 0,10 0,10 10,0 10,0 0)) -< 106 POLYGON((10 10,20 10,20 20,10 20,10 10)) -< 107 POLYGON((10 10,40 10,40 10,10 10,10 10)) -< 108 POLYGON((10 10,20 10,20 20,10 20,10 10)) -< 109 POLYGON((0 0,50 0,50 50,0 50,0 0)) -< 110 POLYGON((0 0,30 0,30 30,0 30,0 0)) -< 111 POLYGON((0 0,20 0,20 20,0 20,0 0)) -< 112 POLYGON((1 1,21 1,21 21,1 21,1 1)) -< 113 POLYGON((3 6,4 6,4 10,3 10,3 6)) -< 114 POLYGON((10 0,16 0,16 48,10 48,10 0)) -< 115 POLYGON((10 0,10 0,10 48,10 48,10 0)) -< 116 POLYGON((1 2,21 2,21 8,1 8,1 2)) -< 117 POLYGON((28 0,84 0,84 42,28 42,28 0)) -< 118 POLYGON((28 0,84 0,84 42,28 42,28 0)) -< 119 POLYGON((0 0,3 0,3 3,0 3,0 0)) -< 120 POLYGON((0 0,10 0,10 10,0 10,0 0)) -< 121 POLYGON((3 6,44 6,44 9,3 9,3 6)) -< 122 GEOMETRYCOLLECTION EMPTY -< 123 GEOMETRYCOLLECTION EMPTY -< SELECT fid, X(g) FROM gis_point; -< fid X(g) -< 101 10 -< 102 20 -< 103 20 -< 104 10 -< SELECT fid, Y(g) FROM gis_point; -< fid Y(g) -< 101 10 -< 102 10 -< 103 20 -< 104 20 -< SELECT fid, AsText(StartPoint(g)) FROM gis_line; -< fid AsText(StartPoint(g)) -< 105 POINT(0 0) -< 106 POINT(10 10) -< 107 POINT(10 10) -< SELECT fid, AsText(EndPoint(g)) FROM gis_line; -< fid AsText(EndPoint(g)) -< 105 POINT(10 0) -< 106 POINT(10 10) -< 107 POINT(40 10) -< SELECT fid, GLength(g) FROM gis_line; -< fid GLength(g) -< 105 24.14213562373095 -< 106 40 -< 107 30 -< SELECT fid, NumPoints(g) FROM gis_line; -< fid NumPoints(g) -< 105 3 -< 106 5 -< 107 2 -< SELECT fid, AsText(PointN(g, 2)) FROM gis_line; -< fid AsText(PointN(g, 2)) -< 105 POINT(0 10) -< 106 POINT(20 10) -< 107 POINT(40 10) -< SELECT fid, IsClosed(g) FROM gis_line; -< fid IsClosed(g) -< 105 0 -< 106 1 -< 107 0 -< SELECT fid, AsText(Centroid(g)) FROM gis_polygon; -< fid AsText(Centroid(g)) -< 108 POINT(15 15) -< 109 POINT(25.416666666666668 25.416666666666668) -< 110 POINT(20 10) -< SELECT fid, Area(g) FROM gis_polygon; -< fid Area(g) -< 108 100 -< 109 2400 -< 110 450 -< SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon; -< fid AsText(ExteriorRing(g)) -< 108 LINESTRING(10 10,20 10,20 20,10 20,10 10) -< 109 LINESTRING(0 0,50 0,50 50,0 50,0 0) -< 110 LINESTRING(0 0,30 0,30 30,0 0) -< SELECT fid, NumInteriorRings(g) FROM gis_polygon; -< fid NumInteriorRings(g) -< 108 0 -< 109 1 -< 110 0 -< SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon; -< fid AsText(InteriorRingN(g, 1)) -< 108 NULL -< 109 LINESTRING(10 10,20 10,20 20,10 20,10 10) -< 110 NULL -< SELECT fid, IsClosed(g) FROM gis_multi_line; -< fid IsClosed(g) -< 114 0 -< 115 0 -< 116 0 -< SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon; -< fid AsText(Centroid(g)) -< 117 POINT(55.58852775304245 17.426536064113982) -< 118 POINT(55.58852775304245 17.426536064113982) -< 119 POINT(2 2) -< SELECT fid, Area(g) FROM gis_multi_polygon; -< fid Area(g) -< 117 1684.5 -< 118 1684.5 -< 119 4.5 -< SELECT fid, NumGeometries(g) from gis_multi_point; -< fid NumGeometries(g) -< 111 4 -< 112 4 -< 113 2 -< SELECT fid, NumGeometries(g) from gis_multi_line; -< fid NumGeometries(g) -< 114 2 -< 115 1 -< 116 2 -< SELECT fid, NumGeometries(g) from gis_multi_polygon; -< fid NumGeometries(g) -< 117 2 -< 118 2 -< 119 1 -< SELECT fid, NumGeometries(g) from gis_geometrycollection; -< fid NumGeometries(g) -< 120 2 -< 121 2 -< 122 0 -< 123 0 -< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point; -< fid AsText(GeometryN(g, 2)) -< 111 POINT(10 10) -< 112 POINT(11 11) -< 113 POINT(4 10) -< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line; -< fid AsText(GeometryN(g, 2)) -< 114 LINESTRING(16 0,16 23,16 48) -< 115 NULL -< 116 LINESTRING(2 5,5 8,21 7) -< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon; -< fid AsText(GeometryN(g, 2)) -< 117 POLYGON((59 18,67 18,67 13,59 13,59 18)) -< 118 POLYGON((59 18,67 18,67 13,59 13,59 18)) -< 119 NULL -< SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection; -< fid AsText(GeometryN(g, 2)) -< 120 LINESTRING(0 0,10 10) -< 121 LINESTRING(3 6,7 9) -< 122 NULL -< 123 NULL -< SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection; -< fid AsText(GeometryN(g, 1)) -< 120 POINT(0 0) -< 121 POINT(44 6) -< 122 NULL -< 123 NULL -< SELECT g1.fid as first, g2.fid as second, -< Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o, -< Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, -< Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r -< FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; -< first second w c o e d t i r -< 120 120 1 1 0 1 0 1 1 0 -< 120 121 0 0 1 0 0 0 1 0 -< 120 122 0 1 NULL 0 NULL 0 NULL 0 -< 120 123 0 1 NULL 0 NULL 0 NULL 0 -< 121 120 0 0 1 0 0 0 1 0 -< 121 121 1 1 0 1 0 1 1 0 -< 121 122 0 1 NULL 0 NULL 0 NULL 0 -< 121 123 0 1 NULL 0 NULL 0 NULL 0 -< 122 120 1 0 NULL 0 NULL 0 NULL 0 -< 122 121 1 0 NULL 0 NULL 0 NULL 0 -< 122 122 1 1 NULL 1 NULL 0 NULL 0 -< 122 123 1 1 NULL 1 NULL 0 NULL 0 -< 123 120 1 0 NULL 0 NULL 0 NULL 0 -< 123 121 1 0 NULL 0 NULL 0 NULL 0 -< 123 122 1 1 NULL 1 NULL 0 NULL 0 -< 123 123 1 1 NULL 1 NULL 0 NULL 0 -< DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; -< USE gis_ogs; -< # Lakes -< INSERT INTO lakes VALUES ( -< 101, 'BLUE LAKE', -< PolyFromText( -< 'POLYGON( -< (52 18,66 23,73 9,48 6,52 18), -< (59 18,67 18,67 13,59 13,59 18) -< )', -< 101)); -< # Road Segments -< INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2, -< LineFromText( -< 'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101)); -< INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4, -< LineFromText( -< 'LINESTRING( 44 31, 56 34, 70 38 )' ,101)); -< INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2, -< LineFromText( -< 'LINESTRING( 70 38, 72 48 )' ,101)); -< INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4, -< LineFromText( -< 'LINESTRING( 70 38, 84 42 )' ,101)); -< INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL, -< 1, -< LineFromText( -< 'LINESTRING( 28 26, 28 0 )',101)); -< # DividedRoutes -< INSERT INTO divided_routes VALUES(119, 'Route 75', 4, -< MLineFromText( -< 'MULTILINESTRING((10 48,10 21,10 0), -< (16 0,16 23,16 48))', 101)); -< # Forests -< INSERT INTO forests VALUES(109, 'Green Forest', -< MPolyFromText( -< 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26), -< (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))', -< 101)); -< # Bridges -< INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText( -< 'POINT( 44 31 )', 101)); -< # Streams -< INSERT INTO streams VALUES(111, 'Cam Stream', -< LineFromText( -< 'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101)); -< INSERT INTO streams VALUES(112, NULL, -< LineFromText( -< 'LINESTRING( 76 0, 78 4, 73 9 )', 101)); -< # Buildings -< INSERT INTO buildings VALUES(113, '123 Main Street', -< PointFromText( -< 'POINT( 52 30 )', 101), -< PolyFromText( -< 'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101)); -< INSERT INTO buildings VALUES(114, '215 Main Street', -< PointFromText( -< 'POINT( 64 33 )', 101), -< PolyFromText( -< 'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101)); -< # Ponds -< INSERT INTO ponds VALUES(120, NULL, 'Stock Pond', -< MPolyFromText( -< 'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ), -< ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101)); -< # Named Places -< INSERT INTO named_places VALUES(117, 'Ashton', -< PolyFromText( -< 'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101)); -< INSERT INTO named_places VALUES(118, 'Goose Island', -< PolyFromText( -< 'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101)); -< # Map Neatlines -< INSERT INTO map_neatlines VALUES(115, -< PolyFromText( -< 'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101)); -< SELECT Dimension(shore) -< FROM lakes -< WHERE name = 'Blue Lake'; -< Dimension(shore) -< 2 -< SELECT GeometryType(centerlines) -< FROM divided_routes -< WHERE name = 'Route 75'; -< GeometryType(centerlines) -< MULTILINESTRING -< SELECT AsText(boundary) -< FROM named_places -< WHERE name = 'Goose Island'; -< AsText(boundary) -< POLYGON((67 13,67 18,59 18,59 13,67 13)) -< SELECT AsText(PolyFromWKB(AsBinary(boundary),101)) -< FROM named_places -< WHERE name = 'Goose Island'; -< AsText(PolyFromWKB(AsBinary(boundary),101)) -< POLYGON((67 13,67 18,59 18,59 13,67 13)) -< SELECT SRID(boundary) -< FROM named_places -< WHERE name = 'Goose Island'; -< SRID(boundary) -< 101 -< SELECT IsEmpty(centerline) -< FROM road_segments -< WHERE name = 'Route 5' -< AND aliases = 'Main Street'; -< IsEmpty(centerline) -< 0 -< SELECT AsText(Envelope(boundary)) -< FROM named_places -< WHERE name = 'Goose Island'; -< AsText(Envelope(boundary)) -< POLYGON((59 13,67 13,67 18,59 18,59 13)) -< SELECT X(position) -< FROM bridges -< WHERE name = 'Cam Bridge'; -< X(position) -< 44 -< SELECT Y(position) -< FROM bridges -< WHERE name = 'Cam Bridge'; -< Y(position) -< 31 -< SELECT AsText(StartPoint(centerline)) -< FROM road_segments -< WHERE fid = 102; -< AsText(StartPoint(centerline)) -< POINT(0 18) -< SELECT AsText(EndPoint(centerline)) -< FROM road_segments -< WHERE fid = 102; -< AsText(EndPoint(centerline)) -< POINT(44 31) -< SELECT GLength(centerline) -< FROM road_segments -< WHERE fid = 106; -< GLength(centerline) -< 26 -< SELECT NumPoints(centerline) -< FROM road_segments -< WHERE fid = 102; -< NumPoints(centerline) -< 5 -< SELECT AsText(PointN(centerline, 1)) -< FROM road_segments -< WHERE fid = 102; -< AsText(PointN(centerline, 1)) -< POINT(0 18) -< SELECT AsText(Centroid(boundary)) -< FROM named_places -< WHERE name = 'Goose Island'; -< AsText(Centroid(boundary)) -< POINT(63 15.5) -< SELECT Area(boundary) -< FROM named_places -< WHERE name = 'Goose Island'; -< Area(boundary) -< 40 -< SELECT AsText(ExteriorRing(shore)) -< FROM lakes -< WHERE name = 'Blue Lake'; -< AsText(ExteriorRing(shore)) -< LINESTRING(52 18,66 23,73 9,48 6,52 18) -< SELECT NumInteriorRings(shore) -< FROM lakes -< WHERE name = 'Blue Lake'; -< NumInteriorRings(shore) -< 1 -< SELECT AsText(InteriorRingN(shore, 1)) -< FROM lakes -< WHERE name = 'Blue Lake'; -< AsText(InteriorRingN(shore, 1)) -< LINESTRING(59 18,67 18,67 13,59 13,59 18) -< SELECT NumGeometries(centerlines) -< FROM divided_routes -< WHERE name = 'Route 75'; -< NumGeometries(centerlines) -< 2 -< SELECT AsText(GeometryN(centerlines, 2)) -< FROM divided_routes -< WHERE name = 'Route 75'; -< AsText(GeometryN(centerlines, 2)) -< LINESTRING(16 0,16 23,16 48) -< SELECT IsClosed(centerlines) -< FROM divided_routes -< WHERE name = 'Route 75'; -< IsClosed(centerlines) -< 0 -< SELECT GLength(centerlines) -< FROM divided_routes -< WHERE name = 'Route 75'; -< GLength(centerlines) -< 96 -< SELECT AsText(Centroid(shores)) -< FROM ponds -< WHERE fid = 120; -< AsText(Centroid(shores)) -< POINT(25 42) -< SELECT Area(shores) -< FROM ponds -< WHERE fid = 120; -< Area(shores) -< 8 -< SELECT ST_Equals(boundary, -< PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) -< FROM named_places -< WHERE name = 'Goose Island'; -< ST_Equals(boundary, -< PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) -< 1 -< SELECT ST_Disjoint(centerlines, boundary) -< FROM divided_routes, named_places -< WHERE divided_routes.name = 'Route 75' -< AND named_places.name = 'Ashton'; -< ST_Disjoint(centerlines, boundary) -< 1 -< SELECT ST_Touches(centerline, shore) -< FROM streams, lakes -< WHERE streams.name = 'Cam Stream' -< AND lakes.name = 'Blue Lake'; -< ST_Touches(centerline, shore) -< 1 -< SELECT Crosses(road_segments.centerline, divided_routes.centerlines) -< FROM road_segments, divided_routes -< WHERE road_segments.fid = 102 -< AND divided_routes.name = 'Route 75'; -< Crosses(road_segments.centerline, divided_routes.centerlines) -< 1 -< SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines) -< FROM road_segments, divided_routes -< WHERE road_segments.fid = 102 -< AND divided_routes.name = 'Route 75'; -< ST_Intersects(road_segments.centerline, divided_routes.centerlines) -< 1 -< SELECT ST_Contains(forests.boundary, named_places.boundary) -< FROM forests, named_places -< WHERE forests.name = 'Green Forest' -< AND named_places.name = 'Ashton'; -< ST_Contains(forests.boundary, named_places.boundary) -< 0 -< SELECT ST_Distance(position, boundary) -< FROM bridges, named_places -< WHERE bridges.name = 'Cam Bridge' -< AND named_places.name = 'Ashton'; -< ST_Distance(position, boundary) -< 12 -< SELECT AsText(ST_Difference(named_places.boundary, forests.boundary)) -< FROM named_places, forests -< WHERE named_places.name = 'Ashton' -< AND forests.name = 'Green Forest'; -< AsText(ST_Difference(named_places.boundary, forests.boundary)) -< POLYGON((56 34,62 48,84 48,84 42,56 34)) -< SELECT AsText(ST_Union(shore, boundary)) -< FROM lakes, named_places -< WHERE lakes.name = 'Blue Lake' -< AND named_places.name = 'Goose Island'; -< AsText(ST_Union(shore, boundary)) -< POLYGON((48 6,52 18,66 23,73 9,48 6)) -< SELECT AsText(ST_SymDifference(shore, boundary)) -< FROM lakes, named_places -< WHERE lakes.name = 'Blue Lake' -< AND named_places.name = 'Ashton'; -< AsText(ST_SymDifference(shore, boundary)) -< MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30))) -< SELECT count(*) -< FROM buildings, bridges -< WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1; -< count(*) -< 1 ---- -> ERROR 42000: The storage engine for the table doesn't support GEOMETRY -> # ERROR: Statement ended with errno 1178, errname ER_CHECK_NOT_IMPLEMENTED (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ CREATE TABLE gis_point (fid INT(11) /*!*/ /*Custom column options*/, g POINT, /*!INDEX*/ /*Custom index*/ g(g(128))) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.gis_point) INSERT_METHOD=LAST ] -> # The statement|command finished with ER_CHECK_NOT_IMPLEMENTED. -> # Geometry types or indexes on them or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- -705,1398c21,30 -< CREATE TABLE gis_line (fid <INT_COLUMN>, g LINESTRING NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE gis_polygon (fid <INT_COLUMN>, g POLYGON NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE gis_multi_point (fid <INT_COLUMN>, g MULTIPOINT NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE gis_multi_line (fid <INT_COLUMN>, g MULTILINESTRING NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE gis_multi_polygon (fid <INT_COLUMN>, g MULTIPOLYGON NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE gis_geometrycollection (fid <INT_COLUMN>, g GEOMETRYCOLLECTION NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE gis_geometry (fid <INT_COLUMN>, g GEOMETRY NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< USE gis_ogs; -< CREATE TABLE lakes (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< shore POLYGON NOT NULL, SPATIAL INDEX s(shore)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE road_segments (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< aliases CHAR(64) <CUSTOM_COL_OPTIONS>, -< num_lanes INT <CUSTOM_COL_OPTIONS>, -< centerline LINESTRING NOT NULL, SPATIAL INDEX c(centerline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE divided_routes (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< num_lanes INT <CUSTOM_COL_OPTIONS>, -< centerlines MULTILINESTRING NOT NULL, SPATIAL INDEX c(centerlines)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE forests (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< boundary MULTIPOLYGON NOT NULL, SPATIAL INDEX b(boundary)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE bridges (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< position POINT NOT NULL, SPATIAL INDEX p(position)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE streams (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< centerline LINESTRING NOT NULL, SPATIAL INDEX c(centerline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE buildings (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< position POINT NOT NULL, -< footprint POLYGON NOT NULL, SPATIAL INDEX p(position), SPATIAL INDEX f(footprint)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE ponds (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< type CHAR(64) <CUSTOM_COL_OPTIONS>, -< shores MULTIPOLYGON NOT NULL, SPATIAL INDEX s(shores)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE named_places (fid INT <CUSTOM_COL_OPTIONS>, -< name CHAR(64) <CUSTOM_COL_OPTIONS>, -< boundary POLYGON NOT NULL, SPATIAL INDEX b(boundary)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< CREATE TABLE map_neatlines (fid INT <CUSTOM_COL_OPTIONS>, -< neatline POLYGON NOT NULL, SPATIAL INDEX n(neatline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< USE test; -< SHOW FIELDS FROM gis_point; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g point NO MUL NULL -< SHOW FIELDS FROM gis_line; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g linestring NO MUL NULL -< SHOW FIELDS FROM gis_polygon; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g polygon NO MUL NULL -< SHOW FIELDS FROM gis_multi_point; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g multipoint NO MUL NULL -< SHOW FIELDS FROM gis_multi_line; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g multilinestring NO MUL NULL -< SHOW FIELDS FROM gis_multi_polygon; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g multipolygon NO MUL NULL -< SHOW FIELDS FROM gis_geometrycollection; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g geometrycollection NO MUL NULL -< SHOW FIELDS FROM gis_geometry; -< Field Type Null Key Default Extra -< fid int(11) YES NULL -< g geometry NO NULL -< INSERT INTO gis_point VALUES -< (101, PointFromText('POINT(10 10)')), -< (102, PointFromText('POINT(20 10)')), -< (103, PointFromText('POINT(20 20)')), -< (104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)')))); -< INSERT INTO gis_line VALUES -< (105, LineFromText('LINESTRING(0 0,0 10,10 0)')), -< (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), -< (107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10))))); -< INSERT INTO gis_polygon VALUES -< (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), -< (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), -< (110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))))); -< INSERT INTO gis_multi_point VALUES -< (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), -< (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), -< (113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10))))); -< INSERT INTO gis_multi_line VALUES -< (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), -< (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), -< (116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))))); -< INSERT INTO gis_multi_polygon VALUES -< (117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), -< (118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), -< (119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))))); -< INSERT INTO gis_geometrycollection VALUES -< (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), -< (121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))), -< (122, GeomFromText('GeometryCollection()')), -< (123, GeomFromText('GeometryCollection EMPTY')); -< INSERT into gis_geometry SELECT * FROM gis_point; -< INSERT into gis_geometry SELECT * FROM gis_line; -< INSERT into gis_geometry SELECT * FROM gis_polygon; -< INSERT into gis_geometry SELECT * FROM gis_multi_point; -< INSERT into gis_geometry SELECT * FROM gis_multi_line; -< INSERT into gis_geometry SELECT * FROM gis_multi_polygon; -< INSERT into gis_geometry SELECT * FROM gis_geometrycollection; -< SELECT fid, AsText(g) FROM gis_point; -< fid AsText(g) -< 101 POINT(10 10) -< 102 POINT(20 10) -< 103 POINT(20 20) -< 104 POINT(10 20) -< SELECT fid, AsText(g) FROM gis_line; -< fid AsText(g) -< 105 LINESTRING(0 0,0 10,10 0) -< 106 LINESTRING(10 10,20 10,20 20,10 20,10 10) -< 107 LINESTRING(10 10,40 10) -< SELECT fid, AsText(g) FROM gis_polygon; -< fid AsText(g) -< 108 POLYGON((10 10,20 10,20 20,10 20,10 10)) -< 109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) -< 110 POLYGON((0 0,30 0,30 30,0 0)) -< SELECT fid, AsText(g) FROM gis_multi_point; -< fid AsText(g) -< 111 MULTIPOINT(0 0,10 10,10 20,20 20) -< 112 MULTIPOINT(1 1,11 11,11 21,21 21) -< 113 MULTIPOINT(3 6,4 10) -< SELECT fid, AsText(g) FROM gis_multi_line; -< fid AsText(g) -< 114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) -< 115 MULTILINESTRING((10 48,10 21,10 0)) -< 116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) -< SELECT fid, AsText(g) FROM gis_multi_polygon; -< fid AsText(g) -< 117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) -< 118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) -< 119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) -< SELECT fid, AsText(g) FROM gis_geometrycollection; -< fid AsText(g) -< 120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) -< 121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) -< 122 GEOMETRYCOLLECTION EMPTY -< 123 GEOMETRYCOLLECTION EMPTY -< SELECT fid, AsText(g) FROM gis_geometry; -< fid AsText(g) -< 101 POINT(10 10) -< 102 POINT(20 10) -< 103 POINT(20 20) -< 104 POINT(10 20) -< 105 LINESTRING(0 0,0 10,10 0) -< 106 LINESTRING(10 10,20 10,20 20,10 20,10 10) -< 107 LINESTRING(10 10,40 10) -< 108 POLYGON((10 10,20 10,20 20,10 20,10 10)) -< 109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) -< 110 POLYGON((0 0,30 0,30 30,0 0)) -< 111 MULTIPOINT(0 0,10 10,10 20,20 20) -< 112 MULTIPOINT(1 1,11 11,11 21,21 21) -< 113 MULTIPOINT(3 6,4 10) -< 114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) -< 115 MULTILINESTRING((10 48,10 21,10 0)) -< 116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) -< 117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) -< 118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) -< 119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) -< 120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) -< 121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) -< 122 GEOMETRYCOLLECTION EMPTY -< 123 GEOMETRYCOLLECTION EMPTY -< SELECT fid, Dimension(g) FROM gis_geometry; -< fid Dimension(g) -< 101 0 -< 102 0 -< 103 0 -< 104 0 -< 105 1 -< 106 1 -< 107 1 -< 108 2 -< 109 2 -< 110 2 -< 111 0 -< 112 0 -< 113 0 -< 114 1 -< 115 1 -< 116 1 -< 117 2 -< 118 2 -< 119 2 -< 120 1 -< 121 1 -< 122 0 -< 123 0 -< SELECT fid, GeometryType(g) FROM gis_geometry; -< fid GeometryType(g) -< 101 POINT -< 102 POINT -< 103 POINT -< 104 POINT -< 105 LINESTRING -< 106 LINESTRING -< 107 LINESTRING -< 108 POLYGON -< 109 POLYGON -< 110 POLYGON -< 111 MULTIPOINT -< 112 MULTIPOINT -< 113 MULTIPOINT -< 114 MULTILINESTRING -< 115 MULTILINESTRING -< 116 MULTILINESTRING -< 117 MULTIPOLYGON -< 118 MULTIPOLYGON -< 119 MULTIPOLYGON -< 120 GEOMETRYCOLLECTION -< 121 GEOMETRYCOLLECTION -< 122 GEOMETRYCOLLECTION -< 123 GEOMETRYCOLLECTION -< SELECT fid, IsEmpty(g) FROM gis_geometry; -< fid IsEmpty(g) -< 101 0 -< 102 0 -< 103 0 -< 104 0 -< 105 0 -< 106 0 -< 107 0 -< 108 0 -< 109 0 -< 110 0 -< 111 0 -< 112 0 -< 113 0 -< 114 0 -< 115 0 -< 116 0 -< 117 0 -< 118 0 -< 119 0 -< 120 0 -< 121 0 -< 122 0 -< 123 0 -< SELECT fid, AsText(Envelope(g)) FROM gis_geometry; -< fid AsText(Envelope(g)) -< 101 POLYGON((10 10,10 10,10 10,10 10,10 10)) -< 102 POLYGON((20 10,20 10,20 10,20 10,20 10)) -< 103 POLYGON((20 20,20 20,20 20,20 20,20 20)) -< 104 POLYGON((10 20,10 20,10 20,10 20,10 20)) -< 105 POLYGON((0 0,10 0,10 10,0 10,0 0)) -< 106 POLYGON((10 10,20 10,20 20,10 20,10 10)) -< 107 POLYGON((10 10,40 10,40 10,10 10,10 10)) -< 108 POLYGON((10 10,20 10,20 20,10 20,10 10)) -< 109 POLYGON((0 0,50 0,50 50,0 50,0 0)) -< 110 POLYGON((0 0,30 0,30 30,0 30,0 0)) -< 111 POLYGON((0 0,20 0,20 20,0 20,0 0)) -< 112 POLYGON((1 1,21 1,21 21,1 21,1 1)) -< 113 POLYGON((3 6,4 6,4 10,3 10,3 6)) -< 114 POLYGON((10 0,16 0,16 48,10 48,10 0)) -< 115 POLYGON((10 0,10 0,10 48,10 48,10 0)) -< 116 POLYGON((1 2,21 2,21 8,1 8,1 2)) -< 117 POLYGON((28 0,84 0,84 42,28 42,28 0)) -< 118 POLYGON((28 0,84 0,84 42,28 42,28 0)) -< 119 POLYGON((0 0,3 0,3 3,0 3,0 0)) -< 120 POLYGON((0 0,10 0,10 10,0 10,0 0)) -< 121 POLYGON((3 6,44 6,44 9,3 9,3 6)) -< 122 GEOMETRYCOLLECTION EMPTY -< 123 GEOMETRYCOLLECTION EMPTY -< SELECT fid, X(g) FROM gis_point; -< fid X(g) -< 101 10 -< 102 20 -< 103 20 -< 104 10 -< SELECT fid, Y(g) FROM gis_point; -< fid Y(g) -< 101 10 -< 102 10 -< 103 20 -< 104 20 -< SELECT fid, AsText(StartPoint(g)) FROM gis_line; -< fid AsText(StartPoint(g)) -< 105 POINT(0 0) -< 106 POINT(10 10) -< 107 POINT(10 10) -< SELECT fid, AsText(EndPoint(g)) FROM gis_line; -< fid AsText(EndPoint(g)) -< 105 POINT(10 0) -< 106 POINT(10 10) -< 107 POINT(40 10) -< SELECT fid, GLength(g) FROM gis_line; -< fid GLength(g) -< 105 24.14213562373095 -< 106 40 -< 107 30 -< SELECT fid, NumPoints(g) FROM gis_line; -< fid NumPoints(g) -< 105 3 -< 106 5 -< 107 2 -< SELECT fid, AsText(PointN(g, 2)) FROM gis_line; -< fid AsText(PointN(g, 2)) -< 105 POINT(0 10) -< 106 POINT(20 10) -< 107 POINT(40 10) -< SELECT fid, IsClosed(g) FROM gis_line; -< fid IsClosed(g) -< 105 0 -< 106 1 -< 107 0 -< SELECT fid, AsText(Centroid(g)) FROM gis_polygon; -< fid AsText(Centroid(g)) -< 108 POINT(15 15) -< 109 POINT(25.416666666666668 25.416666666666668) -< 110 POINT(20 10) -< SELECT fid, Area(g) FROM gis_polygon; -< fid Area(g) -< 108 100 -< 109 2400 -< 110 450 -< SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon; -< fid AsText(ExteriorRing(g)) -< 108 LINESTRING(10 10,20 10,20 20,10 20,10 10) -< 109 LINESTRING(0 0,50 0,50 50,0 50,0 0) -< 110 LINESTRING(0 0,30 0,30 30,0 0) -< SELECT fid, NumInteriorRings(g) FROM gis_polygon; -< fid NumInteriorRings(g) -< 108 0 -< 109 1 -< 110 0 -< SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon; -< fid AsText(InteriorRingN(g, 1)) -< 108 NULL -< 109 LINESTRING(10 10,20 10,20 20,10 20,10 10) -< 110 NULL -< SELECT fid, IsClosed(g) FROM gis_multi_line; -< fid IsClosed(g) -< 114 0 -< 115 0 -< 116 0 -< SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon; -< fid AsText(Centroid(g)) -< 117 POINT(55.58852775304245 17.426536064113982) -< 118 POINT(55.58852775304245 17.426536064113982) -< 119 POINT(2 2) -< SELECT fid, Area(g) FROM gis_multi_polygon; -< fid Area(g) -< 117 1684.5 -< 118 1684.5 -< 119 4.5 -< SELECT fid, NumGeometries(g) from gis_multi_point; -< fid NumGeometries(g) -< 111 4 -< 112 4 -< 113 2 -< SELECT fid, NumGeometries(g) from gis_multi_line; -< fid NumGeometries(g) -< 114 2 -< 115 1 -< 116 2 -< SELECT fid, NumGeometries(g) from gis_multi_polygon; -< fid NumGeometries(g) -< 117 2 -< 118 2 -< 119 1 -< SELECT fid, NumGeometries(g) from gis_geometrycollection; -< fid NumGeometries(g) -< 120 2 -< 121 2 -< 122 0 -< 123 0 -< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point; -< fid AsText(GeometryN(g, 2)) -< 111 POINT(10 10) -< 112 POINT(11 11) -< 113 POINT(4 10) -< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line; -< fid AsText(GeometryN(g, 2)) -< 114 LINESTRING(16 0,16 23,16 48) -< 115 NULL -< 116 LINESTRING(2 5,5 8,21 7) -< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon; -< fid AsText(GeometryN(g, 2)) -< 117 POLYGON((59 18,67 18,67 13,59 13,59 18)) -< 118 POLYGON((59 18,67 18,67 13,59 13,59 18)) -< 119 NULL -< SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection; -< fid AsText(GeometryN(g, 2)) -< 120 LINESTRING(0 0,10 10) -< 121 LINESTRING(3 6,7 9) -< 122 NULL -< 123 NULL -< SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection; -< fid AsText(GeometryN(g, 1)) -< 120 POINT(0 0) -< 121 POINT(44 6) -< 122 NULL -< 123 NULL -< SELECT g1.fid as first, g2.fid as second, -< Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o, -< Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, -< Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r -< FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; -< first second w c o e d t i r -< 120 120 1 1 0 1 0 1 1 0 -< 120 121 0 0 1 0 0 0 1 0 -< 120 122 0 1 NULL 0 NULL 0 NULL 0 -< 120 123 0 1 NULL 0 NULL 0 NULL 0 -< 121 120 0 0 1 0 0 0 1 0 -< 121 121 1 1 0 1 0 1 1 0 -< 121 122 0 1 NULL 0 NULL 0 NULL 0 -< 121 123 0 1 NULL 0 NULL 0 NULL 0 -< 122 120 1 0 NULL 0 NULL 0 NULL 0 -< 122 121 1 0 NULL 0 NULL 0 NULL 0 -< 122 122 1 1 NULL 1 NULL 0 NULL 0 -< 122 123 1 1 NULL 1 NULL 0 NULL 0 -< 123 120 1 0 NULL 0 NULL 0 NULL 0 -< 123 121 1 0 NULL 0 NULL 0 NULL 0 -< 123 122 1 1 NULL 1 NULL 0 NULL 0 -< 123 123 1 1 NULL 1 NULL 0 NULL 0 -< DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; -< USE gis_ogs; -< # Lakes -< INSERT INTO lakes VALUES ( -< 101, 'BLUE LAKE', -< PolyFromText( -< 'POLYGON( -< (52 18,66 23,73 9,48 6,52 18), -< (59 18,67 18,67 13,59 13,59 18) -< )', -< 101)); -< # Road Segments -< INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2, -< LineFromText( -< 'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101)); -< INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4, -< LineFromText( -< 'LINESTRING( 44 31, 56 34, 70 38 )' ,101)); -< INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2, -< LineFromText( -< 'LINESTRING( 70 38, 72 48 )' ,101)); -< INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4, -< LineFromText( -< 'LINESTRING( 70 38, 84 42 )' ,101)); -< INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL, -< 1, -< LineFromText( -< 'LINESTRING( 28 26, 28 0 )',101)); -< # DividedRoutes -< INSERT INTO divided_routes VALUES(119, 'Route 75', 4, -< MLineFromText( -< 'MULTILINESTRING((10 48,10 21,10 0), -< (16 0,16 23,16 48))', 101)); -< # Forests -< INSERT INTO forests VALUES(109, 'Green Forest', -< MPolyFromText( -< 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26), -< (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))', -< 101)); -< # Bridges -< INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText( -< 'POINT( 44 31 )', 101)); -< # Streams -< INSERT INTO streams VALUES(111, 'Cam Stream', -< LineFromText( -< 'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101)); -< INSERT INTO streams VALUES(112, NULL, -< LineFromText( -< 'LINESTRING( 76 0, 78 4, 73 9 )', 101)); -< # Buildings -< INSERT INTO buildings VALUES(113, '123 Main Street', -< PointFromText( -< 'POINT( 52 30 )', 101), -< PolyFromText( -< 'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101)); -< INSERT INTO buildings VALUES(114, '215 Main Street', -< PointFromText( -< 'POINT( 64 33 )', 101), -< PolyFromText( -< 'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101)); -< # Ponds -< INSERT INTO ponds VALUES(120, NULL, 'Stock Pond', -< MPolyFromText( -< 'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ), -< ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101)); -< # Named Places -< INSERT INTO named_places VALUES(117, 'Ashton', -< PolyFromText( -< 'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101)); -< INSERT INTO named_places VALUES(118, 'Goose Island', -< PolyFromText( -< 'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101)); -< # Map Neatlines -< INSERT INTO map_neatlines VALUES(115, -< PolyFromText( -< 'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101)); -< SELECT Dimension(shore) -< FROM lakes -< WHERE name = 'Blue Lake'; -< Dimension(shore) -< 2 -< SELECT GeometryType(centerlines) -< FROM divided_routes -< WHERE name = 'Route 75'; -< GeometryType(centerlines) -< MULTILINESTRING -< SELECT AsText(boundary) -< FROM named_places -< WHERE name = 'Goose Island'; -< AsText(boundary) -< POLYGON((67 13,67 18,59 18,59 13,67 13)) -< SELECT AsText(PolyFromWKB(AsBinary(boundary),101)) -< FROM named_places -< WHERE name = 'Goose Island'; -< AsText(PolyFromWKB(AsBinary(boundary),101)) -< POLYGON((67 13,67 18,59 18,59 13,67 13)) -< SELECT SRID(boundary) -< FROM named_places -< WHERE name = 'Goose Island'; -< SRID(boundary) -< 101 -< SELECT IsEmpty(centerline) -< FROM road_segments -< WHERE name = 'Route 5' -< AND aliases = 'Main Street'; -< IsEmpty(centerline) -< 0 -< SELECT AsText(Envelope(boundary)) -< FROM named_places -< WHERE name = 'Goose Island'; -< AsText(Envelope(boundary)) -< POLYGON((59 13,67 13,67 18,59 18,59 13)) -< SELECT X(position) -< FROM bridges -< WHERE name = 'Cam Bridge'; -< X(position) -< 44 -< SELECT Y(position) -< FROM bridges -< WHERE name = 'Cam Bridge'; -< Y(position) -< 31 -< SELECT AsText(StartPoint(centerline)) -< FROM road_segments -< WHERE fid = 102; -< AsText(StartPoint(centerline)) -< POINT(0 18) -< SELECT AsText(EndPoint(centerline)) -< FROM road_segments -< WHERE fid = 102; -< AsText(EndPoint(centerline)) -< POINT(44 31) -< SELECT GLength(centerline) -< FROM road_segments -< WHERE fid = 106; -< GLength(centerline) -< 26 -< SELECT NumPoints(centerline) -< FROM road_segments -< WHERE fid = 102; -< NumPoints(centerline) -< 5 -< SELECT AsText(PointN(centerline, 1)) -< FROM road_segments -< WHERE fid = 102; -< AsText(PointN(centerline, 1)) -< POINT(0 18) -< SELECT AsText(Centroid(boundary)) -< FROM named_places -< WHERE name = 'Goose Island'; -< AsText(Centroid(boundary)) -< POINT(63 15.5) -< SELECT Area(boundary) -< FROM named_places -< WHERE name = 'Goose Island'; -< Area(boundary) -< 40 -< SELECT AsText(ExteriorRing(shore)) -< FROM lakes -< WHERE name = 'Blue Lake'; -< AsText(ExteriorRing(shore)) -< LINESTRING(52 18,66 23,73 9,48 6,52 18) -< SELECT NumInteriorRings(shore) -< FROM lakes -< WHERE name = 'Blue Lake'; -< NumInteriorRings(shore) -< 1 -< SELECT AsText(InteriorRingN(shore, 1)) -< FROM lakes -< WHERE name = 'Blue Lake'; -< AsText(InteriorRingN(shore, 1)) -< LINESTRING(59 18,67 18,67 13,59 13,59 18) -< SELECT NumGeometries(centerlines) -< FROM divided_routes -< WHERE name = 'Route 75'; -< NumGeometries(centerlines) -< 2 -< SELECT AsText(GeometryN(centerlines, 2)) -< FROM divided_routes -< WHERE name = 'Route 75'; -< AsText(GeometryN(centerlines, 2)) -< LINESTRING(16 0,16 23,16 48) -< SELECT IsClosed(centerlines) -< FROM divided_routes -< WHERE name = 'Route 75'; -< IsClosed(centerlines) -< 0 -< SELECT GLength(centerlines) -< FROM divided_routes -< WHERE name = 'Route 75'; -< GLength(centerlines) -< 96 -< SELECT AsText(Centroid(shores)) -< FROM ponds -< WHERE fid = 120; -< AsText(Centroid(shores)) -< POINT(25 42) -< SELECT Area(shores) -< FROM ponds -< WHERE fid = 120; -< Area(shores) -< 8 -< SELECT ST_Equals(boundary, -< PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) -< FROM named_places -< WHERE name = 'Goose Island'; -< ST_Equals(boundary, -< PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) -< 1 -< SELECT ST_Disjoint(centerlines, boundary) -< FROM divided_routes, named_places -< WHERE divided_routes.name = 'Route 75' -< AND named_places.name = 'Ashton'; -< ST_Disjoint(centerlines, boundary) -< 1 -< SELECT ST_Touches(centerline, shore) -< FROM streams, lakes -< WHERE streams.name = 'Cam Stream' -< AND lakes.name = 'Blue Lake'; -< ST_Touches(centerline, shore) -< 1 -< SELECT Crosses(road_segments.centerline, divided_routes.centerlines) -< FROM road_segments, divided_routes -< WHERE road_segments.fid = 102 -< AND divided_routes.name = 'Route 75'; -< Crosses(road_segments.centerline, divided_routes.centerlines) -< 1 -< SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines) -< FROM road_segments, divided_routes -< WHERE road_segments.fid = 102 -< AND divided_routes.name = 'Route 75'; -< ST_Intersects(road_segments.centerline, divided_routes.centerlines) -< 1 -< SELECT ST_Contains(forests.boundary, named_places.boundary) -< FROM forests, named_places -< WHERE forests.name = 'Green Forest' -< AND named_places.name = 'Ashton'; -< ST_Contains(forests.boundary, named_places.boundary) -< 0 -< SELECT ST_Distance(position, boundary) -< FROM bridges, named_places -< WHERE bridges.name = 'Cam Bridge' -< AND named_places.name = 'Ashton'; -< ST_Distance(position, boundary) -< 12 -< SELECT AsText(ST_Difference(named_places.boundary, forests.boundary)) -< FROM named_places, forests -< WHERE named_places.name = 'Ashton' -< AND forests.name = 'Green Forest'; -< AsText(ST_Difference(named_places.boundary, forests.boundary)) -< POLYGON((56 34,62 48,84 48,84 42,56 34)) -< SELECT AsText(ST_Union(shore, boundary)) -< FROM lakes, named_places -< WHERE lakes.name = 'Blue Lake' -< AND named_places.name = 'Goose Island'; -< AsText(ST_Union(shore, boundary)) -< POLYGON((48 6,52 18,66 23,73 9,48 6)) -< SELECT AsText(ST_SymDifference(shore, boundary)) -< FROM lakes, named_places -< WHERE lakes.name = 'Blue Lake' -< AND named_places.name = 'Ashton'; -< AsText(ST_SymDifference(shore, boundary)) -< MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30))) -< SELECT count(*) -< FROM buildings, bridges -< WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1; -< count(*) -< 1 ---- -> ERROR 42000: The storage engine for the table doesn't support GEOMETRY -> # ERROR: Statement ended with errno 1178, errname ER_CHECK_NOT_IMPLEMENTED (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ CREATE TABLE gis_point (fid INT(11) /*!*/ /*Custom column options*/, g POINT NOT NULL, SPATIAL INDEX(g)) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.gis_point) INSERT_METHOD=LAST ] -> # The statement|command finished with ER_CHECK_NOT_IMPLEMENTED. -> # Geometry types or spatial indexes or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- +--- type_spatial_indexes.result 2013-01-23 01:25:45.367797786 +0400 ++++ type_spatial_indexes.reject 2013-01-23 02:51:15.247306467 +0400 +@@ -2,1399 +2,31 @@ + DROP DATABASE IF EXISTS gis_ogs; + CREATE DATABASE gis_ogs; + CREATE TABLE gis_point (fid <INT_COLUMN>, g POINT, <CUSTOM_INDEX> g(g(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_line (fid <INT_COLUMN>, g LINESTRING, <CUSTOM_INDEX> g(g(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_polygon (fid <INT_COLUMN>, g POLYGON, <CUSTOM_INDEX> g(g(512))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_multi_point (fid <INT_COLUMN>, g MULTIPOINT, <CUSTOM_INDEX> g(g(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_multi_line (fid <INT_COLUMN>, g MULTILINESTRING, <CUSTOM_INDEX> g(g(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_multi_polygon (fid <INT_COLUMN>, g MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_geometrycollection (fid <INT_COLUMN>, g GEOMETRYCOLLECTION) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_geometry (fid <INT_COLUMN>, g GEOMETRY) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-USE gis_ogs; +-CREATE TABLE lakes (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-shore POLYGON, <CUSTOM_INDEX> s(shore(64))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE road_segments (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-aliases CHAR(64) <CUSTOM_COL_OPTIONS>, +-num_lanes INT <CUSTOM_COL_OPTIONS>, +-centerline LINESTRING, <CUSTOM_INDEX> c(centerline(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE divided_routes (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-num_lanes INT <CUSTOM_COL_OPTIONS>, +-centerlines MULTILINESTRING, <CUSTOM_INDEX> c(centerlines(512))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE forests (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-boundary MULTIPOLYGON, <CUSTOM_INDEX> b(boundary(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE bridges (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-position POINT, <CUSTOM_INDEX> p(`position`(64))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE streams (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-centerline LINESTRING, <CUSTOM_INDEX> c(centerline(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE buildings (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-position POINT, +-footprint POLYGON, <CUSTOM_INDEX> p(`position`(64)), <CUSTOM_INDEX> f(footprint(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE ponds (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-type CHAR(64) <CUSTOM_COL_OPTIONS>, +-shores MULTIPOLYGON, <CUSTOM_INDEX> s(shores(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE named_places (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-boundary POLYGON, <CUSTOM_INDEX> b(boundary(512))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE map_neatlines (fid INT <CUSTOM_COL_OPTIONS>, +-neatline POLYGON, <CUSTOM_INDEX> n(neatline(700))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-USE test; +-SHOW FIELDS FROM gis_point; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g point YES MUL NULL +-SHOW FIELDS FROM gis_line; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g linestring YES MUL NULL +-SHOW FIELDS FROM gis_polygon; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g polygon YES MUL NULL +-SHOW FIELDS FROM gis_multi_point; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g multipoint YES MUL NULL +-SHOW FIELDS FROM gis_multi_line; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g multilinestring YES MUL NULL +-SHOW FIELDS FROM gis_multi_polygon; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g multipolygon YES NULL +-SHOW FIELDS FROM gis_geometrycollection; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g geometrycollection YES NULL +-SHOW FIELDS FROM gis_geometry; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g geometry YES NULL +-INSERT INTO gis_point (fid,g) VALUES +-(101, PointFromText('POINT(10 10)')), +-(102, PointFromText('POINT(20 10)')), +-(103, PointFromText('POINT(20 20)')), +-(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)')))); +-INSERT INTO gis_line (fid,g) VALUES +-(105, LineFromText('LINESTRING(0 0,0 10,10 0)')), +-(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), +-(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10))))); +-INSERT INTO gis_polygon (fid,g) VALUES +-(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), +-(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), +-(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))))); +-INSERT INTO gis_multi_point (fid,g) VALUES +-(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), +-(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), +-(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10))))); +-INSERT INTO gis_multi_line (fid,g) VALUES +-(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), +-(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), +-(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))))); +-INSERT INTO gis_multi_polygon (fid,g) VALUES +-(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), +-(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), +-(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))))); +-INSERT INTO gis_geometrycollection (fid,g) VALUES +-(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), +-(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))), +-(122, GeomFromText('GeometryCollection()')), +-(123, GeomFromText('GeometryCollection EMPTY')); +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_point; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_line; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_polygon; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_point; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_line; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_polygon; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_geometrycollection; +-SELECT fid, AsText(g) FROM gis_point; +-fid AsText(g) +-101 POINT(10 10) +-102 POINT(20 10) +-103 POINT(20 20) +-104 POINT(10 20) +-SELECT fid, AsText(g) FROM gis_line; +-fid AsText(g) +-105 LINESTRING(0 0,0 10,10 0) +-106 LINESTRING(10 10,20 10,20 20,10 20,10 10) +-107 LINESTRING(10 10,40 10) +-SELECT fid, AsText(g) FROM gis_polygon; +-fid AsText(g) +-108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +-109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) +-110 POLYGON((0 0,30 0,30 30,0 0)) +-SELECT fid, AsText(g) FROM gis_multi_point; +-fid AsText(g) +-111 MULTIPOINT(0 0,10 10,10 20,20 20) +-112 MULTIPOINT(1 1,11 11,11 21,21 21) +-113 MULTIPOINT(3 6,4 10) +-SELECT fid, AsText(g) FROM gis_multi_line; +-fid AsText(g) +-114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) +-115 MULTILINESTRING((10 48,10 21,10 0)) +-116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) +-SELECT fid, AsText(g) FROM gis_multi_polygon; +-fid AsText(g) +-117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +-118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +-119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) +-SELECT fid, AsText(g) FROM gis_geometrycollection; +-fid AsText(g) +-120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) +-121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) +-122 GEOMETRYCOLLECTION EMPTY +-123 GEOMETRYCOLLECTION EMPTY +-SELECT fid, AsText(g) FROM gis_geometry; +-fid AsText(g) +-101 POINT(10 10) +-102 POINT(20 10) +-103 POINT(20 20) +-104 POINT(10 20) +-105 LINESTRING(0 0,0 10,10 0) +-106 LINESTRING(10 10,20 10,20 20,10 20,10 10) +-107 LINESTRING(10 10,40 10) +-108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +-109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) +-110 POLYGON((0 0,30 0,30 30,0 0)) +-111 MULTIPOINT(0 0,10 10,10 20,20 20) +-112 MULTIPOINT(1 1,11 11,11 21,21 21) +-113 MULTIPOINT(3 6,4 10) +-114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) +-115 MULTILINESTRING((10 48,10 21,10 0)) +-116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) +-117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +-118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +-119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) +-120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) +-121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) +-122 GEOMETRYCOLLECTION EMPTY +-123 GEOMETRYCOLLECTION EMPTY +-SELECT fid, Dimension(g) FROM gis_geometry; +-fid Dimension(g) +-101 0 +-102 0 +-103 0 +-104 0 +-105 1 +-106 1 +-107 1 +-108 2 +-109 2 +-110 2 +-111 0 +-112 0 +-113 0 +-114 1 +-115 1 +-116 1 +-117 2 +-118 2 +-119 2 +-120 1 +-121 1 +-122 0 +-123 0 +-SELECT fid, GeometryType(g) FROM gis_geometry; +-fid GeometryType(g) +-101 POINT +-102 POINT +-103 POINT +-104 POINT +-105 LINESTRING +-106 LINESTRING +-107 LINESTRING +-108 POLYGON +-109 POLYGON +-110 POLYGON +-111 MULTIPOINT +-112 MULTIPOINT +-113 MULTIPOINT +-114 MULTILINESTRING +-115 MULTILINESTRING +-116 MULTILINESTRING +-117 MULTIPOLYGON +-118 MULTIPOLYGON +-119 MULTIPOLYGON +-120 GEOMETRYCOLLECTION +-121 GEOMETRYCOLLECTION +-122 GEOMETRYCOLLECTION +-123 GEOMETRYCOLLECTION +-SELECT fid, IsEmpty(g) FROM gis_geometry; +-fid IsEmpty(g) +-101 0 +-102 0 +-103 0 +-104 0 +-105 0 +-106 0 +-107 0 +-108 0 +-109 0 +-110 0 +-111 0 +-112 0 +-113 0 +-114 0 +-115 0 +-116 0 +-117 0 +-118 0 +-119 0 +-120 0 +-121 0 +-122 0 +-123 0 +-SELECT fid, AsText(Envelope(g)) FROM gis_geometry; +-fid AsText(Envelope(g)) +-101 POLYGON((10 10,10 10,10 10,10 10,10 10)) +-102 POLYGON((20 10,20 10,20 10,20 10,20 10)) +-103 POLYGON((20 20,20 20,20 20,20 20,20 20)) +-104 POLYGON((10 20,10 20,10 20,10 20,10 20)) +-105 POLYGON((0 0,10 0,10 10,0 10,0 0)) +-106 POLYGON((10 10,20 10,20 20,10 20,10 10)) +-107 POLYGON((10 10,40 10,40 10,10 10,10 10)) +-108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +-109 POLYGON((0 0,50 0,50 50,0 50,0 0)) +-110 POLYGON((0 0,30 0,30 30,0 30,0 0)) +-111 POLYGON((0 0,20 0,20 20,0 20,0 0)) +-112 POLYGON((1 1,21 1,21 21,1 21,1 1)) +-113 POLYGON((3 6,4 6,4 10,3 10,3 6)) +-114 POLYGON((10 0,16 0,16 48,10 48,10 0)) +-115 POLYGON((10 0,10 0,10 48,10 48,10 0)) +-116 POLYGON((1 2,21 2,21 8,1 8,1 2)) +-117 POLYGON((28 0,84 0,84 42,28 42,28 0)) +-118 POLYGON((28 0,84 0,84 42,28 42,28 0)) +-119 POLYGON((0 0,3 0,3 3,0 3,0 0)) +-120 POLYGON((0 0,10 0,10 10,0 10,0 0)) +-121 POLYGON((3 6,44 6,44 9,3 9,3 6)) +-122 GEOMETRYCOLLECTION EMPTY +-123 GEOMETRYCOLLECTION EMPTY +-SELECT fid, X(g) FROM gis_point; +-fid X(g) +-101 10 +-102 20 +-103 20 +-104 10 +-SELECT fid, Y(g) FROM gis_point; +-fid Y(g) +-101 10 +-102 10 +-103 20 +-104 20 +-SELECT fid, AsText(StartPoint(g)) FROM gis_line; +-fid AsText(StartPoint(g)) +-105 POINT(0 0) +-106 POINT(10 10) +-107 POINT(10 10) +-SELECT fid, AsText(EndPoint(g)) FROM gis_line; +-fid AsText(EndPoint(g)) +-105 POINT(10 0) +-106 POINT(10 10) +-107 POINT(40 10) +-SELECT fid, GLength(g) FROM gis_line; +-fid GLength(g) +-105 24.14213562373095 +-106 40 +-107 30 +-SELECT fid, NumPoints(g) FROM gis_line; +-fid NumPoints(g) +-105 3 +-106 5 +-107 2 +-SELECT fid, AsText(PointN(g, 2)) FROM gis_line; +-fid AsText(PointN(g, 2)) +-105 POINT(0 10) +-106 POINT(20 10) +-107 POINT(40 10) +-SELECT fid, IsClosed(g) FROM gis_line; +-fid IsClosed(g) +-105 0 +-106 1 +-107 0 +-SELECT fid, AsText(Centroid(g)) FROM gis_polygon; +-fid AsText(Centroid(g)) +-108 POINT(15 15) +-109 POINT(25.416666666666668 25.416666666666668) +-110 POINT(20 10) +-SELECT fid, Area(g) FROM gis_polygon; +-fid Area(g) +-108 100 +-109 2400 +-110 450 +-SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon; +-fid AsText(ExteriorRing(g)) +-108 LINESTRING(10 10,20 10,20 20,10 20,10 10) +-109 LINESTRING(0 0,50 0,50 50,0 50,0 0) +-110 LINESTRING(0 0,30 0,30 30,0 0) +-SELECT fid, NumInteriorRings(g) FROM gis_polygon; +-fid NumInteriorRings(g) +-108 0 +-109 1 +-110 0 +-SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon; +-fid AsText(InteriorRingN(g, 1)) +-108 NULL +-109 LINESTRING(10 10,20 10,20 20,10 20,10 10) +-110 NULL +-SELECT fid, IsClosed(g) FROM gis_multi_line; +-fid IsClosed(g) +-114 0 +-115 0 +-116 0 +-SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon; +-fid AsText(Centroid(g)) +-117 POINT(55.58852775304245 17.426536064113982) +-118 POINT(55.58852775304245 17.426536064113982) +-119 POINT(2 2) +-SELECT fid, Area(g) FROM gis_multi_polygon; +-fid Area(g) +-117 1684.5 +-118 1684.5 +-119 4.5 +-SELECT fid, NumGeometries(g) from gis_multi_point; +-fid NumGeometries(g) +-111 4 +-112 4 +-113 2 +-SELECT fid, NumGeometries(g) from gis_multi_line; +-fid NumGeometries(g) +-114 2 +-115 1 +-116 2 +-SELECT fid, NumGeometries(g) from gis_multi_polygon; +-fid NumGeometries(g) +-117 2 +-118 2 +-119 1 +-SELECT fid, NumGeometries(g) from gis_geometrycollection; +-fid NumGeometries(g) +-120 2 +-121 2 +-122 0 +-123 0 +-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point; +-fid AsText(GeometryN(g, 2)) +-111 POINT(10 10) +-112 POINT(11 11) +-113 POINT(4 10) +-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line; +-fid AsText(GeometryN(g, 2)) +-114 LINESTRING(16 0,16 23,16 48) +-115 NULL +-116 LINESTRING(2 5,5 8,21 7) +-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon; +-fid AsText(GeometryN(g, 2)) +-117 POLYGON((59 18,67 18,67 13,59 13,59 18)) +-118 POLYGON((59 18,67 18,67 13,59 13,59 18)) +-119 NULL +-SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection; +-fid AsText(GeometryN(g, 2)) +-120 LINESTRING(0 0,10 10) +-121 LINESTRING(3 6,7 9) +-122 NULL +-123 NULL +-SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection; +-fid AsText(GeometryN(g, 1)) +-120 POINT(0 0) +-121 POINT(44 6) +-122 NULL +-123 NULL +-SELECT g1.fid as first, g2.fid as second, +-Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o, +-Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, +-Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r +-FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; +-first second w c o e d t i r +-120 120 1 1 0 1 0 1 1 0 +-120 121 0 0 1 0 0 0 1 0 +-120 122 0 1 NULL 0 NULL 0 NULL 0 +-120 123 0 1 NULL 0 NULL 0 NULL 0 +-121 120 0 0 1 0 0 0 1 0 +-121 121 1 1 0 1 0 1 1 0 +-121 122 0 1 NULL 0 NULL 0 NULL 0 +-121 123 0 1 NULL 0 NULL 0 NULL 0 +-122 120 1 0 NULL 0 NULL 0 NULL 0 +-122 121 1 0 NULL 0 NULL 0 NULL 0 +-122 122 1 1 NULL 1 NULL 0 NULL 0 +-122 123 1 1 NULL 1 NULL 0 NULL 0 +-123 120 1 0 NULL 0 NULL 0 NULL 0 +-123 121 1 0 NULL 0 NULL 0 NULL 0 +-123 122 1 1 NULL 1 NULL 0 NULL 0 +-123 123 1 1 NULL 1 NULL 0 NULL 0 +-DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; +-USE gis_ogs; +-# Lakes +-INSERT INTO lakes (fid,name,shore) VALUES ( +-101, 'BLUE LAKE', +-PolyFromText( +-'POLYGON( +- (52 18,66 23,73 9,48 6,52 18), +- (59 18,67 18,67 13,59 13,59 18) +- )', +-101)); +-# Road Segments +-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(102, 'Route 5', NULL, 2, +-LineFromText( +-'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101)); +-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(103, 'Route 5', 'Main Street', 4, +-LineFromText( +-'LINESTRING( 44 31, 56 34, 70 38 )' ,101)); +-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(104, 'Route 5', NULL, 2, +-LineFromText( +-'LINESTRING( 70 38, 72 48 )' ,101)); +-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(105, 'Main Street', NULL, 4, +-LineFromText( +-'LINESTRING( 70 38, 84 42 )' ,101)); +-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(106, 'Dirt Road by Green Forest', NULL, +-1, +-LineFromText( +-'LINESTRING( 28 26, 28 0 )',101)); +-# DividedRoutes +-INSERT INTO divided_routes (fid,name,num_lanes,centerlines) VALUES(119, 'Route 75', 4, +-MLineFromText( +-'MULTILINESTRING((10 48,10 21,10 0), +- (16 0,16 23,16 48))', 101)); +-# Forests +-INSERT INTO forests (fid,name,boundary) VALUES(109, 'Green Forest', +-MPolyFromText( +-'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26), +- (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))', +-101)); +-# Bridges +-INSERT INTO bridges (fid,name,position) VALUES(110, 'Cam Bridge', PointFromText( +-'POINT( 44 31 )', 101)); +-# Streams +-INSERT INTO streams (fid,name,centerline) VALUES(111, 'Cam Stream', +-LineFromText( +-'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101)); +-INSERT INTO streams (fid,name,centerline) VALUES(112, NULL, +-LineFromText( +-'LINESTRING( 76 0, 78 4, 73 9 )', 101)); +-# Buildings +-INSERT INTO buildings (fid,name,position,footprint) VALUES(113, '123 Main Street', +-PointFromText( +-'POINT( 52 30 )', 101), +-PolyFromText( +-'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101)); +-INSERT INTO buildings (fid,name,position,footprint) VALUES(114, '215 Main Street', +-PointFromText( +-'POINT( 64 33 )', 101), +-PolyFromText( +-'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101)); +-# Ponds +-INSERT INTO ponds (fid,name,type,shores) VALUES(120, NULL, 'Stock Pond', +-MPolyFromText( +-'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ), +- ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101)); +-# Named Places +-INSERT INTO named_places (fid,name,boundary) VALUES(117, 'Ashton', +-PolyFromText( +-'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101)); +-INSERT INTO named_places (fid,name,boundary) VALUES(118, 'Goose Island', +-PolyFromText( +-'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101)); +-# Map Neatlines +-INSERT INTO map_neatlines (fid,neatline) VALUES(115, +-PolyFromText( +-'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101)); +-SELECT Dimension(shore) +-FROM lakes +-WHERE name = 'Blue Lake'; +-Dimension(shore) +-2 +-SELECT GeometryType(centerlines) +-FROM divided_routes +-WHERE name = 'Route 75'; +-GeometryType(centerlines) +-MULTILINESTRING +-SELECT AsText(boundary) +-FROM named_places +-WHERE name = 'Goose Island'; +-AsText(boundary) +-POLYGON((67 13,67 18,59 18,59 13,67 13)) +-SELECT AsText(PolyFromWKB(AsBinary(boundary),101)) +-FROM named_places +-WHERE name = 'Goose Island'; +-AsText(PolyFromWKB(AsBinary(boundary),101)) +-POLYGON((67 13,67 18,59 18,59 13,67 13)) +-SELECT SRID(boundary) +-FROM named_places +-WHERE name = 'Goose Island'; +-SRID(boundary) +-101 +-SELECT IsEmpty(centerline) +-FROM road_segments +-WHERE name = 'Route 5' +-AND aliases = 'Main Street'; +-IsEmpty(centerline) +-0 +-SELECT AsText(Envelope(boundary)) +-FROM named_places +-WHERE name = 'Goose Island'; +-AsText(Envelope(boundary)) +-POLYGON((59 13,67 13,67 18,59 18,59 13)) +-SELECT X(position) +-FROM bridges +-WHERE name = 'Cam Bridge'; +-X(position) +-44 +-SELECT Y(position) +-FROM bridges +-WHERE name = 'Cam Bridge'; +-Y(position) +-31 +-SELECT AsText(StartPoint(centerline)) +-FROM road_segments +-WHERE fid = 102; +-AsText(StartPoint(centerline)) +-POINT(0 18) +-SELECT AsText(EndPoint(centerline)) +-FROM road_segments +-WHERE fid = 102; +-AsText(EndPoint(centerline)) +-POINT(44 31) +-SELECT GLength(centerline) +-FROM road_segments +-WHERE fid = 106; +-GLength(centerline) +-26 +-SELECT NumPoints(centerline) +-FROM road_segments +-WHERE fid = 102; +-NumPoints(centerline) +-5 +-SELECT AsText(PointN(centerline, 1)) +-FROM road_segments +-WHERE fid = 102; +-AsText(PointN(centerline, 1)) +-POINT(0 18) +-SELECT AsText(Centroid(boundary)) +-FROM named_places +-WHERE name = 'Goose Island'; +-AsText(Centroid(boundary)) +-POINT(63 15.5) +-SELECT Area(boundary) +-FROM named_places +-WHERE name = 'Goose Island'; +-Area(boundary) +-40 +-SELECT AsText(ExteriorRing(shore)) +-FROM lakes +-WHERE name = 'Blue Lake'; +-AsText(ExteriorRing(shore)) +-LINESTRING(52 18,66 23,73 9,48 6,52 18) +-SELECT NumInteriorRings(shore) +-FROM lakes +-WHERE name = 'Blue Lake'; +-NumInteriorRings(shore) +-1 +-SELECT AsText(InteriorRingN(shore, 1)) +-FROM lakes +-WHERE name = 'Blue Lake'; +-AsText(InteriorRingN(shore, 1)) +-LINESTRING(59 18,67 18,67 13,59 13,59 18) +-SELECT NumGeometries(centerlines) +-FROM divided_routes +-WHERE name = 'Route 75'; +-NumGeometries(centerlines) +-2 +-SELECT AsText(GeometryN(centerlines, 2)) +-FROM divided_routes +-WHERE name = 'Route 75'; +-AsText(GeometryN(centerlines, 2)) +-LINESTRING(16 0,16 23,16 48) +-SELECT IsClosed(centerlines) +-FROM divided_routes +-WHERE name = 'Route 75'; +-IsClosed(centerlines) +-0 +-SELECT GLength(centerlines) +-FROM divided_routes +-WHERE name = 'Route 75'; +-GLength(centerlines) +-96 +-SELECT AsText(Centroid(shores)) +-FROM ponds +-WHERE fid = 120; +-AsText(Centroid(shores)) +-POINT(25 42) +-SELECT Area(shores) +-FROM ponds +-WHERE fid = 120; +-Area(shores) +-8 +-SELECT ST_Equals(boundary, +-PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) +-FROM named_places +-WHERE name = 'Goose Island'; +-ST_Equals(boundary, +-PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) +-1 +-SELECT ST_Disjoint(centerlines, boundary) +-FROM divided_routes, named_places +-WHERE divided_routes.name = 'Route 75' +-AND named_places.name = 'Ashton'; +-ST_Disjoint(centerlines, boundary) +-1 +-SELECT ST_Touches(centerline, shore) +-FROM streams, lakes +-WHERE streams.name = 'Cam Stream' +-AND lakes.name = 'Blue Lake'; +-ST_Touches(centerline, shore) +-1 +-SELECT Crosses(road_segments.centerline, divided_routes.centerlines) +-FROM road_segments, divided_routes +-WHERE road_segments.fid = 102 +-AND divided_routes.name = 'Route 75'; +-Crosses(road_segments.centerline, divided_routes.centerlines) +-1 +-SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines) +-FROM road_segments, divided_routes +-WHERE road_segments.fid = 102 +-AND divided_routes.name = 'Route 75'; +-ST_Intersects(road_segments.centerline, divided_routes.centerlines) +-1 +-SELECT ST_Contains(forests.boundary, named_places.boundary) +-FROM forests, named_places +-WHERE forests.name = 'Green Forest' +-AND named_places.name = 'Ashton'; +-ST_Contains(forests.boundary, named_places.boundary) +-0 +-SELECT ST_Distance(position, boundary) +-FROM bridges, named_places +-WHERE bridges.name = 'Cam Bridge' +-AND named_places.name = 'Ashton'; +-ST_Distance(position, boundary) +-12 +-SELECT AsText(ST_Difference(named_places.boundary, forests.boundary)) +-FROM named_places, forests +-WHERE named_places.name = 'Ashton' +-AND forests.name = 'Green Forest'; +-AsText(ST_Difference(named_places.boundary, forests.boundary)) +-POLYGON((56 34,62 48,84 48,84 42,56 34)) +-SELECT AsText(ST_Union(shore, boundary)) +-FROM lakes, named_places +-WHERE lakes.name = 'Blue Lake' +-AND named_places.name = 'Goose Island'; +-AsText(ST_Union(shore, boundary)) +-POLYGON((48 6,52 18,66 23,73 9,48 6)) +-SELECT AsText(ST_SymDifference(shore, boundary)) +-FROM lakes, named_places +-WHERE lakes.name = 'Blue Lake' +-AND named_places.name = 'Ashton'; +-AsText(ST_SymDifference(shore, boundary)) +-MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30))) +-SELECT count(*) +-FROM buildings, bridges +-WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1; +-count(*) +-1 ++ERROR 42000: The storage engine for the table doesn't support GEOMETRY ++# ERROR: Statement ended with errno 1178, errname ER_CHECK_NOT_IMPLEMENTED (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ CREATE TABLE gis_point (fid INT(11) /*!*/ /*Custom column options*/, g POINT, /*!INDEX*/ /*Custom index*/ g(g(128))) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.gis_point) INSERT_METHOD=LAST ] ++# The statement|command finished with ER_CHECK_NOT_IMPLEMENTED. ++# Geometry types or indexes on them or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + DROP DATABASE gis_ogs; + USE test; + DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; + DROP DATABASE IF EXISTS gis_ogs; + CREATE DATABASE gis_ogs; + CREATE TABLE gis_point (fid <INT_COLUMN>, g POINT NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_line (fid <INT_COLUMN>, g LINESTRING NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_polygon (fid <INT_COLUMN>, g POLYGON NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_multi_point (fid <INT_COLUMN>, g MULTIPOINT NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_multi_line (fid <INT_COLUMN>, g MULTILINESTRING NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_multi_polygon (fid <INT_COLUMN>, g MULTIPOLYGON NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_geometrycollection (fid <INT_COLUMN>, g GEOMETRYCOLLECTION NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE gis_geometry (fid <INT_COLUMN>, g GEOMETRY NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-USE gis_ogs; +-CREATE TABLE lakes (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-shore POLYGON NOT NULL, SPATIAL INDEX s(shore)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE road_segments (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-aliases CHAR(64) <CUSTOM_COL_OPTIONS>, +-num_lanes INT <CUSTOM_COL_OPTIONS>, +-centerline LINESTRING NOT NULL, SPATIAL INDEX c(centerline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE divided_routes (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-num_lanes INT <CUSTOM_COL_OPTIONS>, +-centerlines MULTILINESTRING NOT NULL, SPATIAL INDEX c(centerlines)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE forests (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-boundary MULTIPOLYGON NOT NULL, SPATIAL INDEX b(boundary)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE bridges (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-position POINT NOT NULL, SPATIAL INDEX p(position)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE streams (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-centerline LINESTRING NOT NULL, SPATIAL INDEX c(centerline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE buildings (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-position POINT NOT NULL, +-footprint POLYGON NOT NULL, SPATIAL INDEX p(position), SPATIAL INDEX f(footprint)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE ponds (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-type CHAR(64) <CUSTOM_COL_OPTIONS>, +-shores MULTIPOLYGON NOT NULL, SPATIAL INDEX s(shores)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE named_places (fid INT <CUSTOM_COL_OPTIONS>, +-name CHAR(64) <CUSTOM_COL_OPTIONS>, +-boundary POLYGON NOT NULL, SPATIAL INDEX b(boundary)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-CREATE TABLE map_neatlines (fid INT <CUSTOM_COL_OPTIONS>, +-neatline POLYGON NOT NULL, SPATIAL INDEX n(neatline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-USE test; +-SHOW FIELDS FROM gis_point; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g point NO MUL NULL +-SHOW FIELDS FROM gis_line; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g linestring NO MUL NULL +-SHOW FIELDS FROM gis_polygon; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g polygon NO MUL NULL +-SHOW FIELDS FROM gis_multi_point; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g multipoint NO MUL NULL +-SHOW FIELDS FROM gis_multi_line; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g multilinestring NO MUL NULL +-SHOW FIELDS FROM gis_multi_polygon; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g multipolygon NO MUL NULL +-SHOW FIELDS FROM gis_geometrycollection; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g geometrycollection NO MUL NULL +-SHOW FIELDS FROM gis_geometry; +-Field Type Null Key Default Extra +-fid int(11) YES NULL +-g geometry NO NULL +-INSERT INTO gis_point (fid,g) VALUES +-(101, PointFromText('POINT(10 10)')), +-(102, PointFromText('POINT(20 10)')), +-(103, PointFromText('POINT(20 20)')), +-(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)')))); +-INSERT INTO gis_line (fid,g) VALUES +-(105, LineFromText('LINESTRING(0 0,0 10,10 0)')), +-(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), +-(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10))))); +-INSERT INTO gis_polygon (fid,g) VALUES +-(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), +-(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), +-(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))))); +-INSERT INTO gis_multi_point (fid,g) VALUES +-(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), +-(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), +-(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10))))); +-INSERT INTO gis_multi_line (fid,g) VALUES +-(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), +-(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), +-(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))))); +-INSERT INTO gis_multi_polygon (fid,g) VALUES +-(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), +-(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), +-(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))))); +-INSERT INTO gis_geometrycollection (fid,g) VALUES +-(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), +-(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))), +-(122, GeomFromText('GeometryCollection()')), +-(123, GeomFromText('GeometryCollection EMPTY')); +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_point; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_line; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_polygon; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_point; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_line; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_polygon; +-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_geometrycollection; +-SELECT fid, AsText(g) FROM gis_point; +-fid AsText(g) +-101 POINT(10 10) +-102 POINT(20 10) +-103 POINT(20 20) +-104 POINT(10 20) +-SELECT fid, AsText(g) FROM gis_line; +-fid AsText(g) +-105 LINESTRING(0 0,0 10,10 0) +-106 LINESTRING(10 10,20 10,20 20,10 20,10 10) +-107 LINESTRING(10 10,40 10) +-SELECT fid, AsText(g) FROM gis_polygon; +-fid AsText(g) +-108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +-109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) +-110 POLYGON((0 0,30 0,30 30,0 0)) +-SELECT fid, AsText(g) FROM gis_multi_point; +-fid AsText(g) +-111 MULTIPOINT(0 0,10 10,10 20,20 20) +-112 MULTIPOINT(1 1,11 11,11 21,21 21) +-113 MULTIPOINT(3 6,4 10) +-SELECT fid, AsText(g) FROM gis_multi_line; +-fid AsText(g) +-114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) +-115 MULTILINESTRING((10 48,10 21,10 0)) +-116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) +-SELECT fid, AsText(g) FROM gis_multi_polygon; +-fid AsText(g) +-117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +-118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +-119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) +-SELECT fid, AsText(g) FROM gis_geometrycollection; +-fid AsText(g) +-120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) +-121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) +-122 GEOMETRYCOLLECTION EMPTY +-123 GEOMETRYCOLLECTION EMPTY +-SELECT fid, AsText(g) FROM gis_geometry; +-fid AsText(g) +-101 POINT(10 10) +-102 POINT(20 10) +-103 POINT(20 20) +-104 POINT(10 20) +-105 LINESTRING(0 0,0 10,10 0) +-106 LINESTRING(10 10,20 10,20 20,10 20,10 10) +-107 LINESTRING(10 10,40 10) +-108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +-109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) +-110 POLYGON((0 0,30 0,30 30,0 0)) +-111 MULTIPOINT(0 0,10 10,10 20,20 20) +-112 MULTIPOINT(1 1,11 11,11 21,21 21) +-113 MULTIPOINT(3 6,4 10) +-114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) +-115 MULTILINESTRING((10 48,10 21,10 0)) +-116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) +-117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +-118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +-119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) +-120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) +-121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) +-122 GEOMETRYCOLLECTION EMPTY +-123 GEOMETRYCOLLECTION EMPTY +-SELECT fid, Dimension(g) FROM gis_geometry; +-fid Dimension(g) +-101 0 +-102 0 +-103 0 +-104 0 +-105 1 +-106 1 +-107 1 +-108 2 +-109 2 +-110 2 +-111 0 +-112 0 +-113 0 +-114 1 +-115 1 +-116 1 +-117 2 +-118 2 +-119 2 +-120 1 +-121 1 +-122 0 +-123 0 +-SELECT fid, GeometryType(g) FROM gis_geometry; +-fid GeometryType(g) +-101 POINT +-102 POINT +-103 POINT +-104 POINT +-105 LINESTRING +-106 LINESTRING +-107 LINESTRING +-108 POLYGON +-109 POLYGON +-110 POLYGON +-111 MULTIPOINT +-112 MULTIPOINT +-113 MULTIPOINT +-114 MULTILINESTRING +-115 MULTILINESTRING +-116 MULTILINESTRING +-117 MULTIPOLYGON +-118 MULTIPOLYGON +-119 MULTIPOLYGON +-120 GEOMETRYCOLLECTION +-121 GEOMETRYCOLLECTION +-122 GEOMETRYCOLLECTION +-123 GEOMETRYCOLLECTION +-SELECT fid, IsEmpty(g) FROM gis_geometry; +-fid IsEmpty(g) +-101 0 +-102 0 +-103 0 +-104 0 +-105 0 +-106 0 +-107 0 +-108 0 +-109 0 +-110 0 +-111 0 +-112 0 +-113 0 +-114 0 +-115 0 +-116 0 +-117 0 +-118 0 +-119 0 +-120 0 +-121 0 +-122 0 +-123 0 +-SELECT fid, AsText(Envelope(g)) FROM gis_geometry; +-fid AsText(Envelope(g)) +-101 POLYGON((10 10,10 10,10 10,10 10,10 10)) +-102 POLYGON((20 10,20 10,20 10,20 10,20 10)) +-103 POLYGON((20 20,20 20,20 20,20 20,20 20)) +-104 POLYGON((10 20,10 20,10 20,10 20,10 20)) +-105 POLYGON((0 0,10 0,10 10,0 10,0 0)) +-106 POLYGON((10 10,20 10,20 20,10 20,10 10)) +-107 POLYGON((10 10,40 10,40 10,10 10,10 10)) +-108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +-109 POLYGON((0 0,50 0,50 50,0 50,0 0)) +-110 POLYGON((0 0,30 0,30 30,0 30,0 0)) +-111 POLYGON((0 0,20 0,20 20,0 20,0 0)) +-112 POLYGON((1 1,21 1,21 21,1 21,1 1)) +-113 POLYGON((3 6,4 6,4 10,3 10,3 6)) +-114 POLYGON((10 0,16 0,16 48,10 48,10 0)) +-115 POLYGON((10 0,10 0,10 48,10 48,10 0)) +-116 POLYGON((1 2,21 2,21 8,1 8,1 2)) +-117 POLYGON((28 0,84 0,84 42,28 42,28 0)) +-118 POLYGON((28 0,84 0,84 42,28 42,28 0)) +-119 POLYGON((0 0,3 0,3 3,0 3,0 0)) +-120 POLYGON((0 0,10 0,10 10,0 10,0 0)) +-121 POLYGON((3 6,44 6,44 9,3 9,3 6)) +-122 GEOMETRYCOLLECTION EMPTY +-123 GEOMETRYCOLLECTION EMPTY +-SELECT fid, X(g) FROM gis_point; +-fid X(g) +-101 10 +-102 20 +-103 20 +-104 10 +-SELECT fid, Y(g) FROM gis_point; +-fid Y(g) +-101 10 +-102 10 +-103 20 +-104 20 +-SELECT fid, AsText(StartPoint(g)) FROM gis_line; +-fid AsText(StartPoint(g)) +-105 POINT(0 0) +-106 POINT(10 10) +-107 POINT(10 10) +-SELECT fid, AsText(EndPoint(g)) FROM gis_line; +-fid AsText(EndPoint(g)) +-105 POINT(10 0) +-106 POINT(10 10) +-107 POINT(40 10) +-SELECT fid, GLength(g) FROM gis_line; +-fid GLength(g) +-105 24.14213562373095 +-106 40 +-107 30 +-SELECT fid, NumPoints(g) FROM gis_line; +-fid NumPoints(g) +-105 3 +-106 5 +-107 2 +-SELECT fid, AsText(PointN(g, 2)) FROM gis_line; +-fid AsText(PointN(g, 2)) +-105 POINT(0 10) +-106 POINT(20 10) +-107 POINT(40 10) +-SELECT fid, IsClosed(g) FROM gis_line; +-fid IsClosed(g) +-105 0 +-106 1 +-107 0 +-SELECT fid, AsText(Centroid(g)) FROM gis_polygon; +-fid AsText(Centroid(g)) +-108 POINT(15 15) +-109 POINT(25.416666666666668 25.416666666666668) +-110 POINT(20 10) +-SELECT fid, Area(g) FROM gis_polygon; +-fid Area(g) +-108 100 +-109 2400 +-110 450 +-SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon; +-fid AsText(ExteriorRing(g)) +-108 LINESTRING(10 10,20 10,20 20,10 20,10 10) +-109 LINESTRING(0 0,50 0,50 50,0 50,0 0) +-110 LINESTRING(0 0,30 0,30 30,0 0) +-SELECT fid, NumInteriorRings(g) FROM gis_polygon; +-fid NumInteriorRings(g) +-108 0 +-109 1 +-110 0 +-SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon; +-fid AsText(InteriorRingN(g, 1)) +-108 NULL +-109 LINESTRING(10 10,20 10,20 20,10 20,10 10) +-110 NULL +-SELECT fid, IsClosed(g) FROM gis_multi_line; +-fid IsClosed(g) +-114 0 +-115 0 +-116 0 +-SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon; +-fid AsText(Centroid(g)) +-117 POINT(55.58852775304245 17.426536064113982) +-118 POINT(55.58852775304245 17.426536064113982) +-119 POINT(2 2) +-SELECT fid, Area(g) FROM gis_multi_polygon; +-fid Area(g) +-117 1684.5 +-118 1684.5 +-119 4.5 +-SELECT fid, NumGeometries(g) from gis_multi_point; +-fid NumGeometries(g) +-111 4 +-112 4 +-113 2 +-SELECT fid, NumGeometries(g) from gis_multi_line; +-fid NumGeometries(g) +-114 2 +-115 1 +-116 2 +-SELECT fid, NumGeometries(g) from gis_multi_polygon; +-fid NumGeometries(g) +-117 2 +-118 2 +-119 1 +-SELECT fid, NumGeometries(g) from gis_geometrycollection; +-fid NumGeometries(g) +-120 2 +-121 2 +-122 0 +-123 0 +-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point; +-fid AsText(GeometryN(g, 2)) +-111 POINT(10 10) +-112 POINT(11 11) +-113 POINT(4 10) +-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line; +-fid AsText(GeometryN(g, 2)) +-114 LINESTRING(16 0,16 23,16 48) +-115 NULL +-116 LINESTRING(2 5,5 8,21 7) +-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon; +-fid AsText(GeometryN(g, 2)) +-117 POLYGON((59 18,67 18,67 13,59 13,59 18)) +-118 POLYGON((59 18,67 18,67 13,59 13,59 18)) +-119 NULL +-SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection; +-fid AsText(GeometryN(g, 2)) +-120 LINESTRING(0 0,10 10) +-121 LINESTRING(3 6,7 9) +-122 NULL +-123 NULL +-SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection; +-fid AsText(GeometryN(g, 1)) +-120 POINT(0 0) +-121 POINT(44 6) +-122 NULL +-123 NULL +-SELECT g1.fid as first, g2.fid as second, +-Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o, +-Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, +-Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r +-FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; +-first second w c o e d t i r +-120 120 1 1 0 1 0 1 1 0 +-120 121 0 0 1 0 0 0 1 0 +-120 122 0 1 NULL 0 NULL 0 NULL 0 +-120 123 0 1 NULL 0 NULL 0 NULL 0 +-121 120 0 0 1 0 0 0 1 0 +-121 121 1 1 0 1 0 1 1 0 +-121 122 0 1 NULL 0 NULL 0 NULL 0 +-121 123 0 1 NULL 0 NULL 0 NULL 0 +-122 120 1 0 NULL 0 NULL 0 NULL 0 +-122 121 1 0 NULL 0 NULL 0 NULL 0 +-122 122 1 1 NULL 1 NULL 0 NULL 0 +-122 123 1 1 NULL 1 NULL 0 NULL 0 +-123 120 1 0 NULL 0 NULL 0 NULL 0 +-123 121 1 0 NULL 0 NULL 0 NULL 0 +-123 122 1 1 NULL 1 NULL 0 NULL 0 +-123 123 1 1 NULL 1 NULL 0 NULL 0 +-DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; +-USE gis_ogs; +-# Lakes +-INSERT INTO lakes (fid,name,shore) VALUES ( +-101, 'BLUE LAKE', +-PolyFromText( +-'POLYGON( +- (52 18,66 23,73 9,48 6,52 18), +- (59 18,67 18,67 13,59 13,59 18) +- )', +-101)); +-# Road Segments +-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(102, 'Route 5', NULL, 2, +-LineFromText( +-'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101)); +-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(103, 'Route 5', 'Main Street', 4, +-LineFromText( +-'LINESTRING( 44 31, 56 34, 70 38 )' ,101)); +-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(104, 'Route 5', NULL, 2, +-LineFromText( +-'LINESTRING( 70 38, 72 48 )' ,101)); +-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(105, 'Main Street', NULL, 4, +-LineFromText( +-'LINESTRING( 70 38, 84 42 )' ,101)); +-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(106, 'Dirt Road by Green Forest', NULL, +-1, +-LineFromText( +-'LINESTRING( 28 26, 28 0 )',101)); +-# DividedRoutes +-INSERT INTO divided_routes (fid,name,num_lanes,centerlines) VALUES(119, 'Route 75', 4, +-MLineFromText( +-'MULTILINESTRING((10 48,10 21,10 0), +- (16 0,16 23,16 48))', 101)); +-# Forests +-INSERT INTO forests (fid,name,boundary) VALUES(109, 'Green Forest', +-MPolyFromText( +-'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26), +- (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))', +-101)); +-# Bridges +-INSERT INTO bridges (fid,name,position) VALUES(110, 'Cam Bridge', PointFromText( +-'POINT( 44 31 )', 101)); +-# Streams +-INSERT INTO streams (fid,name,centerline) VALUES(111, 'Cam Stream', +-LineFromText( +-'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101)); +-INSERT INTO streams (fid,name,centerline) VALUES(112, NULL, +-LineFromText( +-'LINESTRING( 76 0, 78 4, 73 9 )', 101)); +-# Buildings +-INSERT INTO buildings (fid,name,position,footprint) VALUES(113, '123 Main Street', +-PointFromText( +-'POINT( 52 30 )', 101), +-PolyFromText( +-'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101)); +-INSERT INTO buildings (fid,name,position,footprint) VALUES(114, '215 Main Street', +-PointFromText( +-'POINT( 64 33 )', 101), +-PolyFromText( +-'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101)); +-# Ponds +-INSERT INTO ponds (fid,name,type,shores) VALUES(120, NULL, 'Stock Pond', +-MPolyFromText( +-'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ), +- ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101)); +-# Named Places +-INSERT INTO named_places (fid,name,boundary) VALUES(117, 'Ashton', +-PolyFromText( +-'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101)); +-INSERT INTO named_places (fid,name,boundary) VALUES(118, 'Goose Island', +-PolyFromText( +-'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101)); +-# Map Neatlines +-INSERT INTO map_neatlines (fid,neatline) VALUES(115, +-PolyFromText( +-'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101)); +-SELECT Dimension(shore) +-FROM lakes +-WHERE name = 'Blue Lake'; +-Dimension(shore) +-2 +-SELECT GeometryType(centerlines) +-FROM divided_routes +-WHERE name = 'Route 75'; +-GeometryType(centerlines) +-MULTILINESTRING +-SELECT AsText(boundary) +-FROM named_places +-WHERE name = 'Goose Island'; +-AsText(boundary) +-POLYGON((67 13,67 18,59 18,59 13,67 13)) +-SELECT AsText(PolyFromWKB(AsBinary(boundary),101)) +-FROM named_places +-WHERE name = 'Goose Island'; +-AsText(PolyFromWKB(AsBinary(boundary),101)) +-POLYGON((67 13,67 18,59 18,59 13,67 13)) +-SELECT SRID(boundary) +-FROM named_places +-WHERE name = 'Goose Island'; +-SRID(boundary) +-101 +-SELECT IsEmpty(centerline) +-FROM road_segments +-WHERE name = 'Route 5' +-AND aliases = 'Main Street'; +-IsEmpty(centerline) +-0 +-SELECT AsText(Envelope(boundary)) +-FROM named_places +-WHERE name = 'Goose Island'; +-AsText(Envelope(boundary)) +-POLYGON((59 13,67 13,67 18,59 18,59 13)) +-SELECT X(position) +-FROM bridges +-WHERE name = 'Cam Bridge'; +-X(position) +-44 +-SELECT Y(position) +-FROM bridges +-WHERE name = 'Cam Bridge'; +-Y(position) +-31 +-SELECT AsText(StartPoint(centerline)) +-FROM road_segments +-WHERE fid = 102; +-AsText(StartPoint(centerline)) +-POINT(0 18) +-SELECT AsText(EndPoint(centerline)) +-FROM road_segments +-WHERE fid = 102; +-AsText(EndPoint(centerline)) +-POINT(44 31) +-SELECT GLength(centerline) +-FROM road_segments +-WHERE fid = 106; +-GLength(centerline) +-26 +-SELECT NumPoints(centerline) +-FROM road_segments +-WHERE fid = 102; +-NumPoints(centerline) +-5 +-SELECT AsText(PointN(centerline, 1)) +-FROM road_segments +-WHERE fid = 102; +-AsText(PointN(centerline, 1)) +-POINT(0 18) +-SELECT AsText(Centroid(boundary)) +-FROM named_places +-WHERE name = 'Goose Island'; +-AsText(Centroid(boundary)) +-POINT(63 15.5) +-SELECT Area(boundary) +-FROM named_places +-WHERE name = 'Goose Island'; +-Area(boundary) +-40 +-SELECT AsText(ExteriorRing(shore)) +-FROM lakes +-WHERE name = 'Blue Lake'; +-AsText(ExteriorRing(shore)) +-LINESTRING(52 18,66 23,73 9,48 6,52 18) +-SELECT NumInteriorRings(shore) +-FROM lakes +-WHERE name = 'Blue Lake'; +-NumInteriorRings(shore) +-1 +-SELECT AsText(InteriorRingN(shore, 1)) +-FROM lakes +-WHERE name = 'Blue Lake'; +-AsText(InteriorRingN(shore, 1)) +-LINESTRING(59 18,67 18,67 13,59 13,59 18) +-SELECT NumGeometries(centerlines) +-FROM divided_routes +-WHERE name = 'Route 75'; +-NumGeometries(centerlines) +-2 +-SELECT AsText(GeometryN(centerlines, 2)) +-FROM divided_routes +-WHERE name = 'Route 75'; +-AsText(GeometryN(centerlines, 2)) +-LINESTRING(16 0,16 23,16 48) +-SELECT IsClosed(centerlines) +-FROM divided_routes +-WHERE name = 'Route 75'; +-IsClosed(centerlines) +-0 +-SELECT GLength(centerlines) +-FROM divided_routes +-WHERE name = 'Route 75'; +-GLength(centerlines) +-96 +-SELECT AsText(Centroid(shores)) +-FROM ponds +-WHERE fid = 120; +-AsText(Centroid(shores)) +-POINT(25 42) +-SELECT Area(shores) +-FROM ponds +-WHERE fid = 120; +-Area(shores) +-8 +-SELECT ST_Equals(boundary, +-PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) +-FROM named_places +-WHERE name = 'Goose Island'; +-ST_Equals(boundary, +-PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) +-1 +-SELECT ST_Disjoint(centerlines, boundary) +-FROM divided_routes, named_places +-WHERE divided_routes.name = 'Route 75' +-AND named_places.name = 'Ashton'; +-ST_Disjoint(centerlines, boundary) +-1 +-SELECT ST_Touches(centerline, shore) +-FROM streams, lakes +-WHERE streams.name = 'Cam Stream' +-AND lakes.name = 'Blue Lake'; +-ST_Touches(centerline, shore) +-1 +-SELECT Crosses(road_segments.centerline, divided_routes.centerlines) +-FROM road_segments, divided_routes +-WHERE road_segments.fid = 102 +-AND divided_routes.name = 'Route 75'; +-Crosses(road_segments.centerline, divided_routes.centerlines) +-1 +-SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines) +-FROM road_segments, divided_routes +-WHERE road_segments.fid = 102 +-AND divided_routes.name = 'Route 75'; +-ST_Intersects(road_segments.centerline, divided_routes.centerlines) +-1 +-SELECT ST_Contains(forests.boundary, named_places.boundary) +-FROM forests, named_places +-WHERE forests.name = 'Green Forest' +-AND named_places.name = 'Ashton'; +-ST_Contains(forests.boundary, named_places.boundary) +-0 +-SELECT ST_Distance(position, boundary) +-FROM bridges, named_places +-WHERE bridges.name = 'Cam Bridge' +-AND named_places.name = 'Ashton'; +-ST_Distance(position, boundary) +-12 +-SELECT AsText(ST_Difference(named_places.boundary, forests.boundary)) +-FROM named_places, forests +-WHERE named_places.name = 'Ashton' +-AND forests.name = 'Green Forest'; +-AsText(ST_Difference(named_places.boundary, forests.boundary)) +-POLYGON((56 34,62 48,84 48,84 42,56 34)) +-SELECT AsText(ST_Union(shore, boundary)) +-FROM lakes, named_places +-WHERE lakes.name = 'Blue Lake' +-AND named_places.name = 'Goose Island'; +-AsText(ST_Union(shore, boundary)) +-POLYGON((48 6,52 18,66 23,73 9,48 6)) +-SELECT AsText(ST_SymDifference(shore, boundary)) +-FROM lakes, named_places +-WHERE lakes.name = 'Blue Lake' +-AND named_places.name = 'Ashton'; +-AsText(ST_SymDifference(shore, boundary)) +-MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30))) +-SELECT count(*) +-FROM buildings, bridges +-WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1; +-count(*) +-1 ++ERROR 42000: The storage engine for the table doesn't support GEOMETRY ++# ERROR: Statement ended with errno 1178, errname ER_CHECK_NOT_IMPLEMENTED (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ CREATE TABLE gis_point (fid INT(11) /*!*/ /*Custom column options*/, g POINT NOT NULL, SPATIAL INDEX(g)) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.gis_point) INSERT_METHOD=LAST ] ++# The statement|command finished with ER_CHECK_NOT_IMPLEMENTED. ++# Geometry types or spatial indexes or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- + DROP DATABASE gis_ogs; + USE test; diff --git a/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff b/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff index 094b26668c1..8b2710be221 100644 --- a/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff @@ -1,79 +1,82 @@ -3,69c3,12 -< SHOW COLUMNS IN t1; -< Field Type Null Key Default Extra -< a int(11) # # -< b int(11) # # VIRTUAL -< INSERT INTO t1 (a) VALUES (1),(2); -< INSERT INTO t1 (a,b) VALUES (3,3),(4,4); -< Warnings: -< Warning 1906 The value specified for computed column 'b' in table 't1' ignored -< Warning 1906 The value specified for computed column 'b' in table 't1' ignored -< SELECT * FROM t1; -< a b -< 1 2 -< 2 3 -< 3 4 -< 4 5 -< DROP TABLE t1; -< CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1) PERSISTENT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< SHOW COLUMNS IN t1; -< Field Type Null Key Default Extra -< a int(11) # # -< b int(11) # # PERSISTENT -< INSERT INTO t1 (a) VALUES (1),(2); -< INSERT INTO t1 (a,b) VALUES (3,3),(4,4); -< Warnings: -< Warning 1906 The value specified for computed column 'b' in table 't1' ignored -< Warning 1906 The value specified for computed column 'b' in table 't1' ignored -< SELECT * FROM t1; -< a b -< 1 2 -< 2 3 -< 3 4 -< 4 5 -< DROP TABLE t1; -< CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1) VIRTUAL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< SHOW COLUMNS IN t1; -< Field Type Null Key Default Extra -< a int(11) # # -< b int(11) # # VIRTUAL -< INSERT INTO t1 (a) VALUES (1),(2); -< INSERT INTO t1 (a,b) VALUES (3,3),(4,4); -< Warnings: -< Warning 1906 The value specified for computed column 'b' in table 't1' ignored -< Warning 1906 The value specified for computed column 'b' in table 't1' ignored -< SELECT * FROM t1; -< a b -< 1 2 -< 2 3 -< 3 4 -< 4 5 -< DROP TABLE t1; -< CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> AS (a+1) PERSISTENT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; -< SHOW COLUMNS IN t1; -< Field Type Null Key Default Extra -< a int(11) # # -< b int(11) # # PERSISTENT -< INSERT INTO t1 (a) VALUES (1),(2); -< INSERT INTO t1 (a,b) VALUES (3,3),(4,4); -< Warnings: -< Warning 1906 The value specified for computed column 'b' in table 't1' ignored -< Warning 1906 The value specified for computed column 'b' in table 't1' ignored -< SELECT * FROM t1; -< a b -< 1 2 -< 2 3 -< 3 4 -< 4 5 -< DROP TABLE t1; ---- -> ERROR HY000: MRG_MyISAM storage engine does not support computed columns -> # ERROR: Statement ended with errno 1910, errname ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS (expected to succeed) -> # ------------ UNEXPECTED RESULT ------------ -> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b INT(11) /*!*/ /*Custom column options*/ GENERATED ALWAYS AS (a+1)) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST ] -> # The statement|command finished with ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS. -> # Virtual columns or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. -> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. -> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. -> # Also, this problem may cause a chain effect (more errors of different kinds in the test). -> # ------------------------------------------- +--- vcol.result 2013-01-22 22:05:05.246633000 +0400 ++++ vcol.reject 2013-01-23 02:51:26.851160587 +0400 +@@ -1,69 +1,12 @@ + DROP TABLE IF EXISTS t1; + CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-SHOW COLUMNS IN t1; +-Field Type Null Key Default Extra +-a int(11) # # +-b int(11) # # VIRTUAL +-INSERT INTO t1 (a) VALUES (1),(2); +-INSERT INTO t1 (a,b) VALUES (3,3),(4,4); +-Warnings: +-Warning 1906 The value specified for computed column 'b' in table 't1' ignored +-Warning 1906 The value specified for computed column 'b' in table 't1' ignored +-SELECT a,b FROM t1; +-a b +-1 2 +-2 3 +-3 4 +-4 5 +-DROP TABLE t1; +-CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1) PERSISTENT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-SHOW COLUMNS IN t1; +-Field Type Null Key Default Extra +-a int(11) # # +-b int(11) # # PERSISTENT +-INSERT INTO t1 (a) VALUES (1),(2); +-INSERT INTO t1 (a,b) VALUES (3,3),(4,4); +-Warnings: +-Warning 1906 The value specified for computed column 'b' in table 't1' ignored +-Warning 1906 The value specified for computed column 'b' in table 't1' ignored +-SELECT a,b FROM t1; +-a b +-1 2 +-2 3 +-3 4 +-4 5 +-DROP TABLE t1; +-CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1) VIRTUAL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-SHOW COLUMNS IN t1; +-Field Type Null Key Default Extra +-a int(11) # # +-b int(11) # # VIRTUAL +-INSERT INTO t1 (a) VALUES (1),(2); +-INSERT INTO t1 (a,b) VALUES (3,3),(4,4); +-Warnings: +-Warning 1906 The value specified for computed column 'b' in table 't1' ignored +-Warning 1906 The value specified for computed column 'b' in table 't1' ignored +-SELECT a,b FROM t1; +-a b +-1 2 +-2 3 +-3 4 +-4 5 +-DROP TABLE t1; +-CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> AS (a+1) PERSISTENT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; +-SHOW COLUMNS IN t1; +-Field Type Null Key Default Extra +-a int(11) # # +-b int(11) # # PERSISTENT +-INSERT INTO t1 (a) VALUES (1),(2); +-INSERT INTO t1 (a,b) VALUES (3,3),(4,4); +-Warnings: +-Warning 1906 The value specified for computed column 'b' in table 't1' ignored +-Warning 1906 The value specified for computed column 'b' in table 't1' ignored +-SELECT a,b FROM t1; +-a b +-1 2 +-2 3 +-3 4 +-4 5 +-DROP TABLE t1; ++ERROR HY000: MRG_MYISAM storage engine does not support computed columns ++# ERROR: Statement ended with errno 1910, errname ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS (expected to succeed) ++# ------------ UNEXPECTED RESULT ------------ ++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b INT(11) /*!*/ /*Custom column options*/ GENERATED ALWAYS AS (a+1)) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST ] ++# The statement|command finished with ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS. ++# Virtual columns or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors. ++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def. ++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped. ++# Also, this problem may cause a chain effect (more errors of different kinds in the test). ++# ------------------------------------------- diff --git a/storage/oqgraph/CMakeLists.txt b/storage/oqgraph/CMakeLists.txt index 83acb99b2a2..593fced6235 100644 --- a/storage/oqgraph/CMakeLists.txt +++ b/storage/oqgraph/CMakeLists.txt @@ -3,6 +3,7 @@ IF(NOT Boost_FOUND) RETURN() ENDIF() INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS}) +SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${Boost_INCLUDE_DIRS}) IF(MSVC) # lp:756966 OQGRAPH on Win64 does not compile diff --git a/storage/perfschema/pfs_events_waits.cc b/storage/perfschema/pfs_events_waits.cc index b6cadf9e61c..a941f815dca 100644 --- a/storage/perfschema/pfs_events_waits.cc +++ b/storage/perfschema/pfs_events_waits.cc @@ -93,6 +93,9 @@ static inline void copy_events_waits(PFS_events_waits *dest, */ void insert_events_waits_history(PFS_thread *thread, PFS_events_waits *wait) { + if (unlikely(events_waits_history_per_thread == 0)) + return; + uint index= thread->m_waits_history_index; /* @@ -120,6 +123,9 @@ void insert_events_waits_history(PFS_thread *thread, PFS_events_waits *wait) */ void insert_events_waits_history_long(PFS_events_waits *wait) { + if (unlikely(events_waits_history_long_size == 0)) + return; + uint index= PFS_atomic::add_u32(&events_waits_history_long_index, 1); index= index % events_waits_history_long_size; diff --git a/storage/xtradb/btr/btr0btr.c b/storage/xtradb/btr/btr0btr.c index ed97fc5bd58..a3e57d632a0 100644 --- a/storage/xtradb/btr/btr0btr.c +++ b/storage/xtradb/btr/btr0btr.c @@ -1641,7 +1641,7 @@ btr_page_reorganize_low( ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); btr_assert_not_corrupted(block, index); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ data_size1 = page_get_data_size(page); max_ins_size1 = page_get_max_insert_size_after_reorganize(page, 1); @@ -1760,7 +1760,7 @@ btr_page_reorganize_low( func_exit: #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ #ifndef UNIV_HOTBACKUP buf_block_free(temp_block); @@ -1835,7 +1835,7 @@ btr_page_empty( ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); ut_ad(page_zip == buf_block_get_page_zip(block)); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ btr_search_drop_page_hash_index(block); @@ -1892,10 +1892,10 @@ btr_root_raise_and_insert( root_block = btr_cur_get_block(cursor); root_page_zip = buf_block_get_page_zip(root_block); ut_ad(page_get_n_recs(root) > 0); + index = btr_cur_get_index(cursor); #ifdef UNIV_ZIP_DEBUG - ut_a(!root_page_zip || page_zip_validate(root_page_zip, root)); + ut_a(!root_page_zip || page_zip_validate(root_page_zip, root, index)); #endif /* UNIV_ZIP_DEBUG */ - index = btr_cur_get_index(cursor); #ifdef UNIV_BTR_DEBUG if (!dict_index_is_ibuf(index)) { ulint space = dict_index_get_space(index); @@ -2825,8 +2825,8 @@ insert_empty: #ifdef UNIV_ZIP_DEBUG if (UNIV_LIKELY_NULL(page_zip)) { - ut_a(page_zip_validate(page_zip, page)); - ut_a(page_zip_validate(new_page_zip, new_page)); + ut_a(page_zip_validate(page_zip, page, cursor->index)); + ut_a(page_zip_validate(new_page_zip, new_page, cursor->index)); } #endif /* UNIV_ZIP_DEBUG */ @@ -2860,7 +2860,8 @@ insert_empty: = buf_block_get_page_zip(insert_block); ut_a(!insert_page_zip - || page_zip_validate(insert_page_zip, insert_page)); + || page_zip_validate(insert_page_zip, insert_page, + cursor->index)); } #endif /* UNIV_ZIP_DEBUG */ @@ -3140,6 +3141,8 @@ btr_lift_page_up( buf_block_t* blocks[BTR_MAX_LEVELS]; ulint n_blocks; /*!< last used index in blocks[] */ ulint i; + ibool lift_father_up = FALSE; + buf_block_t* block_orig = block; ut_ad(btr_page_get_prev(page, mtr) == FIL_NULL); ut_ad(btr_page_get_next(page, mtr) == FIL_NULL); @@ -3150,11 +3153,13 @@ btr_lift_page_up( { btr_cur_t cursor; - mem_heap_t* heap = mem_heap_create(100); - ulint* offsets; + ulint* offsets = NULL; + mem_heap_t* heap = mem_heap_create( + sizeof(*offsets) + * (REC_OFFS_HEADER_SIZE + 1 + 1 + index->n_fields)); buf_block_t* b; - offsets = btr_page_get_father_block(NULL, heap, index, + offsets = btr_page_get_father_block(offsets, heap, index, block, mtr, &cursor); father_block = btr_cur_get_block(&cursor); father_page_zip = buf_block_get_page_zip(father_block); @@ -3178,6 +3183,29 @@ btr_lift_page_up( blocks[n_blocks++] = b = btr_cur_get_block(&cursor); } + if (n_blocks && page_level == 0) { + /* The father page also should be the only on its level (not + root). We should lift up the father page at first. + Because the leaf page should be lifted up only for root page. + The freeing page is based on page_level (==0 or !=0) + to choose segment. If the page_level is changed ==0 from !=0, + later freeing of the page doesn't find the page allocation + to be freed.*/ + + lift_father_up = TRUE; + block = father_block; + page = buf_block_get_frame(block); + page_level = btr_page_get_level(page, mtr); + + ut_ad(btr_page_get_prev(page, mtr) == FIL_NULL); + ut_ad(btr_page_get_next(page, mtr) == FIL_NULL); + ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); + + father_block = blocks[0]; + father_page_zip = buf_block_get_page_zip(father_block); + father_page = buf_block_get_frame(father_block); + } + mem_heap_free(heap); } @@ -3185,6 +3213,7 @@ btr_lift_page_up( /* Make the father empty */ btr_page_empty(father_block, father_page_zip, index, page_level, mtr); + page_level++; /* Copy the records to the father page one by one. */ if (0 @@ -3217,7 +3246,7 @@ btr_lift_page_up( lock_update_copy_and_discard(father_block, block); /* Go upward to root page, decrementing levels by one. */ - for (i = 0; i < n_blocks; i++, page_level++) { + for (i = lift_father_up ? 1 : 0; i < n_blocks; i++, page_level++) { page_t* page = buf_block_get_frame(blocks[i]); page_zip_des_t* page_zip= buf_block_get_page_zip(blocks[i]); @@ -3225,7 +3254,7 @@ btr_lift_page_up( btr_page_set_level(page, page_zip, page_level, mtr); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ } @@ -3239,7 +3268,7 @@ btr_lift_page_up( ut_ad(page_validate(father_page, index)); ut_ad(btr_check_node_ptr(index, father_block, mtr)); - return(father_block); + return(lift_father_up ? block_orig : father_block); } /*************************************************************//** @@ -3310,6 +3339,7 @@ btr_compress( if (adjust) { nth_rec = page_rec_get_n_recs_before(btr_cur_get_rec(cursor)); + ut_ad(nth_rec > 0); } /* Decide the page to which we try to merge and which will inherit @@ -3400,8 +3430,8 @@ err_exit: const page_zip_des_t* page_zip = buf_block_get_page_zip(block); ut_a(page_zip); - ut_a(page_zip_validate(merge_page_zip, merge_page)); - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(merge_page_zip, merge_page, index)); + ut_a(page_zip_validate(page_zip, page, index)); } #endif /* UNIV_ZIP_DEBUG */ @@ -3534,7 +3564,8 @@ err_exit: ut_ad(page_validate(merge_page, index)); #ifdef UNIV_ZIP_DEBUG - ut_a(!merge_page_zip || page_zip_validate(merge_page_zip, merge_page)); + ut_a(!merge_page_zip || page_zip_validate(merge_page_zip, merge_page, + index)); #endif /* UNIV_ZIP_DEBUG */ /* Free the file page */ @@ -3545,6 +3576,7 @@ func_exit: mem_heap_free(heap); if (adjust) { + ut_ad(nth_rec > 0); btr_cur_position( index, page_rec_get_nth(merge_block->frame, nth_rec), @@ -3716,7 +3748,7 @@ btr_discard_page( page_zip_des_t* merge_page_zip = buf_block_get_page_zip(merge_block); ut_a(!merge_page_zip - || page_zip_validate(merge_page_zip, merge_page)); + || page_zip_validate(merge_page_zip, merge_page, index)); } #endif /* UNIV_ZIP_DEBUG */ @@ -4058,8 +4090,22 @@ btr_index_page_validate( { page_cur_t cur; ibool ret = TRUE; +#ifndef DBUG_OFF + ulint nth = 1; +#endif /* !DBUG_OFF */ page_cur_set_before_first(block, &cur); + + /* Directory slot 0 should only contain the infimum record. */ + DBUG_EXECUTE_IF("check_table_rec_next", + ut_a(page_rec_get_nth_const( + page_cur_get_page(&cur), 0) + == cur.rec); + ut_a(page_dir_slot_get_n_owned( + page_dir_get_nth_slot( + page_cur_get_page(&cur), 0)) + == 1);); + page_cur_move_to_next(&cur); for (;;) { @@ -4073,6 +4119,16 @@ btr_index_page_validate( return(FALSE); } + /* Verify that page_rec_get_nth_const() is correctly + retrieving each record. */ + DBUG_EXECUTE_IF("check_table_rec_next", + ut_a(cur.rec == page_rec_get_nth_const( + page_cur_get_page(&cur), + page_rec_get_n_recs_before( + cur.rec))); + ut_a(nth++ == page_rec_get_n_recs_before( + cur.rec));); + page_cur_move_to_next(&cur); } @@ -4170,7 +4226,7 @@ btr_validate_level( ut_a(space == page_get_space_id(page)); #ifdef UNIV_ZIP_DEBUG page_zip = buf_block_get_page_zip(block); - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ ut_a(!page_is_leaf(page)); @@ -4198,7 +4254,7 @@ loop: #ifdef UNIV_ZIP_DEBUG page_zip = buf_block_get_page_zip(block); - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ /* Check ordering etc. of records */ diff --git a/storage/xtradb/btr/btr0cur.c b/storage/xtradb/btr/btr0cur.c index 687853a422e..d089fb5ad22 100644 --- a/storage/xtradb/btr/btr0cur.c +++ b/storage/xtradb/btr/btr0cur.c @@ -97,6 +97,11 @@ srv_refresh_innodb_monitor_stats(). Referenced by srv_printf_innodb_monitor(). */ UNIV_INTERN ulint btr_cur_n_sea_old = 0; +#ifdef UNIV_DEBUG +/* Flag to limit optimistic insert records */ +UNIV_INTERN uint btr_cur_limit_optimistic_insert_debug = 0; +#endif /* UNIV_DEBUG */ + /** In the optimistic insert, if the insert does not fit, but this much space can be released by page reorganize, then it is reorganized */ #define BTR_CUR_PAGE_REORGANIZE_LIMIT (UNIV_PAGE_SIZE / 32) @@ -748,7 +753,7 @@ retry_page_get: #ifdef UNIV_ZIP_DEBUG const page_zip_des_t* page_zip = buf_block_get_page_zip(block); - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ buf_block_dbg_add_level( @@ -1378,6 +1383,9 @@ btr_cur_optimistic_insert( } } + LIMIT_OPTIMISTIC_INSERT_DEBUG(page_get_n_recs(page), + goto fail); + /* If there have been many consecutive inserts, and we are on the leaf level, check if we have to split the page to reserve enough free space for future updates of records. */ @@ -2189,7 +2197,7 @@ any_extern: page_zip = buf_block_get_page_zip(block); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ if (page_zip @@ -2406,7 +2414,7 @@ btr_cur_pessimistic_update( MTR_MEMO_X_LOCK)); ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ /* The insert buffer tree should never be updated in place. */ ut_ad(!dict_index_is_ibuf(index)); @@ -2561,7 +2569,7 @@ make_external: btr_search_update_hash_on_delete(cursor); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ page_cursor = btr_cur_get_page_cur(cursor); @@ -2668,7 +2676,7 @@ make_external: buf_block_t* rec_block = btr_cur_get_block(cursor); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); page = buf_block_get_frame(rec_block); #endif /* UNIV_ZIP_DEBUG */ page_zip = buf_block_get_page_zip(rec_block); @@ -2694,7 +2702,7 @@ make_external: return_after_reservations: #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ if (n_extents > 0) { @@ -3066,7 +3074,7 @@ btr_cur_set_deleted_flag_for_ibuf( when the tablespace is uncompressed */ ibool val, /*!< in: value to set */ - mtr_t* mtr) /*!< in: mtr */ + mtr_t* mtr) /*!< in/out: mini-transaction */ { /* We do not need to reserve btr_search_latch, as the page has just been read to the buffer pool and there cannot be @@ -3171,12 +3179,14 @@ btr_cur_optimistic_delete( page, 1); } #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip + || page_zip_validate(page_zip, page, cursor->index)); #endif /* UNIV_ZIP_DEBUG */ page_cur_delete_rec(btr_cur_get_page_cur(cursor), cursor->index, offsets, mtr); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip + || page_zip_validate(page_zip, page, cursor->index)); #endif /* UNIV_ZIP_DEBUG */ if (dict_index_is_clust(cursor->index) @@ -3273,7 +3283,7 @@ btr_cur_pessimistic_delete( rec = btr_cur_get_rec(cursor); page_zip = buf_block_get_page_zip(block); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap); @@ -3283,7 +3293,7 @@ btr_cur_pessimistic_delete( rec, offsets, page_zip, rb_ctx, mtr); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ } @@ -3344,7 +3354,7 @@ btr_cur_pessimistic_delete( page_cur_delete_rec(btr_cur_get_page_cur(cursor), index, offsets, mtr); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ ut_ad(btr_check_node_ptr(index, block, mtr)); diff --git a/storage/xtradb/buf/buf0buf.c b/storage/xtradb/buf/buf0buf.c index bbc1042ca78..5bcfb0f51b9 100644 --- a/storage/xtradb/buf/buf0buf.c +++ b/storage/xtradb/buf/buf0buf.c @@ -66,9 +66,7 @@ _increment_page_get_statistics(buf_block_t* block, trx_t* trx) byte block_hash_offset; ut_ad(block); - - if (!innobase_get_slow_log() || !trx || !trx->take_stats) - return; + ut_ad(trx && trx->take_stats); if (!trx->distinct_page_access_hash) { trx->distinct_page_access_hash = mem_alloc(DPAH_SIZE); @@ -279,7 +277,7 @@ the read requests for the whole area. #ifndef UNIV_HOTBACKUP /** Value in microseconds */ -static const int WAIT_FOR_READ = 5000; +static const int WAIT_FOR_READ = 100; /** Number of attemtps made to read in a page in the buffer pool */ static const ulint BUF_PAGE_READ_MAX_RETRIES = 100; @@ -412,6 +410,33 @@ buf_get_total_list_len( } /********************************************************************//** +Get total list size in bytes from all buffer pools. */ +UNIV_INTERN +void +buf_get_total_list_size_in_bytes( +/*=============================*/ + buf_pools_list_size_t* buf_pools_list_size) /*!< out: list sizes + in all buffer pools */ +{ + ulint i; + ut_ad(buf_pools_list_size); + memset(buf_pools_list_size, 0, sizeof(*buf_pools_list_size)); + + for (i = 0; i < srv_buf_pool_instances; i++) { + buf_pool_t* buf_pool; + + buf_pool = buf_pool_from_array(i); + /* We don't need mutex protection since this is + for statistics purpose */ + buf_pools_list_size->LRU_bytes += buf_pool->stat.LRU_bytes; + buf_pools_list_size->unzip_LRU_bytes += + UT_LIST_GET_LEN(buf_pool->unzip_LRU) * UNIV_PAGE_SIZE; + buf_pools_list_size->flush_list_bytes += + buf_pool->stat.flush_list_bytes; + } +} + +/********************************************************************//** Get total buffer pool statistics. */ UNIV_INTERN void @@ -1807,40 +1832,24 @@ buf_page_make_young( } /********************************************************************//** -Sets the time of the first access of a page and moves a page to the -start of the buffer pool LRU list if it is too old. This high-level -function can be used to prevent an important page from slipping -out of the buffer pool. */ +Moves a page to the start of the buffer pool LRU list if it is too old. +This high-level function can be used to prevent an important page from +slipping out of the buffer pool. */ static void -buf_page_set_accessed_make_young( -/*=============================*/ - buf_page_t* bpage, /*!< in/out: buffer block of a +buf_page_make_young_if_needed( +/*==========================*/ + buf_page_t* bpage) /*!< in/out: buffer block of a file page */ - unsigned access_time) /*!< in: bpage->access_time - read under mutex protection, - or 0 if unknown */ { +#ifdef UNIV_DEBUG buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); - ut_ad(!buf_pool_mutex_own(buf_pool)); +#endif /* UNIV_DEBUG */ ut_a(buf_page_in_file(bpage)); if (buf_page_peek_if_too_old(bpage)) { - //buf_pool_mutex_enter(buf_pool); - mutex_enter(&buf_pool->LRU_list_mutex); - buf_LRU_make_block_young(bpage); - //buf_pool_mutex_exit(buf_pool); - mutex_exit(&buf_pool->LRU_list_mutex); - } else if (!access_time) { - ulint time_ms = ut_time_ms(); - mutex_t* block_mutex = buf_page_get_mutex_enter(bpage); - //buf_pool_mutex_enter(buf_pool); - if (block_mutex) { - buf_page_set_accessed(bpage, time_ms); - mutex_exit(block_mutex); - } - //buf_pool_mutex_exit(buf_pool); + buf_page_make_young(bpage); } } @@ -1959,7 +1968,6 @@ buf_page_get_zip( buf_page_t* bpage; mutex_t* block_mutex; ibool must_read; - unsigned access_time; trx_t* trx = NULL; ulint sec; ulint ms; @@ -1967,7 +1975,7 @@ buf_page_get_zip( ib_uint64_t finish_time; buf_pool_t* buf_pool = buf_pool_get(space, offset); - if (innobase_get_slow_log()) { + if (UNIV_UNLIKELY(innobase_get_slow_log())) { trx = innobase_get_trx(); } buf_pool->stat.n_page_gets++; @@ -2089,13 +2097,14 @@ err_exit: got_block: must_read = buf_page_get_io_fix(bpage) == BUF_IO_READ; - access_time = buf_page_is_accessed(bpage); //buf_pool_mutex_exit(buf_pool); + buf_page_set_accessed(bpage); + mutex_exit(block_mutex); - buf_page_set_accessed_make_young(bpage, access_time); + buf_page_make_young_if_needed(bpage); #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG ut_a(!bpage->file_page_was_freed); @@ -2111,7 +2120,7 @@ got_block: /* Let us wait until the read operation completes */ - if (innobase_get_slow_log() && trx && trx->take_stats) + if (UNIV_UNLIKELY(trx && trx->take_stats)) { ut_usectime(&sec, &ms); start_time = (ib_uint64_t)sec * 1000000 + ms; @@ -2132,7 +2141,7 @@ got_block: break; } } - if (innobase_get_slow_log() && trx && trx->take_stats && start_time) + if (UNIV_UNLIKELY(start_time != 0)) { ut_usectime(&sec, &ms); finish_time = (ib_uint64_t)sec * 1000000 + ms; @@ -2487,7 +2496,7 @@ buf_page_get_gen( || ibuf_page_low(space, zip_size, offset, FALSE, file, line, NULL)); #endif - if (innobase_get_slow_log()) { + if (UNIV_UNLIKELY(innobase_get_slow_log())) { trx = innobase_get_trx(); } buf_pool->stat.n_page_gets++; @@ -2774,6 +2783,8 @@ wait_until_unfixed: UNIV_MEM_INVALID(bpage, sizeof *bpage); + access_time = buf_page_is_accessed(&block->page); + mutex_exit(block_mutex); mutex_exit(&buf_pool->zip_mutex); @@ -2781,18 +2792,22 @@ wait_until_unfixed: buf_pool->n_pend_unzip++; buf_pool_mutex_exit(buf_pool); - //buf_pool_mutex_exit(buf_pool); - buf_page_free_descriptor(bpage); - /* Decompress the page and apply buffered operations - while not holding buf_pool->mutex or block->mutex. */ + /* Decompress the page while not holding + buf_pool->mutex or block->mutex. */ success = buf_zip_decompress(block, srv_use_checksums); ut_a(success); if (UNIV_LIKELY(!recv_no_ibuf_operations)) { - ibuf_merge_or_delete_for_page(block, space, offset, - zip_size, TRUE); + if (access_time) { +#ifdef UNIV_IBUF_COUNT_DEBUG + ut_a(ibuf_count_get(space, offset) == 0); +#endif /* UNIV_IBUF_COUNT_DEBUG */ + } else { + ibuf_merge_or_delete_for_page( + block, space, offset, zip_size, TRUE); + } } /* Unfix and unlatch the block. */ @@ -2888,17 +2903,16 @@ wait_until_unfixed: ut_a(mode == BUF_GET_POSSIBLY_FREED || !block->page.file_page_was_freed); #endif - //mutex_exit(&block->mutex); /* Check if this is the first access to the page */ - access_time = buf_page_is_accessed(&block->page); - //buf_pool_mutex_exit(buf_pool); - mutex_exit(block_mutex); + buf_page_set_accessed(&block->page); + + mutex_exit(&block->mutex); - if (UNIV_LIKELY(mode != BUF_PEEK_IF_IN_POOL)) { - buf_page_set_accessed_make_young(&block->page, access_time); + if (mode != BUF_PEEK_IF_IN_POOL) { + buf_page_make_young_if_needed(&block->page); } #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG @@ -2913,7 +2927,7 @@ wait_until_unfixed: /* Let us wait until the read operation completes */ - if (innobase_get_slow_log() && trx && trx->take_stats) + if (UNIV_UNLIKELY(trx && trx->take_stats)) { ut_usectime(&sec, &ms); start_time = (ib_uint64_t)sec * 1000000 + ms; @@ -2928,13 +2942,14 @@ wait_until_unfixed: mutex_exit(&block->mutex); if (io_fix == BUF_IO_READ) { - - os_thread_sleep(WAIT_FOR_READ); + /* wait by temporaly s-latch */ + rw_lock_s_lock(&(block->lock)); + rw_lock_s_unlock(&(block->lock)); } else { break; } } - if (innobase_get_slow_log() && trx && trx->take_stats && start_time) + if (UNIV_UNLIKELY(start_time != 0)) { ut_usectime(&sec, &ms); finish_time = (ib_uint64_t)sec * 1000000 + ms; @@ -2961,7 +2976,7 @@ wait_until_unfixed: mtr_memo_push(mtr, block, fix_type); - if (UNIV_LIKELY(mode != BUF_PEEK_IF_IN_POOL) && !access_time) { + if (mode != BUF_PEEK_IF_IN_POOL && !access_time) { /* In the case of a first access, try to apply linear read-ahead */ @@ -2973,7 +2988,7 @@ wait_until_unfixed: ut_a(ibuf_count_get(buf_block_get_space(block), buf_block_get_page_no(block)) == 0); #endif - if (innobase_get_slow_log()) { + if (UNIV_UNLIKELY(trx && trx->take_stats)) { _increment_page_get_statistics(block, trx); } @@ -3018,15 +3033,13 @@ buf_page_optimistic_get( buf_block_buf_fix_inc(block, file, line); - mutex_exit(&block->mutex); + access_time = buf_page_is_accessed(&block->page); - /* Check if this is the first access to the page. - We do a dirty read on purpose, to avoid mutex contention. - This field is only used for heuristic purposes; it does not - affect correctness. */ + buf_page_set_accessed(&block->page); - access_time = buf_page_is_accessed(&block->page); - buf_page_set_accessed_make_young(&block->page, access_time); + mutex_exit(&block->mutex); + + buf_page_make_young_if_needed(&block->page); ut_ad(!ibuf_inside(mtr) || ibuf_page(buf_block_get_space(block), @@ -3078,11 +3091,11 @@ buf_page_optimistic_get( #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG ut_a(block->page.file_page_was_freed == FALSE); #endif - if (innobase_get_slow_log()) { + if (UNIV_UNLIKELY(innobase_get_slow_log())) { trx = innobase_get_trx(); } - if (UNIV_UNLIKELY(!access_time)) { + if (!access_time) { /* In the case of a first access, try to apply linear read-ahead */ @@ -3099,7 +3112,7 @@ buf_page_optimistic_get( buf_pool = buf_pool_from_block(block); buf_pool->stat.n_page_gets++; - if (innobase_get_slow_log()) { + if (UNIV_UNLIKELY(trx && trx->take_stats)) { _increment_page_get_statistics(block, trx); } return(TRUE); @@ -3149,28 +3162,14 @@ buf_page_get_known_nowait( buf_block_buf_fix_inc(block, file, line); + buf_page_set_accessed(&block->page); + mutex_exit(&block->mutex); buf_pool = buf_pool_from_block(block); - if (mode == BUF_MAKE_YOUNG && buf_page_peek_if_too_old(&block->page)) { - //buf_pool_mutex_enter(buf_pool); - mutex_enter(&buf_pool->LRU_list_mutex); - buf_LRU_make_block_young(&block->page); - //buf_pool_mutex_exit(buf_pool); - mutex_exit(&buf_pool->LRU_list_mutex); - } else if (!buf_page_is_accessed(&block->page)) { - /* Above, we do a dirty read on purpose, to avoid - mutex contention. The field buf_page_t::access_time - is only used for heuristic purposes. Writes to the - field must be protected by mutex, however. */ - ulint time_ms = ut_time_ms(); - - //buf_pool_mutex_enter(buf_pool); - mutex_enter(&block->mutex); - buf_page_set_accessed(&block->page, time_ms); - //buf_pool_mutex_exit(buf_pool); - mutex_exit(&block->mutex); + if (mode == BUF_MAKE_YOUNG) { + buf_page_make_young_if_needed(&block->page); } ut_ad(!ibuf_inside(mtr) || mode == BUF_KEEP_OLD); @@ -3211,9 +3210,13 @@ buf_page_get_known_nowait( #endif buf_pool->stat.n_page_gets++; - if (innobase_get_slow_log()) { + if (UNIV_UNLIKELY(innobase_get_slow_log())) { + trx = innobase_get_trx(); - _increment_page_get_statistics(block, trx); + if (trx != NULL && trx->take_stats) { + + _increment_page_get_statistics(block, trx); + } } return(TRUE); @@ -3342,6 +3345,7 @@ buf_page_init( ulint offset, /*!< in: offset of the page within space in units of a page */ ulint fold, /*!< in: buf_page_address_fold(space,offset) */ + ulint zip_size,/*!< in: compressed page size, or 0 */ buf_block_t* block) /*!< in/out: block to init */ { buf_page_t* hash_page; @@ -3411,6 +3415,9 @@ buf_page_init( ut_d(block->page.in_page_hash = TRUE); HASH_INSERT(buf_page_t, hash, buf_pool->page_hash, fold, &block->page); + if (zip_size) { + page_zip_set_size(&block->page.zip, zip_size); + } } /********************************************************************//** @@ -3537,7 +3544,7 @@ err_exit: ut_ad(buf_pool_from_bpage(bpage) == buf_pool); - buf_page_init(buf_pool, space, offset, fold, block); + buf_page_init(buf_pool, space, offset, fold, zip_size, block); rw_lock_x_unlock(&buf_pool->page_hash_latch); @@ -3557,8 +3564,6 @@ err_exit: buf_page_set_io_fix(bpage, BUF_IO_READ); if (UNIV_UNLIKELY(zip_size)) { - page_zip_set_size(&block->page.zip, zip_size); - /* buf_pool->mutex may be released and reacquired by buf_buddy_alloc(). Thus, we must release block->mutex in order not to @@ -3658,7 +3663,8 @@ err_exit: rw_lock_x_unlock(&buf_pool->page_hash_latch); - /* The block must be put to the LRU list, to the old blocks */ + /* The block must be put to the LRU list, to the old blocks + The zip_size is already set into the page zip */ buf_LRU_add_block(bpage, TRUE/* to old blocks */); #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG buf_LRU_insert_zip_clean(bpage); @@ -3706,7 +3712,6 @@ buf_page_create( buf_block_t* block; ulint fold; buf_block_t* free_block = NULL; - ulint time_ms = ut_time_ms(); buf_pool_t* buf_pool = buf_pool_get(space, offset); ut_ad(mtr); @@ -3774,7 +3779,7 @@ retry: mutex_enter(&block->mutex); - buf_page_init(buf_pool, space, offset, fold, block); + buf_page_init(buf_pool, space, offset, fold, zip_size,block); rw_lock_x_unlock(&buf_pool->page_hash_latch); /* The block must be put to the LRU list */ @@ -3793,8 +3798,6 @@ retry: buf_page_set_io_fix(&block->page, BUF_IO_READ); rw_lock_x_lock(&block->lock); - - page_zip_set_size(&block->page.zip, zip_size); mutex_exit(&block->mutex); /* buf_pool->mutex may be released and reacquired by buf_buddy_alloc(). Thus, we must release block->mutex @@ -3818,13 +3821,12 @@ retry: rw_lock_x_unlock(&block->lock); } - buf_page_set_accessed(&block->page, time_ms); - - //buf_pool_mutex_exit(buf_pool); mutex_exit(&buf_pool->LRU_list_mutex); mtr_memo_push(mtr, block, MTR_MEMO_BUF_FIX); + buf_page_set_accessed(&block->page); + mutex_exit(&block->mutex); /* Delete possible entries for the page from the insert buffer: @@ -3937,7 +3939,7 @@ buf_page_io_complete( ensures that this is the only thread that handles the i/o for this block. */ - io_type = buf_page_get_io_fix(bpage); + io_type = buf_page_get_io_fix_unlocked(bpage); ut_ad(io_type == BUF_IO_READ || io_type == BUF_IO_WRITE); if (io_type == BUF_IO_READ) { diff --git a/storage/xtradb/buf/buf0flu.c b/storage/xtradb/buf/buf0flu.c index 39351cd3678..663e2d8f537 100644 --- a/storage/xtradb/buf/buf0flu.c +++ b/storage/xtradb/buf/buf0flu.c @@ -79,6 +79,23 @@ static buf_flush_stat_t buf_flush_stat_sum; /* @} */ +/******************************************************************//** +Increases flush_list size in bytes with zip_size for compressed page, +UNIV_PAGE_SIZE for uncompressed page in inline function */ +static inline +void +incr_flush_list_size_in_bytes( +/*==========================*/ + buf_block_t* block, /*!< in: control block */ + buf_pool_t* buf_pool) /*!< in: buffer pool instance */ +{ + ulint zip_size; + ut_ad(buf_flush_list_mutex_own(buf_pool)); + zip_size = page_zip_get_size(&block->page.zip); + buf_pool->stat.flush_list_bytes += zip_size ? zip_size : UNIV_PAGE_SIZE; + ut_ad(buf_pool->stat.flush_list_bytes <= buf_pool->curr_pool_size); +} + #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG /******************************************************************//** Validates the flush list. @@ -308,6 +325,7 @@ buf_flush_insert_into_flush_list( ut_d(block->page.in_flush_list = TRUE); block->page.oldest_modification = lsn; UT_LIST_ADD_FIRST(flush_list, buf_pool->flush_list, &block->page); + incr_flush_list_size_in_bytes(block, buf_pool); #ifdef UNIV_DEBUG_VALGRIND { @@ -412,6 +430,8 @@ buf_flush_insert_sorted_into_flush_list( prev_b, &block->page); } + incr_flush_list_size_in_bytes(block, buf_pool); + #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG ut_a(buf_flush_validate_low(buf_pool)); #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ @@ -514,6 +534,7 @@ buf_flush_remove( buf_page_t* bpage) /*!< in: pointer to the block in question */ { buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); + ulint zip_size; //ut_ad(buf_pool_mutex_own(buf_pool)); ut_ad(mutex_own(buf_page_get_mutex(bpage))); @@ -552,6 +573,9 @@ buf_flush_remove( because we assert on in_flush_list in comparison function. */ ut_d(bpage->in_flush_list = FALSE); + zip_size = page_zip_get_size(&bpage->zip); + buf_pool->stat.flush_list_bytes -= zip_size ? zip_size : UNIV_PAGE_SIZE; + bpage->oldest_modification = 0; #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG @@ -915,7 +939,7 @@ flush: "InnoDB: Page buf fix count %lu," " io fix %lu, state %lu\n", (ulong)block->page.buf_fix_count, - (ulong)buf_block_get_io_fix(block), + (ulong)buf_block_get_io_fix_unlocked(block), (ulong)buf_block_get_state(block)); } @@ -1115,7 +1139,7 @@ buf_flush_write_block_low( ut_ad(!mutex_own(&buf_pool->LRU_list_mutex)); ut_ad(!buf_flush_list_mutex_own(buf_pool)); ut_ad(!mutex_own(buf_page_get_mutex(bpage))); - ut_ad(buf_page_get_io_fix(bpage) == BUF_IO_WRITE); + ut_ad(buf_page_get_io_fix_unlocked(bpage) == BUF_IO_WRITE); ut_ad(bpage->oldest_modification != 0); #ifdef UNIV_IBUF_COUNT_DEBUG @@ -1181,10 +1205,10 @@ buf_flush_write_block_low( # if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG /********************************************************************//** Writes a flushable page asynchronously from the buffer pool to a file. -NOTE: buf_pool->mutex and block->mutex must be held upon entering this -function, and they will be released by this function after flushing. +NOTE: block->mutex must be held upon entering this function, and it will be +released by this function after flushing. This is loosely based on buf_flush_batch() and buf_flush_page(). -@return TRUE if the page was flushed and the mutexes released */ +@return TRUE if the page was flushed and the mutex released */ UNIV_INTERN ibool buf_flush_page_try( @@ -1553,16 +1577,14 @@ scan: Check if the block is modified and ready for flushing. If the the block is ready to flush then flush the page and try o flush its neighbors. -@return TRUE if buf_pool mutex was not released during this function. +@return TRUE if LRU list mutex was not released during this function. This does not guarantee that some pages were written as well. Number of pages written are incremented to the count. */ static ibool buf_flush_page_and_try_neighbors( /*=============================*/ - buf_page_t* bpage, /*!< in: buffer control block, - must be - buf_page_in_file(bpage) */ + buf_page_t* bpage, /*!< in: buffer control block */ enum buf_flush flush_type, /*!< in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */ ulint n_to_flush, /*!< in: number of pages to diff --git a/storage/xtradb/buf/buf0lru.c b/storage/xtradb/buf/buf0lru.c index 14b5c65132c..cd99d3e4e13 100644 --- a/storage/xtradb/buf/buf0lru.c +++ b/storage/xtradb/buf/buf0lru.c @@ -153,6 +153,23 @@ buf_LRU_block_free_hashed_page( ibool have_page_hash_mutex); /******************************************************************//** +Increases LRU size in bytes with zip_size for compressed page, +UNIV_PAGE_SIZE for uncompressed page in inline function */ +static inline +void +incr_LRU_size_in_bytes( +/*===================*/ + buf_page_t* bpage, /*!< in: control block */ + buf_pool_t* buf_pool) /*!< in: buffer pool instance */ +{ + ulint zip_size; + ut_ad(mutex_own(&buf_pool->LRU_list_mutex)); + zip_size = page_zip_get_size(&bpage->zip); + buf_pool->stat.LRU_bytes += zip_size ? zip_size : UNIV_PAGE_SIZE; + ut_ad(buf_pool->stat.LRU_bytes <= buf_pool->curr_pool_size); +} + +/******************************************************************//** Determines if the unzip_LRU list should be used for evicting a victim instead of the general LRU list. @return TRUE if should use unzip_LRU */ @@ -393,18 +410,18 @@ buf_flush_yield( { mutex_t* block_mutex; + block_mutex = buf_page_get_mutex(bpage); + + ut_ad(mutex_own(block_mutex)); ut_ad(mutex_own(&buf_pool->LRU_list_mutex)); ut_ad(buf_page_in_file(bpage)); - block_mutex = buf_page_get_mutex(bpage); - - mutex_enter(block_mutex); /* "Fix" the block so that the position cannot be changed after we release the buffer pool and block mutexes. */ buf_page_set_sticky(bpage); - /* Now it is safe to release the buf_pool->mutex. */ + /* Now it is safe to release the LRU list mutex. */ mutex_exit(&buf_pool->LRU_list_mutex); mutex_exit(block_mutex); @@ -415,7 +432,7 @@ buf_flush_yield( mutex_enter(block_mutex); /* "Unfix" the block now that we have both the - buffer pool and block mutex again. */ + LRU list and block mutex again. */ buf_page_unset_sticky(bpage); mutex_exit(block_mutex); } @@ -431,7 +448,9 @@ buf_flush_try_yield( /*================*/ buf_pool_t* buf_pool, /*!< in/out: buffer pool instance */ buf_page_t* bpage, /*!< in/out: bpage to remove */ - ulint processed) /*!< in: number of pages processed */ + ulint processed, /*!< in: number of pages processed */ + ibool* must_restart) /*!< in/out: if TRUE, we have to + restart the flush list scan */ { /* Every BUF_LRU_DROP_SEARCH_SIZE iterations in the loop we release buf_pool->mutex to let other threads @@ -441,10 +460,40 @@ buf_flush_try_yield( if (bpage != NULL && processed >= BUF_LRU_DROP_SEARCH_SIZE - && buf_page_get_io_fix(bpage) == BUF_IO_NONE) { + && buf_page_get_io_fix_unlocked(bpage) == BUF_IO_NONE) { + + mutex_t* block_mutex; buf_flush_list_mutex_exit(buf_pool); + /* We don't have to worry about bpage becoming a dangling + pointer by a compressed page flush list relocation because + buf_page_get_gen() won't be called for pages from this + tablespace. */ + + block_mutex = buf_page_get_mutex_enter(bpage); + if (UNIV_UNLIKELY(block_mutex == NULL)) { + + buf_flush_list_mutex_enter(buf_pool); + + *must_restart = TRUE; + return FALSE; + } + + /* Recheck the I/O fix and the flush list presence now that we + hold the right mutex */ + if (UNIV_UNLIKELY(buf_page_get_io_fix(bpage) != BUF_IO_NONE + || bpage->oldest_modification == 0)) { + + mutex_exit(block_mutex); + buf_flush_list_mutex_enter(buf_pool); + + *must_restart = TRUE; + return FALSE; + } + + *must_restart = FALSE; + /* Release the LRU list and block mutex to give the other threads a go. */ @@ -473,7 +522,9 @@ ibool buf_flush_or_remove_page( /*=====================*/ buf_pool_t* buf_pool, /*!< in/out: buffer pool instance */ - buf_page_t* bpage) /*!< in/out: bpage to remove */ + buf_page_t* bpage, /*!< in/out: bpage to remove */ + ibool* must_restart) /*!< in/out: if TRUE, must restart the + flush list scan */ { mutex_t* block_mutex; ibool processed = FALSE; @@ -487,7 +538,8 @@ buf_flush_or_remove_page( buf_pool->mutex and block_mutex. It is safe to check them while holding buf_pool->mutex only. */ - if (buf_page_get_io_fix(bpage) != BUF_IO_NONE) { + if (UNIV_UNLIKELY(buf_page_get_io_fix_unlocked(bpage) + != BUF_IO_NONE)) { /* We cannot remove this page during this scan yet; maybe the system is currently reading it @@ -496,21 +548,38 @@ buf_flush_or_remove_page( } else { /* We have to release the flush_list_mutex to obey the - latching order. We are however guaranteed that the page - will stay in the flush_list because buf_flush_remove() - needs buf_pool->mutex as well (for the non-flush case). */ + latching order. We are not however guaranteed that the page + will stay in the flush_list. */ buf_flush_list_mutex_exit(buf_pool); + /* We don't have to worry about bpage becoming a dangling + pointer by a compressed page flush list relocation because + buf_page_get_gen() won't be called for pages from this + tablespace. */ + mutex_enter(block_mutex); - ut_ad(bpage->oldest_modification != 0); + /* Recheck the page I/O fix and the flush list presence now + thatwe hold the right mutex. */ + if (UNIV_UNLIKELY(buf_page_get_io_fix(bpage) != BUF_IO_NONE + || bpage->oldest_modification == 0)) { - if (bpage->buf_fix_count == 0) { + /* The page became I/O-fixed or is not on the flush + list anymore, this invalidates any flush-list-page + pointers we have. */ + *must_restart = TRUE; - buf_flush_remove(bpage); + } else { + + ut_ad(bpage->oldest_modification != 0); + + if (bpage->buf_fix_count == 0) { + + buf_flush_remove(bpage); - processed = TRUE; + processed = TRUE; + } } mutex_exit(block_mutex); @@ -541,11 +610,12 @@ buf_flush_or_remove_pages( buf_page_t* bpage; ulint processed = 0; ibool all_freed = TRUE; + ibool must_restart = FALSE; buf_flush_list_mutex_enter(buf_pool); for (bpage = UT_LIST_GET_LAST(buf_pool->flush_list); - bpage != NULL; + !must_restart && bpage != NULL; bpage = prev) { ut_a(buf_page_in_file(bpage)); @@ -561,22 +631,31 @@ buf_flush_or_remove_pages( /* Skip this block, as it does not belong to the target space. */ - } else if (!buf_flush_or_remove_page(buf_pool, bpage)) { + } else if (!buf_flush_or_remove_page(buf_pool, bpage, + &must_restart)) { /* Remove was unsuccessful, we have to try again by scanning the entire list from the end. */ all_freed = FALSE; } + if (UNIV_UNLIKELY(must_restart)) { + ut_ad(!all_freed); + break; + } ++processed; /* Yield if we have hogged the CPU and mutexes for too long. */ - if (buf_flush_try_yield(buf_pool, prev, processed)) { + if (buf_flush_try_yield(buf_pool, prev, processed, + &must_restart)) { + ut_ad(!must_restart); /* Reset the batch size counter if we had to yield. */ processed = 0; + } else if (UNIV_UNLIKELY(must_restart)) { + all_freed = FALSE; } } @@ -641,41 +720,39 @@ scan_again: /* No op */) { buf_page_t* prev_bpage; - mutex_t* block_mutex = NULL; + mutex_t* block_mutex; ut_a(buf_page_in_file(bpage)); ut_ad(bpage->in_LRU_list); prev_bpage = UT_LIST_GET_PREV(LRU, bpage); - /* bpage->space and bpage->io_fix are protected by - buf_pool->mutex and the block_mutex. It is safe to check - them while holding buf_pool->mutex only. */ + block_mutex = buf_page_get_mutex_enter(bpage); + + if (!block_mutex) { + /* It may be impossible case... + Something wrong, so will be scan_again */ + + all_freed = FALSE; + goto next_page; + } if (buf_page_get_space(bpage) != id) { /* Skip this block, as it does not belong to the space that is being invalidated. */ + + mutex_exit(block_mutex); goto next_page; } else if (buf_page_get_io_fix(bpage) != BUF_IO_NONE) { /* We cannot remove this page during this scan yet; maybe the system is currently reading it in, or flushing the modifications to the file */ + mutex_exit(block_mutex); all_freed = FALSE; goto next_page; } else { - block_mutex = buf_page_get_mutex_enter(bpage); - - if (!block_mutex) { - /* It may be impossible case... - Something wrong, so will be scan_again */ - - all_freed = FALSE; - goto next_page; - } - - if (bpage->buf_fix_count > 0) { mutex_exit(block_mutex); @@ -1491,6 +1568,7 @@ buf_LRU_remove_block( buf_page_t* bpage) /*!< in: control block */ { buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); + ulint zip_size; ut_ad(buf_pool); ut_ad(bpage); @@ -1527,6 +1605,9 @@ buf_LRU_remove_block( UT_LIST_REMOVE(LRU, buf_pool->LRU, bpage); bpage->in_LRU_list = FALSE; + zip_size = page_zip_get_size(&bpage->zip); + buf_pool->stat.LRU_bytes -= zip_size ? zip_size : UNIV_PAGE_SIZE; + buf_unzip_LRU_remove_block_if_needed(bpage); /* If the LRU list is so short that LRU_old is not defined, @@ -1588,7 +1669,10 @@ buf_unzip_LRU_add_block( } /******************************************************************//** -Adds a block to the LRU list end. */ +Adds a block to the LRU list end. Please make sure that the zip_size is +already set into the page zip when invoking the function, so that we +can get correct zip_size from the buffer page when adding a block +into LRU */ UNIV_INLINE void buf_LRU_add_block_to_end_low( @@ -1608,6 +1692,8 @@ buf_LRU_add_block_to_end_low( UT_LIST_ADD_LAST(LRU, buf_pool->LRU, bpage); bpage->in_LRU_list = TRUE; + incr_LRU_size_in_bytes(bpage, buf_pool); + if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) { ut_ad(buf_pool->LRU_old); @@ -1636,7 +1722,10 @@ buf_LRU_add_block_to_end_low( } /******************************************************************//** -Adds a block to the LRU list. */ +Adds a block to the LRU list. Please make sure that the zip_size is +already set into the page zip when invoking the function, so that we +can get correct zip_size from the buffer page when adding a block +into LRU */ UNIV_INLINE void buf_LRU_add_block_low( @@ -1679,6 +1768,8 @@ buf_LRU_add_block_low( bpage->in_LRU_list = TRUE; + incr_LRU_size_in_bytes(bpage, buf_pool); + if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) { ut_ad(buf_pool->LRU_old); @@ -1706,7 +1797,10 @@ buf_LRU_add_block_low( } /******************************************************************//** -Adds a block to the LRU list. */ +Adds a block to the LRU list. Please make sure that the zip_size is +already set into the page zip when invoking the function, so that we +can get correct zip_size from the buffer page when adding a block +into LRU */ UNIV_INTERN void buf_LRU_add_block( @@ -1853,7 +1947,7 @@ alloc: || !buf_page_can_relocate(bpage)) { not_freed: if (b) { - buf_buddy_free(buf_pool, b, sizeof *b, TRUE); + buf_page_free_descriptor(b); } if (!have_LRU_mutex) mutex_exit(&buf_pool->LRU_list_mutex); @@ -1935,6 +2029,8 @@ not_freed: UT_LIST_INSERT_AFTER(LRU, buf_pool->LRU, prev_b, b); + incr_LRU_size_in_bytes(b, buf_pool); + if (buf_page_is_old(b)) { buf_pool->LRU_old_len++; if (UNIV_UNLIKELY @@ -2196,7 +2292,9 @@ buf_LRU_block_remove_hashed_page( break; case FIL_PAGE_INDEX: #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(&bpage->zip, page)); + ut_a(page_zip_validate( + &bpage->zip, page, + ((buf_block_t*) bpage)->index)); #endif /* UNIV_ZIP_DEBUG */ break; default: diff --git a/storage/xtradb/buf/buf0rea.c b/storage/xtradb/buf/buf0rea.c index 6d76a488af7..cf0a029df92 100644 --- a/storage/xtradb/buf/buf0rea.c +++ b/storage/xtradb/buf/buf0rea.c @@ -235,7 +235,8 @@ not_to_recover: sync, space, 0, offset, 0, UNIV_PAGE_SIZE, ((buf_block_t*) bpage)->frame, bpage, trx); } - if(sync) { + + if (sync) { thd_wait_end(NULL); } diff --git a/storage/xtradb/dict/dict0dict.c b/storage/xtradb/dict/dict0dict.c index 516b6e927e0..29063f028f1 100644 --- a/storage/xtradb/dict/dict0dict.c +++ b/storage/xtradb/dict/dict0dict.c @@ -525,6 +525,20 @@ dict_index_get_nth_col_or_prefix_pos( return(ULINT_UNDEFINED); } +/********************************************************************//** +Looks for column n in an index. +@return position in internal representation of the index; +ULINT_UNDEFINED if not contained */ +UNIV_INTERN +ulint +dict_index_get_nth_col_pos( +/*=======================*/ + const dict_index_t* index, /*!< in: index */ + ulint n) /*!< in: column number */ +{ + return(dict_index_get_nth_col_or_prefix_pos(index, n, FALSE)); +} + #ifndef UNIV_HOTBACKUP /********************************************************************//** Returns TRUE if the index contains a column or a prefix of that column. @@ -2088,7 +2102,6 @@ dict_index_build_internal_clust( { dict_index_t* new_index; dict_field_t* field; - ulint fixed_size; ulint trx_id_pos; ulint i; ibool* indexed; @@ -2165,7 +2178,7 @@ dict_index_build_internal_clust( for (i = 0; i < trx_id_pos; i++) { - fixed_size = dict_col_get_fixed_size( + ulint fixed_size = dict_col_get_fixed_size( dict_index_get_nth_col(new_index, i), dict_table_is_comp(table)); @@ -2182,7 +2195,20 @@ dict_index_build_internal_clust( break; } - new_index->trx_id_offset += (unsigned int) fixed_size; + /* Add fixed_size to new_index->trx_id_offset. + Because the latter is a bit-field, an overflow + can theoretically occur. Check for it. */ + fixed_size += new_index->trx_id_offset; + + new_index->trx_id_offset = fixed_size; + + if (new_index->trx_id_offset != fixed_size) { + /* Overflow. Pretend that this is a + variable-length PRIMARY KEY. */ + ut_ad(0); + new_index->trx_id_offset = 0; + break; + } } } diff --git a/storage/xtradb/dict/dict0load.c b/storage/xtradb/dict/dict0load.c index 0ef74ea8b7c..cdef0d1b270 100644 --- a/storage/xtradb/dict/dict0load.c +++ b/storage/xtradb/dict/dict0load.c @@ -2399,7 +2399,8 @@ dict_load_foreigns( ibool check_charsets) /*!< in: TRUE=check charset compatibility */ { - char tuple_buf[DTUPLE_EST_ALLOC(1)]; + ulint tuple_buf[(DTUPLE_EST_ALLOC(1) + sizeof(ulint) - 1) + / sizeof(ulint)]; btr_pcur_t pcur; dtuple_t* tuple; dfield_t* dfield; diff --git a/storage/xtradb/fil/fil0fil.c b/storage/xtradb/fil/fil0fil.c index 4ab2c16d41f..af8353cdf45 100644 --- a/storage/xtradb/fil/fil0fil.c +++ b/storage/xtradb/fil/fil0fil.c @@ -195,14 +195,16 @@ struct fil_space_struct { requests on the file */ ibool stop_new_ops; /*!< we set this TRUE when we start - deleting a single-table tablespace */ - ibool is_being_deleted; - /*!< this is set to TRUE when we start - deleting a single-table tablespace and its - file; when this flag is set no further i/o - or flush requests can be placed on this space, - though there may be such requests still being - processed on this space */ + deleting a single-table tablespace. + When this is set following new ops + are not allowed: + * read IO request + * ibuf merge + * file flush + Note that we can still possibly have + new write operations because we don't + check this flag when doing flush + batches. */ ulint purpose;/*!< FIL_TABLESPACE, FIL_LOG, or FIL_ARCH_LOG */ UT_LIST_BASE_NODE_T(fil_node_t) chain; @@ -865,7 +867,7 @@ fil_node_close_file( ut_ad(node && system); ut_ad(mutex_own(&(system->mutex))); ut_a(node->open); - ut_a(node->n_pending == 0 || node->space->is_being_deleted); + ut_a(node->n_pending == 0 || node->space->stop_new_ops); ut_a(node->n_pending_flushes == 0); #ifndef UNIV_HOTBACKUP ut_a(node->modification_counter == node->flush_counter @@ -1099,7 +1101,7 @@ fil_node_free( ut_ad(node && system && space); ut_ad(mutex_own(&(system->mutex))); ut_a(node->magic_n == FIL_NODE_MAGIC_N); - ut_a(node->n_pending == 0 || space->is_being_deleted); + ut_a(node->n_pending == 0 || space->stop_new_ops); if (node->open) { /* We fool the assertion in fil_node_close_file() to think @@ -1297,7 +1299,6 @@ try_again: space->stop_ios = FALSE; space->stop_new_ops = FALSE; - space->is_being_deleted = FALSE; space->purpose = purpose; space->size = 0; space->flags = flags; @@ -1478,7 +1479,7 @@ fil_space_get_size( ut_ad(fil_system); - fil_mutex_enter_and_prepare_for_io(id); + mutex_enter(&fil_system->mutex); space = fil_space_get_by_id(id); @@ -1493,6 +1494,23 @@ fil_space_get_size( ut_a(1 == UT_LIST_GET_LEN(space->chain)); + mutex_exit(&fil_system->mutex); + + /* It is possible that the space gets evicted at this point + before the fil_mutex_enter_and_prepare_for_io() acquires + the fil_system->mutex. Check for this after completing the + call to fil_mutex_enter_and_prepare_for_io(). */ + fil_mutex_enter_and_prepare_for_io(id); + + /* We are still holding the fil_system->mutex. Check if + the space is still in memory cache. */ + space = fil_space_get_by_id(id); + + if (space == NULL) { + mutex_exit(&fil_system->mutex); + return(0); + } + node = UT_LIST_GET_FIRST(space->chain); /* It must be a single-table tablespace and we have not opened @@ -1530,7 +1548,7 @@ fil_space_get_flags( return(0); } - fil_mutex_enter_and_prepare_for_io(id); + mutex_enter(&fil_system->mutex); space = fil_space_get_by_id(id); @@ -1545,6 +1563,23 @@ fil_space_get_flags( ut_a(1 == UT_LIST_GET_LEN(space->chain)); + mutex_exit(&fil_system->mutex); + + /* It is possible that the space gets evicted at this point + before the fil_mutex_enter_and_prepare_for_io() acquires + the fil_system->mutex. Check for this after completing the + call to fil_mutex_enter_and_prepare_for_io(). */ + fil_mutex_enter_and_prepare_for_io(id); + + /* We are still holding the fil_system->mutex. Check if + the space is still in memory cache. */ + space = fil_space_get_by_id(id); + + if (space == NULL) { + mutex_exit(&fil_system->mutex); + return(0); + } + node = UT_LIST_GET_FIRST(space->chain); /* It must be a single-table tablespace and we have not opened @@ -2325,11 +2360,9 @@ try_again: return(FALSE); } - ut_a(space); + ut_a(space->stop_new_ops); ut_a(space->n_pending_ops == 0); - space->is_being_deleted = TRUE; - ut_a(UT_LIST_GET_LEN(space->chain) == 1); node = UT_LIST_GET_FIRST(space->chain); @@ -2372,12 +2405,26 @@ try_again: rw_lock_x_lock(&space->latch); #ifndef UNIV_HOTBACKUP - /* Invalidate in the buffer pool all pages belonging to the - tablespace. Since we have set space->is_being_deleted = TRUE, readahead - or ibuf merge can no longer read more pages of this tablespace to the - buffer pool. Thus we can clean the tablespace out of the buffer pool - completely and permanently. The flag is_being_deleted also prevents - fil_flush() from being applied to this tablespace. */ + /* IMPORTANT: Because we have set space::stop_new_ops there + can't be any new ibuf merges, reads or flushes. We are here + because node::n_pending was zero above. However, it is still + possible to have pending read and write requests: + + A read request can happen because the reader thread has + gone through the ::stop_new_ops check in buf_page_init_for_read() + before the flag was set and has not yet incremented ::n_pending + when we checked it above. + + A write request can be issued any time because we don't check + the ::stop_new_ops flag when queueing a block for write. + + We deal with pending write requests in the following function + where we'd minimally evict all dirty pages belonging to this + space from the flush_list. Not that if a block is IO-fixed + we'll wait for IO to complete. + + To deal with potential read requests by checking the + ::stop_new_ops flag in fil_io() */ if (srv_lazy_drop_table) { buf_LRU_mark_space_was_deleted(id); @@ -2393,6 +2440,15 @@ try_again: mutex_enter(&fil_system->mutex); + /* Double check the sanity of pending ops after reacquiring + the fil_system::mutex. */ + if (fil_space_get_by_id(id)) { + ut_a(space->n_pending_ops == 0); + ut_a(UT_LIST_GET_LEN(space->chain) == 1); + node = UT_LIST_GET_FIRST(space->chain); + ut_a(node->n_pending == 0); + } + success = fil_space_free(id, TRUE); mutex_exit(&fil_system->mutex); @@ -2450,7 +2506,7 @@ fil_tablespace_is_being_deleted( ut_a(space != NULL); - is_being_deleted = space->is_being_deleted; + is_being_deleted = space->stop_new_ops; mutex_exit(&fil_system->mutex); @@ -2710,7 +2766,7 @@ retry: mutex_exit(&fil_system->mutex); #ifndef UNIV_HOTBACKUP - if (success) { + if (success && !recv_recovery_on) { mtr_t mtr; mtr_start(&mtr); @@ -4531,7 +4587,7 @@ fil_tablespace_deleted_or_being_deleted_in_mem( space = fil_space_get_by_id(id); - if (space == NULL || space->is_being_deleted) { + if (space == NULL || space->stop_new_ops) { mutex_exit(&fil_system->mutex); return(TRUE); @@ -5271,7 +5327,9 @@ _fil_io( space = fil_space_get_by_id(space_id); - if (!space) { + /* If we are deleting a tablespace we don't allow any read + operations on that. However, we do allow write operations. */ + if (!space || (type == OS_FILE_READ && space->stop_new_ops)) { mutex_exit(&fil_system->mutex); ut_print_timestamp(stderr); @@ -5362,8 +5420,8 @@ _fil_io( /* Do aio */ - ut_a(byte_offset % OS_FILE_LOG_BLOCK_SIZE == 0); - ut_a((len % OS_FILE_LOG_BLOCK_SIZE) == 0); + ut_a(byte_offset % OS_MIN_LOG_BLOCK_SIZE == 0); + ut_a((len % OS_MIN_LOG_BLOCK_SIZE) == 0); if (srv_pass_corrupt_table == 1 && space->is_corrupt) { /* should ignore i/o for the crashed space */ @@ -5551,7 +5609,7 @@ fil_aio_wait( && ((buf_page_t*)message)->space_was_being_deleted) { /* intended not to be uncompress read page */ - ut_a(buf_page_get_io_fix(message) == BUF_IO_WRITE + ut_a(buf_page_get_io_fix_unlocked(message) == BUF_IO_WRITE || !buf_page_get_zip_size(message) || buf_page_get_state(message) != BUF_BLOCK_FILE_PAGE); @@ -5612,7 +5670,7 @@ fil_flush( space = fil_space_get_by_id(space_id); - if (!space || space->is_being_deleted) { + if (!space || space->stop_new_ops) { mutex_exit(&fil_system->mutex); return; @@ -5743,7 +5801,7 @@ fil_flush_file_spaces( space; space = UT_LIST_GET_NEXT(unflushed_spaces, space)) { - if (space->purpose == purpose && !space->is_being_deleted) { + if (space->purpose == purpose && !space->stop_new_ops) { space_ids[n_space_ids++] = space->id; } @@ -5982,3 +6040,26 @@ fil_space_set_corrupt( mutex_exit(&fil_system->mutex); } +/****************************************************************//** +Generate redo logs for swapping two .ibd files */ +UNIV_INTERN +void +fil_mtr_rename_log( +/*===============*/ + ulint old_space_id, /*!< in: tablespace id of the old + table. */ + const char* old_name, /*!< in: old table name */ + ulint new_space_id, /*!< in: tablespace id of the new + table */ + const char* new_name, /*!< in: new table name */ + const char* tmp_name) /*!< in: temp table name used while + swapping */ +{ + mtr_t mtr; + mtr_start(&mtr); + fil_op_write_log(MLOG_FILE_RENAME, old_space_id, + 0, 0, old_name, tmp_name, &mtr); + fil_op_write_log(MLOG_FILE_RENAME, new_space_id, + 0, 0, new_name, old_name, &mtr); + mtr_commit(&mtr); +} diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 5a09bb36292..dde5b8fd965 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -85,6 +85,7 @@ extern "C" { #include "row0sel.h" #include "row0upd.h" #include "log0log.h" +#include "log0online.h" #include "lock0lock.h" #include "dict0crea.h" #include "btr0cur.h" @@ -297,6 +298,7 @@ static PSI_mutex_info all_innodb_mutexes[] = { {&ibuf_pessimistic_insert_mutex_key, "ibuf_pessimistic_insert_mutex", 0}, {&kernel_mutex_key, "kernel_mutex", 0}, + {&log_bmp_sys_mutex_key, "log_bmp_sys_mutex", 0}, {&log_sys_mutex_key, "log_sys_mutex", 0}, # ifdef UNIV_MEM_DEBUG {&mem_hash_mutex_key, "mem_hash_mutex", 0}, @@ -437,6 +439,25 @@ uint innobase_alter_table_flags( /*=======================*/ uint flags); +/************************************************************//** +Synchronously read and parse the redo log up to the last +checkpoint to write the changed page bitmap. +@return 0 to indicate success. Current implementation cannot fail. */ +static +my_bool +innobase_flush_changed_page_bitmaps() __attribute__((unused)); +/*==================================*/ +/************************************************************//** +Delete all the bitmap files for data less than the specified LSN. +If called with lsn == 0 (i.e. set by RESET request) or +IB_ULONGLONG_MAX, restart the bitmap file sequence, otherwise +continue it. +@return 0 to indicate success, 1 for failure. */ +static +my_bool +innobase_purge_changed_page_bitmaps( +/*================================*/ + ulonglong lsn) __attribute__((unused)); /*!< in: LSN to purge files up to */ static const char innobase_hton_name[]= "InnoDB"; @@ -688,8 +709,12 @@ static SHOW_VAR innodb_status_variables[]= { (char*) &export_vars.innodb_background_log_sync, SHOW_LONG}, {"buffer_pool_pages_data", (char*) &export_vars.innodb_buffer_pool_pages_data, SHOW_LONG}, + {"buffer_pool_bytes_data", + (char*) &export_vars.innodb_buffer_pool_bytes_data, SHOW_LONG}, {"buffer_pool_pages_dirty", (char*) &export_vars.innodb_buffer_pool_pages_dirty, SHOW_LONG}, + {"buffer_pool_bytes_dirty", + (char*) &export_vars.innodb_buffer_pool_bytes_dirty, SHOW_LONG}, {"buffer_pool_pages_flushed", (char*) &export_vars.innodb_buffer_pool_pages_flushed, SHOW_LONG}, {"buffer_pool_pages_LRU_flushed", @@ -870,6 +895,12 @@ static SHOW_VAR innodb_status_variables[]= { (char*) &export_vars.innodb_x_lock_spin_rounds, SHOW_LONGLONG}, {"x_lock_spin_waits", (char*) &export_vars.innodb_x_lock_spin_waits, SHOW_LONGLONG}, +#ifdef UNIV_DEBUG + {"purge_trx_id_age", + (char*) &export_vars.innodb_purge_trx_id_age, SHOW_LONG}, + {"purge_view_trx_id_age", + (char*) &export_vars.innodb_purge_view_trx_id_age, SHOW_LONG}, +#endif /* UNIV_DEBUG */ {NullS, NullS, SHOW_LONG} }; @@ -1219,11 +1250,23 @@ convert_error_code_to_mysql( case DB_TABLE_NOT_FOUND: return(HA_ERR_NO_SUCH_TABLE); - case DB_TOO_BIG_RECORD: - my_error(ER_TOO_BIG_ROWSIZE, MYF(0), - page_get_free_space_of_empty(flags - & DICT_TF_COMPACT) / 2); + case DB_TOO_BIG_RECORD: { + /* If prefix is true then a 768-byte prefix is stored + locally for BLOB fields. Refer to dict_table_get_format() */ + bool prefix = ((flags & DICT_TF_FORMAT_MASK) + >> DICT_TF_FORMAT_SHIFT) < UNIV_FORMAT_B; + my_printf_error(ER_TOO_BIG_ROWSIZE, + "Row size too large (> %lu). Changing some columns " + "to TEXT or BLOB %smay help. In current row " + "format, BLOB prefix of %d bytes is stored inline.", + MYF(0), + page_get_free_space_of_empty(flags & + DICT_TF_COMPACT) / 2, + prefix ? "or using ROW_FORMAT=DYNAMIC " + "or ROW_FORMAT=COMPRESSED ": "", + prefix ? DICT_MAX_FIXED_COL_LEN : 0); return(HA_ERR_TO_BIG_ROW); + } case DB_TOO_BIG_INDEX_COL: my_error(ER_INDEX_COLUMN_TOO_LONG, MYF(0), @@ -1262,6 +1305,8 @@ convert_error_code_to_mysql( return(HA_ERR_INDEX_CORRUPT); case DB_UNDO_RECORD_TOO_BIG: return(HA_ERR_UNDO_REC_TOO_BIG); + case DB_OUT_OF_MEMORY: + return(HA_ERR_OUT_OF_MEM); } } @@ -1439,16 +1484,6 @@ innobase_get_lower_case_table_names(void) return(lower_case_table_names); } -#if defined (__WIN__) && defined (MYSQL_DYNAMIC_PLUGIN) -extern MYSQL_PLUGIN_IMPORT MY_TMPDIR mysql_tmpdir_list; -/*******************************************************************//** -Map an OS error to an errno value. The OS error number is stored in -_doserrno and the mapped value is stored in errno) */ -extern "C" -void __cdecl -_dosmaperr( - unsigned long); /*!< in: OS error value */ - /*********************************************************************//** Creates a temporary file. @return temporary file descriptor, or < 0 on error */ @@ -1457,92 +1492,16 @@ int innobase_mysql_tmpfile(void) /*========================*/ { - int fd; /* handle of opened file */ - HANDLE osfh; /* OS handle of opened file */ - char* tmpdir; /* point to the directory - where to create file */ - TCHAR path_buf[MAX_PATH - 14]; /* buffer for tmp file path. - The length cannot be longer - than MAX_PATH - 14, or - GetTempFileName will fail. */ - char filename[MAX_PATH]; /* name of the tmpfile */ - DWORD fileaccess = GENERIC_READ /* OS file access */ - | GENERIC_WRITE - | DELETE; - DWORD fileshare = FILE_SHARE_READ /* OS file sharing mode */ - | FILE_SHARE_WRITE - | FILE_SHARE_DELETE; - DWORD filecreate = CREATE_ALWAYS; /* OS method of open/create */ - DWORD fileattrib = /* OS file attribute flags */ - FILE_ATTRIBUTE_NORMAL - | FILE_FLAG_DELETE_ON_CLOSE - | FILE_ATTRIBUTE_TEMPORARY - | FILE_FLAG_SEQUENTIAL_SCAN; - - DBUG_ENTER("innobase_mysql_tmpfile"); - - tmpdir = my_tmpdir(&mysql_tmpdir_list); - - /* The tmpdir parameter can not be NULL for GetTempFileName. */ - if (!tmpdir) { - uint ret; - - /* Use GetTempPath to determine path for temporary files. */ - ret = GetTempPath(sizeof(path_buf), path_buf); - if (ret > sizeof(path_buf) || (ret == 0)) { - - _dosmaperr(GetLastError()); /* map error */ - DBUG_RETURN(-1); - } - - tmpdir = path_buf; - } - - /* Use GetTempFileName to generate a unique filename. */ - if (!GetTempFileName(tmpdir, "ib", 0, filename)) { - - _dosmaperr(GetLastError()); /* map error */ - DBUG_RETURN(-1); - } - - DBUG_PRINT("info", ("filename: %s", filename)); - - /* Open/Create the file. */ - osfh = CreateFile(filename, fileaccess, fileshare, NULL, - filecreate, fileattrib, NULL); - if (osfh == INVALID_HANDLE_VALUE) { - - /* open/create file failed! */ - _dosmaperr(GetLastError()); /* map error */ - DBUG_RETURN(-1); - } - - do { - /* Associates a CRT file descriptor with the OS file handle. */ - fd = _open_osfhandle((intptr_t) osfh, 0); - } while (fd == -1 && errno == EINTR); + int fd2 = -1; + File fd; - if (fd == -1) { - /* Open failed, close the file handle. */ + DBUG_EXECUTE_IF( + "innobase_tmpfile_creation_failure", + return(-1); + ); - _dosmaperr(GetLastError()); /* map error */ - CloseHandle(osfh); /* no need to check if - CloseHandle fails */ - } + fd = mysql_tmpfile("ib"); - DBUG_RETURN(fd); -} -#else -/*********************************************************************//** -Creates a temporary file. -@return temporary file descriptor, or < 0 on error */ -extern "C" UNIV_INTERN -int -innobase_mysql_tmpfile(void) -/*========================*/ -{ - int fd2 = -1; - File fd = mysql_tmpfile("ib"); if (fd >= 0) { /* Copy the file descriptor, so that the additional resources allocated by create_temp_file() can be freed by invoking @@ -1586,7 +1545,6 @@ innobase_mysql_tmpfile(void) } return(fd2); } -#endif /* defined (__WIN__) && defined (MYSQL_DYNAMIC_PLUGIN) */ /*********************************************************************//** Wrapper around MySQL's copy_and_convert function. @@ -1702,10 +1660,13 @@ innobase_next_autoinc( offset = 0; } - /* Check for overflow. */ + /* Check for overflow. Current can be > max_value if the value is + in reality a negative value.The visual studio compilers converts + large double values automatically into unsigned long long datatype + maximum value */ if (block >= max_value || offset > max_value - || current == max_value + || current >= max_value || max_value - offset <= offset) { next_value = max_value; @@ -1778,7 +1739,7 @@ innobase_trx_init( trx->fake_changes = THDVAR(thd, fake_changes); #ifdef EXTENDED_SLOWLOG - if (thd_log_slow_verbosity(thd) & SLOG_V_INNODB) { + if (thd_log_slow_verbosity(thd) & (1ULL << SLOG_V_INNODB)) { trx->take_stats = TRUE; } else { trx->take_stats = FALSE; @@ -2717,6 +2678,7 @@ innobase_init( } else { srv_log_block_size = 512; } + ut_ad (srv_log_block_size >= OS_MIN_LOG_BLOCK_SIZE); if (!srv_log_block_size) { fprintf(stderr, @@ -3267,6 +3229,36 @@ innobase_alter_table_flags( | HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE); } +/************************************************************//** +Synchronously read and parse the redo log up to the last +checkpoint to write the changed page bitmap. +@return 0 to indicate success. Current implementation cannot fail. */ +static +my_bool +innobase_flush_changed_page_bitmaps() +/*=================================*/ +{ + if (srv_track_changed_pages) { + os_event_reset(srv_checkpoint_completed_event); + log_online_follow_redo_log(); + } + return FALSE; +} + +/************************************************************//** +Delete all the bitmap files for data less than the specified LSN. +If called with lsn == IB_ULONGLONG_MAX (i.e. set by RESET request), +restart the bitmap file sequence, otherwise continue it. +@return 0 to indicate success, 1 for failure. */ +static +my_bool +innobase_purge_changed_page_bitmaps( +/*================================*/ + ulonglong lsn) /*!< in: LSN to purge files up to */ +{ + return (my_bool)log_online_purge_changed_page_bitmaps(lsn); +} + /****************************************************************//** Copy the current replication position from MySQL to a transaction. */ static @@ -3330,7 +3322,7 @@ innobase_commit_low( header for undo purposes, see the comment at corresponding call at innobase_xa_prepare(). */ - innobase_copy_repl_coords_to_trx(current_thd, trx); + innobase_copy_repl_coords_to_trx((THD *) trx->mysql_thd, trx); trx_commit_for_mysql(trx); } @@ -10665,23 +10657,26 @@ ha_innobase::external_lock( if (trx->n_mysql_tables_in_use == 0) { #ifdef EXTENDED_SLOWLOG - increment_thd_innodb_stats(thd, - (unsigned long long) trx->id, - trx->io_reads, - trx->io_read, - trx->io_reads_wait_timer, - trx->lock_que_wait_timer, - trx->innodb_que_wait_timer, - trx->distinct_page_access); - - trx->io_reads = 0; - trx->io_read = 0; - trx->io_reads_wait_timer = 0; - trx->lock_que_wait_timer = 0; - trx->innodb_que_wait_timer = 0; - trx->distinct_page_access = 0; - if (trx->distinct_page_access_hash) - memset(trx->distinct_page_access_hash, 0, DPAH_SIZE); + if (UNIV_UNLIKELY(trx->take_stats)) { + increment_thd_innodb_stats(thd, + (unsigned long long) trx->id, + trx->io_reads, + trx->io_read, + trx->io_reads_wait_timer, + trx->lock_que_wait_timer, + trx->innodb_que_wait_timer, + trx->distinct_page_access); + + trx->io_reads = 0; + trx->io_read = 0; + trx->io_reads_wait_timer = 0; + trx->lock_que_wait_timer = 0; + trx->innodb_que_wait_timer = 0; + trx->distinct_page_access = 0; + if (trx->distinct_page_access_hash) + memset(trx->distinct_page_access_hash, 0, + DPAH_SIZE); + } #endif trx->mysql_n_tables_locked = 0; @@ -12759,7 +12754,8 @@ static MYSQL_SYSVAR_ULONG(page_size, innobase_page_size, static MYSQL_SYSVAR_ULONG(log_block_size, innobase_log_block_size, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "###EXPERIMENTAL###: The log block size of the transaction log file. Changing for created log file is not supported. Use on your own risk!", - NULL, NULL, (1 << 9)/*512*/, (1 << 9)/*512*/, (1 << UNIV_PAGE_SIZE_SHIFT_MAX), 0); + NULL, NULL, (1 << 9)/*512*/, OS_MIN_LOG_BLOCK_SIZE, + (1 << UNIV_PAGE_SIZE_SHIFT_MAX), 0); static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir, PLUGIN_VAR_READONLY, @@ -13182,7 +13178,7 @@ static MYSQL_SYSVAR_ULONGLONG(max_bitmap_file_size, srv_max_bitmap_file_size, "The maximum size of changed page bitmap files", NULL, NULL, 100*1024*1024ULL, 4096ULL, ULONGLONG_MAX, 0); -static MYSQL_SYSVAR_ULONGLONG(changed_pages_limit, srv_changed_pages_limit, +static MYSQL_SYSVAR_ULONGLONG(max_changed_pages, srv_max_changed_pages, PLUGIN_VAR_RQCMDARG, "The maximum number of rows for " "INFORMATION_SCHEMA.INNODB_CHANGED_PAGES table, " @@ -13192,8 +13188,8 @@ static MYSQL_SYSVAR_ULONGLONG(changed_pages_limit, srv_changed_pages_limit, #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug, PLUGIN_VAR_RQCMDARG, - "Debug flags for InnoDB change buffering (0=none)", - NULL, NULL, 0, 0, 1, 0); + "Debug flags for InnoDB change buffering (0=none, 2=crash at merge)", + NULL, NULL, 0, 0, 2, 0); #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ static MYSQL_SYSVAR_BOOL(random_read_ahead, srv_random_read_ahead, @@ -13207,11 +13203,23 @@ static MYSQL_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold, "trigger a readahead.", NULL, NULL, 56, 0, 64, 0); -#ifdef UNIV_DEBUG_never +#ifdef UNIV_DEBUG static MYSQL_SYSVAR_UINT(trx_rseg_n_slots_debug, trx_rseg_n_slots_debug, - PLUGIN_VAR_RQCMDARG, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_NOCMDOPT, "Debug flags for InnoDB to limit TRX_RSEG_N_SLOTS for trx_rsegf_undo_find_free()", NULL, NULL, 0, 0, 1024, 0); + +static MYSQL_SYSVAR_UINT(limit_optimistic_insert_debug, + btr_cur_limit_optimistic_insert_debug, PLUGIN_VAR_RQCMDARG, + "Artificially limit the number of records per B-tree page (0=unlimited).", + NULL, NULL, 0, 0, UINT_MAX32, 0); + +static MYSQL_SYSVAR_BOOL(trx_purge_view_update_only_debug, + srv_purge_view_update_only_debug, PLUGIN_VAR_NOCMDOPT, + "Pause actual purging any delete-marked records, but merely update the purge view. " + "It is to create artificially the situation the purge view have been updated " + "but the each purges were not done yet.", + NULL, NULL, FALSE); #endif /* UNIV_DEBUG */ static MYSQL_SYSVAR_LONGLONG(ibuf_max_size, srv_ibuf_max_size, @@ -13391,6 +13399,11 @@ static MYSQL_SYSVAR_BOOL(locking_fake_changes, srv_fake_changes_locks, "not take any locks at all.", NULL, NULL, TRUE); +static MYSQL_SYSVAR_BOOL(print_all_deadlocks, srv_print_all_deadlocks, + PLUGIN_VAR_OPCMDARG, + "Print all deadlocks to MySQL error log (off by default)", + NULL, NULL, FALSE); + static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(page_size), MYSQL_SYSVAR(log_block_size), @@ -13483,7 +13496,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(change_buffering), MYSQL_SYSVAR(track_changed_pages), MYSQL_SYSVAR(max_bitmap_file_size), - MYSQL_SYSVAR(changed_pages_limit), + MYSQL_SYSVAR(max_changed_pages), #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG MYSQL_SYSVAR(change_buffering_debug), #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ @@ -13495,14 +13508,17 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(purge_threads), MYSQL_SYSVAR(purge_batch_size), MYSQL_SYSVAR(rollback_segments), -#ifdef UNIV_DEBUG_never /* disable this flag. --innodb-trx becomes ambiguous */ +#ifdef UNIV_DEBUG MYSQL_SYSVAR(trx_rseg_n_slots_debug), + MYSQL_SYSVAR(limit_optimistic_insert_debug), + MYSQL_SYSVAR(trx_purge_view_update_only_debug), #endif /* UNIV_DEBUG */ MYSQL_SYSVAR(corrupt_table_action), MYSQL_SYSVAR(lazy_drop_table), MYSQL_SYSVAR(fake_changes), MYSQL_SYSVAR(locking_fake_changes), MYSQL_SYSVAR(merge_sort_block_size), + MYSQL_SYSVAR(print_all_deadlocks), NULL }; diff --git a/storage/xtradb/handler/ha_innodb.h b/storage/xtradb/handler/ha_innodb.h index 359d0b95367..607f9ecfb36 100644 --- a/storage/xtradb/handler/ha_innodb.h +++ b/storage/xtradb/handler/ha_innodb.h @@ -81,12 +81,13 @@ class ha_innobase: public handler uchar* upd_buf; /*!< buffer used in updates */ ulint upd_buf_size; /*!< the size of upd_buf in bytes */ - uchar srch_key_val1[REC_VERSION_56_MAX_INDEX_COL_LEN + 2]; - uchar srch_key_val2[REC_VERSION_56_MAX_INDEX_COL_LEN + 2]; + uchar srch_key_val1[MAX_KEY_LENGTH + MAX_REF_PARTS*2]; + uchar srch_key_val2[MAX_KEY_LENGTH + MAX_REF_PARTS*2]; /*!< buffers used in converting search key values from MySQL format - to InnoDB format. "+ 2" for the two - bytes where the length is stored */ + to InnoDB format. For each column + 2 bytes are used to store length, + hence MAX_REF_PARTS*2. */ Table_flags int_table_flags; uint primary_key; ulong start_of_scan; /*!< this is set to 1 when we are diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc index 0496cb98080..88b07bbebe3 100644 --- a/storage/xtradb/handler/handler0alter.cc +++ b/storage/xtradb/handler/handler0alter.cc @@ -102,8 +102,6 @@ innobase_col_to_mysql( ut_ad(flen >= len); ut_ad(DATA_MBMAXLEN(col->mbminmaxlen) >= DATA_MBMINLEN(col->mbminmaxlen)); - ut_ad(DATA_MBMAXLEN(col->mbminmaxlen) - > DATA_MBMINLEN(col->mbminmaxlen) || flen == len); memcpy(dest, data, len); break; @@ -113,13 +111,17 @@ innobase_col_to_mysql( /* These column types should never be shipped to MySQL. */ ut_ad(0); - case DATA_CHAR: case DATA_FIXBINARY: case DATA_FLOAT: case DATA_DOUBLE: case DATA_DECIMAL: /* Above are the valid column types for MySQL data. */ ut_ad(flen == len); + /* fall through */ + case DATA_CHAR: + /* We may have flen > len when there is a shorter + prefix on a CHAR column. */ + ut_ad(flen >= len); #else /* UNIV_DEBUG */ default: #endif /* UNIV_DEBUG */ @@ -152,7 +154,7 @@ innobase_rec_to_mysql( field->reset(); - ipos = dict_index_get_nth_col_pos(index, i); + ipos = dict_index_get_nth_col_or_prefix_pos(index, i, TRUE); if (UNIV_UNLIKELY(ipos == ULINT_UNDEFINED)) { null_field: diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc index 4b33d6a780c..d64a95a969e 100644 --- a/storage/xtradb/handler/i_s.cc +++ b/storage/xtradb/handler/i_s.cc @@ -169,7 +169,8 @@ do { \ } \ } while (0) -#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && !defined __INTEL_COMPILER +#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && \ + !defined __INTEL_COMPILER && !defined __clang__ #define STRUCT_FLD(name, value) name: value #else #define STRUCT_FLD(name, value) value @@ -1209,7 +1210,7 @@ trx_i_s_common_fill_table( DBUG_ENTER("trx_i_s_common_fill_table"); /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -1369,7 +1370,7 @@ i_s_cmp_fill_low( DBUG_ENTER("i_s_cmp_fill_low"); /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -1641,7 +1642,7 @@ i_s_cmpmem_fill_low( DBUG_ENTER("i_s_cmpmem_fill_low"); /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -2274,7 +2275,7 @@ i_s_innodb_buffer_stats_fill_table( DBUG_ENTER("i_s_innodb_buffer_fill_general"); /* Only allow the PROCESS privilege holder to access the stats */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -2967,7 +2968,7 @@ i_s_innodb_buffer_page_fill_table( DBUG_ENTER("i_s_innodb_buffer_page_fill_table"); /* deny access to user without PROCESS privilege */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -3512,7 +3513,7 @@ i_s_innodb_buf_page_lru_fill_table( DBUG_ENTER("i_s_innodb_buf_page_lru_fill_table"); /* deny access to any users that do not hold PROCESS_ACL */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -3746,7 +3747,7 @@ i_s_sys_tables_fill_table( RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -4049,7 +4050,7 @@ i_s_sys_tables_fill_table_stats( RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -4293,7 +4294,7 @@ i_s_sys_indexes_fill_table( RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -4530,7 +4531,7 @@ i_s_sys_columns_fill_table( RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -4732,7 +4733,7 @@ i_s_sys_fields_fill_table( RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -4961,7 +4962,7 @@ i_s_sys_foreign_fill_table( RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -5172,7 +5173,7 @@ i_s_sys_foreign_cols_fill_table( RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -5387,7 +5388,7 @@ i_s_sys_stats_fill_table( RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -5573,7 +5574,7 @@ i_s_innodb_rseg_fill( DBUG_ENTER("i_s_innodb_rseg_fill"); /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -5797,7 +5798,7 @@ i_s_innodb_table_stats_fill( RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -5862,7 +5863,7 @@ i_s_innodb_index_stats_fill( RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -6054,7 +6055,7 @@ i_s_innodb_admin_command_fill( RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -6431,7 +6432,7 @@ i_s_innodb_buffer_pool_pages_fill( DBUG_ENTER("i_s_innodb_buffer_pool_pages_fill"); /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -6536,7 +6537,7 @@ i_s_innodb_buffer_pool_pages_index_fill( DBUG_ENTER("i_s_innodb_buffer_pool_pages_index_fill"); /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -6605,7 +6606,7 @@ i_s_innodb_buffer_pool_pages_blob_fill( DBUG_ENTER("i_s_innodb_buffer_pool_pages_blob_fill"); /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -7009,7 +7010,7 @@ i_s_innodb_undo_logs_fill( DBUG_ENTER("i_s_innodb_undo_logs_fill"); /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -7335,7 +7336,7 @@ i_s_innodb_changed_pages_fill( DBUG_ENTER("i_s_innodb_changed_pages_fill"); /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { + if (check_global_access(thd, PROCESS_ACL, true)) { DBUG_RETURN(0); } @@ -7356,8 +7357,8 @@ i_s_innodb_changed_pages_fill( } while(log_online_bitmap_iterator_next(&i) && - (!srv_changed_pages_limit || - output_rows_num < srv_changed_pages_limit) && + (!srv_max_changed_pages || + output_rows_num < srv_max_changed_pages) && /* There is no need to compare both start LSN and end LSN fields with maximum value. It's enough to compare only start LSN. diff --git a/storage/xtradb/ibuf/ibuf0ibuf.c b/storage/xtradb/ibuf/ibuf0ibuf.c index 77305e42fb1..96c264b32b4 100644 --- a/storage/xtradb/ibuf/ibuf0ibuf.c +++ b/storage/xtradb/ibuf/ibuf0ibuf.c @@ -2912,6 +2912,14 @@ ibuf_get_volume_buffered_count_func( ut_a(len == 1); ut_ad(trx_sys_multiple_tablespace_format); + if (rec_get_deleted_flag(rec, 0)) { + /* This record has been merged already, + but apparently the system crashed before + the change was discarded from the buffer. + Pretend that the record does not exist. */ + return(0); + } + types = rec_get_nth_field_old(rec, IBUF_REC_FIELD_METADATA, &len); switch (UNIV_EXPECT(len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE, @@ -4224,11 +4232,11 @@ ibuf_delete( page, 1); } #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ page_cur_delete_rec(&page_cur, index, offsets, mtr); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ if (page_zip) { @@ -4333,6 +4341,22 @@ ibuf_delete_rec( ut_ad(ibuf_rec_get_page_no(mtr, btr_pcur_get_rec(pcur)) == page_no); ut_ad(ibuf_rec_get_space(mtr, btr_pcur_get_rec(pcur)) == space); +#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG + if (ibuf_debug == 2) { + /* Inject a fault (crash). We do this before trying + optimistic delete, because a pessimistic delete in the + change buffer would require a larger test case. */ + + /* Flag the buffered record as processed, to avoid + an assertion failure after crash recovery. */ + btr_cur_set_deleted_flag_for_ibuf( + btr_pcur_get_rec(pcur), NULL, TRUE, mtr); + ibuf_mtr_commit(mtr); + log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE); + DBUG_SUICIDE(); + } +#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ + success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), mtr); if (success) { @@ -4367,7 +4391,13 @@ ibuf_delete_rec( ut_ad(ibuf_rec_get_page_no(mtr, btr_pcur_get_rec(pcur)) == page_no); ut_ad(ibuf_rec_get_space(mtr, btr_pcur_get_rec(pcur)) == space); - /* We have to resort to a pessimistic delete from ibuf */ + /* We have to resort to a pessimistic delete from ibuf. + Delete-mark the record so that it will not be applied again, + in case the server crashes before the pessimistic delete is + made persistent. */ + btr_cur_set_deleted_flag_for_ibuf( + btr_pcur_get_rec(pcur), NULL, TRUE, mtr); + btr_pcur_store_position(pcur, mtr); ibuf_btr_pcur_commit_specify_mtr(pcur, mtr); @@ -4448,7 +4478,7 @@ ibuf_merge_or_delete_for_page( ut_ad(!block || buf_block_get_space(block) == space); ut_ad(!block || buf_block_get_page_no(block) == page_no); ut_ad(!block || buf_block_get_zip_size(block) == zip_size); - ut_ad(!block || buf_block_get_io_fix(block) == BUF_IO_READ); + ut_ad(!block || buf_block_get_io_fix_unlocked(block) == BUF_IO_READ); if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE || trx_sys_hdr_page(space, page_no)) { @@ -4648,7 +4678,7 @@ loop: fputs("InnoDB: Discarding record\n ", stderr); rec_print_old(stderr, rec); fputs("\nInnoDB: from the insert buffer!\n\n", stderr); - } else if (block) { + } else if (block && !rec_get_deleted_flag(rec, 0)) { /* Now we have at pcur a record which should be applied on the index page; NOTE that the call below copies pointers to fields in rec, and we must diff --git a/storage/xtradb/include/btr0cur.h b/storage/xtradb/include/btr0cur.h index cb44129aeb5..97929d44159 100644 --- a/storage/xtradb/include/btr0cur.h +++ b/storage/xtradb/include/btr0cur.h @@ -636,7 +636,7 @@ btr_cur_set_deleted_flag_for_ibuf( when the tablespace is uncompressed */ ibool val, /*!< in: value to set */ - mtr_t* mtr); /*!< in: mtr */ + mtr_t* mtr); /*!< in/out: mini-transaction */ /*######################################################################*/ /** In the pessimistic delete, if the page data size drops below this @@ -806,6 +806,11 @@ srv_printf_innodb_monitor(). */ extern ulint btr_cur_n_sea_old; #endif /* !UNIV_HOTBACKUP */ +#ifdef UNIV_DEBUG +/* Flag to limit optimistic insert records */ +extern uint btr_cur_limit_optimistic_insert_debug; +#endif /* UNIV_DEBUG */ + #ifndef UNIV_NONINL #include "btr0cur.ic" #endif diff --git a/storage/xtradb/include/btr0cur.ic b/storage/xtradb/include/btr0cur.ic index e31f77c77eb..5fc4651ca13 100644 --- a/storage/xtradb/include/btr0cur.ic +++ b/storage/xtradb/include/btr0cur.ic @@ -27,6 +27,16 @@ Created 10/16/1994 Heikki Tuuri #include "btr0btr.h" #ifdef UNIV_DEBUG +# define LIMIT_OPTIMISTIC_INSERT_DEBUG(NREC, CODE)\ +if (btr_cur_limit_optimistic_insert_debug\ + && (NREC) >= (ulint)btr_cur_limit_optimistic_insert_debug) {\ + CODE;\ +} +#else +# define LIMIT_OPTIMISTIC_INSERT_DEBUG(NREC, CODE) +#endif /* UNIV_DEBUG */ + +#ifdef UNIV_DEBUG /*********************************************************//** Returns the page cursor component of a tree cursor. @return pointer to page cursor component */ @@ -146,6 +156,9 @@ btr_cur_compress_recommendation( page = btr_cur_get_page(cursor); + LIMIT_OPTIMISTIC_INSERT_DEBUG(page_get_n_recs(page) * 2, + return(FALSE)); + if ((page_get_data_size(page) < BTR_CUR_PAGE_COMPRESS_LIMIT) || ((btr_page_get_next(page, mtr) == FIL_NULL) && (btr_page_get_prev(page, mtr) == FIL_NULL))) { diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h index d48c7f0212f..e0d7a974fc3 100644 --- a/storage/xtradb/include/buf0buf.h +++ b/storage/xtradb/include/buf0buf.h @@ -199,6 +199,15 @@ struct buf_pool_info_struct{ typedef struct buf_pool_info_struct buf_pool_info_t; +/** The occupied bytes of lists in all buffer pools */ +struct buf_pools_list_size_struct { + ulint LRU_bytes; /*!< LRU size in bytes */ + ulint unzip_LRU_bytes; /*!< unzip_LRU size in bytes */ + ulint flush_list_bytes; /*!< flush_list size in bytes */ +}; + +typedef struct buf_pools_list_size_struct buf_pools_list_size_t; + #ifndef UNIV_HOTBACKUP /********************************************************************//** Acquire mutex on all buffer pool instances */ @@ -958,7 +967,7 @@ buf_block_set_file_page( ulint space, /*!< in: tablespace id */ ulint page_no);/*!< in: page number */ /*********************************************************************//** -Gets the io_fix state of a block. +Gets the io_fix state of a block. Requires that the block mutex is held. @return io_fix state */ UNIV_INLINE enum buf_io_fix @@ -967,7 +976,17 @@ buf_page_get_io_fix( const buf_page_t* bpage) /*!< in: pointer to the control block */ __attribute__((pure)); /*********************************************************************//** -Gets the io_fix state of a block. +Gets the io_fix state of a block. Does not assert that the block mutex is +held, to be used in the cases where it is safe not to hold it. +@return io_fix state */ +UNIV_INLINE +enum buf_io_fix +buf_page_get_io_fix_unlocked( +/*=========================*/ + const buf_page_t* bpage) /*!< in: pointer to the control block */ + __attribute__((pure)); +/*********************************************************************//** +Gets the io_fix state of a block. Requires that the block mutex is held. @return io_fix state */ UNIV_INLINE enum buf_io_fix @@ -976,6 +995,16 @@ buf_block_get_io_fix( const buf_block_t* block) /*!< in: pointer to the control block */ __attribute__((pure)); /*********************************************************************//** +Gets the io_fix state of a block. Does not assert that the block mutex is +held, to be used in the cases where it is safe not to hold it. +@return io_fix state */ +UNIV_INLINE +enum buf_io_fix +buf_block_get_io_fix_unlocked( +/*==========================*/ + const buf_block_t* block) /*!< in: pointer to the control block */ + __attribute__((pure)); +/*********************************************************************//** Sets the io_fix state of a block. */ UNIV_INLINE void @@ -1054,8 +1083,7 @@ UNIV_INLINE void buf_page_set_accessed( /*==================*/ - buf_page_t* bpage, /*!< in/out: control block */ - ulint time_ms) /*!< in: ut_time_ms() */ + buf_page_t* bpage) /*!< in/out: control block */ __attribute__((nonnull)); /*********************************************************************//** Gets the buf_block_t handle of a buffered file block if an uncompressed @@ -1374,6 +1402,14 @@ buf_get_total_list_len( ulint* free_len, /*!< out: length of all free lists */ ulint* flush_list_len);/*!< out: length of all flush lists */ /********************************************************************//** +Get total list size in bytes from all buffer pools. */ +UNIV_INTERN +void +buf_get_total_list_size_in_bytes( +/*=============================*/ + buf_pools_list_size_t* buf_pools_list_size); /*!< out: list sizes + in all buffer pools */ +/********************************************************************//** Get total buffer pool statistics. */ UNIV_INTERN void @@ -1548,10 +1584,11 @@ struct buf_page_struct{ to read this for heuristic purposes without holding any mutex or latch */ - unsigned access_time:32; /*!< time of first access, or - 0 if the block was never accessed - in the buffer pool */ /* @} */ + unsigned access_time; /*!< time of first access, or + 0 if the block was never accessed + in the buffer pool. Protected by + block mutex */ ibool space_was_being_deleted; ibool is_corrupt; # if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG @@ -1741,6 +1778,8 @@ struct buf_pool_stat_struct{ young because the first access was not long enough ago, in buf_page_peek_if_too_old() */ + ulint LRU_bytes; /*!< LRU size in bytes */ + ulint flush_list_bytes;/*!< flush_list size in bytes */ }; /** Statistics of buddy blocks of a given size. */ diff --git a/storage/xtradb/include/buf0buf.ic b/storage/xtradb/include/buf0buf.ic index 221f86d9d62..8d5c3edeef8 100644 --- a/storage/xtradb/include/buf0buf.ic +++ b/storage/xtradb/include/buf0buf.ic @@ -434,7 +434,7 @@ buf_block_set_file_page( } /*********************************************************************//** -Gets the io_fix state of a block. +Gets the io_fix state of a block. Requires that the block mutex is held. @return io_fix state */ UNIV_INLINE enum buf_io_fix @@ -442,6 +442,20 @@ buf_page_get_io_fix( /*================*/ const buf_page_t* bpage) /*!< in: pointer to the control block */ { + ut_ad(mutex_own(buf_page_get_mutex(bpage))); + return buf_page_get_io_fix_unlocked(bpage); +} + +/*********************************************************************//** +Gets the io_fix state of a block. Does not assert that the block mutex is +held, to be used in the cases where it is safe not to hold it. +@return io_fix state */ +UNIV_INLINE +enum buf_io_fix +buf_page_get_io_fix_unlocked( +/*=========================*/ + const buf_page_t* bpage) /*!< in: pointer to the control block */ +{ enum buf_io_fix io_fix = (enum buf_io_fix) bpage->io_fix; #ifdef UNIV_DEBUG switch (io_fix) { @@ -457,7 +471,7 @@ buf_page_get_io_fix( } /*********************************************************************//** -Gets the io_fix state of a block. +Gets the io_fix state of a block. Requires that the block mutex is held. @return io_fix state */ UNIV_INLINE enum buf_io_fix @@ -469,6 +483,19 @@ buf_block_get_io_fix( } /*********************************************************************//** +Gets the io_fix state of a block. Does not assert that the block mutex is +held, to be used in the cases where it is safe not to hold it. +@return io_fix state */ +UNIV_INLINE +enum buf_io_fix +buf_block_get_io_fix_unlocked( +/*==========================*/ + const buf_block_t* block) /*!< in: pointer to the control block */ +{ + return(buf_page_get_io_fix_unlocked(&block->page)); +} + +/*********************************************************************//** Sets the io_fix state of a block. */ UNIV_INLINE void @@ -638,19 +665,18 @@ UNIV_INLINE void buf_page_set_accessed( /*==================*/ - buf_page_t* bpage, /*!< in/out: control block */ - ulint time_ms) /*!< in: ut_time_ms() */ + buf_page_t* bpage) /*!< in/out: control block */ { #ifdef UNIV_DEBUG - //buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); - //ut_ad(buf_pool_mutex_own(buf_pool)); -#endif + buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); + ut_ad(!buf_pool_mutex_own(buf_pool)); ut_ad(mutex_own(buf_page_get_mutex(bpage))); +#endif ut_a(buf_page_in_file(bpage)); if (!bpage->access_time) { /* Make this the time of the first access. */ - bpage->access_time = time_ms; + bpage->access_time = ut_time_ms(); } } diff --git a/storage/xtradb/include/buf0lru.h b/storage/xtradb/include/buf0lru.h index efaa758f27a..2ea4f9b1ecf 100644 --- a/storage/xtradb/include/buf0lru.h +++ b/storage/xtradb/include/buf0lru.h @@ -158,7 +158,10 @@ buf_LRU_block_free_non_file_page( buf_block_t* block, /*!< in: block, must not contain a file page */ ibool have_page_hash_mutex); /******************************************************************//** -Adds a block to the LRU list. */ +Adds a block to the LRU list. Please make sure that the zip_size is +already set into the page zip when invoking the function, so that we +can get correct zip_size from the buffer page when adding a block +into LRU */ UNIV_INTERN void buf_LRU_add_block( diff --git a/storage/xtradb/include/data0type.ic b/storage/xtradb/include/data0type.ic index 757dd815c5e..7ec2cb6cf36 100644 --- a/storage/xtradb/include/data0type.ic +++ b/storage/xtradb/include/data0type.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. 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 @@ -459,36 +459,18 @@ dtype_get_fixed_size_low( } else if (!comp) { return(len); } else { - /* We play it safe here and ask MySQL for - mbminlen and mbmaxlen. Although - mbminlen and mbmaxlen are - initialized if and only if prtype - is (in one of the 3 functions in this file), - it could be that none of these functions - has been called. */ - +#ifdef UNIV_DEBUG ulint i_mbminlen, i_mbmaxlen; innobase_get_cset_width( dtype_get_charset_coll(prtype), &i_mbminlen, &i_mbmaxlen); - if (UNIV_UNLIKELY - (DATA_MBMINMAXLEN(i_mbminlen, i_mbmaxlen) - != mbminmaxlen)) { - - ut_print_timestamp(stderr); - fprintf(stderr, " InnoDB: " - "mbminlen=%lu, " - "mbmaxlen=%lu, " - "type->mbminlen=%lu, " - "type->mbmaxlen=%lu\n", - (ulong) i_mbminlen, - (ulong) i_mbmaxlen, - (ulong) DATA_MBMINLEN(mbminmaxlen), - (ulong) DATA_MBMAXLEN(mbminmaxlen)); - } - if (i_mbminlen == i_mbmaxlen) { + ut_ad(DATA_MBMINMAXLEN(i_mbminlen, i_mbmaxlen) + == mbminmaxlen); +#endif /* UNIV_DEBUG */ + if (DATA_MBMINLEN(mbminmaxlen) + == DATA_MBMAXLEN(mbminmaxlen)) { return(len); } } diff --git a/storage/xtradb/include/dict0dict.h b/storage/xtradb/include/dict0dict.h index de3605b1dfb..1dd0b3f5082 100644 --- a/storage/xtradb/include/dict0dict.h +++ b/storage/xtradb/include/dict0dict.h @@ -903,7 +903,7 @@ dict_index_get_nth_col_no( Looks for column n in an index. @return position in internal representation of the index; ULINT_UNDEFINED if not contained */ -UNIV_INLINE +UNIV_INTERN ulint dict_index_get_nth_col_pos( /*=======================*/ diff --git a/storage/xtradb/include/dict0dict.ic b/storage/xtradb/include/dict0dict.ic index 02eafcc5d9c..eeb916fe181 100644 --- a/storage/xtradb/include/dict0dict.ic +++ b/storage/xtradb/include/dict0dict.ic @@ -697,20 +697,6 @@ dict_index_get_nth_col_no( return(dict_col_get_no(dict_index_get_nth_col(index, pos))); } -/********************************************************************//** -Looks for column n in an index. -@return position in internal representation of the index; -ULINT_UNDEFINED if not contained */ -UNIV_INLINE -ulint -dict_index_get_nth_col_pos( -/*=======================*/ - const dict_index_t* index, /*!< in: index */ - ulint n) /*!< in: column number */ -{ - return(dict_index_get_nth_col_or_prefix_pos(index, n, FALSE)); -} - #ifndef UNIV_HOTBACKUP /********************************************************************//** Returns the minimum data size of an index record. diff --git a/storage/xtradb/include/dict0mem.h b/storage/xtradb/include/dict0mem.h index 54593a0b9c7..630942ae2ac 100644 --- a/storage/xtradb/include/dict0mem.h +++ b/storage/xtradb/include/dict0mem.h @@ -377,10 +377,15 @@ struct dict_index_struct{ unsigned type:DICT_IT_BITS; /*!< index type (DICT_CLUSTERED, DICT_UNIQUE, DICT_UNIVERSAL, DICT_IBUF, DICT_CORRUPT) */ - unsigned trx_id_offset:10;/*!< position of the trx id column +#define MAX_KEY_LENGTH_BITS 12 + unsigned trx_id_offset:MAX_KEY_LENGTH_BITS; + /*!< position of the trx id column in a clustered index record, if the fields before it are known to be of a fixed size, 0 otherwise */ +#if (1<<MAX_KEY_LENGTH_BITS) < MAX_KEY_LENGTH +# error (1<<MAX_KEY_LENGTH_BITS) < MAX_KEY_LENGTH +#endif unsigned n_user_defined_cols:10; /*!< number of columns the user defined to be in the index: in the internal diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h index 7da62e68e56..2149d0aadca 100644 --- a/storage/xtradb/include/fil0fil.h +++ b/storage/xtradb/include/fil0fil.h @@ -776,6 +776,21 @@ fil_space_set_corrupt( /*==================*/ ulint space_id); +/****************************************************************//** +Generate redo logs for swapping two .ibd files */ +UNIV_INTERN +void +fil_mtr_rename_log( +/*===============*/ + ulint old_space_id, /*!< in: tablespace id of the old + table. */ + const char* old_name, /*!< in: old table name */ + ulint new_space_id, /*!< in: tablespace id of the new + table */ + const char* new_name, /*!< in: new table name */ + const char* tmp_name); /*!< in: temp table name used while + swapping */ + typedef struct fil_space_struct fil_space_t; #endif diff --git a/storage/xtradb/include/lock0lock.h b/storage/xtradb/include/lock0lock.h index ea636f985b4..2b659ab417e 100644 --- a/storage/xtradb/include/lock0lock.h +++ b/storage/xtradb/include/lock0lock.h @@ -798,14 +798,22 @@ lock_rec_get_page_no( remains set when the waiting lock is granted, or if the lock is inherited to a neighboring record */ -#if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION)&LOCK_MODE_MASK +#define LOCK_CONV_BY_OTHER 4096 /*!< this bit is set when the lock is created + by other transaction */ +#if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION|LOCK_CONV_BY_OTHER)&LOCK_MODE_MASK # error #endif -#if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION)&LOCK_TYPE_MASK +#if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION|LOCK_CONV_BY_OTHER)&LOCK_TYPE_MASK # error #endif /* @} */ +/** Checks if this is a waiting lock created by lock->trx itself. +@param type_mode lock->type_mode +@return whether it is a waiting lock belonging to lock->trx */ +#define lock_is_wait_not_by_other(type_mode) \ + ((type_mode & (LOCK_CONV_BY_OTHER | LOCK_WAIT)) == LOCK_WAIT) + /** Lock operation struct */ typedef struct lock_op_struct lock_op_t; /** Lock operation struct */ diff --git a/storage/xtradb/include/log0online.h b/storage/xtradb/include/log0online.h index e7c3f301e45..999a317780e 100644 --- a/storage/xtradb/include/log0online.h +++ b/storage/xtradb/include/log0online.h @@ -41,23 +41,51 @@ typedef struct log_bitmap_iterator_struct log_bitmap_iterator_t; Initializes the online log following subsytem. */ UNIV_INTERN void -log_online_read_init(); -/*===================*/ +log_online_read_init(void); +/*=======================*/ /*********************************************************************//** Shuts down the online log following subsystem. */ UNIV_INTERN void -log_online_read_shutdown(); -/*=======================*/ +log_online_read_shutdown(void); +/*===========================*/ /*********************************************************************//** Reads and parses the redo log up to last checkpoint LSN to build the changed -page bitmap which is then written to disk. */ +page bitmap which is then written to disk. + +@return TRUE if log tracking succeeded, FALSE if bitmap write I/O error */ UNIV_INTERN -void -log_online_follow_redo_log(); -/*=========================*/ +ibool +log_online_follow_redo_log(void); +/*=============================*/ + +/************************************************************//** +Delete all the bitmap files for data less than the specified LSN. +If called with lsn == 0 (i.e. set by RESET request) or +IB_ULONGLONG_MAX, restart the bitmap file sequence, otherwise +continue it. + +@return FALSE to indicate success, TRUE for failure. */ +UNIV_INTERN +ibool +log_online_purge_changed_page_bitmaps( +/*==================================*/ + ib_uint64_t lsn); /*!<in: LSN to purge files up to */ + +/************************************************************//** +Delete all the bitmap files for data less than the specified LSN. +If called with lsn == 0 (i.e. set by RESET request) or +IB_ULONGLONG_MAX, restart the bitmap file sequence, otherwise +continue it. + +@return FALSE to indicate success, TRUE for failure. */ +UNIV_INTERN +ibool +log_online_purge_changed_page_bitmaps( +/*==================================*/ + ib_uint64_t lsn); /*!<in: LSN to purge files up to */ #define LOG_BITMAP_ITERATOR_START_LSN(i) \ ((i).start_lsn) diff --git a/storage/xtradb/include/os0file.h b/storage/xtradb/include/os0file.h index 4c795d93141..05403a8e752 100644 --- a/storage/xtradb/include/os0file.h +++ b/storage/xtradb/include/os0file.h @@ -190,6 +190,8 @@ extern ulint os_n_file_reads; extern ulint os_n_file_writes; extern ulint os_n_fsyncs; +#define OS_MIN_LOG_BLOCK_SIZE 512 + extern ulint srv_log_block_size; #ifdef UNIV_PFS_IO diff --git a/storage/xtradb/include/page0zip.h b/storage/xtradb/include/page0zip.h index fe3d2e52e0b..23a2cac618b 100644 --- a/storage/xtradb/include/page0zip.h +++ b/storage/xtradb/include/page0zip.h @@ -156,9 +156,10 @@ page_zip_validate_low( /*==================*/ const page_zip_des_t* page_zip,/*!< in: compressed page */ const page_t* page, /*!< in: uncompressed page */ + const dict_index_t* index, /*!< in: index of the page, if known */ ibool sloppy) /*!< in: FALSE=strict, TRUE=ignore the MIN_REC_FLAG */ - __attribute__((nonnull)); + __attribute__((nonnull(1,2))); /**********************************************************************//** Check that the compressed and decompressed pages match. */ UNIV_INTERN @@ -166,8 +167,9 @@ ibool page_zip_validate( /*==============*/ const page_zip_des_t* page_zip,/*!< in: compressed page */ - const page_t* page) /*!< in: uncompressed page */ - __attribute__((nonnull)); + const page_t* page, /*!< in: uncompressed page */ + const dict_index_t* index) /*!< in: index of the page, if known */ + __attribute__((nonnull(1,2))); #endif /* UNIV_ZIP_DEBUG */ /**********************************************************************//** diff --git a/storage/xtradb/include/rem0rec.h b/storage/xtradb/include/rem0rec.h index 10b74d18c13..98bf889b996 100644 --- a/storage/xtradb/include/rem0rec.h +++ b/storage/xtradb/include/rem0rec.h @@ -362,24 +362,6 @@ rec_get_offsets_func( rec_get_offsets_func(rec,index,offsets,n,heap,__FILE__,__LINE__) /******************************************************//** -Determine the offset to each field in a leaf-page record -in ROW_FORMAT=COMPACT. This is a special case of -rec_init_offsets() and rec_get_offsets_func(). */ -UNIV_INTERN -void -rec_init_offsets_comp_ordinary( -/*===========================*/ - const rec_t* rec, /*!< in: physical record in - ROW_FORMAT=COMPACT */ - ulint extra, /*!< in: number of bytes to reserve - between the record header and - the data payload - (usually REC_N_NEW_EXTRA_BYTES) */ - const dict_index_t* index, /*!< in: record descriptor */ - ulint* offsets);/*!< in/out: array of offsets; - in: n=rec_offs_n_fields(offsets) */ - -/******************************************************//** The following function determines the offsets to each field in the record. It can reuse a previously allocated array. */ UNIV_INTERN @@ -644,8 +626,48 @@ rec_copy( /*=====*/ void* buf, /*!< in: buffer */ const rec_t* rec, /*!< in: physical record */ - const ulint* offsets);/*!< in: array returned by rec_get_offsets() */ + const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ + __attribute__((nonnull)); #ifndef UNIV_HOTBACKUP +/**********************************************************//** +Determines the size of a data tuple prefix in a temporary file. +@return total size */ +UNIV_INTERN +ulint +rec_get_converted_size_temp( +/*========================*/ + const dict_index_t* index, /*!< in: record descriptor */ + const dfield_t* fields, /*!< in: array of data fields */ + ulint n_fields,/*!< in: number of data fields */ + ulint* extra) /*!< out: extra size */ + __attribute__((warn_unused_result, nonnull)); + +/******************************************************//** +Determine the offset to each field in temporary file. +@see rec_convert_dtuple_to_temp() */ +UNIV_INTERN +void +rec_init_offsets_temp( +/*==================*/ + const rec_t* rec, /*!< in: temporary file record */ + const dict_index_t* index, /*!< in: record descriptor */ + ulint* offsets)/*!< in/out: array of offsets; + in: n=rec_offs_n_fields(offsets) */ + __attribute__((nonnull)); + +/*********************************************************//** +Builds a temporary file record out of a data tuple. +@see rec_init_offsets_temp() */ +UNIV_INTERN +void +rec_convert_dtuple_to_temp( +/*=======================*/ + rec_t* rec, /*!< out: record */ + const dict_index_t* index, /*!< in: record descriptor */ + const dfield_t* fields, /*!< in: array of data fields */ + ulint n_fields) /*!< in: number of fields */ + __attribute__((nonnull)); + /**************************************************************//** Copies the first n fields of a physical record to a new physical record in a buffer. @@ -680,21 +702,6 @@ rec_fold( __attribute__((pure)); #endif /* !UNIV_HOTBACKUP */ /*********************************************************//** -Builds a ROW_FORMAT=COMPACT record out of a data tuple. */ -UNIV_INTERN -void -rec_convert_dtuple_to_rec_comp( -/*===========================*/ - rec_t* rec, /*!< in: origin of record */ - ulint extra, /*!< in: number of bytes to - reserve between the record - header and the data payload - (normally REC_N_NEW_EXTRA_BYTES) */ - const dict_index_t* index, /*!< in: record descriptor */ - ulint status, /*!< in: status bits of the record */ - const dfield_t* fields, /*!< in: array of data fields */ - ulint n_fields);/*!< in: number of data fields */ -/*********************************************************//** Builds a physical record out of a data tuple and stores it into the given buffer. @return pointer to the origin of physical record */ @@ -727,10 +734,7 @@ UNIV_INTERN ulint rec_get_converted_size_comp_prefix( /*===============================*/ - const dict_index_t* index, /*!< in: record descriptor; - dict_table_is_comp() is - assumed to hold, even if - it does not */ + const dict_index_t* index, /*!< in: record descriptor */ const dfield_t* fields, /*!< in: array of data fields */ ulint n_fields,/*!< in: number of data fields */ ulint* extra); /*!< out: extra size */ diff --git a/storage/xtradb/include/row0undo.h b/storage/xtradb/include/row0undo.h index 6eb4ca448b3..9420d022e3b 100644 --- a/storage/xtradb/include/row0undo.h +++ b/storage/xtradb/include/row0undo.h @@ -87,10 +87,6 @@ that index record. */ enum undo_exec { UNDO_NODE_FETCH_NEXT = 1, /*!< we should fetch the next undo log record */ - UNDO_NODE_PREV_VERS, /*!< the roll ptr to previous - version of a row is stored in - node, and undo should be done - based on it */ UNDO_NODE_INSERT, /*!< undo a fresh insert of a row to a table */ UNDO_NODE_MODIFY /*!< undo a modify operation @@ -108,9 +104,6 @@ struct undo_node_struct{ undo_no_t undo_no;/*!< undo number of the record */ ulint rec_type;/*!< undo log record type: TRX_UNDO_INSERT_REC, ... */ - roll_ptr_t new_roll_ptr; - /*!< roll ptr to restore to clustered index - record */ trx_id_t new_trx_id; /*!< trx id to restore to clustered index record */ btr_pcur_t pcur; /*!< persistent cursor used in searching the diff --git a/storage/xtradb/include/row0upd.ic b/storage/xtradb/include/row0upd.ic index 10646241125..6706c9f8c69 100644 --- a/storage/xtradb/include/row0upd.ic +++ b/storage/xtradb/include/row0upd.ic @@ -28,6 +28,7 @@ Created 12/27/1996 Heikki Tuuri # include "trx0trx.h" # include "trx0undo.h" # include "row0row.h" +# include "lock0lock.h" #endif /* !UNIV_HOTBACKUP */ #include "page0zip.h" @@ -171,6 +172,8 @@ row_upd_rec_sys_fields( #if DATA_TRX_ID + 1 != DATA_ROLL_PTR # error "DATA_TRX_ID + 1 != DATA_ROLL_PTR" #endif + ut_ad(lock_check_trx_id_sanity(trx_read_trx_id(rec + offset), + rec, index, offsets, FALSE)); trx_write_trx_id(rec + offset, trx->id); trx_write_roll_ptr(rec + offset + DATA_TRX_ID_LEN, roll_ptr); } diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h index 6c5b61487f2..a64e5ee607b 100644 --- a/storage/xtradb/include/srv0srv.h +++ b/storage/xtradb/include/srv0srv.h @@ -148,7 +148,7 @@ extern my_bool srv_track_changed_pages; extern ib_uint64_t srv_max_bitmap_file_size; extern -ulonglong srv_changed_pages_limit; +ulonglong srv_max_changed_pages; extern ibool srv_auto_extend_last_data_file; extern ulint srv_last_file_size_max; @@ -320,6 +320,10 @@ extern ulint srv_fatal_semaphore_wait_threshold; extern ulint srv_dml_needed_delay; extern long long srv_kill_idle_transaction; +#ifdef UNIV_DEBUG +extern my_bool srv_purge_view_update_only_debug; +#endif /* UNIV_DEBUG */ + extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs, query threads, and lock table: we allocate it from dynamic memory to get it to the @@ -400,6 +404,9 @@ extern ibool srv_blocking_lru_restore; When FALSE, row locks are not taken at all. */ extern my_bool srv_fake_changes_locks; +/** print all user-level transactions deadlocks to mysqld stderr */ +extern my_bool srv_print_all_deadlocks; + /** Status variables to be passed to MySQL */ typedef struct export_var_struct export_struc; @@ -794,7 +801,9 @@ struct export_var_struct{ ulint innodb_dict_tables; ulint innodb_buffer_pool_pages_total; /*!< Buffer pool size */ ulint innodb_buffer_pool_pages_data; /*!< Data pages */ + ulint innodb_buffer_pool_bytes_data; /*!< File bytes used */ ulint innodb_buffer_pool_pages_dirty; /*!< Dirty data pages */ + ulint innodb_buffer_pool_bytes_dirty; /*!< File bytes modified */ ulint innodb_buffer_pool_pages_misc; /*!< Miscellanous pages */ ulint innodb_buffer_pool_pages_free; /*!< Free pages */ #ifdef UNIV_DEBUG @@ -880,6 +889,11 @@ struct export_var_struct{ ib_int64_t innodb_x_lock_os_waits; ib_int64_t innodb_x_lock_spin_rounds; ib_int64_t innodb_x_lock_spin_waits; +#ifdef UNIV_DEBUG + ulint innodb_purge_trx_id_age; /*!< max_trx_id - purged trx_id */ + ulint innodb_purge_view_trx_id_age; /*!< rw_max_trx_id + - purged view's min trx_id */ +#endif /* UNIV_DEBUG */ }; /** Thread slot in the thread table */ diff --git a/storage/xtradb/include/sync0sync.h b/storage/xtradb/include/sync0sync.h index 4a2f55d90ff..b3b99b10630 100644 --- a/storage/xtradb/include/sync0sync.h +++ b/storage/xtradb/include/sync0sync.h @@ -89,6 +89,7 @@ extern mysql_pfs_key_t hash_table_mutex_key; extern mysql_pfs_key_t ibuf_bitmap_mutex_key; extern mysql_pfs_key_t ibuf_mutex_key; extern mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key; +extern mysql_pfs_key_t log_bmp_sys_mutex_key; extern mysql_pfs_key_t log_sys_mutex_key; extern mysql_pfs_key_t log_flush_order_mutex_key; extern mysql_pfs_key_t kernel_mutex_key; @@ -672,6 +673,7 @@ or row lock! */ #define SYNC_TRX_LOCK_HEAP 298 #define SYNC_TRX_SYS_HEADER 290 #define SYNC_PURGE_QUEUE 200 +#define SYNC_LOG_ONLINE 175 #define SYNC_LOG 170 #define SYNC_LOG_FLUSH_ORDER 156 #define SYNC_RECV 168 diff --git a/storage/xtradb/include/trx0purge.h b/storage/xtradb/include/trx0purge.h index 2bd9e64476b..1e8acd65e01 100644 --- a/storage/xtradb/include/trx0purge.h +++ b/storage/xtradb/include/trx0purge.h @@ -156,6 +156,10 @@ struct trx_purge_struct{ than this */ undo_no_t purge_undo_no; /*!< Purge has advanced past all records whose undo number is less than this */ +#ifdef UNIV_DEBUG + trx_id_t done_trx_no; /* Indicate 'purge pointer' which have + purged already accurately. */ +#endif /* UNIV_DEBUG */ /*-----------------------------*/ ibool next_stored; /*!< TRUE if the info of the next record to purge is stored below: if yes, then diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i index 77acf54d8dc..60c5cc79852 100644 --- a/storage/xtradb/include/univ.i +++ b/storage/xtradb/include/univ.i @@ -49,13 +49,10 @@ Created 1/20/1994 Heikki Tuuri #define _IB_TO_STR(s) #s #define IB_TO_STR(s) _IB_TO_STR(s) -#define INNODB_VERSION_MAJOR 1 -#define INNODB_VERSION_MINOR 1 -#define INNODB_VERSION_BUGFIX 8 +#include <mysql_version.h> -#ifndef PERCONA_INNODB_VERSION -#define PERCONA_INNODB_VERSION 29.3 -#endif +#define INNODB_VERSION_MAJOR MYSQL_MAJOR_VERSION +#define INNODB_VERSION_MINOR MYSQL_MINOR_VERSION /* The following is the InnoDB version as shown in SELECT plugin_version FROM information_schema.plugins; @@ -66,11 +63,11 @@ component, i.e. we show M.N.P as M.N */ #define INNODB_VERSION_SHORT \ (INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR) -#define INNODB_VERSION_STR \ - IB_TO_STR(INNODB_VERSION_MAJOR) "." \ - IB_TO_STR(INNODB_VERSION_MINOR) "." \ - IB_TO_STR(INNODB_VERSION_BUGFIX) "-" \ - IB_TO_STR(PERCONA_INNODB_VERSION) +#ifndef PERCONA_INNODB_VERSION +#define PERCONA_INNODB_VERSION 30.1 +#endif + +#define INNODB_VERSION_STR MYSQL_SERVER_VERSION "-" IB_TO_STR(PERCONA_INNODB_VERSION) #define REFMAN "http://dev.mysql.com/doc/refman/" \ IB_TO_STR(MYSQL_MAJOR_VERSION) "." \ @@ -300,6 +297,24 @@ management to ensure correct alignment for doubles etc. */ ======================== */ +/** There are currently two InnoDB file formats which are used to group +features with similar restrictions and dependencies. Using an enum allows +switch statements to give a compiler warning when a new one is introduced. */ +enum innodb_file_formats_enum { + /** Antelope File Format: InnoDB/MySQL up to 5.1. + This format includes REDUNDANT and COMPACT row formats */ + UNIV_FORMAT_A = 0, + + /** Barracuda File Format: Introduced in InnoDB plugin for 5.1: + This format includes COMPRESSED and DYNAMIC row formats. It + includes the ability to create secondary indexes from data that + is not on the clustered index page and the ability to store more + data off the clustered index page. */ + UNIV_FORMAT_B = 1 +}; + +typedef enum innodb_file_formats_enum innodb_file_formats_t; + /* The 2-logarithm of UNIV_PAGE_SIZE: */ /* #define UNIV_PAGE_SIZE_SHIFT 14 */ #define UNIV_PAGE_SIZE_SHIFT_MAX 14 diff --git a/storage/xtradb/lock/lock0lock.c b/storage/xtradb/lock/lock0lock.c index f172ad6695b..47d082ed49f 100644 --- a/storage/xtradb/lock/lock0lock.c +++ b/storage/xtradb/lock/lock0lock.c @@ -790,12 +790,16 @@ lock_reset_lock_and_trx_wait( /*=========================*/ lock_t* lock) /*!< in: record lock */ { - ut_ad((lock->trx)->wait_lock == lock); ut_ad(lock_get_wait(lock)); /* Reset the back pointer in trx to this waiting lock request */ - (lock->trx)->wait_lock = NULL; + if (!(lock->type_mode & LOCK_CONV_BY_OTHER)) { + ut_ad((lock->trx)->wait_lock == lock); + (lock->trx)->wait_lock = NULL; + } else { + ut_ad(lock_get_type_low(lock) == LOCK_REC); + } lock->type_mode &= ~LOCK_WAIT; } @@ -1431,9 +1435,9 @@ lock_rec_has_expl( while (lock) { if (lock->trx == trx + && !lock_is_wait_not_by_other(lock->type_mode) && lock_mode_stronger_or_eq(lock_get_mode(lock), precise_mode & LOCK_MODE_MASK) - && !lock_get_wait(lock) && (!lock_rec_get_rec_not_gap(lock) || (precise_mode & LOCK_REC_NOT_GAP) || heap_no == PAGE_HEAP_NO_SUPREMUM) @@ -1731,9 +1735,9 @@ lock_rec_create( HASH_INSERT(lock_t, hash, lock_sys->rec_hash, lock_rec_fold(space, page_no), lock); - lock_sys->rec_num++; - if (UNIV_UNLIKELY(type_mode & LOCK_WAIT)) { + lock_sys->rec_num++; + if (lock_is_wait_not_by_other(type_mode)) { lock_set_lock_and_trx_wait(lock, trx); } @@ -1763,10 +1767,11 @@ lock_rec_enqueue_waiting( const buf_block_t* block, /*!< in: buffer block containing the record */ ulint heap_no,/*!< in: heap number of the record */ + lock_t* lock, /*!< in: lock object; NULL if a new + one should be created. */ dict_index_t* index, /*!< in: index of record */ que_thr_t* thr) /*!< in: query thread */ { - lock_t* lock; trx_t* trx; ulint sec; ulint ms; @@ -1803,9 +1808,17 @@ lock_rec_enqueue_waiting( ut_ad(0); } - /* Enqueue the lock request that will wait to be granted */ - lock = lock_rec_create(type_mode | LOCK_WAIT, - block, heap_no, index, trx); + if (lock == NULL) { + /* Enqueue the lock request that will wait to be granted */ + lock = lock_rec_create(type_mode | LOCK_WAIT, + block, heap_no, index, trx); + } else { + ut_ad(lock->type_mode & LOCK_WAIT); + ut_ad(lock->type_mode & LOCK_CONV_BY_OTHER); + + lock->type_mode &= ~LOCK_CONV_BY_OTHER; + lock_set_lock_and_trx_wait(lock, trx); + } /* Check if a deadlock occurs: if yes, remove the lock request and return an error code */ @@ -1829,7 +1842,7 @@ lock_rec_enqueue_waiting( trx->que_state = TRX_QUE_LOCK_WAIT; trx->was_chosen_as_deadlock_victim = FALSE; trx->wait_started = time(NULL); - if (innobase_get_slow_log() && trx->take_stats) { + if (UNIV_UNLIKELY(trx->take_stats)) { ut_usectime(&sec, &ms); trx->lock_que_wait_ustarted = (ib_uint64_t)sec * 1000000 + ms; } @@ -2054,6 +2067,7 @@ lock_rec_lock_slow( que_thr_t* thr) /*!< in: query thread */ { trx_t* trx; + lock_t* lock; ut_ad(mutex_own(&kernel_mutex)); ut_ad((LOCK_MODE_MASK & mode) != LOCK_S @@ -2068,7 +2082,27 @@ lock_rec_lock_slow( trx = thr_get_trx(thr); - if (lock_rec_has_expl(mode, block, heap_no, trx)) { + lock = lock_rec_has_expl(mode, block, heap_no, trx); + if (lock) { + if (lock->type_mode & LOCK_CONV_BY_OTHER) { + /* This lock or lock waiting was created by the other + transaction, not by the transaction (trx) itself. + So, the transaction (trx) should treat it collectly + according as whether granted or not. */ + + if (lock->type_mode & LOCK_WAIT) { + /* This lock request was not granted yet. + Should wait for granted. */ + + goto enqueue_waiting; + } else { + /* This lock request was already granted. + Just clearing the flag. */ + + lock->type_mode &= ~LOCK_CONV_BY_OTHER; + } + } + /* The trx already has a strong enough lock on rec: do nothing */ @@ -2078,8 +2112,10 @@ lock_rec_lock_slow( the queue, as this transaction does not have a lock strong enough already granted on the record, we have to wait. */ + ut_ad(lock == NULL); +enqueue_waiting: return(lock_rec_enqueue_waiting(mode, block, heap_no, - index, thr)); + lock, index, thr)); } else if (!impl) { /* Set the requested lock on the record */ @@ -2221,7 +2257,8 @@ lock_grant( TRX_QUE_LOCK_WAIT state, and there is no need to end the lock wait for it */ - if (lock->trx->que_state == TRX_QUE_LOCK_WAIT) { + if (!(lock->type_mode & LOCK_CONV_BY_OTHER) + && lock->trx->que_state == TRX_QUE_LOCK_WAIT) { trx_end_lock_wait(lock->trx); } } @@ -2238,6 +2275,7 @@ lock_rec_cancel( { ut_ad(mutex_own(&kernel_mutex)); ut_ad(lock_get_type_low(lock) == LOCK_REC); + ut_ad(!(lock->type_mode & LOCK_CONV_BY_OTHER)); /* Reset the bit (there can be only one set bit) in the lock bitmap */ lock_rec_reset_nth_bit(lock, lock_rec_find_set_bit(lock)); @@ -2382,8 +2420,12 @@ lock_rec_reset_and_release_wait( lock = lock_rec_get_first(block, heap_no); while (lock != NULL) { - if (lock_get_wait(lock)) { + if (lock_is_wait_not_by_other(lock->type_mode)) { lock_rec_cancel(lock); + } else if (lock_get_wait(lock)) { + /* just reset LOCK_WAIT */ + lock_rec_reset_nth_bit(lock, heap_no); + lock_reset_lock_and_trx_wait(lock); } else { lock_rec_reset_nth_bit(lock, heap_no); } @@ -3271,6 +3313,80 @@ lock_rec_restore_from_page_infimum( /*=========== DEADLOCK CHECKING ======================================*/ +/*********************************************************************//** +rewind(3) the file used for storing the latest detected deadlock and +print a heading message to stderr if printing of all deadlocks to stderr +is enabled. */ +UNIV_INLINE +void +lock_deadlock_start_print() +/*=======================*/ +{ + rewind(lock_latest_err_file); + ut_print_timestamp(lock_latest_err_file); + + if (srv_print_all_deadlocks) { + fprintf(stderr, "InnoDB: transactions deadlock detected, " + "dumping detailed information.\n"); + ut_print_timestamp(stderr); + } +} + +/*********************************************************************//** +Print a message to the deadlock file and possibly to stderr. */ +UNIV_INLINE +void +lock_deadlock_fputs( +/*================*/ + const char* msg) /*!< in: message to print */ +{ + fputs(msg, lock_latest_err_file); + + if (srv_print_all_deadlocks) { + fputs(msg, stderr); + } +} + +/*********************************************************************//** +Print transaction data to the deadlock file and possibly to stderr. */ +UNIV_INLINE +void +lock_deadlock_trx_print( +/*====================*/ + trx_t* trx, /*!< in: transaction */ + ulint max_query_len) /*!< in: max query length to print, or 0 to + use the default max length */ +{ + trx_print(lock_latest_err_file, trx, max_query_len); + + if (srv_print_all_deadlocks) { + trx_print(stderr, trx, max_query_len); + } +} + +/*********************************************************************//** +Print lock data to the deadlock file and possibly to stderr. */ +UNIV_INLINE +void +lock_deadlock_lock_print( +/*=====================*/ + const lock_t* lock) /*!< in: record or table type lock */ +{ + if (lock_get_type_low(lock) == LOCK_REC) { + lock_rec_print(lock_latest_err_file, lock); + + if (srv_print_all_deadlocks) { + lock_rec_print(stderr, lock); + } + } else { + lock_table_print(lock_latest_err_file, lock); + + if (srv_print_all_deadlocks) { + lock_table_print(stderr, lock); + } + } +} + /********************************************************************//** Checks if a lock request results in a deadlock. @return TRUE if a deadlock was detected and we chose trx as a victim; @@ -3314,31 +3430,26 @@ retry: /* If the lock search exceeds the max step or the max depth, the current trx will be the victim. Print its information. */ - rewind(lock_latest_err_file); - ut_print_timestamp(lock_latest_err_file); + lock_deadlock_start_print(); - fputs("TOO DEEP OR LONG SEARCH IN THE LOCK TABLE" - " WAITS-FOR GRAPH, WE WILL ROLL BACK" - " FOLLOWING TRANSACTION \n", - lock_latest_err_file); + lock_deadlock_fputs( + "TOO DEEP OR LONG SEARCH IN THE LOCK TABLE" + " WAITS-FOR GRAPH, WE WILL ROLL BACK" + " FOLLOWING TRANSACTION \n\n" + "*** TRANSACTION:\n"); - fputs("\n*** TRANSACTION:\n", lock_latest_err_file); - trx_print(lock_latest_err_file, trx, 3000); + lock_deadlock_trx_print(trx, 3000); - fputs("*** WAITING FOR THIS LOCK TO BE GRANTED:\n", - lock_latest_err_file); + lock_deadlock_fputs( + "*** WAITING FOR THIS LOCK TO BE GRANTED:\n"); + + lock_deadlock_lock_print(lock); - if (lock_get_type(lock) == LOCK_REC) { - lock_rec_print(lock_latest_err_file, lock); - } else { - lock_table_print(lock_latest_err_file, lock); - } break; case LOCK_VICTIM_IS_START: srv_n_lock_deadlock_count++; - fputs("*** WE ROLL BACK TRANSACTION (2)\n", - lock_latest_err_file); + lock_deadlock_fputs("*** WE ROLL BACK TRANSACTION (2)\n"); break; default: @@ -3453,45 +3564,33 @@ lock_deadlock_recursive( point: a deadlock detected; or we have searched the waits-for graph too long */ - FILE* ef = lock_latest_err_file; + lock_deadlock_start_print(); - rewind(ef); - ut_print_timestamp(ef); + lock_deadlock_fputs("\n*** (1) TRANSACTION:\n"); - fputs("\n*** (1) TRANSACTION:\n", ef); + lock_deadlock_trx_print(wait_lock->trx, 3000); - trx_print(ef, wait_lock->trx, 3000); + lock_deadlock_fputs( + "*** (1) WAITING FOR THIS LOCK" + " TO BE GRANTED:\n"); - fputs("*** (1) WAITING FOR THIS LOCK" - " TO BE GRANTED:\n", ef); + lock_deadlock_lock_print(wait_lock); - if (lock_get_type_low(wait_lock) == LOCK_REC) { - lock_rec_print(ef, wait_lock); - } else { - lock_table_print(ef, wait_lock); - } + lock_deadlock_fputs("*** (2) TRANSACTION:\n"); - fputs("*** (2) TRANSACTION:\n", ef); + lock_deadlock_trx_print(lock->trx, 3000); - trx_print(ef, lock->trx, 3000); + lock_deadlock_fputs( + "*** (2) HOLDS THE LOCK(S):\n"); - fputs("*** (2) HOLDS THE LOCK(S):\n", ef); + lock_deadlock_lock_print(lock); - if (lock_get_type_low(lock) == LOCK_REC) { - lock_rec_print(ef, lock); - } else { - lock_table_print(ef, lock); - } + lock_deadlock_fputs( + "*** (2) WAITING FOR THIS LOCK" + " TO BE GRANTED:\n"); - fputs("*** (2) WAITING FOR THIS LOCK" - " TO BE GRANTED:\n", ef); + lock_deadlock_lock_print(start->wait_lock); - if (lock_get_type_low(start->wait_lock) - == LOCK_REC) { - lock_rec_print(ef, start->wait_lock); - } else { - lock_table_print(ef, start->wait_lock); - } #ifdef UNIV_DEBUG if (lock_print_waits) { fputs("Deadlock detected\n", @@ -3514,8 +3613,8 @@ lock_deadlock_recursive( as a victim to try to avoid deadlocking our recursion starting point transaction */ - fputs("*** WE ROLL BACK TRANSACTION (1)\n", - ef); + lock_deadlock_fputs( + "*** WE ROLL BACK TRANSACTION (1)\n"); wait_lock->trx->was_chosen_as_deadlock_victim = TRUE; @@ -3600,6 +3699,7 @@ lock_table_create( ut_ad(table && trx); ut_ad(mutex_own(&kernel_mutex)); + ut_ad(!(type_mode & LOCK_CONV_BY_OTHER)); if ((type_mode & LOCK_MODE_MASK) == LOCK_AUTO_INC) { ++table->n_waiting_or_granted_auto_inc_locks; @@ -3837,7 +3937,7 @@ lock_table_enqueue_waiting( return(DB_SUCCESS); } - if (innobase_get_slow_log() && trx->take_stats) { + if (UNIV_UNLIKELY(trx->take_stats)) { ut_usectime(&sec, &ms); trx->lock_que_wait_ustarted = (ib_uint64_t)sec * 1000000 + ms; } @@ -4163,6 +4263,7 @@ lock_cancel_waiting_and_release( lock_t* lock) /*!< in: waiting lock request */ { ut_ad(mutex_own(&kernel_mutex)); + ut_ad(!(lock->type_mode & LOCK_CONV_BY_OTHER)); if (lock_get_type_low(lock) == LOCK_REC) { @@ -4658,12 +4759,16 @@ loop: lock_mutex_exit_kernel(); - mtr_start(&mtr); + if (srv_show_verbose_locks) { + mtr_start(&mtr); - buf_page_get_with_no_latch(space, zip_size, - page_no, &mtr); + buf_page_get_gen(space, zip_size, page_no, + RW_NO_LATCH, NULL, + BUF_GET_POSSIBLY_FREED, + __FILE__, __LINE__, &mtr); - mtr_commit(&mtr); + mtr_commit(&mtr); + } load_page_first = FALSE; @@ -5211,7 +5316,7 @@ lock_rec_insert_check_and_lock( err = lock_rec_enqueue_waiting(LOCK_X | LOCK_GAP | LOCK_INSERT_INTENTION, block, next_rec_heap_no, - index, thr); + NULL, index, thr); } else { err = DB_SUCCESS; } @@ -5287,10 +5392,23 @@ lock_rec_convert_impl_to_expl( if (!lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP, block, heap_no, impl_trx)) { + ulint type_mode = (LOCK_REC | LOCK_X + | LOCK_REC_NOT_GAP); + + /* If the delete-marked record was locked already, + we should reserve lock waiting for impl_trx as + implicit lock. Because cannot lock at this moment.*/ + + if (rec_get_deleted_flag(rec, rec_offs_comp(offsets)) + && lock_rec_other_has_conflicting( + LOCK_X | LOCK_REC_NOT_GAP, block, + heap_no, impl_trx)) { + + type_mode |= (LOCK_WAIT | LOCK_CONV_BY_OTHER); + } lock_rec_add_to_queue( - LOCK_REC | LOCK_X | LOCK_REC_NOT_GAP, - block, heap_no, index, impl_trx); + type_mode, block, heap_no, index, impl_trx); } } } diff --git a/storage/xtradb/log/log0online.c b/storage/xtradb/log/log0online.c index 55eb9d17c46..be0a9708b8c 100644 --- a/storage/xtradb/log/log0online.c +++ b/storage/xtradb/log/log0online.c @@ -36,6 +36,11 @@ Online database log parsing for changed page tracking enum { FOLLOW_SCAN_SIZE = 4 * (UNIV_PAGE_SIZE_MAX) }; +#ifdef UNIV_PFS_MUTEX +/* Key to register log_bmp_sys->mutex with PFS */ +UNIV_INTERN mysql_pfs_key_t log_bmp_sys_mutex_key; +#endif /* UNIV_PFS_MUTEX */ + /** Log parsing and bitmap output data structure */ struct log_bitmap_struct { byte read_buf[FOLLOW_SCAN_SIZE]; @@ -69,6 +74,7 @@ struct log_bitmap_struct { both the correct type and the tree does not mind its overwrite during rbt_next() tree traversal. */ + mutex_t mutex; /*!< mutex protecting all the fields.*/ }; /* The log parsing and bitmap output struct instance */ @@ -172,6 +178,8 @@ log_online_set_page_bit( byte search_page[MODIFIED_PAGE_BLOCK_SIZE]; byte *page_ptr; + ut_ad(mutex_own(&log_bmp_sys->mutex)); + ut_a(space != ULINT_UNDEFINED); ut_a(page_no != ULINT_UNDEFINED); @@ -312,8 +320,8 @@ its name is correct and use it for (re-)tracking start. @return the last fully tracked LSN */ static ib_uint64_t -log_online_read_last_tracked_lsn() -/*==============================*/ +log_online_read_last_tracked_lsn(void) +/*==================================*/ { byte page[MODIFIED_PAGE_BLOCK_SIZE]; ibool is_last_page = FALSE; @@ -405,8 +413,10 @@ log_online_can_track_missing( if (last_tracked_lsn > tracking_start_lsn) { fprintf(stderr, - "InnoDB: Error: last tracked LSN is in future. This " - "can be caused by mismatched bitmap files.\n"); + "InnoDB: Error: last tracked LSN %llu is ahead of " + "tracking start LSN %llu. This can be caused by " + "mismatched bitmap files.\n", last_tracked_lsn, + tracking_start_lsn); exit(1); } @@ -431,10 +441,10 @@ log_online_track_missing_on_startup( { ut_ad(last_tracked_lsn != tracking_start_lsn); - fprintf(stderr, "InnoDB: last tracked LSN is %llu, but the last " - "checkpoint LSN is %llu. This might be due to a server " - "crash or a very fast shutdown. ", last_tracked_lsn, - tracking_start_lsn); + fprintf(stderr, "InnoDB: last tracked LSN in \'%s\' is %llu, but the " + "last checkpoint LSN is %llu. This might be due to a server " + "crash or a very fast shutdown. ", log_bmp_sys->out.name, + last_tracked_lsn, tracking_start_lsn); /* See if we can fully recover the missing interval */ if (log_online_can_track_missing(last_tracked_lsn, @@ -446,7 +456,9 @@ log_online_track_missing_on_startup( log_bmp_sys->start_lsn = ut_max_uint64(last_tracked_lsn, MIN_TRACKED_LSN); log_set_tracked_lsn(log_bmp_sys->start_lsn); - log_online_follow_redo_log(); + if (!log_online_follow_redo_log()) { + exit(1); + } ut_ad(log_bmp_sys->end_lsn >= tracking_start_lsn); fprintf(stderr, @@ -484,18 +496,47 @@ log_online_make_bitmap_name( } /*********************************************************************//** -Create a new empty bitmap output file. */ +Check if an old file that has the name of a new bitmap file we are about to +create should be overwritten. */ static -void -log_online_start_bitmap_file() -/*==========================*/ +ibool +log_online_should_overwrite( +/*========================*/ + const char *path) /*!< in: path to file */ { - ibool success; + ibool success; + os_file_stat_t file_info; - log_bmp_sys->out.file - = os_file_create(innodb_file_bmp_key, log_bmp_sys->out.name, - OS_FILE_OVERWRITE, OS_FILE_NORMAL, - OS_DATA_FILE, &success); + /* Currently, it's OK to overwrite 0-sized files only */ + success = os_file_get_status(path, &file_info); + return success && file_info.size == 0LL; +} + +/*********************************************************************//** +Create a new empty bitmap output file. + +@return TRUE if operation succeeded, FALSE if I/O error */ +static +ibool +log_online_start_bitmap_file(void) +/*==============================*/ +{ + ibool success = TRUE; + + /* Check for an old file that should be deleted first */ + if (log_online_should_overwrite(log_bmp_sys->out.name)) { + success = os_file_delete(log_bmp_sys->out.name); + } + + if (UNIV_LIKELY(success)) { + log_bmp_sys->out.file + = os_file_create_simple_no_error_handling( + innodb_file_bmp_key, + log_bmp_sys->out.name, + OS_FILE_CREATE, + OS_FILE_READ_WRITE, + &success); + } if (UNIV_UNLIKELY(!success)) { /* The following call prints an error message */ @@ -503,25 +544,32 @@ log_online_start_bitmap_file() fprintf(stderr, "InnoDB: Error: Cannot create \'%s\'\n", log_bmp_sys->out.name); - exit(1); + log_bmp_sys->out.file = -1; + return FALSE; } log_bmp_sys->out.offset = 0; + return TRUE; } /*********************************************************************//** -Close the current bitmap output file and create the next one. */ +Close the current bitmap output file and create the next one. + +@return TRUE if operation succeeded, FALSE if I/O error */ static -void +ibool log_online_rotate_bitmap_file( /*===========================*/ ib_uint64_t next_file_start_lsn) /*!<in: the start LSN name part */ { - os_file_close(log_bmp_sys->out.file); + if (log_bmp_sys->out.file != -1) { + os_file_close(log_bmp_sys->out.file); + log_bmp_sys->out.file = -1; + } log_bmp_sys->out_seq_num++; log_online_make_bitmap_name(next_file_start_lsn); - log_online_start_bitmap_file(); + return log_online_start_bitmap_file(); } /*********************************************************************//** @@ -556,8 +604,8 @@ log_online_is_bitmap_file( Initialize the online log following subsytem. */ UNIV_INTERN void -log_online_read_init() -/*==================*/ +log_online_read_init(void) +/*======================*/ { ibool success; ib_uint64_t tracking_start_lsn @@ -566,13 +614,16 @@ log_online_read_init() os_file_stat_t bitmap_dir_file_info; ib_uint64_t last_file_start_lsn = MIN_TRACKED_LSN; - /* Assert (could be compile-time assert) that bitmap data start and end - in a bitmap block is 8-byte aligned */ - ut_a(MODIFIED_PAGE_BLOCK_BITMAP % 8 == 0); - ut_a(MODIFIED_PAGE_BLOCK_BITMAP_LEN % 8 == 0); + /* Bitmap data start and end in a bitmap block must be 8-byte + aligned. */ + compile_time_assert(MODIFIED_PAGE_BLOCK_BITMAP % 8 == 0); + compile_time_assert(MODIFIED_PAGE_BLOCK_BITMAP_LEN % 8 == 0); log_bmp_sys = ut_malloc(sizeof(*log_bmp_sys)); + mutex_create(log_bmp_sys_mutex_key, &log_bmp_sys->mutex, + SYNC_LOG_ONLINE); + /* Enumerate existing bitmap files to either open the last one to get the last tracked LSN either to find that there are none and start tracking from scratch. */ @@ -629,7 +680,9 @@ log_online_read_init() if (!success) { /* New file, tracking from scratch */ - log_online_start_bitmap_file(); + if (!log_online_start_bitmap_file()) { + exit(1); + } } else { @@ -637,6 +690,7 @@ log_online_read_init() ulint size_low; ulint size_high; ib_uint64_t last_tracked_lsn; + ib_uint64_t file_start_lsn; success = os_file_get_size(log_bmp_sys->out.file, &size_low, &size_high); @@ -667,10 +721,12 @@ log_online_read_init() if we can retrack any missing data. */ if (log_online_can_track_missing(last_tracked_lsn, tracking_start_lsn)) { - log_online_rotate_bitmap_file(last_tracked_lsn); + file_start_lsn = last_tracked_lsn; + } else { + file_start_lsn = tracking_start_lsn; } - else { - log_online_rotate_bitmap_file(tracking_start_lsn); + if (!log_online_rotate_bitmap_file(file_start_lsn)) { + exit(1); } if (last_tracked_lsn < tracking_start_lsn) { @@ -701,12 +757,15 @@ log_online_read_init() Shut down the online log following subsystem. */ UNIV_INTERN void -log_online_read_shutdown() -/*======================*/ +log_online_read_shutdown(void) +/*==========================*/ { ib_rbt_node_t *free_list_node = log_bmp_sys->page_free_list; - os_file_close(log_bmp_sys->out.file); + if (log_bmp_sys->out.file != -1) { + os_file_close(log_bmp_sys->out.file); + log_bmp_sys->out.file = -1; + } rbt_free(log_bmp_sys->modified_pages); @@ -716,6 +775,8 @@ log_online_read_shutdown() free_list_node = next; } + mutex_free(&log_bmp_sys->mutex); + ut_free(log_bmp_sys); } @@ -759,14 +820,16 @@ from the buffer. If an incomplete record is found, moves it to the end of the buffer. */ static void -log_online_parse_redo_log() -/*=======================*/ +log_online_parse_redo_log(void) +/*===========================*/ { byte *ptr = log_bmp_sys->parse_buf; byte *end = log_bmp_sys->parse_buf_end; ulint len = 0; + ut_ad(mutex_own(&log_bmp_sys->mutex)); + while (ptr != end && log_bmp_sys->next_parse_lsn < log_bmp_sys->end_lsn) { @@ -857,6 +920,8 @@ log_online_add_to_parse_buf( ulint actual_data_len = (end_offset >= start_offset) ? end_offset - start_offset : 0; + ut_ad(mutex_own(&log_bmp_sys->mutex)); + ut_memcpy(log_bmp_sys->parse_buf_end, log_block + start_offset, actual_data_len); @@ -881,6 +946,8 @@ log_online_parse_redo_log_block( { ulint block_data_len; + ut_ad(mutex_own(&log_bmp_sys->mutex)); + block_data_len = log_block_get_data_len(log_block); ut_ad(block_data_len % OS_FILE_LOG_BLOCK_SIZE == 0 @@ -907,6 +974,8 @@ log_online_follow_log_seg( byte* log_block_end = log_bmp_sys->read_buf + (block_end_lsn - block_start_lsn); + ut_ad(mutex_own(&log_bmp_sys->mutex)); + mutex_enter(&log_sys->mutex); log_group_read_log_seg(LOG_RECOVER, log_bmp_sys->read_buf, group, block_start_lsn, block_end_lsn); @@ -969,6 +1038,8 @@ log_online_follow_log_group( ib_uint64_t block_start_lsn = contiguous_lsn; ib_uint64_t block_end_lsn; + ut_ad(mutex_own(&log_bmp_sys->mutex)); + log_bmp_sys->next_parse_lsn = log_bmp_sys->start_lsn; log_bmp_sys->parse_buf_end = log_bmp_sys->parse_buf; @@ -996,19 +1067,26 @@ log_online_follow_log_group( /*********************************************************************//** Write, flush one bitmap block to disk and advance the output position if -successful. */ +successful. + +@return TRUE if page written OK, FALSE if I/O error */ static -void +ibool log_online_write_bitmap_page( /*=========================*/ const byte *block) /*!< in: block to write */ { ibool success; + ut_ad(mutex_own(&log_bmp_sys->mutex)); + + /* Simulate a write error */ + DBUG_EXECUTE_IF("bitmap_page_write_error", return FALSE;); + success = os_file_write(log_bmp_sys->out.name, log_bmp_sys->out.file, block, (ulint)(log_bmp_sys->out.offset & 0xFFFFFFFF), - (ulint)(log_bmp_sys->out.offset << 32), + (ulint)(log_bmp_sys->out.offset >> 32), MODIFIED_PAGE_BLOCK_SIZE); if (UNIV_UNLIKELY(!success)) { @@ -1016,7 +1094,7 @@ log_online_write_bitmap_page( os_file_get_last_error(TRUE); fprintf(stderr, "InnoDB: Error: failed writing changed page " "bitmap file \'%s\'\n", log_bmp_sys->out.name); - return; + return FALSE; } success = os_file_flush(log_bmp_sys->out.file, FALSE); @@ -1027,25 +1105,38 @@ log_online_write_bitmap_page( fprintf(stderr, "InnoDB: Error: failed flushing " "changed page bitmap file \'%s\'\n", log_bmp_sys->out.name); - return; + return FALSE; } +#ifdef UNIV_LINUX + posix_fadvise(log_bmp_sys->out.file, log_bmp_sys->out.offset, + MODIFIED_PAGE_BLOCK_SIZE, POSIX_FADV_DONTNEED); +#endif + log_bmp_sys->out.offset += MODIFIED_PAGE_BLOCK_SIZE; + return TRUE; } /*********************************************************************//** Append the current changed page bitmap to the bitmap file. Clears the -bitmap tree and recycles its nodes to the free list. */ +bitmap tree and recycles its nodes to the free list. + +@return TRUE if bitmap written OK, FALSE if I/O error*/ static -void -log_online_write_bitmap() -/*=====================*/ +ibool +log_online_write_bitmap(void) +/*=========================*/ { ib_rbt_node_t *bmp_tree_node; const ib_rbt_node_t *last_bmp_tree_node; + ibool success = TRUE; + + ut_ad(mutex_own(&log_bmp_sys->mutex)); if (log_bmp_sys->out.offset >= srv_max_bitmap_file_size) { - log_online_rotate_bitmap_file(log_bmp_sys->start_lsn); + if (!log_online_rotate_bitmap_file(log_bmp_sys->start_lsn)) { + return FALSE; + } } bmp_tree_node = (ib_rbt_node_t *) @@ -1056,18 +1147,25 @@ log_online_write_bitmap() byte *page = rbt_value(byte, bmp_tree_node); - if (bmp_tree_node == last_bmp_tree_node) { - mach_write_to_4(page + MODIFIED_PAGE_IS_LAST_BLOCK, 1); - } + /* In case of a bitmap page write error keep on looping over + the tree to reclaim its memory through the free list instead of + returning immediatelly. */ + if (UNIV_LIKELY(success)) { + if (bmp_tree_node == last_bmp_tree_node) { + mach_write_to_4(page + + MODIFIED_PAGE_IS_LAST_BLOCK, + 1); + } - mach_write_to_8(page + MODIFIED_PAGE_START_LSN, - log_bmp_sys->start_lsn); - mach_write_to_8(page + MODIFIED_PAGE_END_LSN, - log_bmp_sys->end_lsn); - mach_write_to_4(page + MODIFIED_PAGE_BLOCK_CHECKSUM, - log_online_calc_checksum(page)); + mach_write_to_8(page + MODIFIED_PAGE_START_LSN, + log_bmp_sys->start_lsn); + mach_write_to_8(page + MODIFIED_PAGE_END_LSN, + log_bmp_sys->end_lsn); + mach_write_to_4(page + MODIFIED_PAGE_BLOCK_CHECKSUM, + log_online_calc_checksum(page)); - log_online_write_bitmap_page(page); + success = log_online_write_bitmap_page(page); + } bmp_tree_node->left = log_bmp_sys->page_free_list; log_bmp_sys->page_free_list = bmp_tree_node; @@ -1077,18 +1175,29 @@ log_online_write_bitmap() } rbt_reset(log_bmp_sys->modified_pages); + return success; } /*********************************************************************//** Read and parse the redo log up to last checkpoint LSN to build the changed -page bitmap which is then written to disk. */ +page bitmap which is then written to disk. + +@return TRUE if log tracking succeeded, FALSE if bitmap write I/O error */ UNIV_INTERN -void -log_online_follow_redo_log() -/*========================*/ +ibool +log_online_follow_redo_log(void) +/*============================*/ { ib_uint64_t contiguous_start_lsn; log_group_t* group; + ibool result; + + mutex_enter(&log_bmp_sys->mutex); + + if (!srv_track_changed_pages) { + mutex_exit(&log_bmp_sys->mutex); + return FALSE; + } /* Grab the LSN of the last checkpoint, we will parse up to it */ mutex_enter(&(log_sys->mutex)); @@ -1096,7 +1205,8 @@ log_online_follow_redo_log() mutex_exit(&(log_sys->mutex)); if (log_bmp_sys->end_lsn == log_bmp_sys->start_lsn) { - return; + mutex_exit(&log_bmp_sys->mutex); + return TRUE; } group = UT_LIST_GET_FIRST(log_sys->log_groups); @@ -1114,9 +1224,12 @@ log_online_follow_redo_log() tracked LSN, so that LSN tracking for this interval is tested. */ DBUG_EXECUTE_IF("crash_before_bitmap_write", DBUG_SUICIDE();); - log_online_write_bitmap(); + result = log_online_write_bitmap(); log_bmp_sys->start_lsn = log_bmp_sys->end_lsn; log_set_tracked_lsn(log_bmp_sys->start_lsn); + + mutex_exit(&log_bmp_sys->mutex); + return result; } /*********************************************************************//** @@ -1514,3 +1627,81 @@ log_online_bitmap_iterator_next( return TRUE; } + +/************************************************************//** +Delete all the bitmap files for data less than the specified LSN. +If called with lsn == 0 (i.e. set by RESET request) or +IB_ULONGLONG_MAX, restart the bitmap file sequence, otherwise +continue it. + +@return FALSE to indicate success, TRUE for failure. */ +UNIV_INTERN +ibool +log_online_purge_changed_page_bitmaps( +/*==================================*/ + ib_uint64_t lsn) /*!< in: LSN to purge files up to */ +{ + log_online_bitmap_file_range_t bitmap_files; + size_t i; + ibool result = FALSE; + + if (lsn == 0) { + lsn = IB_ULONGLONG_MAX; + } + + if (srv_track_changed_pages) { + /* User requests might happen with both enabled and disabled + tracking */ + mutex_enter(&log_bmp_sys->mutex); + } + + if (!log_online_setup_bitmap_file_range(&bitmap_files, 0, lsn)) { + if (srv_track_changed_pages) { + mutex_exit(&log_bmp_sys->mutex); + } + return TRUE; + } + + if (srv_track_changed_pages && lsn >= log_bmp_sys->end_lsn) { + /* If we have to delete the current output file, close it + first. */ + os_file_close(log_bmp_sys->out.file); + log_bmp_sys->out.file = -1; + } + + for (i = 0; i < bitmap_files.count; i++) { + if (bitmap_files.files[i].seq_num == 0 + || bitmap_files.files[i].start_lsn >= lsn) { + break; + } + if (!os_file_delete_if_exists(bitmap_files.files[i].name)) { + os_file_get_last_error(TRUE); + result = TRUE; + break; + } + } + + if (srv_track_changed_pages) { + if (lsn > log_bmp_sys->end_lsn) { + ib_uint64_t new_file_lsn; + if (lsn == IB_ULONGLONG_MAX) { + /* RESET restarts the sequence */ + log_bmp_sys->out_seq_num = 0; + new_file_lsn = 0; + } else { + new_file_lsn = log_bmp_sys->end_lsn; + } + if (!log_online_rotate_bitmap_file(new_file_lsn)) { + /* If file create failed, signal the log + tracking thread to quit next time it wakes + up. */ + srv_track_changed_pages = FALSE; + } + } + + mutex_exit(&log_bmp_sys->mutex); + } + + free(bitmap_files.files); + return result; +} diff --git a/storage/xtradb/log/log0recv.c b/storage/xtradb/log/log0recv.c index 5ab8c14ae2e..4e179afd50c 100644 --- a/storage/xtradb/log/log0recv.c +++ b/storage/xtradb/log/log0recv.c @@ -994,8 +994,11 @@ recv_parse_or_apply_log_rec_body( not NULL, then the log record is applied to the page, and the log record should be complete then */ - mtr_t* mtr) /*!< in: mtr or NULL; should be non-NULL + mtr_t* mtr, /*!< in: mtr or NULL; should be non-NULL if and only if block is non-NULL */ + ulint space_id) + /*!< in: tablespace id obtained by + parsing initial log record */ { dict_index_t* index = NULL; page_t* page; @@ -1267,8 +1270,11 @@ recv_parse_or_apply_log_rec_body( ut_ad(!page || page_type != FIL_PAGE_TYPE_ALLOCATED); ptr = mlog_parse_string(ptr, end_ptr, page, page_zip); break; - case MLOG_FILE_CREATE: case MLOG_FILE_RENAME: + ptr = fil_op_log_parse_or_replay(ptr, end_ptr, type, + space_id, 0); + break; + case MLOG_FILE_CREATE: case MLOG_FILE_DELETE: case MLOG_FILE_CREATE2: ptr = fil_op_log_parse_or_replay(ptr, end_ptr, type, 0, 0); @@ -1672,7 +1678,8 @@ recv_recover_page_func( recv_parse_or_apply_log_rec_body(recv->type, buf, buf + recv->len, - block, &mtr); + block, &mtr, + recv_addr->space); if (srv_recovery_stats) { mutex_enter(&(recv_sys->mutex)); @@ -1704,9 +1711,8 @@ recv_recover_page_func( if (fil_page_get_type(page) == FIL_PAGE_INDEX) { page_zip_des_t* page_zip = buf_block_get_page_zip(block); - if (page_zip) { - ut_a(page_zip_validate_low(page_zip, page, FALSE)); - } + ut_a(!page_zip + || page_zip_validate_low(page_zip, page, NULL, FALSE)); } #endif /* UNIV_ZIP_DEBUG */ @@ -2158,7 +2164,7 @@ recv_parse_log_rec( #endif /* UNIV_LOG_LSN_DEBUG */ new_ptr = recv_parse_or_apply_log_rec_body(*type, new_ptr, end_ptr, - NULL, NULL); + NULL, NULL, *space); if (UNIV_UNLIKELY(new_ptr == NULL)) { return(0); diff --git a/storage/xtradb/os/os0file.c b/storage/xtradb/os/os0file.c index 8e0516a84a9..f4a6c33655f 100644 --- a/storage/xtradb/os/os0file.c +++ b/storage/xtradb/os/os0file.c @@ -1490,6 +1490,13 @@ os_file_create_func( DWORD create_flag; DWORD attributes; ibool retry; + + DBUG_EXECUTE_IF( + "ib_create_table_fail_disk_full", + *success = FALSE; + SetLastError(ERROR_DISK_FULL); + return((os_file_t) -1); + ); try_again: ut_a(name); @@ -1618,6 +1625,12 @@ try_again: ibool retry; const char* mode_str = NULL; + DBUG_EXECUTE_IF( + "ib_create_table_fail_disk_full", + *success = FALSE; + errno = ENOSPC; + return((os_file_t) -1); + ); try_again: ut_a(name); @@ -2377,7 +2390,7 @@ os_file_pread( os_n_file_reads++; - if (innobase_get_slow_log() && trx && trx->take_stats) + if (UNIV_UNLIKELY(trx && trx->take_stats)) { trx->io_reads++; trx->io_read += n; @@ -2410,7 +2423,7 @@ os_file_pread( os_n_pending_reads--; os_mutex_exit(os_file_count_mutex); - if (innobase_get_slow_log() && trx && trx->take_stats && start_time) + if (UNIV_UNLIKELY(start_time != 0)) { ut_usectime(&sec, &ms); finish_time = (ib_uint64_t)sec * 1000000 + ms; @@ -2464,7 +2477,7 @@ os_file_pread( os_n_pending_reads--; os_mutex_exit(os_file_count_mutex); - if (innobase_get_slow_log() && trx && trx->take_stats && start_time) + if (UNIV_UNLIKELY(start_time != 0) { ut_usectime(&sec, &ms); finish_time = (ib_uint64_t)sec * 1000000 + ms; @@ -4245,8 +4258,8 @@ os_aio_func( ut_ad(file); ut_ad(buf); ut_ad(n > 0); - ut_ad(n % OS_FILE_LOG_BLOCK_SIZE == 0); - ut_ad(offset % OS_FILE_LOG_BLOCK_SIZE == 0); + ut_ad(n % OS_MIN_LOG_BLOCK_SIZE == 0); + ut_ad(offset % OS_MIN_LOG_BLOCK_SIZE == 0); ut_ad(os_aio_validate_skip()); #ifdef WIN_ASYNC_IO ut_ad((n & 0xFFFFFFFFUL) == n); diff --git a/storage/xtradb/page/page0cur.c b/storage/xtradb/page/page0cur.c index d49b121afab..a722f5b188d 100644 --- a/storage/xtradb/page/page0cur.c +++ b/storage/xtradb/page/page0cur.c @@ -310,7 +310,7 @@ page_cur_search_with_match( #endif /* UNIV_DEBUG */ page = buf_block_get_frame(block); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ page_check_dir(page); @@ -1248,7 +1248,7 @@ page_cur_insert_rec_zip( ut_ad(!page_rec_is_supremum(*current_rec)); #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ /* 1. Get the size of the physical record in the page */ @@ -1902,6 +1902,7 @@ page_cur_delete_rec( /* Save to local variables some data associated with current_rec */ cur_slot_no = page_dir_find_owner_slot(current_rec); + ut_ad(cur_slot_no > 0); cur_dir_slot = page_dir_get_nth_slot(page, cur_slot_no); cur_n_owned = page_dir_slot_get_n_owned(cur_dir_slot); @@ -1972,7 +1973,7 @@ page_cur_delete_rec( } #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ } diff --git a/storage/xtradb/page/page0page.c b/storage/xtradb/page/page0page.c index e29fa2eb1e5..f2ce6c9fe16 100644 --- a/storage/xtradb/page/page0page.c +++ b/storage/xtradb/page/page0page.c @@ -626,7 +626,7 @@ page_copy_rec_list_end( Furthermore, btr_compress() may set FIL_PAGE_PREV to FIL_NULL on new_page while leaving it intact on new_page_zip. So, we cannot validate new_page_zip. */ - ut_a(page_zip_validate_low(page_zip, page, TRUE)); + ut_a(page_zip_validate_low(page_zip, page, index, TRUE)); } #endif /* UNIV_ZIP_DEBUG */ ut_ad(buf_block_get_frame(block) == page); @@ -796,8 +796,8 @@ zip_reorganize: /* Before copying, "ret" was the predecessor of the predefined supremum record. If it was the predefined infimum record, then it would - still be the infimum. Thus, the assertion - ut_a(ret_pos > 0) would fail here. */ + still be the infimum, and we would have + ret_pos == 0. */ if (UNIV_UNLIKELY (!page_zip_reorganize(new_block, index, mtr))) { @@ -946,7 +946,7 @@ page_delete_rec_list_end( ut_ad(size == ULINT_UNDEFINED || size < UNIV_PAGE_SIZE); ut_ad(!page_zip || page_rec_is_comp(rec)); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ if (page_rec_is_infimum(rec)) { @@ -988,7 +988,7 @@ page_delete_rec_list_end( ULINT_UNDEFINED, &heap); rec = rec_get_next_ptr(rec, TRUE); #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ page_cur_delete_rec(&cur, index, offsets, mtr); } while (page_offset(rec) != PAGE_NEW_SUPREMUM); @@ -1052,6 +1052,7 @@ page_delete_rec_list_end( n_owned = rec_get_n_owned_new(rec2) - count; slot_index = page_dir_find_owner_slot(rec2); + ut_ad(slot_index > 0); slot = page_dir_get_nth_slot(page, slot_index); } else { rec_t* rec2 = rec; @@ -1067,6 +1068,7 @@ page_delete_rec_list_end( n_owned = rec_get_n_owned_old(rec2) - count; slot_index = page_dir_find_owner_slot(rec2); + ut_ad(slot_index > 0); slot = page_dir_get_nth_slot(page, slot_index); } @@ -1126,7 +1128,8 @@ page_delete_rec_list_start( between btr_attach_half_pages() and insert_page = ... when btr_page_get_split_rec_to_left() holds (direction == FSP_DOWN). */ - ut_a(!page_zip || page_zip_validate_low(page_zip, page, TRUE)); + ut_a(!page_zip + || page_zip_validate_low(page_zip, page, index, TRUE)); } #endif /* UNIV_ZIP_DEBUG */ @@ -1197,9 +1200,10 @@ page_move_rec_list_end( = buf_block_get_page_zip(block); ut_a(!new_page_zip == !page_zip); ut_a(!new_page_zip - || page_zip_validate(new_page_zip, new_page)); + || page_zip_validate(new_page_zip, new_page, index)); ut_a(!page_zip - || page_zip_validate(page_zip, page_align(split_rec))); + || page_zip_validate(page_zip, page_align(split_rec), + index)); } #endif /* UNIV_ZIP_DEBUG */ @@ -1471,6 +1475,10 @@ page_rec_get_nth_const( ulint n_owned; const rec_t* rec; + if (nth == 0) { + return(page_get_infimum_rec(page)); + } + ut_ad(nth < UNIV_PAGE_SIZE / (REC_N_NEW_EXTRA_BYTES + 1)); for (i = 0;; i++) { diff --git a/storage/xtradb/page/page0zip.c b/storage/xtradb/page/page0zip.c index 4751f4816a9..5357479908f 100644 --- a/storage/xtradb/page/page0zip.c +++ b/storage/xtradb/page/page0zip.c @@ -1437,7 +1437,7 @@ err_exit: page_zip_get_size(page_zip) - PAGE_DATA); mem_heap_free(heap); #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ if (mtr) { @@ -3123,6 +3123,7 @@ page_zip_validate_low( /*==================*/ const page_zip_des_t* page_zip,/*!< in: compressed page */ const page_t* page, /*!< in: uncompressed page */ + const dict_index_t* index, /*!< in: index of the page, if known */ ibool sloppy) /*!< in: FALSE=strict, TRUE=ignore the MIN_REC_FLAG */ { @@ -3210,39 +3211,102 @@ page_zip_validate_low( committed. Let us tolerate that difference when we are performing a sloppy validation. */ - if (sloppy) { - byte info_bits_diff; - ulint offset - = rec_get_next_offs(page + PAGE_NEW_INFIMUM, - TRUE); - ut_a(offset >= PAGE_NEW_SUPREMUM); - offset -= 5 /* REC_NEW_INFO_BITS */; - - info_bits_diff = page[offset] ^ temp_page[offset]; - - if (info_bits_diff == REC_INFO_MIN_REC_FLAG) { - temp_page[offset] = page[offset]; - - if (!memcmp(page + PAGE_HEADER, - temp_page + PAGE_HEADER, - UNIV_PAGE_SIZE - PAGE_HEADER - - FIL_PAGE_DATA_END)) { - - /* Only the minimum record flag - differed. Let us ignore it. */ - page_zip_fail(("page_zip_validate: " - "min_rec_flag " - "(ignored, " - "%lu,%lu,0x%02lx)\n", - page_get_space_id(page), - page_get_page_no(page), - (ulong) page[offset])); - goto func_exit; + ulint* offsets; + mem_heap_t* heap; + const rec_t* rec; + const rec_t* trec; + byte info_bits_diff; + ulint offset + = rec_get_next_offs(page + PAGE_NEW_INFIMUM, TRUE); + ut_a(offset >= PAGE_NEW_SUPREMUM); + offset -= 5/*REC_NEW_INFO_BITS*/; + + info_bits_diff = page[offset] ^ temp_page[offset]; + + if (info_bits_diff == REC_INFO_MIN_REC_FLAG) { + temp_page[offset] = page[offset]; + + if (!memcmp(page + PAGE_HEADER, + temp_page + PAGE_HEADER, + UNIV_PAGE_SIZE - PAGE_HEADER + - FIL_PAGE_DATA_END)) { + + /* Only the minimum record flag + differed. Let us ignore it. */ + page_zip_fail(("page_zip_validate: " + "min_rec_flag " + "(%s" + "%lu,%lu,0x%02lx)\n", + sloppy ? "ignored, " : "", + page_get_space_id(page), + page_get_page_no(page), + (ulong) page[offset])); + valid = sloppy; + goto func_exit; + } + } + + /* Compare the pointers in the PAGE_FREE list. */ + rec = page_header_get_ptr(page, PAGE_FREE); + trec = page_header_get_ptr(temp_page, PAGE_FREE); + + while (rec || trec) { + if (page_offset(rec) != page_offset(trec)) { + page_zip_fail(("page_zip_validate: " + "PAGE_FREE list: %u!=%u\n", + (unsigned) page_offset(rec), + (unsigned) page_offset(trec))); + valid = FALSE; + goto func_exit; + } + + rec = page_rec_get_next_low(rec, TRUE); + trec = page_rec_get_next_low(trec, TRUE); + } + + /* Compare the records. */ + heap = NULL; + offsets = NULL; + rec = page_rec_get_next_low( + page + PAGE_NEW_INFIMUM, TRUE); + trec = page_rec_get_next_low( + temp_page + PAGE_NEW_INFIMUM, TRUE); + + do { + if (page_offset(rec) != page_offset(trec)) { + page_zip_fail(("page_zip_validate: " + "record list: 0x%02x!=0x%02x\n", + (unsigned) page_offset(rec), + (unsigned) page_offset(trec))); + valid = FALSE; + break; + } + + if (index) { + /* Compare the data. */ + offsets = rec_get_offsets( + rec, index, offsets, + ULINT_UNDEFINED, &heap); + + if (memcmp(rec - rec_offs_extra_size(offsets), + trec - rec_offs_extra_size(offsets), + rec_offs_size(offsets))) { + page_zip_fail( + ("page_zip_validate: " + "record content: 0x%02x", + (unsigned) page_offset(rec))); + valid = FALSE; + break; } } + + rec = page_rec_get_next_low(rec, TRUE); + trec = page_rec_get_next_low(trec, TRUE); + } while (rec || trec); + + if (heap) { + mem_heap_free(heap); } - page_zip_fail(("page_zip_validate: content\n")); - valid = FALSE; } func_exit: @@ -3264,9 +3328,10 @@ ibool page_zip_validate( /*==============*/ const page_zip_des_t* page_zip,/*!< in: compressed page */ - const page_t* page) /*!< in: uncompressed page */ + const page_t* page, /*!< in: uncompressed page */ + const dict_index_t* index) /*!< in: index of the page, if known */ { - return(page_zip_validate_low(page_zip, page, + return(page_zip_validate_low(page_zip, page, index, recv_recovery_is_on())); } #endif /* UNIV_ZIP_DEBUG */ @@ -3597,7 +3662,7 @@ page_zip_write_rec( page_zip->m_nonempty = TRUE; #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page_align(rec))); + ut_a(page_zip_validate(page_zip, page_align(rec), index)); #endif /* UNIV_ZIP_DEBUG */ } @@ -3644,7 +3709,7 @@ corrupt: } #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, NULL)); #endif /* UNIV_ZIP_DEBUG */ memcpy(page + offset, @@ -3653,7 +3718,7 @@ corrupt: ptr + 4, BTR_EXTERN_FIELD_REF_SIZE); #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, NULL)); #endif /* UNIV_ZIP_DEBUG */ } @@ -3720,7 +3785,7 @@ page_zip_write_blob_ptr( memcpy(externs, field, BTR_EXTERN_FIELD_REF_SIZE); #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ if (mtr) { @@ -3791,7 +3856,7 @@ corrupt: } #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, NULL)); #endif /* UNIV_ZIP_DEBUG */ field = page + offset; @@ -3812,7 +3877,7 @@ corrupt: memcpy(storage, ptr + 4, REC_NODE_PTR_SIZE); #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, NULL)); #endif /* UNIV_ZIP_DEBUG */ } @@ -4039,7 +4104,7 @@ page_zip_clear_rec( } #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ } @@ -4063,7 +4128,7 @@ page_zip_rec_set_deleted( *slot &= ~(PAGE_ZIP_DIR_SLOT_DEL >> 8); } #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page_align(rec))); + ut_a(page_zip_validate(page_zip, page_align(rec), NULL)); #endif /* UNIV_ZIP_DEBUG */ } @@ -4364,14 +4429,14 @@ corrupt: goto corrupt; } #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, NULL)); #endif /* UNIV_ZIP_DEBUG */ memcpy(page + offset, ptr, len); memcpy(page_zip->data + offset, ptr, len); #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, NULL)); #endif /* UNIV_ZIP_DEBUG */ } @@ -4449,7 +4514,7 @@ page_zip_reorganize( ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); ut_ad(page_is_comp(page)); ut_ad(!dict_index_is_ibuf(index)); - /* Note that page_zip_validate(page_zip, page) may fail here. */ + /* Note that page_zip_validate(page_zip, page, index) may fail here. */ UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE); UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); @@ -4536,7 +4601,7 @@ page_zip_copy_recs( FIL_PAGE_PREV or PAGE_LEVEL, causing a temporary min_rec_flag mismatch. A strict page_zip_validate() will be executed later during the B-tree operations. */ - ut_a(page_zip_validate_low(src_zip, src, TRUE)); + ut_a(page_zip_validate_low(src_zip, src, index, TRUE)); #endif /* UNIV_ZIP_DEBUG */ ut_a(page_zip_get_size(page_zip) == page_zip_get_size(src_zip)); if (UNIV_UNLIKELY(src_zip->n_blobs)) { @@ -4597,7 +4662,7 @@ page_zip_copy_recs( } #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ btr_blob_dbg_add(page, index, "page_zip_copy_recs"); diff --git a/storage/xtradb/rem/rem0rec.c b/storage/xtradb/rem/rem0rec.c index 30fc28561fa..6bd40c54a0c 100644 --- a/storage/xtradb/rem/rem0rec.c +++ b/storage/xtradb/rem/rem0rec.c @@ -167,7 +167,6 @@ rec_get_n_extern_new( { const byte* nulls; const byte* lens; - dict_field_t* field; ulint null_mask; ulint n_extern; ulint i; @@ -188,10 +187,13 @@ rec_get_n_extern_new( /* read the lengths of fields 0..n */ do { - ulint len; + const dict_field_t* field + = dict_index_get_nth_field(index, i); + const dict_col_t* col + = dict_field_get_col(field); + ulint len; - field = dict_index_get_nth_field(index, i); - if (!(dict_field_get_col(field)->prtype & DATA_NOT_NULL)) { + if (!(col->prtype & DATA_NOT_NULL)) { /* nullable field => read the null flag */ if (UNIV_UNLIKELY(!(byte) null_mask)) { @@ -209,8 +211,6 @@ rec_get_n_extern_new( if (UNIV_UNLIKELY(!field->fixed_len)) { /* Variable-length field: read the length */ - const dict_col_t* col - = dict_field_get_col(field); len = *lens--; /* If the maximum length of the field is up to 255 bytes, the actual length is always @@ -239,16 +239,15 @@ rec_get_n_extern_new( Determine the offset to each field in a leaf-page record in ROW_FORMAT=COMPACT. This is a special case of rec_init_offsets() and rec_get_offsets_func(). */ -UNIV_INTERN +UNIV_INLINE __attribute__((nonnull)) void rec_init_offsets_comp_ordinary( /*===========================*/ const rec_t* rec, /*!< in: physical record in ROW_FORMAT=COMPACT */ - ulint extra, /*!< in: number of bytes to reserve - between the record header and - the data payload - (usually REC_N_NEW_EXTRA_BYTES) */ + ibool temp, /*!< in: whether to use the + format for temporary files in + index creation */ const dict_index_t* index, /*!< in: record descriptor */ ulint* offsets)/*!< in/out: array of offsets; in: n=rec_offs_n_fields(offsets) */ @@ -256,27 +255,38 @@ rec_init_offsets_comp_ordinary( ulint i = 0; ulint offs = 0; ulint any_ext = 0; - const byte* nulls = rec - (extra + 1); + const byte* nulls = temp + ? rec - 1 + : rec - (1 + REC_N_NEW_EXTRA_BYTES); const byte* lens = nulls - UT_BITS_IN_BYTES(index->n_nullable); - dict_field_t* field; ulint null_mask = 1; #ifdef UNIV_DEBUG - /* We cannot invoke rec_offs_make_valid() here, because it can hold - that extra != REC_N_NEW_EXTRA_BYTES. Similarly, rec_offs_validate() - will fail in that case, because it invokes rec_get_status(). */ + /* We cannot invoke rec_offs_make_valid() here if temp=TRUE. + Similarly, rec_offs_validate() will fail in that case, because + it invokes rec_get_status(). */ offsets[2] = (ulint) rec; offsets[3] = (ulint) index; #endif /* UNIV_DEBUG */ + ut_ad(temp || dict_table_is_comp(index->table)); + + if (temp && dict_table_is_comp(index->table)) { + /* No need to do adjust fixed_len=0. We only need to + adjust it for ROW_FORMAT=REDUNDANT. */ + temp = FALSE; + } + /* read the lengths of fields 0..n */ do { - ulint len; + const dict_field_t* field + = dict_index_get_nth_field(index, i); + const dict_col_t* col + = dict_field_get_col(field); + ulint len; - field = dict_index_get_nth_field(index, i); - if (!(dict_field_get_col(field)->prtype - & DATA_NOT_NULL)) { + if (!(col->prtype & DATA_NOT_NULL)) { /* nullable field => read the null flag */ if (UNIV_UNLIKELY(!(byte) null_mask)) { @@ -296,10 +306,9 @@ rec_init_offsets_comp_ordinary( null_mask <<= 1; } - if (UNIV_UNLIKELY(!field->fixed_len)) { + if (!field->fixed_len + || (temp && !dict_col_get_fixed_size(col, temp))) { /* Variable-length field: read the length */ - const dict_col_t* col - = dict_field_get_col(field); len = *lens--; /* If the maximum length of the field is up to 255 bytes, the actual length is always @@ -393,9 +402,8 @@ rec_init_offsets( = dict_index_get_n_unique_in_tree(index); break; case REC_STATUS_ORDINARY: - rec_init_offsets_comp_ordinary(rec, - REC_N_NEW_EXTRA_BYTES, - index, offsets); + rec_init_offsets_comp_ordinary( + rec, FALSE, index, offsets); return; } @@ -766,17 +774,19 @@ rec_get_nth_field_offs_old( /**********************************************************//** Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT. @return total size */ -UNIV_INTERN +UNIV_INLINE __attribute__((warn_unused_result, nonnull(1,2))) ulint -rec_get_converted_size_comp_prefix( -/*===============================*/ +rec_get_converted_size_comp_prefix_low( +/*===================================*/ const dict_index_t* index, /*!< in: record descriptor; dict_table_is_comp() is assumed to hold, even if it does not */ const dfield_t* fields, /*!< in: array of data fields */ ulint n_fields,/*!< in: number of data fields */ - ulint* extra) /*!< out: extra size */ + ulint* extra, /*!< out: extra size */ + ibool temp) /*!< in: whether this is a + temporary file record */ { ulint extra_size; ulint data_size; @@ -785,15 +795,25 @@ rec_get_converted_size_comp_prefix( ut_ad(fields); ut_ad(n_fields > 0); ut_ad(n_fields <= dict_index_get_n_fields(index)); + ut_ad(!temp || extra); - extra_size = REC_N_NEW_EXTRA_BYTES + extra_size = temp + ? UT_BITS_IN_BYTES(index->n_nullable) + : REC_N_NEW_EXTRA_BYTES + UT_BITS_IN_BYTES(index->n_nullable); data_size = 0; + if (temp && dict_table_is_comp(index->table)) { + /* No need to do adjust fixed_len=0. We only need to + adjust it for ROW_FORMAT=REDUNDANT. */ + temp = FALSE; + } + /* read the lengths of fields 0..n */ for (i = 0; i < n_fields; i++) { const dict_field_t* field; ulint len; + ulint fixed_len; const dict_col_t* col; field = dict_index_get_nth_field(index, i); @@ -809,8 +829,14 @@ rec_get_converted_size_comp_prefix( continue; } - ut_ad(len <= col->len || col->mtype == DATA_BLOB); + ut_ad(len <= col->len || col->mtype == DATA_BLOB + || (col->len == 0 && col->mtype == DATA_VARCHAR)); + fixed_len = field->fixed_len; + if (temp && fixed_len + && !dict_col_get_fixed_size(col, temp)) { + fixed_len = 0; + } /* If the maximum length of a variable-length field is up to 255 bytes, the actual length is always stored in one byte. If the maximum length is more than 255 @@ -818,11 +844,20 @@ rec_get_converted_size_comp_prefix( 0..127. The length will be encoded in two bytes when it is 128 or more, or when the field is stored externally. */ - if (field->fixed_len) { - ut_ad(len == field->fixed_len); + if (fixed_len) { +#ifdef UNIV_DEBUG + ulint mbminlen = DATA_MBMINLEN(col->mbminmaxlen); + ulint mbmaxlen = DATA_MBMAXLEN(col->mbminmaxlen); + + ut_ad(len <= fixed_len); + + ut_ad(!mbmaxlen || len >= mbminlen + * (fixed_len / mbmaxlen)); + /* dict_index_add_col() should guarantee this */ ut_ad(!field->prefix_len - || field->fixed_len == field->prefix_len); + || fixed_len == field->prefix_len); +#endif /* UNIV_DEBUG */ } else if (dfield_is_ext(&fields[i])) { ut_ad(col->len >= 256 || col->mtype == DATA_BLOB); extra_size += 2; @@ -839,7 +874,7 @@ rec_get_converted_size_comp_prefix( data_size += len; } - if (UNIV_LIKELY_NULL(extra)) { + if (extra) { *extra = extra_size; } @@ -847,6 +882,23 @@ rec_get_converted_size_comp_prefix( } /**********************************************************//** +Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT. +@return total size */ +UNIV_INTERN +ulint +rec_get_converted_size_comp_prefix( +/*===============================*/ + const dict_index_t* index, /*!< in: record descriptor */ + const dfield_t* fields, /*!< in: array of data fields */ + ulint n_fields,/*!< in: number of data fields */ + ulint* extra) /*!< out: extra size */ +{ + ut_ad(dict_table_is_comp(index->table)); + return(rec_get_converted_size_comp_prefix_low( + index, fields, n_fields, extra, FALSE)); +} + +/**********************************************************//** Determines the size of a data tuple in ROW_FORMAT=COMPACT. @return total size */ UNIV_INTERN @@ -890,8 +942,8 @@ rec_get_converted_size_comp( return(ULINT_UNDEFINED); } - return(size + rec_get_converted_size_comp_prefix(index, fields, - n_fields, extra)); + return(size + rec_get_converted_size_comp_prefix_low( + index, fields, n_fields, extra, FALSE)); } /***********************************************************//** @@ -1068,19 +1120,18 @@ rec_convert_dtuple_to_rec_old( /*********************************************************//** Builds a ROW_FORMAT=COMPACT record out of a data tuple. */ -UNIV_INTERN +UNIV_INLINE __attribute__((nonnull)) void rec_convert_dtuple_to_rec_comp( /*===========================*/ rec_t* rec, /*!< in: origin of record */ - ulint extra, /*!< in: number of bytes to - reserve between the record - header and the data payload - (normally REC_N_NEW_EXTRA_BYTES) */ const dict_index_t* index, /*!< in: record descriptor */ - ulint status, /*!< in: status bits of the record */ const dfield_t* fields, /*!< in: array of data fields */ - ulint n_fields)/*!< in: number of data fields */ + ulint n_fields,/*!< in: number of data fields */ + ulint status, /*!< in: status bits of the record */ + ibool temp) /*!< in: whether to use the + format for temporary files in + index creation */ { const dfield_t* field; const dtype_t* type; @@ -1092,31 +1143,44 @@ rec_convert_dtuple_to_rec_comp( ulint n_node_ptr_field; ulint fixed_len; ulint null_mask = 1; - ut_ad(extra == 0 || dict_table_is_comp(index->table)); - ut_ad(extra == 0 || extra == REC_N_NEW_EXTRA_BYTES); + ut_ad(temp || dict_table_is_comp(index->table)); ut_ad(n_fields > 0); - switch (UNIV_EXPECT(status, REC_STATUS_ORDINARY)) { - case REC_STATUS_ORDINARY: + if (temp) { + ut_ad(status == REC_STATUS_ORDINARY); ut_ad(n_fields <= dict_index_get_n_fields(index)); n_node_ptr_field = ULINT_UNDEFINED; - break; - case REC_STATUS_NODE_PTR: - ut_ad(n_fields == dict_index_get_n_unique_in_tree(index) + 1); - n_node_ptr_field = n_fields - 1; - break; - case REC_STATUS_INFIMUM: - case REC_STATUS_SUPREMUM: - ut_ad(n_fields == 1); - n_node_ptr_field = ULINT_UNDEFINED; - break; - default: - ut_error; - return; + nulls = rec - 1; + if (dict_table_is_comp(index->table)) { + /* No need to do adjust fixed_len=0. We only + need to adjust it for ROW_FORMAT=REDUNDANT. */ + temp = FALSE; + } + } else { + nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1); + + switch (UNIV_EXPECT(status, REC_STATUS_ORDINARY)) { + case REC_STATUS_ORDINARY: + ut_ad(n_fields <= dict_index_get_n_fields(index)); + n_node_ptr_field = ULINT_UNDEFINED; + break; + case REC_STATUS_NODE_PTR: + ut_ad(n_fields + == dict_index_get_n_unique_in_tree(index) + 1); + n_node_ptr_field = n_fields - 1; + break; + case REC_STATUS_INFIMUM: + case REC_STATUS_SUPREMUM: + ut_ad(n_fields == 1); + n_node_ptr_field = ULINT_UNDEFINED; + break; + default: + ut_error; + return; + } } end = rec; - nulls = rec - (extra + 1); lens = nulls - UT_BITS_IN_BYTES(index->n_nullable); /* clear the SQL-null flags */ memset(lens + 1, 0, nulls - lens); @@ -1162,6 +1226,10 @@ rec_convert_dtuple_to_rec_comp( ifield = dict_index_get_nth_field(index, i); fixed_len = ifield->fixed_len; + if (temp && fixed_len + && !dict_col_get_fixed_size(ifield->col, temp)) { + fixed_len = 0; + } /* If the maximum length of a variable-length field is up to 255 bytes, the actual length is always stored in one byte. If the maximum length is more than 255 @@ -1169,8 +1237,17 @@ rec_convert_dtuple_to_rec_comp( 0..127. The length will be encoded in two bytes when it is 128 or more, or when the field is stored externally. */ if (fixed_len) { - ut_ad(len == fixed_len); +#ifdef UNIV_DEBUG + ulint mbminlen = DATA_MBMINLEN( + ifield->col->mbminmaxlen); + ulint mbmaxlen = DATA_MBMAXLEN( + ifield->col->mbminmaxlen); + + ut_ad(len <= fixed_len); + ut_ad(!mbmaxlen || len >= mbminlen + * (fixed_len / mbmaxlen)); ut_ad(!dfield_is_ext(field)); +#endif /* UNIV_DEBUG */ } else if (dfield_is_ext(field)) { ut_ad(ifield->col->len >= 256 || ifield->col->mtype == DATA_BLOB); @@ -1222,8 +1299,7 @@ rec_convert_dtuple_to_rec_new( rec = buf + extra_size; rec_convert_dtuple_to_rec_comp( - rec, REC_N_NEW_EXTRA_BYTES, index, status, - dtuple->fields, dtuple->n_fields); + rec, index, dtuple->fields, dtuple->n_fields, status, FALSE); /* Set the info bits of the record */ rec_set_info_and_status_bits(rec, dtuple_get_info_bits(dtuple)); @@ -1285,6 +1361,54 @@ rec_convert_dtuple_to_rec( return(rec); } +#ifndef UNIV_HOTBACKUP +/**********************************************************//** +Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT. +@return total size */ +UNIV_INTERN +ulint +rec_get_converted_size_temp( +/*========================*/ + const dict_index_t* index, /*!< in: record descriptor */ + const dfield_t* fields, /*!< in: array of data fields */ + ulint n_fields,/*!< in: number of data fields */ + ulint* extra) /*!< out: extra size */ +{ + return(rec_get_converted_size_comp_prefix_low( + index, fields, n_fields, extra, TRUE)); +} + +/******************************************************//** +Determine the offset to each field in temporary file. +@see rec_convert_dtuple_to_temp() */ +UNIV_INTERN +void +rec_init_offsets_temp( +/*==================*/ + const rec_t* rec, /*!< in: temporary file record */ + const dict_index_t* index, /*!< in: record descriptor */ + ulint* offsets)/*!< in/out: array of offsets; + in: n=rec_offs_n_fields(offsets) */ +{ + rec_init_offsets_comp_ordinary(rec, TRUE, index, offsets); +} + +/*********************************************************//** +Builds a temporary file record out of a data tuple. +@see rec_init_offsets_temp() */ +UNIV_INTERN +void +rec_convert_dtuple_to_temp( +/*=======================*/ + rec_t* rec, /*!< out: record */ + const dict_index_t* index, /*!< in: record descriptor */ + const dfield_t* fields, /*!< in: array of data fields */ + ulint n_fields) /*!< in: number of fields */ +{ + rec_convert_dtuple_to_rec_comp(rec, index, fields, n_fields, + REC_STATUS_ORDINARY, TRUE); +} + /**************************************************************//** Copies the first n fields of a physical record to a data tuple. The fields are copied to the memory heap. */ @@ -1495,6 +1619,7 @@ rec_copy_prefix_to_buf( return(*buf + (rec - (lens + 1))); } +#endif /* UNIV_HOTBACKUP */ /***************************************************************//** Validates the consistency of an old-style physical record. diff --git a/storage/xtradb/row/row0ins.c b/storage/xtradb/row/row0ins.c index 61c3720fa2e..fda0c55b5c7 100644 --- a/storage/xtradb/row/row0ins.c +++ b/storage/xtradb/row/row0ins.c @@ -2288,7 +2288,10 @@ row_ins_index_entry( err = row_ins_index_entry_low(BTR_MODIFY_LEAF, index, entry, n_ext, thr); if (err != DB_FAIL) { - + if (index == dict_table_get_first_index(index->table) + && thr_get_trx(thr)->mysql_thd != 0) { + DEBUG_SYNC_C("row_ins_clust_index_entry_leaf_after"); + } return(err); } diff --git a/storage/xtradb/row/row0merge.c b/storage/xtradb/row/row0merge.c index 0fd13f5339c..0b6a6302854 100644 --- a/storage/xtradb/row/row0merge.c +++ b/storage/xtradb/row/row0merge.c @@ -301,6 +301,7 @@ row_merge_buf_add( for (i = 0; i < n_fields; i++, field++, ifield++) { const dict_col_t* col; ulint col_no; + ulint fixed_len; const dfield_t* row_field; ulint len; @@ -349,9 +350,30 @@ row_merge_buf_add( ut_ad(len <= col->len || col->mtype == DATA_BLOB); - if (ifield->fixed_len) { - ut_ad(len == ifield->fixed_len); + fixed_len = ifield->fixed_len; + if (fixed_len && !dict_table_is_comp(index->table) + && DATA_MBMINLEN(col->mbminmaxlen) + != DATA_MBMAXLEN(col->mbminmaxlen)) { + /* CHAR in ROW_FORMAT=REDUNDANT is always + fixed-length, but in the temporary file it is + variable-length for variable-length character + sets. */ + fixed_len = 0; + } + + if (fixed_len) { +#ifdef UNIV_DEBUG + ulint mbminlen = DATA_MBMINLEN(col->mbminmaxlen); + ulint mbmaxlen = DATA_MBMAXLEN(col->mbminmaxlen); + + /* len should be between size calcualted base on + mbmaxlen and mbminlen */ + ut_ad(len <= fixed_len); + ut_ad(!mbmaxlen || len >= mbminlen + * (fixed_len / mbmaxlen)); + ut_ad(!dfield_is_ext(field)); +#endif /* UNIV_DEBUG */ } else if (dfield_is_ext(field)) { extra_size += 2; } else if (len < 128 @@ -372,12 +394,11 @@ row_merge_buf_add( ulint size; ulint extra; - size = rec_get_converted_size_comp(index, - REC_STATUS_ORDINARY, - entry, n_fields, &extra); + size = rec_get_converted_size_temp( + index, entry, n_fields, &extra); - ut_ad(data_size + extra_size + REC_N_NEW_EXTRA_BYTES == size); - ut_ad(extra_size + REC_N_NEW_EXTRA_BYTES == extra); + ut_ad(data_size + extra_size == size); + ut_ad(extra_size == extra); } #endif /* UNIV_DEBUG */ @@ -581,14 +602,9 @@ row_merge_buf_write( ulint extra_size; const dfield_t* entry = buf->tuples[i]; - size = rec_get_converted_size_comp(index, - REC_STATUS_ORDINARY, - entry, n_fields, - &extra_size); + size = rec_get_converted_size_temp( + index, entry, n_fields, &extra_size); ut_ad(size >= extra_size); - ut_ad(extra_size >= REC_N_NEW_EXTRA_BYTES); - extra_size -= REC_N_NEW_EXTRA_BYTES; - size -= REC_N_NEW_EXTRA_BYTES; /* Encode extra_size + 1 */ if (extra_size + 1 < 0x80) { @@ -601,9 +617,8 @@ row_merge_buf_write( ut_ad(b + size < block[1]); - rec_convert_dtuple_to_rec_comp(b + extra_size, 0, index, - REC_STATUS_ORDINARY, - entry, n_fields); + rec_convert_dtuple_to_temp(b + extra_size, index, + entry, n_fields); b += size; @@ -709,6 +724,8 @@ row_merge_read( ib_uint64_t ofs = ((ib_uint64_t) offset) * block_size; ibool success; + DBUG_EXECUTE_IF("row_merge_read_failure", return(FALSE);); + #ifdef UNIV_DEBUG if (row_merge_print_block_read) { fprintf(stderr, "row_merge_read fd=%d ofs=%lu\n", @@ -756,6 +773,8 @@ row_merge_write( (ulint) (ofs >> 32), block_size); + DBUG_EXECUTE_IF("row_merge_write_failure", return(FALSE);); + #ifdef UNIV_DEBUG if (row_merge_print_block_write) { fprintf(stderr, "row_merge_write fd=%d ofs=%lu\n", @@ -872,7 +891,7 @@ err_exit: *mrec = *buf + extra_size; - rec_init_offsets_comp_ordinary(*mrec, 0, index, offsets); + rec_init_offsets_temp(*mrec, index, offsets); data_size = rec_offs_data_size(offsets); @@ -891,7 +910,7 @@ err_exit: *mrec = b + extra_size; - rec_init_offsets_comp_ordinary(*mrec, 0, index, offsets); + rec_init_offsets_temp(*mrec, index, offsets); data_size = rec_offs_data_size(offsets); ut_ad(extra_size + data_size < block_size); @@ -2261,7 +2280,7 @@ row_merge_drop_temp_indexes(void) /*********************************************************************//** Creates temperary merge files, and if UNIV_PFS_IO defined, register the file descriptor with Performance Schema. -@return File descriptor */ +@return file descriptor, or -1 on failure */ UNIV_INLINE int row_merge_file_create_low(void) @@ -2283,12 +2302,19 @@ row_merge_file_create_low(void) #ifdef UNIV_PFS_IO register_pfs_file_open_end(locker, fd); #endif + if (fd < 0) { + fprintf(stderr, + "InnoDB: Error: Cannot create temporary merge file\n"); + return(-1); + } return(fd); } + /*********************************************************************//** -Create a merge file. */ -static -void +Create a merge file. +@return file descriptor, or -1 on failure */ +static __attribute__((nonnull, warn_unused_result)) +int row_merge_file_create( /*==================*/ merge_file_t* merge_file) /*!< out: merge file structure */ @@ -2296,6 +2322,7 @@ row_merge_file_create( merge_file->fd = row_merge_file_create_low(); merge_file->offset = 0; merge_file->n_rec = 0; + return(merge_file->fd); } /*********************************************************************//** @@ -2541,6 +2568,28 @@ row_merge_rename_tables( goto err_exit; } + /* Generate the redo logs for file operations */ + fil_mtr_rename_log(old_table->space, old_name, + new_table->space, new_table->name, tmp_name); + + /* What if the redo logs are flushed to disk here? This is + tested with following crash point */ + DBUG_EXECUTE_IF("bug14669848_precommit", log_buffer_flush_to_disk(); + DBUG_SUICIDE();); + + /* File operations cannot be rolled back. So, before proceeding + with file operations, commit the dictionary changes.*/ + trx_commit_for_mysql(trx); + + /* If server crashes here, the dictionary in InnoDB and MySQL + will differ. The .ibd files and the .frm files must be swapped + manually by the administrator. No loss of data. */ + DBUG_EXECUTE_IF("bug14669848", DBUG_SUICIDE();); + + /* Ensure that the redo logs are flushed to disk. The config + innodb_flush_log_at_trx_commit must not affect this. */ + log_buffer_flush_to_disk(); + /* The following calls will also rename the .ibd data files if the tables are stored in a single-table tablespace */ @@ -2715,7 +2764,7 @@ row_merge_build_indexes( ulint block_size; ulint i; ulint error; - int tmpfd; + int tmpfd = -1; ulint merge_sort_block_size; void* block_mem; @@ -2741,13 +2790,31 @@ row_merge_build_indexes( i * merge_sort_block_size); } + /* Initialize all the merge file descriptors, so that we + don't call row_merge_file_destroy() on uninitialized + merge file descriptor */ + + for (i = 0; i < n_indexes; i++) { + merge_files[i].fd = -1; + } + for (i = 0; i < n_indexes; i++) { - row_merge_file_create(&merge_files[i]); + if (row_merge_file_create(&merge_files[i]) < 0) + { + error = DB_OUT_OF_MEMORY; + goto func_exit; + } } tmpfd = row_merge_file_create_low(); + if (tmpfd < 0) + { + error = DB_OUT_OF_MEMORY; + goto func_exit; + } + /* Reset the MySQL row buffer that is used when reporting duplicate keys. */ innobase_rec_reset(table); diff --git a/storage/xtradb/row/row0mysql.c b/storage/xtradb/row/row0mysql.c index 9ab85940760..3a18cfc679e 100644 --- a/storage/xtradb/row/row0mysql.c +++ b/storage/xtradb/row/row0mysql.c @@ -1879,7 +1879,8 @@ Creates a table for MySQL. If the name of the table ends in one of "innodb_monitor", "innodb_lock_monitor", "innodb_tablespace_monitor", "innodb_table_monitor", then this will also start the printing of monitor output by the master thread. If the table name ends in "innodb_mem_validate", -InnoDB will try to invoke mem_validate(). +InnoDB will try to invoke mem_validate(). On failure the transaction will +be rolled back and the 'table' object will be freed. @return error code or DB_SUCCESS */ UNIV_INTERN int @@ -2017,6 +2018,8 @@ err_exit: row_drop_table_for_mysql(table->name, trx, FALSE); trx_commit_for_mysql(trx); + } else { + dict_mem_table_free(table); } break; @@ -4270,6 +4273,13 @@ end: trx->error_state = DB_SUCCESS; trx_general_rollback_for_mysql(trx, NULL); trx->error_state = DB_SUCCESS; + } else { + if (old_is_tmp && !new_is_tmp) { + /* After ALTER TABLE the table statistics + needs to be rebuilt. It will be rebuilt + when the table is loaded again. */ + table->stat_initialized = FALSE; + } } } diff --git a/storage/xtradb/row/row0sel.c b/storage/xtradb/row/row0sel.c index ec3603f2550..858d50fd5a6 100644 --- a/storage/xtradb/row/row0sel.c +++ b/storage/xtradb/row/row0sel.c @@ -2489,6 +2489,9 @@ row_sel_convert_mysql_key_to_innobase( dfield++; } + DBUG_EXECUTE_IF("innodb_srch_key_buffer_full", + ut_a(buf == (original_buf + buf_len));); + ut_a(buf <= original_buf + buf_len); /* We set the length of tuple to n_fields: we assume that the memory @@ -3641,13 +3644,13 @@ row_search_for_mysql( should_release = 0; for (i = 0; i < btr_search_index_num; i++) { /* we should check all latches (fix Bug#791030) */ - if (rw_lock_get_writer(btr_search_latch_part[i]) - != RW_LOCK_NOT_LOCKED) { + if (UNIV_UNLIKELY(rw_lock_get_writer(btr_search_latch_part[i]) + != RW_LOCK_NOT_LOCKED)) { should_release |= ((ulint)1 << i); } } - if (should_release) { + if (UNIV_UNLIKELY(should_release)) { /* There is an x-latch request on the adaptive hash index: release the s-latch to reduce starvation and wait for @@ -4124,6 +4127,11 @@ wait_table_again: } rec_loop: + if (trx_is_interrupted(trx)) { + err = DB_INTERRUPTED; + goto normal_return; + } + /*-------------------------------------------------------------*/ /* PHASE 4: Look for matching records in a loop */ @@ -5118,11 +5126,15 @@ row_search_autoinc_read_column( rec_offs_init(offsets_); - offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap); + offsets = rec_get_offsets(rec, index, offsets, col_no + 1, &heap); - data = rec_get_nth_field(rec, offsets, col_no, &len); + if (rec_offs_nth_sql_null(offsets, col_no)) { + /* There is no non-NULL value in the auto-increment column. */ + value = 0; + goto func_exit; + } - ut_a(len != UNIV_SQL_NULL); + data = rec_get_nth_field(rec, offsets, col_no, &len); switch (mtype) { case DATA_INT: @@ -5144,14 +5156,15 @@ row_search_autoinc_read_column( ut_error; } - if (UNIV_LIKELY_NULL(heap)) { - mem_heap_free(heap); - } - if (!unsigned_type && (ib_int64_t) value < 0) { value = 0; } +func_exit: + if (UNIV_LIKELY_NULL(heap)) { + mem_heap_free(heap); + } + return(value); } diff --git a/storage/xtradb/row/row0umod.c b/storage/xtradb/row/row0umod.c index 9597c476125..3c933c87b27 100644 --- a/storage/xtradb/row/row0umod.c +++ b/storage/xtradb/row/row0umod.c @@ -69,36 +69,6 @@ If you make a change in this module make sure that no codepath is introduced where a call to log_free_check() is bypassed. */ /***********************************************************//** -Checks if also the previous version of the clustered index record was -modified or inserted by the same transaction, and its undo number is such -that it should be undone in the same rollback. -@return TRUE if also previous modify or insert of this row should be undone */ -static -ibool -row_undo_mod_undo_also_prev_vers( -/*=============================*/ - undo_node_t* node, /*!< in: row undo node */ - undo_no_t* undo_no)/*!< out: the undo number */ -{ - trx_undo_rec_t* undo_rec; - trx_t* trx; - - trx = node->trx; - - if (node->new_trx_id != trx->id) { - - *undo_no = 0; - return(FALSE); - } - - undo_rec = trx_undo_get_undo_rec_low(node->new_roll_ptr, node->heap); - - *undo_no = trx_undo_rec_get_undo_no(undo_rec); - - return(trx->roll_limit <= *undo_no); -} - -/***********************************************************//** Undoes a modify in a clustered index record. @return DB_SUCCESS, DB_FAIL, or error code: we may run out of file space */ static @@ -226,19 +196,11 @@ row_undo_mod_clust( btr_pcur_t* pcur; mtr_t mtr; ulint err; - ibool success; - ibool more_vers; - undo_no_t new_undo_no; ut_ad(node && thr); log_free_check(); - /* Check if also the previous version of the clustered index record - should be undone in this same rollback operation */ - - more_vers = row_undo_mod_undo_also_prev_vers(node, &new_undo_no); - pcur = &(node->pcur); mtr_start(&mtr); @@ -286,20 +248,6 @@ row_undo_mod_clust( trx_undo_rec_release(node->trx, node->undo_no); - if (more_vers && err == DB_SUCCESS) { - - /* Reserve the undo log record to the prior version after - committing &mtr: this is necessary to comply with the latching - order, as &mtr may contain the fsp latch which is lower in - the latch hierarchy than trx->undo_mutex. */ - - success = trx_undo_rec_reserve(node->trx, new_undo_no); - - if (success) { - node->state = UNDO_NODE_PREV_VERS; - } - } - return(err); } @@ -571,6 +519,7 @@ row_undo_mod_upd_del_sec( ulint err = DB_SUCCESS; ut_ad(node->rec_type == TRX_UNDO_UPD_DEL_REC); + ut_ad(!node->undo_row); heap = mem_heap_create(1024); while (node->index != NULL) { @@ -632,6 +581,8 @@ row_undo_mod_del_mark_sec( dict_index_t* index; ulint err; + ut_ad(!node->undo_row); + heap = mem_heap_create(1024); while (node->index != NULL) { @@ -847,7 +798,6 @@ row_undo_mod_parse_undo_rec( trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id, roll_ptr, info_bits, trx, node->heap, &(node->update)); - node->new_roll_ptr = roll_ptr; node->new_trx_id = trx_id; node->cmpl_info = cmpl_info; } diff --git a/storage/xtradb/row/row0undo.c b/storage/xtradb/row/row0undo.c index 09970b7fe21..74fc1baf1d2 100644 --- a/storage/xtradb/row/row0undo.c +++ b/storage/xtradb/row/row0undo.c @@ -216,7 +216,7 @@ row_undo_search_clust_to_pcur( node->row = row_build(ROW_COPY_DATA, clust_index, rec, offsets, NULL, ext, node->heap); - if (node->update) { + if (node->rec_type == TRX_UNDO_UPD_EXIST_REC) { node->undo_row = dtuple_copy(node->row, node->heap); row_upd_replace(node->undo_row, &node->undo_ext, clust_index, node->update, node->heap); @@ -282,25 +282,6 @@ row_undo( } else { node->state = UNDO_NODE_MODIFY; } - - } else if (node->state == UNDO_NODE_PREV_VERS) { - - /* Undo should be done to the same clustered index record - again in this same rollback, restoring the previous version */ - - roll_ptr = node->new_roll_ptr; - - node->undo_rec = trx_undo_get_undo_rec_low(roll_ptr, - node->heap); - node->roll_ptr = roll_ptr; - node->undo_no = trx_undo_rec_get_undo_no(node->undo_rec); - - if (trx_undo_roll_ptr_is_insert(roll_ptr)) { - - node->state = UNDO_NODE_INSERT; - } else { - node->state = UNDO_NODE_MODIFY; - } } /* Prevent DROP TABLE etc. while we are rolling back this row. diff --git a/storage/xtradb/srv/srv0srv.c b/storage/xtradb/srv/srv0srv.c index 6e210071746..1de5523f62c 100644 --- a/storage/xtradb/srv/srv0srv.c +++ b/storage/xtradb/srv/srv0srv.c @@ -58,6 +58,8 @@ Created 10/8/1995 Heikki Tuuri *******************************************************/ /* Dummy comment */ +#include "m_string.h" /* for my_sys.h */ +#include "my_sys.h" /* DEBUG_SYNC_C */ #include "srv0srv.h" #include "ut0mem.h" @@ -181,7 +183,7 @@ UNIV_INTERN my_bool srv_track_changed_pages = TRUE; UNIV_INTERN ib_uint64_t srv_max_bitmap_file_size = 100 * 1024 * 1024; -UNIV_INTERN ulonglong srv_changed_pages_limit = 0; +UNIV_INTERN ulonglong srv_max_changed_pages = 0; /** When TRUE, fake change transcations take S rather than X row locks. When FALSE, row locks are not taken at all. */ @@ -312,58 +314,11 @@ UNIV_INTERN ulong srv_purge_batch_size = 20; /* the number of rollback segments to use */ UNIV_INTERN ulong srv_rollback_segments = TRX_SYS_N_RSEGS; -/* variable counts amount of data read in total (in bytes) */ -UNIV_INTERN ulint srv_data_read = 0; - /* Internal setting for "innodb_stats_method". Decides how InnoDB treats NULL value when collecting statistics. By default, it is set to SRV_STATS_NULLS_EQUAL(0), ie. all NULL value are treated equal */ ulong srv_innodb_stats_method = SRV_STATS_NULLS_EQUAL; -/* here we count the amount of data written in total (in bytes) */ -UNIV_INTERN ulint srv_data_written = 0; - -/* the number of the log write requests done */ -UNIV_INTERN ulint srv_log_write_requests = 0; - -/* the number of physical writes to the log performed */ -UNIV_INTERN ulint srv_log_writes = 0; - -/* amount of data written to the log files in bytes */ -UNIV_INTERN ulint srv_os_log_written = 0; - -/* amount of writes being done to the log files */ -UNIV_INTERN ulint srv_os_log_pending_writes = 0; - -/* we increase this counter, when there we don't have enough space in the -log buffer and have to flush it */ -UNIV_INTERN ulint srv_log_waits = 0; - -/* this variable counts the amount of times, when the doublewrite buffer -was flushed */ -UNIV_INTERN ulint srv_dblwr_writes = 0; - -/* here we store the number of pages that have been flushed to the -doublewrite buffer */ -UNIV_INTERN ulint srv_dblwr_pages_written = 0; - -/* in this variable we store the number of write requests issued */ -UNIV_INTERN ulint srv_buf_pool_write_requests = 0; - -/* here we store the number of times when we had to wait for a free page -in the buffer pool. It happens when the buffer pool is full and we need -to make a flush, in order to be able to read or create a page. */ -UNIV_INTERN ulint srv_buf_pool_wait_free = 0; - -/* variable to count the number of pages that were written from buffer -pool to the disk */ -UNIV_INTERN ulint srv_buf_pool_flushed = 0; -UNIV_INTERN ulint buf_lru_flush_page_count = 0; - -/** Number of buffer pool reads that led to the -reading of a disk page */ -UNIV_INTERN ulint srv_buf_pool_reads = 0; - /** Time in seconds between automatic buffer pool dumps */ UNIV_INTERN uint srv_auto_lru_dump = 0; @@ -406,6 +361,9 @@ UNIV_INTERN lint srv_conc_n_threads = 0; InnoDB */ UNIV_INTERN ulint srv_conc_n_waiting_threads = 0; +/* print all user-level transactions deadlocks to mysqld stderr */ +UNIV_INTERN my_bool srv_print_all_deadlocks = FALSE; + typedef struct srv_conc_slot_struct srv_conc_slot_t; struct srv_conc_slot_struct{ os_event_t event; /*!< event to wait */ @@ -489,23 +447,83 @@ UNIV_INTERN ibool srv_print_log_io = FALSE; UNIV_INTERN ibool srv_print_latch_waits = FALSE; #endif /* UNIV_DEBUG */ -UNIV_INTERN ulint srv_n_rows_inserted = 0; -UNIV_INTERN ulint srv_n_rows_updated = 0; -UNIV_INTERN ulint srv_n_rows_deleted = 0; -UNIV_INTERN ulint srv_n_rows_read = 0; - static ulint srv_n_rows_inserted_old = 0; static ulint srv_n_rows_updated_old = 0; static ulint srv_n_rows_deleted_old = 0; static ulint srv_n_rows_read_old = 0; -UNIV_INTERN ulint srv_n_lock_deadlock_count = 0; -UNIV_INTERN ulint srv_n_lock_wait_count = 0; -UNIV_INTERN ulint srv_n_lock_wait_current_count = 0; -UNIV_INTERN ib_int64_t srv_n_lock_wait_time = 0; -UNIV_INTERN ulint srv_n_lock_max_wait_time = 0; +/* Ensure counters are on separate cache lines */ + +#define CACHE_LINE_SIZE 64 +#define CACHE_ALIGNED __attribute__ ((aligned (CACHE_LINE_SIZE))) + +UNIV_INTERN byte +counters_pad_start[CACHE_LINE_SIZE] __attribute__((unused)) = {0}; + +UNIV_INTERN ulint srv_n_rows_inserted CACHE_ALIGNED = 0; +UNIV_INTERN ulint srv_n_rows_updated CACHE_ALIGNED = 0; +UNIV_INTERN ulint srv_n_rows_deleted CACHE_ALIGNED = 0; +UNIV_INTERN ulint srv_n_rows_read CACHE_ALIGNED = 0; + +UNIV_INTERN ulint srv_n_lock_deadlock_count CACHE_ALIGNED = 0; +UNIV_INTERN ulint srv_n_lock_wait_count CACHE_ALIGNED = 0; +UNIV_INTERN ulint srv_n_lock_wait_current_count CACHE_ALIGNED = 0; +UNIV_INTERN ib_int64_t srv_n_lock_wait_time CACHE_ALIGNED = 0; +UNIV_INTERN ulint srv_n_lock_max_wait_time CACHE_ALIGNED = 0; + +UNIV_INTERN ulint srv_truncated_status_writes CACHE_ALIGNED = 0; + +/* variable counts amount of data read in total (in bytes) */ +UNIV_INTERN ulint srv_data_read CACHE_ALIGNED = 0; + +/* here we count the amount of data written in total (in bytes) */ +UNIV_INTERN ulint srv_data_written CACHE_ALIGNED = 0; + +/* the number of the log write requests done */ +UNIV_INTERN ulint srv_log_write_requests CACHE_ALIGNED = 0; + +/* the number of physical writes to the log performed */ +UNIV_INTERN ulint srv_log_writes CACHE_ALIGNED = 0; + +/* amount of data written to the log files in bytes */ +UNIV_INTERN ulint srv_os_log_written CACHE_ALIGNED = 0; + +/* amount of writes being done to the log files */ +UNIV_INTERN ulint srv_os_log_pending_writes CACHE_ALIGNED = 0; + +/* we increase this counter, when there we don't have enough space in the +log buffer and have to flush it */ +UNIV_INTERN ulint srv_log_waits CACHE_ALIGNED = 0; + +/* this variable counts the amount of times, when the doublewrite buffer +was flushed */ +UNIV_INTERN ulint srv_dblwr_writes CACHE_ALIGNED = 0; + +/* here we store the number of pages that have been flushed to the +doublewrite buffer */ +UNIV_INTERN ulint srv_dblwr_pages_written CACHE_ALIGNED = 0; + +/* in this variable we store the number of write requests issued */ +UNIV_INTERN ulint srv_buf_pool_write_requests CACHE_ALIGNED = 0; + +/* here we store the number of times when we had to wait for a free page +in the buffer pool. It happens when the buffer pool is full and we need +to make a flush, in order to be able to read or create a page. */ +UNIV_INTERN ulint srv_buf_pool_wait_free CACHE_ALIGNED = 0; + +/** Number of buffer pool reads that led to the +reading of a disk page */ +UNIV_INTERN ulint srv_buf_pool_reads CACHE_ALIGNED = 0; -UNIV_INTERN ulint srv_truncated_status_writes = 0; +/* variable to count the number of pages that were written from buffer +pool to the disk */ +UNIV_INTERN ulint srv_buf_pool_flushed CACHE_ALIGNED = 0; + +/* variable to count the number of LRU flushed pages */ +UNIV_INTERN ulint buf_lru_flush_page_count CACHE_ALIGNED = 0; + +UNIV_INTERN byte +counters_pad_end[CACHE_LINE_SIZE] __attribute__((unused)) = {0}; /* Set the following to 0 if you want InnoDB to write messages on @@ -1438,7 +1456,7 @@ retry: ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch)); #endif /* UNIV_SYNC_DEBUG */ - if (innobase_get_slow_log() && trx->take_stats) { + if (UNIV_UNLIKELY(trx->take_stats)) { ut_usectime(&sec, &ms); start_time = (ib_uint64_t)sec * 1000000 + ms; } else { @@ -1453,7 +1471,7 @@ retry: trx->op_info = ""; - if (innobase_get_slow_log() && trx->take_stats && start_time) { + if (UNIV_UNLIKELY(start_time != 0)) { ut_usectime(&sec, &ms); finish_time = (ib_uint64_t)sec * 1000000 + ms; trx->innodb_que_wait_timer += (ulint)(finish_time - start_time); @@ -1764,6 +1782,10 @@ srv_suspend_mysql_thread( trx = thr_get_trx(thr); + if (trx->mysql_thd != 0) { + DEBUG_SYNC_C("srv_suspend_mysql_thread_enter"); + } + os_event_set(srv_lock_timeout_thread_event); mutex_enter(&kernel_mutex); @@ -2193,6 +2215,8 @@ srv_printf_innodb_monitor( (long) srv_conc_n_threads, (ulong) srv_conc_n_waiting_threads); + mutex_enter(&kernel_mutex); + fprintf(file, "%lu read views open inside InnoDB\n", UT_LIST_GET_LEN(trx_sys->view_list)); @@ -2206,6 +2230,8 @@ srv_printf_innodb_monitor( } } + mutex_exit(&kernel_mutex); + n_reserved = fil_space_get_n_reserved_extents(0); if (n_reserved > 0) { fprintf(file, @@ -2290,16 +2316,18 @@ void srv_export_innodb_status(void) /*==========================*/ { - buf_pool_stat_t stat; - ulint LRU_len; - ulint free_len; - ulint flush_list_len; - ulint mem_adaptive_hash, mem_dictionary; - read_view_t* oldest_view; - ulint i; + buf_pool_stat_t stat; + buf_pools_list_size_t buf_pools_list_size; + ulint LRU_len; + ulint free_len; + ulint flush_list_len; + ulint mem_adaptive_hash, mem_dictionary; + read_view_t* oldest_view; + ulint i; buf_get_total_stat(&stat); buf_get_total_list_len(&LRU_len, &free_len, &flush_list_len); + buf_get_total_list_size_in_bytes(&buf_pools_list_size); if (btr_search_sys && btr_search_sys->hash_index[0]->heap) { mem_adaptive_hash = mem_heap_get_size(btr_search_sys->hash_index[0]->heap); @@ -2364,7 +2392,12 @@ srv_export_innodb_status(void) export_vars.innodb_buffer_pool_read_ahead_evicted = stat.n_ra_pages_evicted; export_vars.innodb_buffer_pool_pages_data = LRU_len; + export_vars.innodb_buffer_pool_bytes_data = + buf_pools_list_size.LRU_bytes + + buf_pools_list_size.unzip_LRU_bytes; export_vars.innodb_buffer_pool_pages_dirty = flush_list_len; + export_vars.innodb_buffer_pool_bytes_dirty = + buf_pools_list_size.flush_list_bytes; export_vars.innodb_buffer_pool_pages_free = free_len; export_vars.innodb_deadlocks = srv_n_lock_deadlock_count; #ifdef UNIV_DEBUG @@ -2497,6 +2530,23 @@ srv_export_innodb_status(void) export_vars.innodb_rows_deleted = srv_n_rows_deleted; export_vars.innodb_truncated_status_writes = srv_truncated_status_writes; +#ifdef UNIV_DEBUG + if (trx_sys->max_trx_id < purge_sys->done_trx_no) { + export_vars.innodb_purge_trx_id_age = 0; + } else { + export_vars.innodb_purge_trx_id_age = + trx_sys->max_trx_id - purge_sys->done_trx_no; + } + + if (!purge_sys->view + || trx_sys->max_trx_id < purge_sys->view->up_limit_id) { + export_vars.innodb_purge_view_trx_id_age = 0; + } else { + export_vars.innodb_purge_view_trx_id_age = + trx_sys->max_trx_id - purge_sys->view->up_limit_id; + } +#endif /* UNIV_DEBUG */ + mutex_exit(&srv_innodb_monitor_mutex); } @@ -3080,11 +3130,19 @@ srv_redo_log_follow_thread( os_event_reset(srv_checkpoint_completed_event); if (srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE) { - log_online_follow_redo_log(); + if (!log_online_follow_redo_log()) { + /* TODO: sync with I_S log tracking status? */ + fprintf(stderr, + "InnoDB: Error: log tracking bitmap " + "write failed, stopping log tracking " + "thread!\n"); + break; + } } } while (srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE); + srv_track_changed_pages = FALSE; log_online_read_shutdown(); os_event_set(srv_redo_log_thread_finished_event); @@ -3329,6 +3387,26 @@ loop: for (i = 0; i < 10; i++) { ulint cur_time = ut_time_ms(); +#ifdef UNIV_DEBUG + if (btr_cur_limit_optimistic_insert_debug + && srv_n_purge_threads == 0) { + /* If btr_cur_limit_optimistic_insert_debug is enabled + and no purge_threads, purge opportunity is increased + by x100 (1purge/100msec), to speed up debug scripts + which should wait for purged. */ + next_itr_time -= 900; + + srv_main_thread_op_info = "master purging"; + + srv_master_do_purge(); + + if (srv_fast_shutdown && srv_shutdown_state > 0) { + + goto background_loop; + } + } +#endif /* UNIV_DEBUG */ + n_pages_flushed = 0; /* initialize */ /* ALTER TABLE in MySQL requires on Unix that the table handler @@ -3487,8 +3565,7 @@ loop: buf_pool = buf_pool_from_array(j); - /* The scanning flush_list is optimistic here */ - + buf_flush_list_mutex_enter(buf_pool); level = 0; n_blocks = 0; bpage = UT_LIST_GET_FIRST(buf_pool->flush_list); @@ -3502,6 +3579,7 @@ loop: bpage = UT_LIST_GET_NEXT(flush_list, bpage); n_blocks++; } + buf_flush_list_mutex_exit(buf_pool); if (level) { bpl += ((ib_uint64_t) n_blocks * n_blocks @@ -3567,30 +3645,25 @@ retry_flush_batch: /* prev_flush_info[j] should be the previous loop's */ for (j = 0; j < srv_buf_pool_instances; j++) { - lint blocks_num, new_blocks_num, flushed_blocks_num; - ibool found; + lint blocks_num, new_blocks_num = 0; + lint flushed_blocks_num; buf_pool = buf_pool_from_array(j); + buf_flush_list_mutex_enter(buf_pool); blocks_num = UT_LIST_GET_LEN(buf_pool->flush_list); bpage = UT_LIST_GET_FIRST(buf_pool->flush_list); - new_blocks_num = 0; - found = FALSE; while (bpage != NULL) { if (prev_flush_info[j].space == bpage->space && prev_flush_info[j].offset == bpage->offset && prev_flush_info[j].oldest_modification == bpage->oldest_modification) { - found = TRUE; break; } bpage = UT_LIST_GET_NEXT(flush_list, bpage); new_blocks_num++; } - if (!found) { - new_blocks_num = blocks_num; - } flushed_blocks_num = new_blocks_num + prev_flush_info[j].count - blocks_num; @@ -3605,7 +3678,9 @@ retry_flush_batch: prev_flush_info[j].space = bpage->space; prev_flush_info[j].offset = bpage->offset; prev_flush_info[j].oldest_modification = bpage->oldest_modification; + buf_flush_list_mutex_exit(buf_pool); } else { + buf_flush_list_mutex_exit(buf_pool); prev_flush_info[j].space = 0; prev_flush_info[j].offset = 0; prev_flush_info[j].oldest_modification = 0; @@ -3631,6 +3706,7 @@ retry_flush_batch: /* store previous first pages of the flush_list */ for (j = 0; j < srv_buf_pool_instances; j++) { buf_pool = buf_pool_from_array(j); + buf_flush_list_mutex_enter(buf_pool); bpage = UT_LIST_GET_FIRST(buf_pool->flush_list); @@ -3639,7 +3715,9 @@ retry_flush_batch: prev_flush_info[j].space = bpage->space; prev_flush_info[j].offset = bpage->offset; prev_flush_info[j].oldest_modification = bpage->oldest_modification; + buf_flush_list_mutex_exit(buf_pool); } else { + buf_flush_list_mutex_exit(buf_pool); prev_flush_info[j].space = 0; prev_flush_info[j].offset = 0; prev_flush_info[j].oldest_modification = 0; diff --git a/storage/xtradb/srv/srv0start.c b/storage/xtradb/srv/srv0start.c index 2faa68cb87c..9e0477253cd 100644 --- a/storage/xtradb/srv/srv0start.c +++ b/storage/xtradb/srv/srv0start.c @@ -1155,6 +1155,11 @@ void init_log_online(void) /*=================*/ { + if (UNIV_UNLIKELY(srv_force_recovery > 0)) { + srv_track_changed_pages = FALSE; + return; + } + if (srv_track_changed_pages) { log_online_read_init(); diff --git a/storage/xtradb/trx/trx0purge.c b/storage/xtradb/trx/trx0purge.c index 122aab119ba..b048dc66efe 100644 --- a/storage/xtradb/trx/trx0purge.c +++ b/storage/xtradb/trx/trx0purge.c @@ -61,6 +61,10 @@ UNIV_INTERN mysql_pfs_key_t trx_purge_latch_key; UNIV_INTERN mysql_pfs_key_t purge_sys_bh_mutex_key; #endif /* UNIV_PFS_MUTEX */ +#ifdef UNIV_DEBUG +UNIV_INTERN my_bool srv_purge_view_update_only_debug; +#endif /* UNIV_DEBUG */ + /*****************************************************************//** Checks if trx_id is >= purge_view: then it is guaranteed that its update undo log still exists in the system. @@ -236,6 +240,7 @@ trx_purge_sys_create( purge_sys->purge_trx_no = 0; purge_sys->purge_undo_no = 0; purge_sys->next_stored = FALSE; + ut_d(purge_sys->done_trx_no = 0); rw_lock_create(trx_purge_latch_key, &purge_sys->latch, SYNC_PURGE_LATCH); @@ -656,6 +661,12 @@ trx_purge_truncate_if_arr_empty(void) { static ulint count; +#ifdef UNIV_DEBUG + if (purge_sys->arr->n_used == 0) { + purge_sys->done_trx_no = purge_sys->purge_trx_no; + } +#endif /* UNIV_DEBUG */ + if (!(++count % TRX_SYS_N_RSEGS) && purge_sys->arr->n_used == 0) { trx_purge_truncate_history(); @@ -1172,6 +1183,12 @@ trx_purge( rw_lock_x_unlock(&(purge_sys->latch)); +#ifdef UNIV_DEBUG + if (srv_purge_view_update_only_debug) { + return(0); + } +#endif + purge_sys->state = TRX_PURGE_ON; purge_sys->handle_limit = purge_sys->n_pages_handled + limit; diff --git a/storage/xtradb/trx/trx0rec.c b/storage/xtradb/trx/trx0rec.c index db4897c368d..ef42152aeb7 100644 --- a/storage/xtradb/trx/trx0rec.c +++ b/storage/xtradb/trx/trx0rec.c @@ -36,6 +36,7 @@ Created 3/26/1996 Heikki Tuuri #ifndef UNIV_HOTBACKUP #include "dict0dict.h" #include "ut0mem.h" +#include "read0read.h" #include "row0ext.h" #include "row0upd.h" #include "que0que.h" @@ -1647,6 +1648,25 @@ trx_undo_prev_version_build( if (row_upd_changes_field_size_or_external(index, offsets, update)) { ulint n_ext; + /* We should confirm the existence of disowned external data, + if the previous version record is delete marked. If the trx_id + of the previous record is seen by purge view, we should treat + it as missing history, because the disowned external data + might be purged already. + + The inherited external data (BLOBs) can be freed (purged) + after trx_id was committed, provided that no view was started + before trx_id. If the purge view can see the committed + delete-marked record by trx_id, no transactions need to access + the BLOB. */ + + if ((update->info_bits & REC_INFO_DELETED_FLAG) + && read_view_sees_trx_id(purge_sys->view, trx_id)) { + /* treat as a fresh insert, not to + cause assertion error at the caller. */ + return(DB_SUCCESS); + } + /* We have to set the appropriate extern storage bits in the old version of the record: the extern bits in rec for those fields that update does NOT update, as well as the bits for diff --git a/storage/xtradb/trx/trx0trx.c b/storage/xtradb/trx/trx0trx.c index 99b4276fbee..a17f8abdad0 100644 --- a/storage/xtradb/trx/trx0trx.c +++ b/storage/xtradb/trx/trx0trx.c @@ -235,7 +235,7 @@ trx_allocate_for_mysql(void) mutex_exit(&kernel_mutex); - if (innobase_get_slow_log() && trx->take_stats) { + if (UNIV_UNLIKELY(trx->take_stats)) { trx->distinct_page_access_hash = mem_alloc(DPAH_SIZE); memset(trx->distinct_page_access_hash, 0, DPAH_SIZE); } @@ -1269,7 +1269,7 @@ trx_end_lock_wait( thr = UT_LIST_GET_FIRST(trx->wait_thrs); } - if (innobase_get_slow_log() && trx->take_stats) { + if (UNIV_UNLIKELY(trx->take_stats)) { ut_usectime(&sec, &ms); now = (ib_uint64_t)sec * 1000000 + ms; trx->lock_que_wait_timer += (ulint)(now - trx->lock_que_wait_ustarted); @@ -1304,7 +1304,7 @@ trx_lock_wait_to_suspended( thr = UT_LIST_GET_FIRST(trx->wait_thrs); } - if (innobase_get_slow_log() && trx->take_stats) { + if (UNIV_UNLIKELY(trx->take_stats)) { ut_usectime(&sec, &ms); now = (ib_uint64_t)sec * 1000000 + ms; trx->lock_que_wait_timer += (ulint)(now - trx->lock_que_wait_ustarted); diff --git a/strings/decimal.c b/strings/decimal.c index f318a234d3f..3245f224b44 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1445,7 +1445,9 @@ int decimal_bin_size(int precision, int scale) intg0=intg/DIG_PER_DEC1, frac0=scale/DIG_PER_DEC1, intg0x=intg-intg0*DIG_PER_DEC1, frac0x=scale-frac0*DIG_PER_DEC1; - DBUG_ASSERT(scale >= 0 && precision > 0 && scale <= precision); + DBUG_ASSERT(scale >= 0); + DBUG_ASSERT(precision > 0); + DBUG_ASSERT(scale <= precision); return intg0*sizeof(dec1)+dig2bytes[intg0x]+ frac0*sizeof(dec1)+dig2bytes[frac0x]; } diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 2d629c766e8..bac22fc96a9 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -370,7 +370,6 @@ For a description of MySQL see the base MySQL RPM or http://www.mysql.com/ Summary: MySQL - Shared libraries Group: Applications/Databases Provides: MySQL-shared -Conflicts: mysql-libs mysql-libs-advanced Obsoletes: MySQL-shared-standard MySQL-shared-pro Obsoletes: MySQL-shared-pro-cert MySQL-shared-pro-gpl Obsoletes: MySQL-shared-pro-gpl-cert MySQL-shared diff --git a/support-files/rpm/server-postin.sh b/support-files/rpm/server-postin.sh index 156865b61ad..b5ba10bd265 100644 --- a/support-files/rpm/server-postin.sh +++ b/support-files/rpm/server-postin.sh @@ -5,41 +5,46 @@ if [ $1 = 1 ] ; then /sbin/chkconfig --add mysql fi - mysql_dirs=(`%{_sbindir}/mysqld --verbose --help 2>/dev/null|sed -ne 's/^\(basedir\|datadir\)[[:space:]]*\(.*\)$/\2/p'`) - basedir="${mysql_dirs[0]}" - datadir="${mysql_dirs[1]}" - # datadir may be relative to a basedir! - if expr $datadir : / > /dev/null; then - mysql_datadir=$datadir + basedir=`%{_bindir}/my_print_defaults --mysqld|sed -ne 's/^--basedir=//p'|tail -1` + if [ -z "$basedir" ] ; then + basedir=%{mysqlbasedir} + fi + + datadir=`%{_bindir}/my_print_defaults --mysqld|sed -ne 's/^--datadir=//p'|tail -1` + if [ -z "$datadir" ] ; then + datadir=%{mysqldatadir} else - mysql_datadir=$basedir/$datadir + # datadir may be relative to a basedir! + if ! expr $datadir : / > /dev/null; then + datadir=$basedir/$datadir + fi fi # Create a MySQL user and group. Do not report any problems if it already # exists. groupadd -r %{mysqld_group} 2> /dev/null || true - useradd -M -r -d $mysql_datadir -s /bin/bash -c "MySQL server" -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true + useradd -M -r -d $datadir -s /bin/bash -c "MySQL server" -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true # The user may already exist, make sure it has the proper group nevertheless (BUG#12823) usermod -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true # Change permissions so that the user that will run the MySQL daemon # owns all database files. - chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir + chown -R %{mysqld_user}:%{mysqld_group} $datadir - if [ ! -e $mysql_datadir ]; then + if [ ! -e $datadir ]; then # Create data directory - mkdir -p $mysql_datadir/{mysql,test} + mkdir -p $datadir/{mysql,test} # Initiate databases %{_bindir}/mysql_install_db --rpm --user=%{mysqld_user} fi # Change permissions again to fix any new files. - chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir + chown -R %{mysqld_user}:%{mysqld_group} $datadir # Fix permissions for the permission database so that only the user # can read them. - chmod -R og-rw $mysql_datadir/mysql + chmod -R og-rw $datadir/mysql fi # install SELinux files - but don't override existing ones |