mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
System Versioning 1.0 pre3
Merge branch '10.3' into trunk
This commit is contained in:
1
VERSION
1
VERSION
@ -1,3 +1,4 @@
|
|||||||
MYSQL_VERSION_MAJOR=10
|
MYSQL_VERSION_MAJOR=10
|
||||||
MYSQL_VERSION_MINOR=3
|
MYSQL_VERSION_MINOR=3
|
||||||
MYSQL_VERSION_PATCH=3
|
MYSQL_VERSION_PATCH=3
|
||||||
|
SERVER_MATURITY=beta
|
||||||
|
@ -2955,10 +2955,11 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
if (!argc || opt_version)
|
if (!argc || opt_version)
|
||||||
{
|
{
|
||||||
if (!argc)
|
|
||||||
usage();
|
|
||||||
if (!opt_version)
|
if (!opt_version)
|
||||||
|
{
|
||||||
|
usage();
|
||||||
retval= ERROR_STOP;
|
retval= ERROR_STOP;
|
||||||
|
}
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,8 @@ MACRO(CHECK_DTRACE)
|
|||||||
# On FreeBSD, dtrace does not handle userland tracing yet
|
# On FreeBSD, dtrace does not handle userland tracing yet
|
||||||
IF(DTRACE AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD"
|
IF(DTRACE AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD"
|
||||||
AND NOT BUGGY_GCC_NO_DTRACE_MODULES
|
AND NOT BUGGY_GCC_NO_DTRACE_MODULES
|
||||||
AND NOT BUGGY_LINUX_DTRACE)
|
AND NOT BUGGY_LINUX_DTRACE
|
||||||
|
AND NOT CMAKE_SYSTEM_NAME MATCHES "SunOS")
|
||||||
SET(ENABLE_DTRACE ON CACHE BOOL "Enable dtrace")
|
SET(ENABLE_DTRACE ON CACHE BOOL "Enable dtrace")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
SET(HAVE_DTRACE ${ENABLE_DTRACE})
|
SET(HAVE_DTRACE ${ENABLE_DTRACE})
|
||||||
|
@ -48,6 +48,7 @@ MACRO(GET_MYSQL_VERSION)
|
|||||||
MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_MINOR" MINOR_VERSION)
|
MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_MINOR" MINOR_VERSION)
|
||||||
MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_PATCH" PATCH_VERSION)
|
MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_PATCH" PATCH_VERSION)
|
||||||
MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_EXTRA" EXTRA_VERSION)
|
MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_EXTRA" EXTRA_VERSION)
|
||||||
|
MYSQL_GET_CONFIG_VALUE("SERVER_MATURITY" SERVER_MATURITY)
|
||||||
|
|
||||||
IF(NOT "${MAJOR_VERSION}" MATCHES "[0-9]+" OR
|
IF(NOT "${MAJOR_VERSION}" MATCHES "[0-9]+" OR
|
||||||
NOT "${MINOR_VERSION}" MATCHES "[0-9]+" OR
|
NOT "${MINOR_VERSION}" MATCHES "[0-9]+" OR
|
||||||
@ -69,6 +70,10 @@ ENDMACRO()
|
|||||||
# Get mysql version and other interesting variables
|
# Get mysql version and other interesting variables
|
||||||
GET_MYSQL_VERSION()
|
GET_MYSQL_VERSION()
|
||||||
|
|
||||||
|
# Maturity level
|
||||||
|
string(TOUPPER ${SERVER_MATURITY} SERVER_MATURITY)
|
||||||
|
SET(SERVER_MATURITY_LEVEL MariaDB_PLUGIN_MATURITY_${SERVER_MATURITY})
|
||||||
|
|
||||||
SET(MYSQL_TCP_PORT_DEFAULT 0)
|
SET(MYSQL_TCP_PORT_DEFAULT 0)
|
||||||
IF(NOT MYSQL_TCP_PORT)
|
IF(NOT MYSQL_TCP_PORT)
|
||||||
SET(MYSQL_TCP_PORT 3306)
|
SET(MYSQL_TCP_PORT 3306)
|
||||||
|
@ -26,7 +26,7 @@ ENDIF()
|
|||||||
OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" ${with_wsrep_default})
|
OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" ${with_wsrep_default})
|
||||||
|
|
||||||
# Set the patch version
|
# Set the patch version
|
||||||
SET(WSREP_PATCH_VERSION "20")
|
SET(WSREP_PATCH_VERSION "21")
|
||||||
|
|
||||||
# Obtain wsrep API version
|
# Obtain wsrep API version
|
||||||
FILE(STRINGS "${MySQL_SOURCE_DIR}/wsrep/wsrep_api.h" WSREP_API_VERSION
|
FILE(STRINGS "${MySQL_SOURCE_DIR}/wsrep/wsrep_api.h" WSREP_API_VERSION
|
||||||
|
@ -191,7 +191,6 @@
|
|||||||
#cmakedefine HAVE_PREAD 1
|
#cmakedefine HAVE_PREAD 1
|
||||||
#cmakedefine HAVE_PAUSE_INSTRUCTION 1
|
#cmakedefine HAVE_PAUSE_INSTRUCTION 1
|
||||||
#cmakedefine HAVE_FAKE_PAUSE_INSTRUCTION 1
|
#cmakedefine HAVE_FAKE_PAUSE_INSTRUCTION 1
|
||||||
#cmakedefine HAVE_HMT_PRIORITY_INSTRUCTION 1
|
|
||||||
#cmakedefine HAVE_RDTSCLL 1
|
#cmakedefine HAVE_RDTSCLL 1
|
||||||
#cmakedefine HAVE_READ_REAL_TIME 1
|
#cmakedefine HAVE_READ_REAL_TIME 1
|
||||||
#cmakedefine HAVE_PTHREAD_ATTR_CREATE 1
|
#cmakedefine HAVE_PTHREAD_ATTR_CREATE 1
|
||||||
|
@ -792,17 +792,6 @@ IF(NOT CMAKE_CROSSCOMPILING AND NOT MSVC)
|
|||||||
}
|
}
|
||||||
" HAVE_FAKE_PAUSE_INSTRUCTION)
|
" HAVE_FAKE_PAUSE_INSTRUCTION)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
IF (NOT HAVE_PAUSE_INSTRUCTION)
|
|
||||||
CHECK_C_SOURCE_COMPILES("
|
|
||||||
#include <sys/platform/ppc.h>
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
__ppc_set_ppr_low();
|
|
||||||
__ppc_set_ppr_med();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
" HAVE_HMT_PRIORITY_INSTRUCTION)
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
CHECK_SYMBOL_EXISTS(tcgetattr "termios.h" HAVE_TCGETATTR 1)
|
CHECK_SYMBOL_EXISTS(tcgetattr "termios.h" HAVE_TCGETATTR 1)
|
||||||
|
@ -252,9 +252,8 @@ datadir_iter_next_database(datadir_iter_t *it)
|
|||||||
it->dbpath = static_cast<char*>(
|
it->dbpath = static_cast<char*>(
|
||||||
malloc(it->dbpath_len));
|
malloc(it->dbpath_len));
|
||||||
}
|
}
|
||||||
ut_snprintf(it->dbpath, it->dbpath_len,
|
snprintf(it->dbpath, it->dbpath_len, "%s/%s",
|
||||||
"%s/%s", it->datadir_path,
|
it->datadir_path, it->dbinfo.name);
|
||||||
it->dbinfo.name);
|
|
||||||
os_normalize_path(it->dbpath);
|
os_normalize_path(it->dbpath);
|
||||||
|
|
||||||
if (it->dbinfo.type == OS_FILE_TYPE_FILE) {
|
if (it->dbinfo.type == OS_FILE_TYPE_FILE) {
|
||||||
@ -1034,8 +1033,8 @@ move_file(ds_ctxt_t *datasink,
|
|||||||
char dst_dir_abs[FN_REFLEN];
|
char dst_dir_abs[FN_REFLEN];
|
||||||
size_t dirname_length;
|
size_t dirname_length;
|
||||||
|
|
||||||
ut_snprintf(dst_file_path_abs, sizeof(dst_file_path_abs),
|
snprintf(dst_file_path_abs, sizeof(dst_file_path_abs),
|
||||||
"%s/%s", dst_dir, dst_file_path);
|
"%s/%s", dst_dir, dst_file_path);
|
||||||
|
|
||||||
dirname_part(dst_dir_abs, dst_file_path_abs, &dirname_length);
|
dirname_part(dst_dir_abs, dst_file_path_abs, &dirname_length);
|
||||||
|
|
||||||
@ -1252,8 +1251,8 @@ backup_files(const char *from, bool prep_mode)
|
|||||||
} else if (!prep_mode) {
|
} else if (!prep_mode) {
|
||||||
/* backup fake file into empty directory */
|
/* backup fake file into empty directory */
|
||||||
char path[FN_REFLEN];
|
char path[FN_REFLEN];
|
||||||
ut_snprintf(path, sizeof(path),
|
snprintf(path, sizeof(path),
|
||||||
"%s/db.opt", node.filepath);
|
"%s/db.opt", node.filepath);
|
||||||
if (!(ret = backup_file_printf(
|
if (!(ret = backup_file_printf(
|
||||||
trim_dotslash(path), "%s", ""))) {
|
trim_dotslash(path), "%s", ""))) {
|
||||||
msg("Failed to create file %s\n", path);
|
msg("Failed to create file %s\n", path);
|
||||||
|
@ -589,7 +589,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn)
|
|||||||
mysql_real_escape_string(mysql_connection, buf,
|
mysql_real_escape_string(mysql_connection, buf,
|
||||||
opt_incremental_history_name,
|
opt_incremental_history_name,
|
||||||
(unsigned long)strlen(opt_incremental_history_name));
|
(unsigned long)strlen(opt_incremental_history_name));
|
||||||
ut_snprintf(query, sizeof(query),
|
snprintf(query, sizeof(query),
|
||||||
"SELECT innodb_to_lsn "
|
"SELECT innodb_to_lsn "
|
||||||
"FROM PERCONA_SCHEMA.xtrabackup_history "
|
"FROM PERCONA_SCHEMA.xtrabackup_history "
|
||||||
"WHERE name = '%s' "
|
"WHERE name = '%s' "
|
||||||
@ -602,7 +602,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn)
|
|||||||
mysql_real_escape_string(mysql_connection, buf,
|
mysql_real_escape_string(mysql_connection, buf,
|
||||||
opt_incremental_history_uuid,
|
opt_incremental_history_uuid,
|
||||||
(unsigned long)strlen(opt_incremental_history_uuid));
|
(unsigned long)strlen(opt_incremental_history_uuid));
|
||||||
ut_snprintf(query, sizeof(query),
|
snprintf(query, sizeof(query),
|
||||||
"SELECT innodb_to_lsn "
|
"SELECT innodb_to_lsn "
|
||||||
"FROM PERCONA_SCHEMA.xtrabackup_history "
|
"FROM PERCONA_SCHEMA.xtrabackup_history "
|
||||||
"WHERE uuid = '%s' "
|
"WHERE uuid = '%s' "
|
||||||
@ -766,7 +766,7 @@ kill_long_queries(MYSQL *connection, time_t timeout)
|
|||||||
is_select_query(info))) {
|
is_select_query(info))) {
|
||||||
msg_ts("Killing query %s (duration %d sec): %s\n",
|
msg_ts("Killing query %s (duration %d sec): %s\n",
|
||||||
id, (int)duration, info);
|
id, (int)duration, info);
|
||||||
ut_snprintf(kill_stmt, sizeof(kill_stmt),
|
snprintf(kill_stmt, sizeof(kill_stmt),
|
||||||
"KILL %s", id);
|
"KILL %s", id);
|
||||||
xb_mysql_query(connection, kill_stmt, false, false);
|
xb_mysql_query(connection, kill_stmt, false, false);
|
||||||
}
|
}
|
||||||
@ -1288,8 +1288,8 @@ write_current_binlog_file(MYSQL *connection)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_snprintf(filepath, sizeof(filepath), "%s%c%s",
|
snprintf(filepath, sizeof(filepath), "%s%c%s",
|
||||||
log_bin_dir, FN_LIBCHAR, log_bin_file);
|
log_bin_dir, FN_LIBCHAR, log_bin_file);
|
||||||
result = copy_file(ds_data, filepath, log_bin_file, 0);
|
result = copy_file(ds_data, filepath, log_bin_file, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1574,8 +1574,8 @@ char *make_argv(char *buf, size_t len, int argc, char **argv)
|
|||||||
if (strncmp(*argv, "--password", strlen("--password")) == 0) {
|
if (strncmp(*argv, "--password", strlen("--password")) == 0) {
|
||||||
arg = "--password=...";
|
arg = "--password=...";
|
||||||
}
|
}
|
||||||
left-= ut_snprintf(buf + len - left, left,
|
left-= snprintf(buf + len - left, left,
|
||||||
"%s%c", arg, argc > 1 ? ' ' : 0);
|
"%s%c", arg, argc > 1 ? ' ' : 0);
|
||||||
++argv; --argc;
|
++argv; --argc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,7 +441,7 @@ log_online_open_bitmap_file_read_only(
|
|||||||
|
|
||||||
xb_ad(name[0] != '\0');
|
xb_ad(name[0] != '\0');
|
||||||
|
|
||||||
ut_snprintf(bitmap_file->name, FN_REFLEN, "%s%s", srv_data_home, name);
|
snprintf(bitmap_file->name, FN_REFLEN, "%s%s", srv_data_home, name);
|
||||||
bitmap_file->file = os_file_create_simple_no_error_handling(
|
bitmap_file->file = os_file_create_simple_no_error_handling(
|
||||||
0, bitmap_file->name,
|
0, bitmap_file->name,
|
||||||
OS_FILE_OPEN, OS_FILE_READ_ONLY, true, &success);
|
OS_FILE_OPEN, OS_FILE_READ_ONLY, true, &success);
|
||||||
|
@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|||||||
#include <mysql_version.h>
|
#include <mysql_version.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <my_sys.h>
|
||||||
|
|
||||||
|
|
||||||
# define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open)
|
# define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open)
|
||||||
|
@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
#if __GNUC__ >= 4 && defined(__x86_64__)
|
#if defined(__GNUC__) && defined(__x86_64__)
|
||||||
static int pclmul_enabled = 0;
|
static int pclmul_enabled = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -165,6 +165,7 @@ static void encryption_plugin_init(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
/* Patch optional and mandatory plugins, we only need to load the one in xb_plugin_load. */
|
/* Patch optional and mandatory plugins, we only need to load the one in xb_plugin_load. */
|
||||||
mysql_optional_plugins[0] = mysql_mandatory_plugins[0] = 0;
|
mysql_optional_plugins[0] = mysql_mandatory_plugins[0] = 0;
|
||||||
|
plugin_maturity = MariaDB_PLUGIN_MATURITY_UNKNOWN; /* mariabackup accepts all plugins */
|
||||||
msg("Loading encryption plugin\n");
|
msg("Loading encryption plugin\n");
|
||||||
for (int i= 1; i < argc; i++)
|
for (int i= 1; i < argc; i++)
|
||||||
msg("\t Encryption plugin parameter : '%s'\n", argv[i]);
|
msg("\t Encryption plugin parameter : '%s'\n", argv[i]);
|
||||||
|
@ -212,24 +212,7 @@ xb_fil_cur_open(
|
|||||||
|
|
||||||
posix_fadvise(cursor->file, 0, 0, POSIX_FADV_SEQUENTIAL);
|
posix_fadvise(cursor->file, 0, 0, POSIX_FADV_SEQUENTIAL);
|
||||||
|
|
||||||
/* Determine the page size */
|
const page_size_t page_size(cursor->node->space->flags);
|
||||||
ulint flags = xb_get_space_flags(cursor->file);
|
|
||||||
if (flags == ULINT_UNDEFINED) {
|
|
||||||
xb_fil_cur_close(cursor);
|
|
||||||
return(XB_FIL_CUR_SKIP);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fsp_flags_is_valid(flags, cursor->space_id)) {
|
|
||||||
ulint cflags = fsp_flags_convert_from_101(flags);
|
|
||||||
if (cflags == ULINT_UNDEFINED) {
|
|
||||||
msg("[%02u] mariabackup: Error: Invalid "
|
|
||||||
"tablespace flags: %x.\n", thread_n, uint(flags));
|
|
||||||
return(XB_FIL_CUR_SKIP);
|
|
||||||
}
|
|
||||||
flags = cflags;
|
|
||||||
}
|
|
||||||
|
|
||||||
const page_size_t page_size(flags);
|
|
||||||
cursor->page_size = page_size;
|
cursor->page_size = page_size;
|
||||||
|
|
||||||
/* Allocate read buffer */
|
/* Allocate read buffer */
|
||||||
|
@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|||||||
#include "write_filt.h"
|
#include "write_filt.h"
|
||||||
#include "fil_cur.h"
|
#include "fil_cur.h"
|
||||||
#include "xtrabackup.h"
|
#include "xtrabackup.h"
|
||||||
|
#include <os0proc.h>
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
Write-through page write filter. */
|
Write-through page write filter. */
|
||||||
@ -68,19 +69,22 @@ wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name,
|
|||||||
xb_fil_cur_t *cursor)
|
xb_fil_cur_t *cursor)
|
||||||
{
|
{
|
||||||
char meta_name[FN_REFLEN];
|
char meta_name[FN_REFLEN];
|
||||||
ulint buf_size;
|
|
||||||
xb_wf_incremental_ctxt_t *cp =
|
xb_wf_incremental_ctxt_t *cp =
|
||||||
&(ctxt->u.wf_incremental_ctxt);
|
&(ctxt->u.wf_incremental_ctxt);
|
||||||
|
|
||||||
ctxt->cursor = cursor;
|
ctxt->cursor = cursor;
|
||||||
|
|
||||||
/* allocate buffer for incremental backup (4096 pages) */
|
/* allocate buffer for incremental backup (4096 pages) */
|
||||||
buf_size = (cursor->page_size.physical() / 4 + 1)
|
cp->delta_buf_size = (cursor->page_size.physical() / 4)
|
||||||
* cursor->page_size.physical();
|
* cursor->page_size.physical();
|
||||||
cp->delta_buf_base = static_cast<byte *>(malloc(buf_size));
|
cp->delta_buf = (unsigned char *)os_mem_alloc_large(&cp->delta_buf_size);
|
||||||
memset(cp->delta_buf_base, 0, buf_size);
|
|
||||||
cp->delta_buf = static_cast<byte *>
|
if (!cp->delta_buf) {
|
||||||
(ut_align(cp->delta_buf_base, cursor->page_size.physical()));
|
msg("[%02u] mariabackup: Error: "
|
||||||
|
"cannot allocate %zu bytes\n",
|
||||||
|
cursor->thread_n, (size_t) cp->delta_buf_size);
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
/* write delta meta info */
|
/* write delta meta info */
|
||||||
snprintf(meta_name, sizeof(meta_name), "%s%s", dst_name,
|
snprintf(meta_name, sizeof(meta_name), "%s%s", dst_name,
|
||||||
@ -184,8 +188,7 @@ static void
|
|||||||
wf_incremental_deinit(xb_write_filt_ctxt_t *ctxt)
|
wf_incremental_deinit(xb_write_filt_ctxt_t *ctxt)
|
||||||
{
|
{
|
||||||
xb_wf_incremental_ctxt_t *cp = &(ctxt->u.wf_incremental_ctxt);
|
xb_wf_incremental_ctxt_t *cp = &(ctxt->u.wf_incremental_ctxt);
|
||||||
|
os_mem_free_large(cp->delta_buf, cp->delta_buf_size);
|
||||||
free(cp->delta_buf_base);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|||||||
|
|
||||||
/* Incremental page filter context */
|
/* Incremental page filter context */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
byte *delta_buf_base;
|
ulint delta_buf_size;
|
||||||
byte *delta_buf;
|
byte *delta_buf;
|
||||||
ulint npages;
|
ulint npages;
|
||||||
} xb_wf_incremental_ctxt_t;
|
} xb_wf_incremental_ctxt_t;
|
||||||
|
@ -2135,28 +2135,6 @@ check_if_skip_table(
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return the tablespace flags from a given data file
|
|
||||||
@retval ULINT_UNDEFINED if the file is not readable */
|
|
||||||
ulint xb_get_space_flags(pfs_os_file_t file)
|
|
||||||
{
|
|
||||||
byte *buf;
|
|
||||||
byte *page;
|
|
||||||
ulint flags;
|
|
||||||
|
|
||||||
buf = static_cast<byte *>(malloc(2 * UNIV_PAGE_SIZE));
|
|
||||||
page = static_cast<byte *>(ut_align(buf, UNIV_PAGE_SIZE));
|
|
||||||
|
|
||||||
if (os_file_read(IORequestRead, file, page, 0, UNIV_PAGE_SIZE)) {
|
|
||||||
flags = fsp_header_get_flags(page);
|
|
||||||
} else {
|
|
||||||
flags = ULINT_UNDEFINED;
|
|
||||||
}
|
|
||||||
|
|
||||||
free(buf);
|
|
||||||
|
|
||||||
return(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
xb_get_copy_action(const char *dflt)
|
xb_get_copy_action(const char *dflt)
|
||||||
{
|
{
|
||||||
@ -2421,8 +2399,15 @@ xtrabackup_copy_logfile(copy_logfile copy)
|
|||||||
|
|
||||||
log_mutex_enter();
|
log_mutex_enter();
|
||||||
|
|
||||||
lsn_t lsn = log_group_read_log_seg(log_sys->buf, &log_sys->log,
|
lsn_t lsn= start_lsn;
|
||||||
start_lsn, end_lsn);
|
for(int retries= 0; retries < 100; retries++) {
|
||||||
|
if (log_group_read_log_seg(log_sys->buf, &log_sys->log,
|
||||||
|
&lsn, end_lsn)){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
msg("Retrying read of a redo log block");
|
||||||
|
my_sleep(1000);
|
||||||
|
}
|
||||||
|
|
||||||
start_lsn = xtrabackup_copy_log(copy, start_lsn, lsn);
|
start_lsn = xtrabackup_copy_log(copy, start_lsn, lsn);
|
||||||
|
|
||||||
@ -2683,10 +2668,10 @@ xb_load_single_table_tablespace(
|
|||||||
name = static_cast<char*>(ut_malloc_nokey(pathlen));
|
name = static_cast<char*>(ut_malloc_nokey(pathlen));
|
||||||
|
|
||||||
if (dirname != NULL) {
|
if (dirname != NULL) {
|
||||||
ut_snprintf(name, pathlen, "%s/%s", dirname, filname);
|
snprintf(name, pathlen, "%s/%s", dirname, filname);
|
||||||
name[pathlen - 5] = 0;
|
name[pathlen - 5] = 0;
|
||||||
} else {
|
} else {
|
||||||
ut_snprintf(name, pathlen, "%s", filname);
|
snprintf(name, pathlen, "%s", filname);
|
||||||
name[pathlen - 5] = 0;
|
name[pathlen - 5] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2804,8 +2789,8 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback)
|
|||||||
|
|
||||||
dbpath = static_cast<char*>(ut_malloc_nokey(dbpath_len));
|
dbpath = static_cast<char*>(ut_malloc_nokey(dbpath_len));
|
||||||
}
|
}
|
||||||
ut_snprintf(dbpath, dbpath_len,
|
snprintf(dbpath, dbpath_len,
|
||||||
"%s/%s", fil_path_to_mysql_datadir, dbinfo.name);
|
"%s/%s", fil_path_to_mysql_datadir, dbinfo.name);
|
||||||
os_normalize_path(dbpath);
|
os_normalize_path(dbpath);
|
||||||
|
|
||||||
if (check_if_skip_database_by_path(dbpath)) {
|
if (check_if_skip_database_by_path(dbpath)) {
|
||||||
@ -3037,7 +3022,7 @@ xb_validate_name(
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
p = strpbrk(name, "/\\~");
|
p = strpbrk(name, "/\\~");
|
||||||
if (p && p - name < NAME_LEN) {
|
if (p && (uint) (p - name) < NAME_LEN) {
|
||||||
msg("mariabackup: name `%s` is not valid.\n", name);
|
msg("mariabackup: name `%s` is not valid.\n", name);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@ -4311,12 +4296,12 @@ xtrabackup_apply_delta(
|
|||||||
|
|
||||||
page_size = info.page_size.physical();
|
page_size = info.page_size.physical();
|
||||||
page_size_shift = get_bit_shift(page_size);
|
page_size_shift = get_bit_shift(page_size);
|
||||||
msg("mariabackup: page size for %s is %lu bytes\n",
|
msg("mariabackup: page size for %s is %zu bytes\n",
|
||||||
src_path, page_size);
|
src_path, page_size);
|
||||||
if (page_size_shift < 10 ||
|
if (page_size_shift < 10 ||
|
||||||
page_size_shift > UNIV_PAGE_SIZE_SHIFT_MAX) {
|
page_size_shift > UNIV_PAGE_SIZE_SHIFT_MAX) {
|
||||||
msg("mariabackup: error: invalid value of page_size "
|
msg("mariabackup: error: invalid value of page_size "
|
||||||
"(%lu bytes) read from %s\n", page_size, meta_path);
|
"(%zu bytes) read from %s\n", page_size, meta_path);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4418,10 +4403,29 @@ xtrabackup_apply_delta(
|
|||||||
if (off == 0) {
|
if (off == 0) {
|
||||||
/* Read tablespace size from page 0,
|
/* Read tablespace size from page 0,
|
||||||
and extend the file to specified size.*/
|
and extend the file to specified size.*/
|
||||||
os_offset_t n_pages = mach_read_from_4(buf + FSP_HEADER_OFFSET + FSP_SIZE);
|
os_offset_t n_pages = mach_read_from_4(
|
||||||
success = os_file_set_size(dst_path, dst_file, n_pages*page_size);
|
buf + FSP_HEADER_OFFSET + FSP_SIZE);
|
||||||
if (!success)
|
if (mach_read_from_4(buf
|
||||||
goto error;
|
+ FIL_PAGE_SPACE_ID)) {
|
||||||
|
if (!os_file_set_size(
|
||||||
|
dst_path, dst_file,
|
||||||
|
n_pages * page_size))
|
||||||
|
goto error;
|
||||||
|
} else if (fil_space_t* space
|
||||||
|
= fil_space_acquire(0)) {
|
||||||
|
/* The system tablespace can
|
||||||
|
consist of multiple files. The
|
||||||
|
first one has full tablespace
|
||||||
|
size in page 0, but only the last
|
||||||
|
file should be extended. */
|
||||||
|
fil_node_t* n = UT_LIST_GET_FIRST(
|
||||||
|
space->chain);
|
||||||
|
bool fail = !strcmp(n->name, dst_path)
|
||||||
|
&& !fil_space_extend(
|
||||||
|
space, (ulint)n_pages);
|
||||||
|
fil_space_release(space);
|
||||||
|
if (fail) goto error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
success = os_file_write(IORequestWrite,
|
success = os_file_write(IORequestWrite,
|
||||||
|
@ -149,10 +149,6 @@ void xtrabackup_io_throttling(void);
|
|||||||
my_bool xb_write_delta_metadata(const char *filename,
|
my_bool xb_write_delta_metadata(const char *filename,
|
||||||
const xb_delta_info_t *info);
|
const xb_delta_info_t *info);
|
||||||
|
|
||||||
/** @return the tablespace flags from a given data file
|
|
||||||
@retval ULINT_UNDEFINED if the file is not readable */
|
|
||||||
ulint xb_get_space_flags(pfs_os_file_t file);
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
Checks if a table specified as a name in the form "database/name" (InnoDB 5.6)
|
Checks if a table specified as a name in the form "database/name" (InnoDB 5.6)
|
||||||
or "./database/name.ibd" (InnoDB 5.5-) should be skipped from backup based on
|
or "./database/name.ibd" (InnoDB 5.5-) should be skipped from backup based on
|
||||||
|
@ -192,7 +192,7 @@ static my_long_addr_t read_addr(char** buf)
|
|||||||
while((c = hex_val(*p++)) != HEX_INVALID)
|
while((c = hex_val(*p++)) != HEX_INVALID)
|
||||||
addr = (addr << 4) + c;
|
addr = (addr << 4) + c;
|
||||||
|
|
||||||
*buf = p;
|
*buf= p-1;
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,6 +203,7 @@ static int init_sym_entry(SYM_ENTRY* se, char* buf)
|
|||||||
|
|
||||||
if (!se->addr)
|
if (!se->addr)
|
||||||
return -1;
|
return -1;
|
||||||
|
buf++;
|
||||||
while (my_isspace(&my_charset_latin1,*buf++))
|
while (my_isspace(&my_charset_latin1,*buf++))
|
||||||
/* empty */;
|
/* empty */;
|
||||||
|
|
||||||
@ -281,32 +282,47 @@ static SYM_ENTRY* resolve_addr(uchar* addr, SYM_ENTRY* se)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Resolve anything that starts with [0x or (+0x or start of line and 0x
|
||||||
|
Skip '_end' as this is an indication of a wrong symbol (stack?)
|
||||||
|
*/
|
||||||
|
|
||||||
static void do_resolve()
|
static void do_resolve()
|
||||||
{
|
{
|
||||||
char buf[1024], *p;
|
char buf[1024], *p;
|
||||||
while (fgets(buf, sizeof(buf), fp_dump))
|
while (fgets(buf, sizeof(buf), fp_dump))
|
||||||
{
|
{
|
||||||
/* skip bracket */
|
for (p= buf ; *p ; p++)
|
||||||
p= (p= strchr(buf, '[')) ? p+1 : buf;
|
|
||||||
/* skip space */
|
|
||||||
while (my_isspace(&my_charset_latin1,*p))
|
|
||||||
++p;
|
|
||||||
|
|
||||||
if (*p++ == '0' && *p++ == 'x')
|
|
||||||
{
|
{
|
||||||
SYM_ENTRY se ;
|
int found= 0;
|
||||||
uchar* addr = (uchar*)read_addr(&p);
|
if (p[0] == '[' && p[1] == '0' && p[2] == 'x')
|
||||||
if (resolve_addr(addr, &se))
|
found= 3;
|
||||||
fprintf(fp_out, "%p %s + %d\n", addr, se.symbol,
|
if (p[0] == '(' && p[1] == '+' && p[2] == '0' && p[3] == 'x')
|
||||||
(int) (addr - se.addr));
|
found= 4;
|
||||||
|
|
||||||
|
/* For stdin */
|
||||||
|
if (p == buf && p[0] == '0' && p[1] == 'x')
|
||||||
|
found= 2;
|
||||||
|
|
||||||
|
if (found)
|
||||||
|
{
|
||||||
|
SYM_ENTRY se ;
|
||||||
|
uchar *addr;
|
||||||
|
char *tmp= p + found;
|
||||||
|
addr= (uchar*)read_addr(&tmp);
|
||||||
|
if (resolve_addr(addr, &se) && strcmp(se.symbol, "_end"))
|
||||||
|
{
|
||||||
|
fprintf(fp_out, "%c%p %s + %d", *p, addr, se.symbol,
|
||||||
|
(int) (addr - se.addr));
|
||||||
|
p= tmp-1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fputc(*p, stdout);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
fprintf(fp_out, "%p (?)\n", addr);
|
fputc(*p, stdout);
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fputs(buf, fp_out);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef ATOMIC_GCC_BUILTINS_INCLUDED
|
#ifndef ATOMIC_GCC_BUILTINS_INCLUDED
|
||||||
#define ATOMIC_GCC_BUILTINS_INCLUDED
|
#define ATOMIC_GCC_BUILTINS_INCLUDED
|
||||||
|
|
||||||
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
/* Copyright (c) 2017 MariaDB Foundation
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -16,8 +16,6 @@
|
|||||||
along with this program; if not, write to the Free Software
|
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 St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||||
|
|
||||||
#if defined(HAVE_GCC_C11_ATOMICS)
|
|
||||||
#define MY_ATOMIC_MODE "gcc-atomics-smp"
|
|
||||||
|
|
||||||
#define MY_MEMORY_ORDER_RELAXED __ATOMIC_RELAXED
|
#define MY_MEMORY_ORDER_RELAXED __ATOMIC_RELAXED
|
||||||
#define MY_MEMORY_ORDER_CONSUME __ATOMIC_CONSUME
|
#define MY_MEMORY_ORDER_CONSUME __ATOMIC_CONSUME
|
||||||
@ -76,21 +74,5 @@
|
|||||||
__atomic_compare_exchange_n((P), (E), (D), 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
|
__atomic_compare_exchange_n((P), (E), (D), 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
|
||||||
#define my_atomic_casptr(P, E, D) \
|
#define my_atomic_casptr(P, E, D) \
|
||||||
__atomic_compare_exchange_n((P), (E), (D), 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
|
__atomic_compare_exchange_n((P), (E), (D), 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
|
||||||
#else
|
|
||||||
#define MY_ATOMIC_MODE "gcc-builtins-smp"
|
|
||||||
#define make_atomic_load_body(S) \
|
|
||||||
ret= __sync_fetch_and_or(a, 0);
|
|
||||||
#define make_atomic_store_body(S) \
|
|
||||||
(void) __sync_lock_test_and_set(a, v);
|
|
||||||
#define make_atomic_add_body(S) \
|
|
||||||
v= __sync_fetch_and_add(a, v);
|
|
||||||
#define make_atomic_fas_body(S) \
|
|
||||||
v= __sync_lock_test_and_set(a, v);
|
|
||||||
#define make_atomic_cas_body(S) \
|
|
||||||
int ## S sav; \
|
|
||||||
int ## S cmp_val= *cmp; \
|
|
||||||
sav= __sync_val_compare_and_swap(a, cmp_val, set);\
|
|
||||||
if (!(ret= (sav == cmp_val))) *cmp= sav
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* ATOMIC_GCC_BUILTINS_INCLUDED */
|
#endif /* ATOMIC_GCC_BUILTINS_INCLUDED */
|
||||||
|
106
include/atomic/gcc_sync.h
Normal file
106
include/atomic/gcc_sync.h
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
#ifndef GCC_SYNC_INCLUDED
|
||||||
|
#define GCC_SYNC_INCLUDED
|
||||||
|
|
||||||
|
/* Copyright (c) 2008, 2016, 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 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 GCC __sync builtins introduced in GCC 4.1 */
|
||||||
|
|
||||||
|
static inline int my_atomic_cas32(int32 volatile *a, int32 *cmp, int32 set)
|
||||||
|
{
|
||||||
|
int32 cmp_val= *cmp;
|
||||||
|
int32 sav= __sync_val_compare_and_swap(a, cmp_val, set);
|
||||||
|
int ret= (sav == cmp_val);
|
||||||
|
if (!ret)
|
||||||
|
*cmp = sav;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int my_atomic_cas64(int64 volatile *a, int64 *cmp, int64 set)
|
||||||
|
{
|
||||||
|
int64 cmp_val= *cmp;
|
||||||
|
int64 sav= __sync_val_compare_and_swap(a, cmp_val, set);
|
||||||
|
int ret= (sav == cmp_val);
|
||||||
|
if (!ret)
|
||||||
|
*cmp = sav;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int my_atomic_casptr(void * volatile *a, void **cmp, void *set)
|
||||||
|
{
|
||||||
|
void *cmp_val= *cmp;
|
||||||
|
void *sav= __sync_val_compare_and_swap(a, cmp_val, set);
|
||||||
|
int ret= (sav == cmp_val);
|
||||||
|
if (!ret)
|
||||||
|
*cmp = sav;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int32 my_atomic_add32(int32 volatile *a, int32 v)
|
||||||
|
{
|
||||||
|
return __sync_fetch_and_add(a, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int64 my_atomic_add64(int64 volatile *a, int64 v)
|
||||||
|
{
|
||||||
|
return __sync_fetch_and_add(a, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int32 my_atomic_fas32(int32 volatile *a, int32 v)
|
||||||
|
{
|
||||||
|
return __sync_lock_test_and_set(a, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int64 my_atomic_fas64(int64 volatile *a, int64 v)
|
||||||
|
{
|
||||||
|
return __sync_lock_test_and_set(a, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void * my_atomic_fasptr(void * volatile *a, void * v)
|
||||||
|
{
|
||||||
|
return __sync_lock_test_and_set(a, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int32 my_atomic_load32(int32 volatile *a)
|
||||||
|
{
|
||||||
|
return __sync_fetch_and_or(a, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int64 my_atomic_load64(int64 volatile *a)
|
||||||
|
{
|
||||||
|
return __sync_fetch_and_or(a, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void* my_atomic_loadptr(void * volatile *a)
|
||||||
|
{
|
||||||
|
return __sync_fetch_and_or(a, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void my_atomic_store32(int32 volatile *a, int32 v)
|
||||||
|
{
|
||||||
|
(void) __sync_lock_test_and_set(a, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void my_atomic_store64(int64 volatile *a, int64 v)
|
||||||
|
{
|
||||||
|
(void) __sync_lock_test_and_set(a, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void my_atomic_storeptr(void * volatile *a, void *v)
|
||||||
|
{
|
||||||
|
(void) __sync_lock_test_and_set(a, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* GCC_SYNC_INCLUDED */
|
@ -1,5 +1,7 @@
|
|||||||
/* Copyright (c) 2006-2008 MySQL AB, 2009 Sun Microsystems, Inc.
|
#ifndef ATOMIC_MSC_INCLUDED
|
||||||
Use is subject to license terms.
|
#define ATOMIC_MSC_INCLUDED
|
||||||
|
|
||||||
|
/* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -14,79 +16,132 @@
|
|||||||
along with this program; if not, write to the Free Software
|
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 St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||||
|
|
||||||
#ifndef _atomic_h_cleanup_
|
|
||||||
#define _atomic_h_cleanup_ "atomic/generic-msvc.h"
|
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
/*
|
|
||||||
x86 compilers (both VS2003 or VS2005) never use instrinsics, but generate
|
|
||||||
function calls to kernel32 instead, even in the optimized build.
|
|
||||||
We force intrinsics as described in MSDN documentation for
|
|
||||||
_InterlockedCompareExchange.
|
|
||||||
*/
|
|
||||||
#ifdef _M_IX86
|
|
||||||
|
|
||||||
#if (_MSC_VER >= 1500)
|
static inline int my_atomic_cas32(int32 volatile *a, int32 *cmp, int32 set)
|
||||||
#include <intrin.h>
|
{
|
||||||
|
int32 initial_cmp= *cmp;
|
||||||
|
int32 initial_a= InterlockedCompareExchange((volatile LONG*)a,
|
||||||
|
set, initial_cmp);
|
||||||
|
int ret= (initial_a == initial_cmp);
|
||||||
|
if (!ret)
|
||||||
|
*cmp= initial_a;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int my_atomic_cas64(int64 volatile *a, int64 *cmp, int64 set)
|
||||||
|
{
|
||||||
|
int64 initial_cmp= *cmp;
|
||||||
|
int64 initial_a= InterlockedCompareExchange64((volatile LONGLONG*)a,
|
||||||
|
(LONGLONG)set,
|
||||||
|
(LONGLONG)initial_cmp);
|
||||||
|
int ret= (initial_a == initial_cmp);
|
||||||
|
if (!ret)
|
||||||
|
*cmp= initial_a;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int my_atomic_casptr(void * volatile *a, void **cmp, void *set)
|
||||||
|
{
|
||||||
|
void *initial_cmp= *cmp;
|
||||||
|
void *initial_a= InterlockedCompareExchangePointer(a, set, initial_cmp);
|
||||||
|
int ret= (initial_a == initial_cmp);
|
||||||
|
if (!ret)
|
||||||
|
*cmp= initial_a;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int32 my_atomic_add32(int32 volatile *a, int32 v)
|
||||||
|
{
|
||||||
|
return (int32)InterlockedExchangeAdd((volatile LONG*)a, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int64 my_atomic_add64(int64 volatile *a, int64 v)
|
||||||
|
{
|
||||||
|
return (int64)InterlockedExchangeAdd64((volatile LONGLONG*)a, (LONGLONG)v);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
According to MSDN:
|
||||||
|
|
||||||
|
Simple reads and writes to properly-aligned 32-bit variables are atomic
|
||||||
|
operations.
|
||||||
|
...
|
||||||
|
Simple reads and writes to properly aligned 64-bit variables are atomic on
|
||||||
|
64-bit Windows. Reads and writes to 64-bit values are not guaranteed to be
|
||||||
|
atomic on 32-bit Windows.
|
||||||
|
|
||||||
|
https://msdn.microsoft.com/en-us/library/windows/desktop/ms684122(v=vs.85).aspx
|
||||||
|
*/
|
||||||
|
|
||||||
|
static inline int32 my_atomic_load32(int32 volatile *a)
|
||||||
|
{
|
||||||
|
int32 value= *a;
|
||||||
|
MemoryBarrier();
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int64 my_atomic_load64(int64 volatile *a)
|
||||||
|
{
|
||||||
|
#ifdef _M_X64
|
||||||
|
int64 value= *a;
|
||||||
|
MemoryBarrier();
|
||||||
|
return value;
|
||||||
#else
|
#else
|
||||||
C_MODE_START
|
return (int64) InterlockedCompareExchange64((volatile LONGLONG *) a, 0, 0);
|
||||||
/*Visual Studio 2003 and earlier do not have prototypes for atomic intrinsics*/
|
|
||||||
LONG _InterlockedCompareExchange (LONG volatile *Target, LONG Value, LONG Comp);
|
|
||||||
LONGLONG _InterlockedCompareExchange64 (LONGLONG volatile *Target,
|
|
||||||
LONGLONG Value, LONGLONG Comp);
|
|
||||||
C_MODE_END
|
|
||||||
|
|
||||||
#pragma intrinsic(_InterlockedCompareExchange)
|
|
||||||
#pragma intrinsic(_InterlockedCompareExchange64)
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#define InterlockedCompareExchange _InterlockedCompareExchange
|
static inline void* my_atomic_loadptr(void * volatile *a)
|
||||||
#define InterlockedCompareExchange64 _InterlockedCompareExchange64
|
{
|
||||||
/*
|
void *value= *a;
|
||||||
No need to do something special for InterlockedCompareExchangePointer
|
MemoryBarrier();
|
||||||
as it is a #define to InterlockedCompareExchange. The same applies to
|
return value;
|
||||||
InterlockedExchangePointer.
|
}
|
||||||
*/
|
|
||||||
#endif /*_M_IX86*/
|
|
||||||
|
|
||||||
#define MY_ATOMIC_MODE "msvc-intrinsics"
|
static inline int32 my_atomic_fas32(int32 volatile *a, int32 v)
|
||||||
/* Implement using CAS on WIN32 */
|
{
|
||||||
#define IL_COMP_EXCHG32(X,Y,Z) \
|
return (int32)InterlockedExchange((volatile LONG*)a, v);
|
||||||
InterlockedCompareExchange((volatile LONG *)(X),(Y),(Z))
|
}
|
||||||
#define IL_COMP_EXCHG64(X,Y,Z) \
|
|
||||||
InterlockedCompareExchange64((volatile LONGLONG *)(X), \
|
|
||||||
(LONGLONG)(Y),(LONGLONG)(Z))
|
|
||||||
#define IL_COMP_EXCHGptr InterlockedCompareExchangePointer
|
|
||||||
|
|
||||||
#define make_atomic_cas_body(S) \
|
static inline int64 my_atomic_fas64(int64 volatile *a, int64 v)
|
||||||
int ## S initial_cmp= *cmp; \
|
{
|
||||||
int ## S initial_a= IL_COMP_EXCHG ## S (a, set, initial_cmp); \
|
return (int64)InterlockedExchange64((volatile LONGLONG*)a, v);
|
||||||
if (!(ret= (initial_a == initial_cmp))) *cmp= initial_a;
|
}
|
||||||
|
|
||||||
#ifndef _M_IX86
|
static inline void * my_atomic_fasptr(void * volatile *a, void * v)
|
||||||
/* Use full set of optimised functions on WIN64 */
|
{
|
||||||
#define IL_EXCHG_ADD32(X,Y) \
|
return InterlockedExchangePointer(a, v);
|
||||||
InterlockedExchangeAdd((volatile LONG *)(X),(Y))
|
}
|
||||||
#define IL_EXCHG_ADD64(X,Y) \
|
|
||||||
InterlockedExchangeAdd64((volatile LONGLONG *)(X),(LONGLONG)(Y))
|
|
||||||
#define IL_EXCHG32(X,Y) \
|
|
||||||
InterlockedExchange((volatile LONG *)(X),(Y))
|
|
||||||
#define IL_EXCHG64(X,Y) \
|
|
||||||
InterlockedExchange64((volatile LONGLONG *)(X),(LONGLONG)(Y))
|
|
||||||
#define IL_EXCHGptr InterlockedExchangePointer
|
|
||||||
|
|
||||||
#define make_atomic_add_body(S) \
|
static inline void my_atomic_store32(int32 volatile *a, int32 v)
|
||||||
v= IL_EXCHG_ADD ## S (a, v)
|
{
|
||||||
#define make_atomic_swap_body(S) \
|
MemoryBarrier();
|
||||||
v= IL_EXCHG ## S (a, v)
|
*a= v;
|
||||||
#define make_atomic_load_body(S) \
|
}
|
||||||
ret= 0; /* avoid compiler warning */ \
|
|
||||||
ret= IL_COMP_EXCHG ## S (a, ret, ret);
|
static inline void my_atomic_store64(int64 volatile *a, int64 v)
|
||||||
|
{
|
||||||
|
#ifdef _M_X64
|
||||||
|
MemoryBarrier();
|
||||||
|
*a= v;
|
||||||
|
#else
|
||||||
|
(void) InterlockedExchange64((volatile LONGLONG *) a, v);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void my_atomic_storeptr(void * volatile *a, void *v)
|
||||||
|
{
|
||||||
|
MemoryBarrier();
|
||||||
|
*a= v;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
my_yield_processor (equivalent of x86 PAUSE instruction) should be used
|
my_yield_processor (equivalent of x86 PAUSE instruction) should be used
|
||||||
to improve performance on hyperthreaded CPUs. Intel recommends to use it in
|
to improve performance on hyperthreaded CPUs. Intel recommends to use it in
|
||||||
spin loops also on non-HT machines to reduce power consumption (see e.g
|
spin loops also on non-HT machines to reduce power consumption (see e.g
|
||||||
http://softwarecommunity.intel.com/articles/eng/2004.htm)
|
http://softwarecommunity.intel.com/articles/eng/2004.htm)
|
||||||
|
|
||||||
Running benchmarks for spinlocks implemented with InterlockedCompareExchange
|
Running benchmarks for spinlocks implemented with InterlockedCompareExchange
|
||||||
@ -94,35 +149,18 @@ C_MODE_END
|
|||||||
YieldProcessor in a loop - that is, yielding longer. On Intel boxes setting
|
YieldProcessor in a loop - that is, yielding longer. On Intel boxes setting
|
||||||
loop count in the range 200-300 brought best results.
|
loop count in the range 200-300 brought best results.
|
||||||
*/
|
*/
|
||||||
#ifndef YIELD_LOOPS
|
|
||||||
#define YIELD_LOOPS 200
|
#define YIELD_LOOPS 200
|
||||||
#endif
|
|
||||||
|
|
||||||
static __inline int my_yield_processor()
|
static inline int my_yield_processor()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<YIELD_LOOPS; i++)
|
for (i=0; i<YIELD_LOOPS; i++)
|
||||||
{
|
{
|
||||||
#if (_MSC_VER <= 1310)
|
|
||||||
/* On older compilers YieldProcessor is not available, use inline assembly*/
|
|
||||||
__asm { rep nop }
|
|
||||||
#else
|
|
||||||
YieldProcessor();
|
YieldProcessor();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LF_BACKOFF my_yield_processor()
|
#define LF_BACKOFF my_yield_processor()
|
||||||
#else /* cleanup */
|
|
||||||
|
|
||||||
#undef IL_EXCHG_ADD32
|
#endif /* ATOMIC_MSC_INCLUDED */
|
||||||
#undef IL_EXCHG_ADD64
|
|
||||||
#undef IL_COMP_EXCHG32
|
|
||||||
#undef IL_COMP_EXCHG64
|
|
||||||
#undef IL_COMP_EXCHGptr
|
|
||||||
#undef IL_EXCHG32
|
|
||||||
#undef IL_EXCHG64
|
|
||||||
#undef IL_EXCHGptr
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
#ifndef ATOMIC_SOLARIS_INCLUDED
|
||||||
|
#define ATOMIC_SOLARIS_INCLUDED
|
||||||
|
|
||||||
|
/* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -13,51 +16,102 @@
|
|||||||
along with this program; if not, write to the Free Software
|
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 St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||||
|
|
||||||
#ifndef _atomic_h_cleanup_
|
|
||||||
#define _atomic_h_cleanup_ "atomic/solaris.h"
|
|
||||||
|
|
||||||
#include <atomic.h>
|
#include <atomic.h>
|
||||||
|
|
||||||
#define MY_ATOMIC_MODE "solaris-atomic"
|
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
#define atomic_typeof(T,V) __typeof__(V)
|
#define atomic_typeof(T,V) __typeof__(V)
|
||||||
#else
|
#else
|
||||||
#define atomic_typeof(T,V) T
|
#define atomic_typeof(T,V) T
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define uintptr_t void *
|
static inline int my_atomic_cas32(int32 volatile *a, int32 *cmp, int32 set)
|
||||||
#define atomic_or_ptr_nv(X,Y) (void *)atomic_or_ulong_nv((volatile ulong_t *)X, Y)
|
{
|
||||||
|
int ret;
|
||||||
#define make_atomic_cas_body(S) \
|
atomic_typeof(uint32_t, *cmp) sav;
|
||||||
atomic_typeof(uint ## S ## _t, *cmp) sav; \
|
sav= atomic_cas_32((volatile uint32_t *)a, (uint32_t)*cmp, (uint32_t)set);
|
||||||
sav = atomic_cas_ ## S( \
|
ret= (sav == *cmp);
|
||||||
(volatile uint ## S ## _t *)a, \
|
if (!ret)
|
||||||
(uint ## S ## _t)*cmp, \
|
|
||||||
(uint ## S ## _t)set); \
|
|
||||||
if (! (ret= (sav == *cmp))) \
|
|
||||||
*cmp= sav;
|
*cmp= sav;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
#define make_atomic_add_body(S) \
|
static inline int my_atomic_cas64(int64 volatile *a, int64 *cmp, int64 set)
|
||||||
int ## S nv; /* new value */ \
|
{
|
||||||
nv= atomic_add_ ## S ## _nv((volatile uint ## S ## _t *)a, v); \
|
int ret;
|
||||||
v= nv - v
|
atomic_typeof(uint64_t, *cmp) sav;
|
||||||
|
sav= atomic_cas_64((volatile uint64_t *)a, (uint64_t)*cmp, (uint64_t)set);
|
||||||
|
ret= (sav == *cmp);
|
||||||
|
if (!ret)
|
||||||
|
*cmp= sav;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
static inline int my_atomic_casptr(void * volatile *a, void **cmp, void *set)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
atomic_typeof(void *, *cmp) sav;
|
||||||
|
sav= atomic_cas_ptr((volatile void **)a, (void *)*cmp, (void *)set);
|
||||||
|
ret= (sav == *cmp);
|
||||||
|
if (!ret)
|
||||||
|
*cmp= sav;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
#define make_atomic_load_body(S) \
|
static inline int32 my_atomic_add32(int32 volatile *a, int32 v)
|
||||||
ret= atomic_or_ ## S ## _nv((volatile uint ## S ## _t *)a, 0)
|
{
|
||||||
|
int32 nv= atomic_add_32_nv((volatile uint32_t *)a, v);
|
||||||
|
return nv - v;
|
||||||
|
}
|
||||||
|
|
||||||
#define make_atomic_store_body(S) \
|
static inline int64 my_atomic_add64(int64 volatile *a, int64 v)
|
||||||
(void) atomic_swap_ ## S((volatile uint ## S ## _t *)a, (uint ## S ## _t)v)
|
{
|
||||||
|
int64 nv= atomic_add_64_nv((volatile uint64_t *)a, v);
|
||||||
|
return nv - v;
|
||||||
|
}
|
||||||
|
|
||||||
#define make_atomic_fas_body(S) \
|
static inline int32 my_atomic_fas32(int32 volatile *a, int32 v)
|
||||||
v= atomic_swap_ ## S((volatile uint ## S ## _t *)a, (uint ## S ## _t)v)
|
{
|
||||||
|
return atomic_swap_32((volatile uint32_t *)a, (uint32_t)v);
|
||||||
|
}
|
||||||
|
|
||||||
#else /* cleanup */
|
static inline int64 my_atomic_fas64(int64 volatile *a, int64 v)
|
||||||
|
{
|
||||||
|
return atomic_swap_64((volatile uint64_t *)a, (uint64_t)v);
|
||||||
|
}
|
||||||
|
|
||||||
#undef uintptr_t
|
static inline void * my_atomic_fasptr(void * volatile *a, void * v)
|
||||||
#undef atomic_or_ptr_nv
|
{
|
||||||
|
return atomic_swap_ptr(a, v);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
static inline int32 my_atomic_load32(int32 volatile *a)
|
||||||
|
{
|
||||||
|
return atomic_or_32_nv((volatile uint32_t *)a, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int64 my_atomic_load64(int64 volatile *a)
|
||||||
|
{
|
||||||
|
return atomic_or_64_nv((volatile uint64_t *)a, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void* my_atomic_loadptr(void * volatile *a)
|
||||||
|
{
|
||||||
|
return atomic_add_ptr_nv(a, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void my_atomic_store32(int32 volatile *a, int32 v)
|
||||||
|
{
|
||||||
|
(void) atomic_swap_32((volatile uint32_t *)a, (uint32_t)v);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void my_atomic_store64(int64 volatile *a, int64 v)
|
||||||
|
{
|
||||||
|
(void) atomic_swap_64((volatile uint64_t *)a, (uint64_t)v);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void my_atomic_storeptr(void * volatile *a, void *v)
|
||||||
|
{
|
||||||
|
(void) atomic_swap_ptr((volatile void **)a, (void *)v);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* ATOMIC_SOLARIS_INCLUDED */
|
||||||
|
@ -110,119 +110,13 @@
|
|||||||
#include "atomic/generic-msvc.h"
|
#include "atomic/generic-msvc.h"
|
||||||
#elif defined(HAVE_SOLARIS_ATOMIC)
|
#elif defined(HAVE_SOLARIS_ATOMIC)
|
||||||
#include "atomic/solaris.h"
|
#include "atomic/solaris.h"
|
||||||
#elif defined(HAVE_GCC_ATOMIC_BUILTINS) || defined(HAVE_GCC_C11_ATOMICS)
|
#elif defined(HAVE_GCC_C11_ATOMICS)
|
||||||
#include "atomic/gcc_builtins.h"
|
#include "atomic/gcc_builtins.h"
|
||||||
|
#elif defined(HAVE_GCC_ATOMIC_BUILTINS)
|
||||||
|
#include "atomic/gcc_sync.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef HAVE_GCC_C11_ATOMICS
|
|
||||||
#ifndef make_atomic_cas_body
|
|
||||||
/* nolock.h was not able to generate even a CAS function, fall back */
|
|
||||||
#error atomic ops for this platform are not implemented
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define intptr void *
|
|
||||||
|
|
||||||
/* define missing functions by using the already generated ones */
|
|
||||||
#ifndef make_atomic_add_body
|
|
||||||
#define make_atomic_add_body(S) \
|
|
||||||
int ## S tmp=*a; \
|
|
||||||
while (!my_atomic_cas ## S(a, &tmp, tmp+v)) ; \
|
|
||||||
v=tmp;
|
|
||||||
#endif
|
|
||||||
#ifndef make_atomic_fas_body
|
|
||||||
#define make_atomic_fas_body(S) \
|
|
||||||
int ## S tmp=*a; \
|
|
||||||
while (!my_atomic_cas ## S(a, &tmp, v)) ; \
|
|
||||||
v=tmp;
|
|
||||||
#endif
|
|
||||||
#ifndef make_atomic_load_body
|
|
||||||
#define make_atomic_load_body(S) \
|
|
||||||
ret= 0; /* avoid compiler warning */ \
|
|
||||||
(void)(my_atomic_cas ## S(a, &ret, ret));
|
|
||||||
#endif
|
|
||||||
#ifndef make_atomic_store_body
|
|
||||||
#define make_atomic_store_body(S) \
|
|
||||||
(void)(my_atomic_fas ## S (a, v));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define make_atomic_cas(S) \
|
|
||||||
static inline int my_atomic_cas ## S(int ## S volatile *a, \
|
|
||||||
int ## S *cmp, int ## S set) \
|
|
||||||
{ \
|
|
||||||
int8 ret; \
|
|
||||||
make_atomic_cas_body(S); \
|
|
||||||
return ret; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define make_atomic_add(S) \
|
|
||||||
static inline int ## S my_atomic_add ## S( \
|
|
||||||
int ## S volatile *a, int ## S v) \
|
|
||||||
{ \
|
|
||||||
make_atomic_add_body(S); \
|
|
||||||
return v; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define make_atomic_fas(S) \
|
|
||||||
static inline int ## S my_atomic_fas ## S( \
|
|
||||||
int ## S volatile *a, int ## S v) \
|
|
||||||
{ \
|
|
||||||
make_atomic_fas_body(S); \
|
|
||||||
return v; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define make_atomic_load(S) \
|
|
||||||
static inline int ## S my_atomic_load ## S(int ## S volatile *a)\
|
|
||||||
{ \
|
|
||||||
int ## S ret; \
|
|
||||||
make_atomic_load_body(S); \
|
|
||||||
return ret; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define make_atomic_store(S) \
|
|
||||||
static inline void my_atomic_store ## S( \
|
|
||||||
int ## S volatile *a, int ## S v) \
|
|
||||||
{ \
|
|
||||||
make_atomic_store_body(S); \
|
|
||||||
}
|
|
||||||
|
|
||||||
make_atomic_cas(32)
|
|
||||||
make_atomic_cas(64)
|
|
||||||
make_atomic_cas(ptr)
|
|
||||||
|
|
||||||
make_atomic_add(32)
|
|
||||||
make_atomic_add(64)
|
|
||||||
|
|
||||||
make_atomic_load(32)
|
|
||||||
make_atomic_load(64)
|
|
||||||
make_atomic_load(ptr)
|
|
||||||
|
|
||||||
make_atomic_fas(32)
|
|
||||||
make_atomic_fas(64)
|
|
||||||
make_atomic_fas(ptr)
|
|
||||||
|
|
||||||
make_atomic_store(32)
|
|
||||||
make_atomic_store(64)
|
|
||||||
make_atomic_store(ptr)
|
|
||||||
|
|
||||||
#ifdef _atomic_h_cleanup_
|
|
||||||
#include _atomic_h_cleanup_
|
|
||||||
#undef _atomic_h_cleanup_
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef make_atomic_add
|
|
||||||
#undef make_atomic_cas
|
|
||||||
#undef make_atomic_load
|
|
||||||
#undef make_atomic_store
|
|
||||||
#undef make_atomic_fas
|
|
||||||
#undef make_atomic_add_body
|
|
||||||
#undef make_atomic_cas_body
|
|
||||||
#undef make_atomic_load_body
|
|
||||||
#undef make_atomic_store_body
|
|
||||||
#undef make_atomic_fas_body
|
|
||||||
#undef intptr
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
the macro below defines (as an expression) the code that
|
the macro below defines (as an expression) the code that
|
||||||
will be run in spin-loops. Intel manuals recummend to have PAUSE there.
|
will be run in spin-loops. Intel manuals recummend to have PAUSE there.
|
||||||
|
@ -204,6 +204,11 @@ enum ha_extra_function {
|
|||||||
HA_EXTRA_PREPARE_FOR_FORCED_CLOSE,
|
HA_EXTRA_PREPARE_FOR_FORCED_CLOSE,
|
||||||
/* Inform handler that we will do an alter table */
|
/* Inform handler that we will do an alter table */
|
||||||
HA_EXTRA_PREPARE_FOR_ALTER_TABLE,
|
HA_EXTRA_PREPARE_FOR_ALTER_TABLE,
|
||||||
|
/*
|
||||||
|
Used in ha_partition::handle_ordered_index_scan() to inform engine
|
||||||
|
that we are starting an ordered index scan. Needed by Spider
|
||||||
|
*/
|
||||||
|
HA_EXTRA_STARTING_ORDERED_INDEX_SCAN
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Compatible option, to be deleted in 6.0 */
|
/* Compatible option, to be deleted in 6.0 */
|
||||||
|
@ -45,6 +45,8 @@ extern "C" {
|
|||||||
/* compatibility functions */
|
/* compatibility functions */
|
||||||
#define bitmap_init(A,B,C,D) my_bitmap_init(A,B,C,D)
|
#define bitmap_init(A,B,C,D) my_bitmap_init(A,B,C,D)
|
||||||
#define bitmap_free(A) my_bitmap_free(A)
|
#define bitmap_free(A) my_bitmap_free(A)
|
||||||
|
/* Reset memory. Faster then doing a full bzero */
|
||||||
|
#define my_bitmap_clear(A) ((A)->bitmap= 0)
|
||||||
|
|
||||||
extern void create_last_word_mask(MY_BITMAP *map);
|
extern void create_last_word_mask(MY_BITMAP *map);
|
||||||
extern my_bool my_bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits,
|
extern my_bool my_bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits,
|
||||||
|
@ -21,17 +21,18 @@
|
|||||||
The defines are the same ones used by the linux kernel
|
The defines are the same ones used by the linux kernel
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(__powerpc__)
|
#ifdef _ARCH_PWR8
|
||||||
|
#include <sys/platform/ppc.h>
|
||||||
/* Very low priority */
|
/* Very low priority */
|
||||||
#define HMT_very_low() asm volatile("or 31,31,31")
|
#define HMT_very_low() __ppc_set_ppr_very_low()
|
||||||
/* Low priority */
|
/* Low priority */
|
||||||
#define HMT_low() asm volatile("or 1,1,1")
|
#define HMT_low() __ppc_set_ppr_low()
|
||||||
/* Medium low priority */
|
/* Medium low priority */
|
||||||
#define HMT_medium_low() asm volatile("or 6,6,6")
|
#define HMT_medium_low() __ppc_set_ppr_med_low()
|
||||||
/* Medium priority */
|
/* Medium priority */
|
||||||
#define HMT_medium() asm volatile("or 2,2,2")
|
#define HMT_medium() __ppc_set_ppr_med()
|
||||||
/* Medium high priority */
|
/* Medium high priority */
|
||||||
#define HMT_medium_high() asm volatile("or 5,5,5")
|
#define HMT_medium_high() __ppc_set_ppr_med_high()
|
||||||
/* High priority */
|
/* High priority */
|
||||||
#define HMT_high() asm volatile("or 3,3,3")
|
#define HMT_high() asm volatile("or 3,3,3")
|
||||||
#else
|
#else
|
||||||
|
@ -649,7 +649,6 @@ void **thd_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
|
|||||||
void thd_storage_lock_wait(MYSQL_THD thd, long long value);
|
void thd_storage_lock_wait(MYSQL_THD thd, long long value);
|
||||||
int thd_tx_isolation(const MYSQL_THD thd);
|
int thd_tx_isolation(const MYSQL_THD thd);
|
||||||
int thd_tx_is_read_only(const MYSQL_THD thd);
|
int thd_tx_is_read_only(const MYSQL_THD thd);
|
||||||
int thd_rpl_is_parallel(const MYSQL_THD thd);
|
|
||||||
/**
|
/**
|
||||||
Create a temporary file.
|
Create a temporary file.
|
||||||
|
|
||||||
|
@ -518,7 +518,6 @@ void **thd_ha_data(const void* thd, const struct handlerton *hton);
|
|||||||
void thd_storage_lock_wait(void* thd, long long value);
|
void thd_storage_lock_wait(void* thd, long long value);
|
||||||
int thd_tx_isolation(const void* thd);
|
int thd_tx_isolation(const void* thd);
|
||||||
int thd_tx_is_read_only(const void* thd);
|
int thd_tx_is_read_only(const void* thd);
|
||||||
int thd_rpl_is_parallel(const void* thd);
|
|
||||||
int mysql_tmpfile(const char *prefix);
|
int mysql_tmpfile(const char *prefix);
|
||||||
unsigned long thd_get_thread_id(const void* thd);
|
unsigned long thd_get_thread_id(const void* thd);
|
||||||
void thd_get_xid(const void* thd, MYSQL_XID *xid);
|
void thd_get_xid(const void* thd, MYSQL_XID *xid);
|
||||||
|
@ -518,7 +518,6 @@ void **thd_ha_data(const void* thd, const struct handlerton *hton);
|
|||||||
void thd_storage_lock_wait(void* thd, long long value);
|
void thd_storage_lock_wait(void* thd, long long value);
|
||||||
int thd_tx_isolation(const void* thd);
|
int thd_tx_isolation(const void* thd);
|
||||||
int thd_tx_is_read_only(const void* thd);
|
int thd_tx_is_read_only(const void* thd);
|
||||||
int thd_rpl_is_parallel(const void* thd);
|
|
||||||
int mysql_tmpfile(const char *prefix);
|
int mysql_tmpfile(const char *prefix);
|
||||||
unsigned long thd_get_thread_id(const void* thd);
|
unsigned long thd_get_thread_id(const void* thd);
|
||||||
void thd_get_xid(const void* thd, MYSQL_XID *xid);
|
void thd_get_xid(const void* thd, MYSQL_XID *xid);
|
||||||
|
@ -518,7 +518,6 @@ void **thd_ha_data(const void* thd, const struct handlerton *hton);
|
|||||||
void thd_storage_lock_wait(void* thd, long long value);
|
void thd_storage_lock_wait(void* thd, long long value);
|
||||||
int thd_tx_isolation(const void* thd);
|
int thd_tx_isolation(const void* thd);
|
||||||
int thd_tx_is_read_only(const void* thd);
|
int thd_tx_is_read_only(const void* thd);
|
||||||
int thd_rpl_is_parallel(const void* thd);
|
|
||||||
int mysql_tmpfile(const char *prefix);
|
int mysql_tmpfile(const char *prefix);
|
||||||
unsigned long thd_get_thread_id(const void* thd);
|
unsigned long thd_get_thread_id(const void* thd);
|
||||||
void thd_get_xid(const void* thd, MYSQL_XID *xid);
|
void thd_get_xid(const void* thd, MYSQL_XID *xid);
|
||||||
|
@ -472,7 +472,6 @@ void **thd_ha_data(const void* thd, const struct handlerton *hton);
|
|||||||
void thd_storage_lock_wait(void* thd, long long value);
|
void thd_storage_lock_wait(void* thd, long long value);
|
||||||
int thd_tx_isolation(const void* thd);
|
int thd_tx_isolation(const void* thd);
|
||||||
int thd_tx_is_read_only(const void* thd);
|
int thd_tx_is_read_only(const void* thd);
|
||||||
int thd_rpl_is_parallel(const void* thd);
|
|
||||||
int mysql_tmpfile(const char *prefix);
|
int mysql_tmpfile(const char *prefix);
|
||||||
unsigned long thd_get_thread_id(const void* thd);
|
unsigned long thd_get_thread_id(const void* thd);
|
||||||
void thd_get_xid(const void* thd, MYSQL_XID *xid);
|
void thd_get_xid(const void* thd, MYSQL_XID *xid);
|
||||||
|
@ -518,7 +518,6 @@ void **thd_ha_data(const void* thd, const struct handlerton *hton);
|
|||||||
void thd_storage_lock_wait(void* thd, long long value);
|
void thd_storage_lock_wait(void* thd, long long value);
|
||||||
int thd_tx_isolation(const void* thd);
|
int thd_tx_isolation(const void* thd);
|
||||||
int thd_tx_is_read_only(const void* thd);
|
int thd_tx_is_read_only(const void* thd);
|
||||||
int thd_rpl_is_parallel(const void* thd);
|
|
||||||
int mysql_tmpfile(const char *prefix);
|
int mysql_tmpfile(const char *prefix);
|
||||||
unsigned long thd_get_thread_id(const void* thd);
|
unsigned long thd_get_thread_id(const void* thd);
|
||||||
void thd_get_xid(const void* thd, MYSQL_XID *xid);
|
void thd_get_xid(const void* thd, MYSQL_XID *xid);
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#define MYSQL_UNIX_ADDR "@MYSQL_UNIX_ADDR@"
|
#define MYSQL_UNIX_ADDR "@MYSQL_UNIX_ADDR@"
|
||||||
#define MYSQL_CONFIG_NAME "my"
|
#define MYSQL_CONFIG_NAME "my"
|
||||||
#define MYSQL_COMPILATION_COMMENT "@COMPILATION_COMMENT@"
|
#define MYSQL_COMPILATION_COMMENT "@COMPILATION_COMMENT@"
|
||||||
|
#define SERVER_MATURITY_LEVEL @SERVER_MATURITY_LEVEL@
|
||||||
|
|
||||||
#ifdef WITH_WSREP
|
#ifdef WITH_WSREP
|
||||||
#define WSREP_PATCH_VERSION "@WSREP_PATCH_VERSION@"
|
#define WSREP_PATCH_VERSION "@WSREP_PATCH_VERSION@"
|
||||||
|
Submodule libmariadb updated: 7e53ab3698...63f841f78f
@ -65,6 +65,8 @@ flush logs;
|
|||||||
# To make it predictable, we do a useless update now, but which has the
|
# To make it predictable, we do a useless update now, but which has the
|
||||||
# interest of making the slave catch both rotate events.
|
# interest of making the slave catch both rotate events.
|
||||||
|
|
||||||
|
let $skip_checkpoint_events=1;
|
||||||
|
|
||||||
eval create table t3 (a int)ENGINE=$engine_type;
|
eval create table t3 (a int)ENGINE=$engine_type;
|
||||||
|
|
||||||
# Sync slave and force it to start on another binary log
|
# Sync slave and force it to start on another binary log
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
# Default values that applies to all MySQL Servers
|
# Default values that applies to all MySQL Servers
|
||||||
[mysqld]
|
[mysqld]
|
||||||
disable-getopt-prefix-matching
|
disable-getopt-prefix-matching
|
||||||
|
plugin-maturity=unknown
|
||||||
open-files-limit= 1024
|
open-files-limit= 1024
|
||||||
local-infile
|
local-infile
|
||||||
character-set-server= latin1
|
character-set-server= latin1
|
||||||
|
@ -53,6 +53,9 @@
|
|||||||
#
|
#
|
||||||
# $rpl_debug
|
# $rpl_debug
|
||||||
# If set, verbose debug info is printed.
|
# If set, verbose debug info is printed.
|
||||||
|
#
|
||||||
|
# $filter_script
|
||||||
|
# If set, rows matching this regexp will be filtered out
|
||||||
|
|
||||||
--let $include_filename= filter_file.inc
|
--let $include_filename= filter_file.inc
|
||||||
--source include/begin_include_file.inc
|
--source include/begin_include_file.inc
|
||||||
@ -67,10 +70,12 @@ if ($rpl_debug)
|
|||||||
|
|
||||||
--let _FF_PRE_SCRIPT= $pre_script
|
--let _FF_PRE_SCRIPT= $pre_script
|
||||||
--let _FF_SCRIPT= $script
|
--let _FF_SCRIPT= $script
|
||||||
|
--let _FF_FILTER_SCRIPT= $filter_script
|
||||||
--let _FF_INPUT_FILE= $input_file
|
--let _FF_INPUT_FILE= $input_file
|
||||||
--let _FF_OUTPUT_FILE= $output_file
|
--let _FF_OUTPUT_FILE= $output_file
|
||||||
--let _FF_SELECT_COLUMNS= $select_columns
|
--let _FF_SELECT_COLUMNS= $select_columns
|
||||||
--let _FF_DEBUG= $rpl_debug
|
--let _FF_DEBUG= $rpl_debug
|
||||||
|
|
||||||
if (!$output_file)
|
if (!$output_file)
|
||||||
{
|
{
|
||||||
--let _FF_OUTPUT_FILE= $input_file
|
--let _FF_OUTPUT_FILE= $input_file
|
||||||
@ -79,6 +84,7 @@ perl;
|
|||||||
my $pre_script = $ENV{'_FF_PRE_SCRIPT'};
|
my $pre_script = $ENV{'_FF_PRE_SCRIPT'};
|
||||||
$pre_script =~ s/DOLLAR/\$/g;
|
$pre_script =~ s/DOLLAR/\$/g;
|
||||||
my $script = $ENV{'_FF_SCRIPT'};
|
my $script = $ENV{'_FF_SCRIPT'};
|
||||||
|
my $filter_script = $ENV{'_FF_FILTER_SCRIPT'};
|
||||||
$script =~ s/DOLLAR/\$/g;
|
$script =~ s/DOLLAR/\$/g;
|
||||||
my $input_file = $ENV{'_FF_INPUT_FILE'};
|
my $input_file = $ENV{'_FF_INPUT_FILE'};
|
||||||
my $output_file = $ENV{'_FF_OUTPUT_FILE'};
|
my $output_file = $ENV{'_FF_OUTPUT_FILE'};
|
||||||
@ -123,7 +129,10 @@ perl;
|
|||||||
{
|
{
|
||||||
' . $script . '
|
' . $script . '
|
||||||
}
|
}
|
||||||
$filtered_contents .= $_."\n";
|
if (!$filter_script || ! m/$filter_script/)
|
||||||
|
{
|
||||||
|
$filtered_contents .= $_."\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
close FILE or die "Error closing $input_file: $!";
|
close FILE or die "Error closing $input_file: $!";
|
||||||
open FILE, "> $output_file" or die "Error opening $output_file: $!";
|
open FILE, "> $output_file" or die "Error opening $output_file: $!";
|
||||||
|
@ -2,8 +2,3 @@
|
|||||||
# suite.pm will make sure that all tests including this file
|
# suite.pm will make sure that all tests including this file
|
||||||
# will be skipped unless this is a debug build.
|
# will be skipped unless this is a debug build.
|
||||||
#
|
#
|
||||||
# The test below is redundant
|
|
||||||
|
|
||||||
if (`select version() not like '%debug%'`) {
|
|
||||||
--skip Needs a debug build
|
|
||||||
}
|
|
||||||
|
@ -1,14 +1,4 @@
|
|||||||
#
|
#
|
||||||
# Check if server has support for loading plugins
|
# suite.pm will make sure that all tests including this file
|
||||||
|
# will be skipped unless dynamic ha_example plugin is available
|
||||||
#
|
#
|
||||||
if (`SELECT @@have_dynamic_loading != 'YES'`) {
|
|
||||||
--skip Example plugin requires dynamic loading
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Check if the variable EXAMPLE_PLUGIN is set
|
|
||||||
#
|
|
||||||
if (!$HA_EXAMPLE_SO) {
|
|
||||||
--skip Need example plugin
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -2,9 +2,3 @@
|
|||||||
# suite.pm will make sure that all tests including this file
|
# suite.pm will make sure that all tests including this file
|
||||||
# will be skipped unless innodb is enabled
|
# will be skipped unless innodb is enabled
|
||||||
#
|
#
|
||||||
# The test below is redundant
|
|
||||||
|
|
||||||
if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED')`)
|
|
||||||
{
|
|
||||||
--skip Test requires InnoDB.
|
|
||||||
}
|
|
||||||
|
@ -1 +1 @@
|
|||||||
--plugin-load-add=$AUTH_TEST_PLUGIN_SO
|
--plugin-load-add=$AUTH_TEST_PLUGIN_SO --plugin-maturity=unknown
|
||||||
|
@ -224,6 +224,12 @@ INSERT INTO global_suppressions VALUES
|
|||||||
("Slave I/O: Setting @slave_gtid_ignore_duplicates failed with error.*"),
|
("Slave I/O: Setting @slave_gtid_ignore_duplicates failed with error.*"),
|
||||||
("Slave I/O: Setting @slave_until_gtid failed with error.*"),
|
("Slave I/O: Setting @slave_until_gtid failed with error.*"),
|
||||||
("Slave I/O: Get master GTID position failed with error.*"),
|
("Slave I/O: Get master GTID position failed with error.*"),
|
||||||
|
|
||||||
|
/*
|
||||||
|
MDEV-12501 -- set --maturity-level by default
|
||||||
|
*/
|
||||||
|
("Plugin .* is of maturity level .* while the server is .*"),
|
||||||
|
|
||||||
("THE_LAST_SUPPRESSION")||
|
("THE_LAST_SUPPRESSION")||
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,9 +2,3 @@
|
|||||||
# suite.pm will make sure that all tests including this file
|
# suite.pm will make sure that all tests including this file
|
||||||
# will be skipped unless this is an embedded test run
|
# will be skipped unless this is an embedded test run
|
||||||
#
|
#
|
||||||
# The test below is redundant
|
|
||||||
|
|
||||||
if (`select version() like '%embedded%'`) {
|
|
||||||
This should never happen;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
--require r/not_windows.require
|
#
|
||||||
disable_query_log;
|
# suite.pm will make sure that all tests including this file
|
||||||
select convert(@@version_compile_os using latin1) NOT IN ("Win32","Win64","Windows") as "TRUE";
|
# will be skipped unless this is on Windows
|
||||||
enable_query_log;
|
#
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
# [--let $binlog_file= [<FILENAME> | LAST]]
|
# [--let $binlog_file= [<FILENAME> | LAST]]
|
||||||
# [--let $binlog_start= <POSITION> ]
|
# [--let $binlog_start= <POSITION> ]
|
||||||
# [--let $binlog_limit= 1, 3 ]
|
# [--let $binlog_limit= 1, 3 ]
|
||||||
# [--let $keep_gtid_events= 1]
|
# [--let $skip_checkpoint_events= 1]
|
||||||
# --source include/show_binlog_events.inc
|
# --source include/show_binlog_events.inc
|
||||||
#
|
#
|
||||||
# Parameters:
|
# Parameters:
|
||||||
@ -26,12 +26,6 @@
|
|||||||
# Limit for the 'LIMIT' clause of SHOW BINLOG EVENTS, i.e.:
|
# Limit for the 'LIMIT' clause of SHOW BINLOG EVENTS, i.e.:
|
||||||
# $binlog_limit= 3 -- print three events
|
# $binlog_limit= 3 -- print three events
|
||||||
# $binlog_limit= 4, 3 -- skip four events, print the three next events
|
# $binlog_limit= 4, 3 -- skip four events, print the three next events
|
||||||
#
|
|
||||||
# $keep_gtid_events
|
|
||||||
# By default, Gtid_log_event and Previous_gtid_log_event are
|
|
||||||
# filtered out, so that the output is independent of whether GTIDs
|
|
||||||
# are enabled or not. If this flag is set, events are kept but
|
|
||||||
# the actual GTID values are masked out.
|
|
||||||
|
|
||||||
--let $include_filename= show_binlog_events.inc
|
--let $include_filename= show_binlog_events.inc
|
||||||
--source include/begin_include_file.inc
|
--source include/begin_include_file.inc
|
||||||
|
@ -104,8 +104,15 @@ let $script=
|
|||||||
s{DOLLARmysqltest_vardir}{MYSQLTEST_VARDIR}g;
|
s{DOLLARmysqltest_vardir}{MYSQLTEST_VARDIR}g;
|
||||||
||
|
||
|
||||||
--let $pre_script= my DOLLARmysqltest_vardir = DOLLARENV{'MYSQLTEST_VARDIR'};
|
--let $pre_script= my DOLLARmysqltest_vardir = DOLLARENV{'MYSQLTEST_VARDIR'};
|
||||||
|
|
||||||
--delimiter ;
|
--delimiter ;
|
||||||
|
|
||||||
|
if ($skip_checkpoint_events)
|
||||||
|
{
|
||||||
|
let $filter_script=Binlog_checkpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#--let $select_columns= 1 3 6
|
#--let $select_columns= 1 3 6
|
||||||
--let $input_file= $output_file
|
--let $input_file= $output_file
|
||||||
--source include/filter_file.inc
|
--source include/filter_file.inc
|
||||||
|
15
mysql-test/include/show_gtid_list.inc
Normal file
15
mysql-test/include/show_gtid_list.inc
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# ==== Purpose ====
|
||||||
|
#
|
||||||
|
# Extract Gtid_list info from SHOW BINLOG EVENTS output masking
|
||||||
|
# non-deterministic fields.
|
||||||
|
#
|
||||||
|
# ==== Usage ====
|
||||||
|
#
|
||||||
|
# [--let $binlog_file=filename
|
||||||
|
#
|
||||||
|
if ($binlog_file)
|
||||||
|
{
|
||||||
|
--let $_in_binlog_file=in '$binlog_file'
|
||||||
|
}
|
||||||
|
--replace_column 2 # 5 #
|
||||||
|
--eval show binlog events $_in_binlog_file limit 1,1
|
@ -2794,7 +2794,7 @@ sub mysql_server_start($) {
|
|||||||
# Some InnoDB options are incompatible with the default bootstrap.
|
# Some InnoDB options are incompatible with the default bootstrap.
|
||||||
# If they are used, re-bootstrap
|
# If they are used, re-bootstrap
|
||||||
if ( $extra_opts and
|
if ( $extra_opts and
|
||||||
"@$extra_opts" =~ /--innodb[-_](?:page[-_]size|checksum[-_]algorithm|undo[-_]tablespaces|log[-_]group[-_]home[-_]dir|data[-_]home[-_]dir)/ )
|
"@$extra_opts" =~ /--innodb[-_](?:page[-_]size|checksum[-_]algorithm|undo[-_]tablespaces|log[-_]group[-_]home[-_]dir|data[-_]home[-_]dir)|data[-_]file[-_]path/ )
|
||||||
{
|
{
|
||||||
mysql_install_db($mysqld, undef, $extra_opts);
|
mysql_install_db($mysqld, undef, $extra_opts);
|
||||||
}
|
}
|
||||||
@ -4439,7 +4439,7 @@ sub extract_warning_lines ($$) {
|
|||||||
qr|feedback plugin: failed to retrieve the MAC address|,
|
qr|feedback plugin: failed to retrieve the MAC address|,
|
||||||
qr|Plugin 'FEEDBACK' init function returned error|,
|
qr|Plugin 'FEEDBACK' init function returned error|,
|
||||||
qr|Plugin 'FEEDBACK' registration as a INFORMATION SCHEMA failed|,
|
qr|Plugin 'FEEDBACK' registration as a INFORMATION SCHEMA failed|,
|
||||||
qr|'log-bin-use-v1-row-events' is MySQL 5.6 compatible option|,
|
qr|'log-bin-use-v1-row-events' is MySQL .* compatible option|,
|
||||||
qr|InnoDB: Setting thread \d+ nice to \d+ failed, current nice \d+, errno 13|, # setpriority() fails under valgrind
|
qr|InnoDB: Setting thread \d+ nice to \d+ failed, current nice \d+, errno 13|, # setpriority() fails under valgrind
|
||||||
qr|Failed to setup SSL|,
|
qr|Failed to setup SSL|,
|
||||||
qr|SSL error: Failed to set ciphers to use|,
|
qr|SSL error: Failed to set ciphers to use|,
|
||||||
|
@ -1452,7 +1452,7 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f
|
|||||||
DELETE FROM t1 USING t1, t2;
|
DELETE FROM t1 USING t1, t2;
|
||||||
EXPLAIN DELETE FROM t1 USING t1, t2;
|
EXPLAIN DELETE FROM t1 USING t1, t2;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
|
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
|
||||||
ANALYZE DELETE FROM t1 USING t1, t2;
|
ANALYZE DELETE FROM t1 USING t1, t2;
|
||||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||||
@ -1797,7 +1797,7 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f
|
|||||||
DELETE FROM t1 USING t1, t2;
|
DELETE FROM t1 USING t1, t2;
|
||||||
EXPLAIN DELETE FROM t1 USING t1, t2;
|
EXPLAIN DELETE FROM t1 USING t1, t2;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
|
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
|
||||||
ANALYZE DELETE FROM t1 USING t1, t2;
|
ANALYZE DELETE FROM t1 USING t1, t2;
|
||||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||||
@ -1813,7 +1813,7 @@ SELECT * FROM t1;
|
|||||||
a b
|
a b
|
||||||
EXPLAIN SELECT * FROM t1;
|
EXPLAIN SELECT * FROM t1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
|
||||||
ANALYZE SELECT * FROM t1;
|
ANALYZE SELECT * FROM t1;
|
||||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||||
|
@ -1168,3 +1168,112 @@ CAST('-1' AS UNSIGNED)
|
|||||||
18446744073709551615
|
18446744073709551615
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
SET sql_mode=DEFAULT;
|
SET sql_mode=DEFAULT;
|
||||||
|
#
|
||||||
|
# MDEV-14376 Explicit CAST(CHAR(N)) erroneously escalates warnings to errors in STRICT_ALL_TABLES
|
||||||
|
#
|
||||||
|
SET sql_mode=STRICT_ALL_TABLES;
|
||||||
|
SELECT CAST('xxx' AS CHAR(1));
|
||||||
|
CAST('xxx' AS CHAR(1))
|
||||||
|
x
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect CHAR(1) value: 'xxx'
|
||||||
|
CREATE OR REPLACE TABLE t1 (a VARCHAR(1));
|
||||||
|
INSERT INTO t1 VALUES (CAST('xxx' AS CHAR(1)));
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect CHAR(1) value: 'xxx'
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE OR REPLACE TABLE t1 (a VARCHAR(3));
|
||||||
|
INSERT INTO t1 VALUES ('xxx');
|
||||||
|
UPDATE t1 SET a=CAST(a AS CHAR(1));
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect CHAR(1) value: 'xxx'
|
||||||
|
DROP TABLE t1;
|
||||||
|
BEGIN NOT ATOMIC
|
||||||
|
DECLARE a VARCHAR(30) CHARACTER SET latin1;
|
||||||
|
SET a=CAST('xxx' AS CHAR(1));
|
||||||
|
END;
|
||||||
|
$$
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect CHAR(1) value: 'xxx'
|
||||||
|
BEGIN NOT ATOMIC
|
||||||
|
DECLARE a VARCHAR(30) CHARACTER SET latin1;
|
||||||
|
SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET latin1);
|
||||||
|
END;
|
||||||
|
$$
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect CHAR(1) value: 'xxx'
|
||||||
|
BEGIN NOT ATOMIC
|
||||||
|
DECLARE a VARCHAR(30) CHARACTER SET latin1;
|
||||||
|
SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET utf8);
|
||||||
|
END;
|
||||||
|
$$
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect CHAR(1) value: 'xxx'
|
||||||
|
BEGIN NOT ATOMIC
|
||||||
|
DECLARE a VARCHAR(30) CHARACTER SET utf8;
|
||||||
|
SET a=CAST('xxx' AS CHAR(1));
|
||||||
|
END;
|
||||||
|
$$
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect CHAR(1) value: 'xxx'
|
||||||
|
BEGIN NOT ATOMIC
|
||||||
|
DECLARE a VARCHAR(30) CHARACTER SET utf8;
|
||||||
|
SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET latin1);
|
||||||
|
END;
|
||||||
|
$$
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect CHAR(1) value: 'xxx'
|
||||||
|
BEGIN NOT ATOMIC
|
||||||
|
DECLARE a VARCHAR(30) CHARACTER SET utf8;
|
||||||
|
SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET utf8);
|
||||||
|
END;
|
||||||
|
$$
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect CHAR(1) value: 'xxx'
|
||||||
|
# Conversion problems still escalate warnings to errors (without right truncation)
|
||||||
|
BEGIN NOT ATOMIC
|
||||||
|
DECLARE a VARCHAR(30) CHARACTER SET utf8;
|
||||||
|
SET a=CAST(_utf8 0xD18F AS CHAR(1) CHARACTER SET latin1);
|
||||||
|
END;
|
||||||
|
$$
|
||||||
|
ERROR HY000: Cannot convert 'utf8' character 0xD18F to 'latin1'
|
||||||
|
# Conversion problems still escalate warnings to errors (with right truncation)
|
||||||
|
BEGIN NOT ATOMIC
|
||||||
|
DECLARE a VARCHAR(30) CHARACTER SET utf8;
|
||||||
|
SET a=CAST(_utf8 0xD18FD18F AS CHAR(1) CHARACTER SET latin1);
|
||||||
|
END;
|
||||||
|
$$
|
||||||
|
ERROR HY000: Cannot convert 'utf8' character 0xD18F to 'latin1'
|
||||||
|
# CAST(number AS CHAR) escalates warnings to errors on truncation
|
||||||
|
CREATE OR REPLACE TABLE t1 (a VARCHAR(10));
|
||||||
|
INSERT INTO t1 VALUES (CAST(123 AS CHAR(1)));
|
||||||
|
ERROR 22007: Truncated incorrect CHAR(1) value: '123'
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE OR REPLACE TABLE t1 (a VARCHAR(10));
|
||||||
|
INSERT INTO t1 VALUES ('1');
|
||||||
|
UPDATE t1 SET a=CAST(123 AS CHAR(1));
|
||||||
|
ERROR 22007: Truncated incorrect CHAR(1) value: '123'
|
||||||
|
DROP TABLE t1;
|
||||||
|
BEGIN NOT ATOMIC
|
||||||
|
DECLARE a VARCHAR(10);
|
||||||
|
SET a=CAST(123 AS CHAR(1));
|
||||||
|
END;
|
||||||
|
$$
|
||||||
|
ERROR 22007: Truncated incorrect CHAR(1) value: '123'
|
||||||
|
# CAST(temporal AS CHAR) escalates warnings to errors on truncation
|
||||||
|
CREATE OR REPLACE TABLE t1 (a VARCHAR(10));
|
||||||
|
INSERT INTO t1 VALUES (CAST(TIME'10:20:30' AS CHAR(1)));
|
||||||
|
ERROR 22007: Truncated incorrect CHAR(1) value: '10:20:30'
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE OR REPLACE TABLE t1 (a VARCHAR(10));
|
||||||
|
INSERT INTO t1 VALUES ('1');
|
||||||
|
UPDATE t1 SET a=CAST(TIME'10:20:30' AS CHAR(1));
|
||||||
|
ERROR 22007: Truncated incorrect CHAR(1) value: '10:20:30'
|
||||||
|
DROP TABLE t1;
|
||||||
|
BEGIN NOT ATOMIC
|
||||||
|
DECLARE a VARCHAR(10);
|
||||||
|
SET a=CAST(TIME'10:20:30' AS CHAR(1));
|
||||||
|
END;
|
||||||
|
$$
|
||||||
|
ERROR 22007: Truncated incorrect CHAR(1) value: '10:20:30'
|
||||||
|
SET sql_mode=DEFAULT;
|
||||||
|
@ -230,7 +230,7 @@ insert into t2 (a) values (1023);
|
|||||||
do (f2(23));
|
do (f2(23));
|
||||||
Warnings:
|
Warnings:
|
||||||
Error 1062 Duplicate entry '23' for key 'a'
|
Error 1062 Duplicate entry '23' for key 'a'
|
||||||
Note 4092 At line 4 in test.f2
|
Note 4093 At line 4 in test.f2
|
||||||
select * from t2;
|
select * from t2;
|
||||||
a
|
a
|
||||||
1023
|
1023
|
||||||
|
@ -160,7 +160,7 @@ Note 1050 Table 'v1' already exists
|
|||||||
DROP VIEW IF EXISTS v1;
|
DROP VIEW IF EXISTS v1;
|
||||||
DROP VIEW IF EXISTS v1;
|
DROP VIEW IF EXISTS v1;
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 4090 Unknown VIEW: 'test.v1'
|
Note 4091 Unknown VIEW: 'test.v1'
|
||||||
SHOW BINLOG EVENTS;
|
SHOW BINLOG EVENTS;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
# # Format_desc 1 # VER
|
# # Format_desc 1 # VER
|
||||||
|
@ -3,8 +3,8 @@ CREATE FUNCTION f1(str char(20))
|
|||||||
RETURNS CHAR(100)
|
RETURNS CHAR(100)
|
||||||
RETURN CONCAT('Hello, ', str, '!');
|
RETURN CONCAT('Hello, ', str, '!');
|
||||||
SELECT * FROM mysql.proc WHERE name like 'f1';
|
SELECT * FROM mysql.proc WHERE name like 'f1';
|
||||||
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
|
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
|
||||||
test f1 FUNCTION f1 SQL CONTAINS_SQL NO DEFINER str char(20) char(100) CHARSET latin1 RETURN CONCAT('Hello, ', str, '!') root@localhost 2014-09-30 08:00:00 2014-09-30 08:00:00 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci RETURN CONCAT('Hello, ', str, '!')
|
test f1 FUNCTION f1 SQL CONTAINS_SQL NO DEFINER str char(20) char(100) CHARSET latin1 RETURN CONCAT('Hello, ', str, '!') root@localhost 2014-09-30 08:00:00 2014-09-30 08:00:00 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci RETURN CONCAT('Hello, ', str, '!') NONE
|
||||||
SELECT f1('world');
|
SELECT f1('world');
|
||||||
f1('world')
|
f1('world')
|
||||||
Hello, world!
|
Hello, world!
|
||||||
|
@ -55,5 +55,5 @@ id
|
|||||||
DROP VIEW IF EXISTS v1;
|
DROP VIEW IF EXISTS v1;
|
||||||
DROP VIEW IF EXISTS v1;
|
DROP VIEW IF EXISTS v1;
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 4090 Unknown VIEW: 'test.v1'
|
Note 4091 Unknown VIEW: 'test.v1'
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
@ -63,3 +63,61 @@ connection root;
|
|||||||
revoke all privileges on mysqltest.v1 from mysqltest_1@localhost;
|
revoke all privileges on mysqltest.v1 from mysqltest_1@localhost;
|
||||||
drop user mysqltest_1@localhost;
|
drop user mysqltest_1@localhost;
|
||||||
drop database mysqltest;
|
drop database mysqltest;
|
||||||
|
#
|
||||||
|
# MDEV-13453: privileges checking for CTE
|
||||||
|
#
|
||||||
|
create database db;
|
||||||
|
use db;
|
||||||
|
create table t1 (i int);
|
||||||
|
insert into t1
|
||||||
|
values (3), (7), (1), (4), (2), (3), (1);
|
||||||
|
create table t2 (a int, b int);
|
||||||
|
insert into t2
|
||||||
|
values (3,10), (7,11), (1,17), (4,15), (2,11), (3,10), (1,15);
|
||||||
|
create user foo@localhost;
|
||||||
|
grant SELECT on db.t1 to foo@localhost;
|
||||||
|
grant SELECT(a) on db.t2 to foo@localhost;
|
||||||
|
connect con1,localhost,foo,,;
|
||||||
|
use db;
|
||||||
|
with cte as (select * from t1 where i < 4)
|
||||||
|
select * from cte;
|
||||||
|
i
|
||||||
|
3
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
1
|
||||||
|
with cte as (select * from t1 where i < 4 group by i)
|
||||||
|
select * from cte;
|
||||||
|
i
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
with cte as (select * from t1 where i < 4)
|
||||||
|
select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2;
|
||||||
|
i
|
||||||
|
1
|
||||||
|
3
|
||||||
|
with cte as (select * from t1 where i < 4 group by i)
|
||||||
|
select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2;
|
||||||
|
i
|
||||||
|
1
|
||||||
|
3
|
||||||
|
with cte as (select b from t2 where a < 4)
|
||||||
|
select * from cte cte1 where b < 15 union select * from cte cte2 where b > 15;
|
||||||
|
ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'b' in table 't2'
|
||||||
|
with cte as (select a from t2 where a < 4)
|
||||||
|
select * from cte cte1 where a < 2 union select * from cte cte2 where a > 2;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
3
|
||||||
|
connection default;
|
||||||
|
revoke SELECT on db.t1 from foo@localhost;
|
||||||
|
connection con1;
|
||||||
|
with cte as (select * from t1 where i < 4)
|
||||||
|
select * from cte;
|
||||||
|
ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1'
|
||||||
|
disconnect con1;
|
||||||
|
connection default;
|
||||||
|
drop database db;
|
||||||
|
drop user foo@localhost;
|
||||||
|
938
mysql-test/r/custom_aggregate_functions.result
Normal file
938
mysql-test/r/custom_aggregate_functions.result
Normal file
@ -0,0 +1,938 @@
|
|||||||
|
create table t2 (sal int(10));
|
||||||
|
create aggregate function f1(x INT) returns int
|
||||||
|
begin
|
||||||
|
declare continue handler for not found return 0;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
insert into t2 (sal) values (x);
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
create table t1 (sal int(10),id int(10));
|
||||||
|
INSERT INTO t1 (sal,id) VALUES (5000,1);
|
||||||
|
INSERT INTO t1 (sal,id) VALUES (2000,1);
|
||||||
|
INSERT INTO t1 (sal,id) VALUES (1000,1);
|
||||||
|
select f1(sal) from t1 where id>= 1;
|
||||||
|
f1(sal)
|
||||||
|
0
|
||||||
|
Warnings:
|
||||||
|
Note 4093 At line 5 in test.f1
|
||||||
|
Note 4093 At line 5 in test.f1
|
||||||
|
Note 4093 At line 5 in test.f1
|
||||||
|
select * from t2;
|
||||||
|
sal
|
||||||
|
5000
|
||||||
|
2000
|
||||||
|
1000
|
||||||
|
drop table t2;
|
||||||
|
drop function f1;
|
||||||
|
create aggregate function f1(x INT) returns INT
|
||||||
|
begin
|
||||||
|
insert into t1(sal) values (x);
|
||||||
|
return x;
|
||||||
|
end|
|
||||||
|
ERROR HY000: Aggregate specific instruction(FETCH GROUP NEXT ROW) missing from the aggregate function
|
||||||
|
create function f1(x INT) returns INT
|
||||||
|
begin
|
||||||
|
set x=5;
|
||||||
|
fetch group next row;
|
||||||
|
return x+1;
|
||||||
|
end |
|
||||||
|
ERROR HY000: Non-aggregate function contains aggregate specific instructions: (FETCH GROUP NEXT ROW)
|
||||||
|
create aggregate function f1(x INT) returns INT
|
||||||
|
begin
|
||||||
|
declare continue handler for not found return x;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
end loop;
|
||||||
|
end |
|
||||||
|
select f1(1);
|
||||||
|
f1(1)
|
||||||
|
1
|
||||||
|
show create function f1;
|
||||||
|
Function sql_mode Create Function character_set_client collation_connection Database Collation
|
||||||
|
f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` AGGREGATE FUNCTION `f1`(x INT) RETURNS int(11)
|
||||||
|
begin
|
||||||
|
declare continue handler for not found return x;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
end loop;
|
||||||
|
end latin1 latin1_swedish_ci latin1_swedish_ci
|
||||||
|
alter function f1 aggregate none;
|
||||||
|
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 'aggregate none' at line 1
|
||||||
|
show create function f1;
|
||||||
|
Function sql_mode Create Function character_set_client collation_connection Database Collation
|
||||||
|
f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` AGGREGATE FUNCTION `f1`(x INT) RETURNS int(11)
|
||||||
|
begin
|
||||||
|
declare continue handler for not found return x;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
end loop;
|
||||||
|
end latin1 latin1_swedish_ci latin1_swedish_ci
|
||||||
|
select f1(1);
|
||||||
|
f1(1)
|
||||||
|
1
|
||||||
|
drop function f1;
|
||||||
|
create aggregate function f2(i int) returns int
|
||||||
|
begin
|
||||||
|
FEtCH GROUP NEXT ROW;
|
||||||
|
if i <= 0 then
|
||||||
|
return 0;
|
||||||
|
elseif i = 1 then
|
||||||
|
return (select count(*) from t1 where id = i);
|
||||||
|
else
|
||||||
|
return (select count(*) + f2( i - 1) from t1 where id = i);
|
||||||
|
end if;
|
||||||
|
end|
|
||||||
|
select f2(1)|
|
||||||
|
f2(1)
|
||||||
|
3
|
||||||
|
select f2(2)|
|
||||||
|
ERROR HY000: Recursive stored functions and triggers are not allowed
|
||||||
|
select f2(3)|
|
||||||
|
ERROR HY000: Recursive stored functions and triggers are not allowed
|
||||||
|
drop function f2|
|
||||||
|
create aggregate function f1(x int) returns int
|
||||||
|
begin
|
||||||
|
declare mini int default 0;
|
||||||
|
declare continue handler for not found return mini;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
set mini= mini+x;
|
||||||
|
fetch group next row;
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
select f1(10);
|
||||||
|
f1(10)
|
||||||
|
10
|
||||||
|
select f1(sal) from t1;
|
||||||
|
f1(sal)
|
||||||
|
6000
|
||||||
|
select f1(sal) from t1 where 1=0;
|
||||||
|
f1(sal)
|
||||||
|
NULL
|
||||||
|
drop function f1;
|
||||||
|
create aggregate function f1(x int) returns int
|
||||||
|
begin
|
||||||
|
declare mini int default 0;
|
||||||
|
LOOP
|
||||||
|
FETCH GROUP NEXT ROW;
|
||||||
|
set mini = mini + x;
|
||||||
|
END LOOP;
|
||||||
|
end|
|
||||||
|
ERROR 42000: No RETURN found in FUNCTION test.f1
|
||||||
|
create aggregate function f1(x int) returns int
|
||||||
|
begin
|
||||||
|
declare mini int default 0;
|
||||||
|
LOOP
|
||||||
|
FETCH GROUP NEXT ROW;
|
||||||
|
set mini = mini + x;
|
||||||
|
END LOOP;
|
||||||
|
return -1;
|
||||||
|
end|
|
||||||
|
select f1(sal) from t1|
|
||||||
|
ERROR 02000: No data - zero rows fetched, selected, or processed
|
||||||
|
drop function f1|
|
||||||
|
create aggregate function f1(x int) returns int
|
||||||
|
begin
|
||||||
|
declare mini int default 0;
|
||||||
|
declare continue handler for not found return mini;
|
||||||
|
FETCH GROUP NEXT ROW;
|
||||||
|
set mini = mini + x;
|
||||||
|
end|
|
||||||
|
select f1(sal) from t1|
|
||||||
|
ERROR 2F005: FUNCTION f1 ended without RETURN
|
||||||
|
drop function f1|
|
||||||
|
create aggregate function f1(x int) returns int
|
||||||
|
begin
|
||||||
|
declare mini int default 0;
|
||||||
|
declare continue handler for not found set mini=-1;
|
||||||
|
LOOP
|
||||||
|
FETCH GROUP NEXT ROW;
|
||||||
|
set mini = mini + x;
|
||||||
|
END LOOP;
|
||||||
|
return 0;
|
||||||
|
end|
|
||||||
|
select f1(sal) from t1|
|
||||||
|
ERROR 2F005: FUNCTION f1 ended without RETURN
|
||||||
|
drop function f1|
|
||||||
|
drop table t1|
|
||||||
|
create table t1 (sal int, id int, val int, counter int, primary key(id));
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, 16, 2);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 15, 3);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5);
|
||||||
|
create aggregate function f1(x INT) returns double
|
||||||
|
begin
|
||||||
|
declare z double default 0;
|
||||||
|
declare continue handler for not found return z;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
set z= z+x;
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by counter order by val;
|
||||||
|
id f1(sal)
|
||||||
|
1 3000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1;
|
||||||
|
id f1(sal)
|
||||||
|
1 17000
|
||||||
|
select id, f1(sal) from t1 where id>= 1;
|
||||||
|
id f1(sal)
|
||||||
|
1 17000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by counter;
|
||||||
|
id f1(sal)
|
||||||
|
1 3000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by id;
|
||||||
|
id f1(sal)
|
||||||
|
1 1000
|
||||||
|
2 2000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by val;
|
||||||
|
id f1(sal)
|
||||||
|
1 1000
|
||||||
|
2 2000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by counter order by counter;
|
||||||
|
id f1(sal)
|
||||||
|
1 3000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by counter order by val;
|
||||||
|
id f1(sal)
|
||||||
|
1 3000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by counter order by id;
|
||||||
|
id f1(sal)
|
||||||
|
1 3000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by val order by counter;
|
||||||
|
id f1(sal)
|
||||||
|
1 1000
|
||||||
|
2 2000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by val order by id;
|
||||||
|
id f1(sal)
|
||||||
|
1 1000
|
||||||
|
2 2000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by val order by val;
|
||||||
|
id f1(sal)
|
||||||
|
1 1000
|
||||||
|
2 2000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (sal int, id int, val int, counter int, primary key(id), unique key(val));
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, NULL, 2);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 15, 3);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5);
|
||||||
|
select id, f1(sal) from t1;
|
||||||
|
id f1(sal)
|
||||||
|
1 17000
|
||||||
|
select id, f1(sal) from t1 where id>= 1;
|
||||||
|
id f1(sal)
|
||||||
|
1 17000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by counter;
|
||||||
|
id f1(sal)
|
||||||
|
1 3000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by id;
|
||||||
|
id f1(sal)
|
||||||
|
1 1000
|
||||||
|
2 2000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by val;
|
||||||
|
id f1(sal)
|
||||||
|
1 1000
|
||||||
|
2 2000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by counter order by counter;
|
||||||
|
id f1(sal)
|
||||||
|
1 3000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by counter order by val;
|
||||||
|
id f1(sal)
|
||||||
|
1 3000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by counter order by id;
|
||||||
|
id f1(sal)
|
||||||
|
1 3000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by val order by counter;
|
||||||
|
id f1(sal)
|
||||||
|
1 1000
|
||||||
|
2 2000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by val order by id;
|
||||||
|
id f1(sal)
|
||||||
|
1 1000
|
||||||
|
2 2000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by val order by val;
|
||||||
|
id f1(sal)
|
||||||
|
1 1000
|
||||||
|
2 2000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (sal int, id int, val int, counter int, primary key(id), INDEX name (val,counter));
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, 10, 4);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 11, 3);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5);
|
||||||
|
select id, f1(sal) from t1;
|
||||||
|
id f1(sal)
|
||||||
|
1 17000
|
||||||
|
select id, f1(sal) from t1 where id>= 1;
|
||||||
|
id f1(sal)
|
||||||
|
1 17000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by counter;
|
||||||
|
id f1(sal)
|
||||||
|
1 1000
|
||||||
|
2 2000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by id;
|
||||||
|
id f1(sal)
|
||||||
|
1 1000
|
||||||
|
2 2000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by val;
|
||||||
|
id f1(sal)
|
||||||
|
1 3000
|
||||||
|
3 6000
|
||||||
|
4 8000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by counter order by counter;
|
||||||
|
id f1(sal)
|
||||||
|
1 1000
|
||||||
|
2 2000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by counter order by val;
|
||||||
|
id f1(sal)
|
||||||
|
1 1000
|
||||||
|
2 2000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by counter order by id;
|
||||||
|
id f1(sal)
|
||||||
|
1 1000
|
||||||
|
2 2000
|
||||||
|
3 6000
|
||||||
|
4 5000
|
||||||
|
5 3000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by val order by counter;
|
||||||
|
id f1(sal)
|
||||||
|
1 3000
|
||||||
|
3 6000
|
||||||
|
4 8000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by val order by id;
|
||||||
|
id f1(sal)
|
||||||
|
1 3000
|
||||||
|
3 6000
|
||||||
|
4 8000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by val order by val;
|
||||||
|
id f1(sal)
|
||||||
|
1 3000
|
||||||
|
3 6000
|
||||||
|
4 8000
|
||||||
|
drop table t1;
|
||||||
|
drop function f1;
|
||||||
|
create aggregate function f1(x INT) returns double
|
||||||
|
begin
|
||||||
|
declare z double default 0;
|
||||||
|
declare continue handler for not found return z;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
set z= z+x;
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
create aggregate function f2() returns double
|
||||||
|
begin
|
||||||
|
declare z int default 0;
|
||||||
|
declare continue handler for not found return z;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
set z = z+1;
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
create table t1 (sal int, id int, val int, counter int);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 10, 2);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 1, 16, 5);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 2, 18, 1);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 3, 15, 3);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 4, 11, 4);
|
||||||
|
prepare test from "select f2() from t1 where id>= ?";
|
||||||
|
set @param= 2;
|
||||||
|
execute test using @param;
|
||||||
|
f2()
|
||||||
|
4
|
||||||
|
execute test using @param;
|
||||||
|
f2()
|
||||||
|
4
|
||||||
|
execute test using @param;
|
||||||
|
f2()
|
||||||
|
4
|
||||||
|
execute test using @param;
|
||||||
|
f2()
|
||||||
|
4
|
||||||
|
set @param= 1;
|
||||||
|
execute test using @param;
|
||||||
|
f2()
|
||||||
|
5
|
||||||
|
set @param= 3;
|
||||||
|
execute test using @param;
|
||||||
|
f2()
|
||||||
|
2
|
||||||
|
set @param= 4;
|
||||||
|
execute test using @param;
|
||||||
|
f2()
|
||||||
|
1
|
||||||
|
deallocate prepare test;
|
||||||
|
prepare test from "select f1(sal) from t1 where id>= ?";
|
||||||
|
set @param= 2;
|
||||||
|
execute test using @param;
|
||||||
|
f1(sal)
|
||||||
|
15000
|
||||||
|
execute test using @param;
|
||||||
|
f1(sal)
|
||||||
|
15000
|
||||||
|
execute test using @param;
|
||||||
|
f1(sal)
|
||||||
|
15000
|
||||||
|
execute test using @param;
|
||||||
|
f1(sal)
|
||||||
|
15000
|
||||||
|
set @param= 1;
|
||||||
|
execute test using @param;
|
||||||
|
f1(sal)
|
||||||
|
17000
|
||||||
|
set @param= 3;
|
||||||
|
execute test using @param;
|
||||||
|
f1(sal)
|
||||||
|
8000
|
||||||
|
set @param= 4;
|
||||||
|
execute test using @param;
|
||||||
|
f1(sal)
|
||||||
|
3000
|
||||||
|
set @param= 5;
|
||||||
|
execute test using @param;
|
||||||
|
f1(sal)
|
||||||
|
NULL
|
||||||
|
deallocate prepare test;
|
||||||
|
drop function f2;
|
||||||
|
prepare test from "select f1(sal) from t1 where id>= ?";
|
||||||
|
set @param= 2;
|
||||||
|
execute test using @param;
|
||||||
|
f1(sal)
|
||||||
|
15000
|
||||||
|
drop function f1;
|
||||||
|
create function f1(x int) returns int
|
||||||
|
return -1;
|
||||||
|
execute test using @param;
|
||||||
|
f1(sal)
|
||||||
|
-1
|
||||||
|
-1
|
||||||
|
-1
|
||||||
|
-1
|
||||||
|
drop function f1;
|
||||||
|
create aggregate function f1(x INT) returns double
|
||||||
|
begin
|
||||||
|
declare z double default 0;
|
||||||
|
declare continue handler for not found return z;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
set z= z+x;
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
execute test using @param;
|
||||||
|
f1(sal)
|
||||||
|
15000
|
||||||
|
deallocate prepare test;
|
||||||
|
drop table t1;
|
||||||
|
drop function f1;
|
||||||
|
create table t1 (sal int, id int, val varchar(10), counter int);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 'ab', 2);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 'cd', 5);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 'ef', 1);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 3, 'gh', 3);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 4, 'ij', 4);
|
||||||
|
create table t2 (sal int, id int, val int, counter int);
|
||||||
|
INSERT INTO t2 (sal, id, val, counter) VALUES (1000, 2, 10, 2);
|
||||||
|
INSERT INTO t2 (sal, id, val, counter) VALUES (2000, 1, 16, 5);
|
||||||
|
INSERT INTO t2 (sal, id, val, counter) VALUES (6000, 2, 18, 1);
|
||||||
|
INSERT INTO t2 (sal, id, val, counter) VALUES (5000, 3, 15, 3);
|
||||||
|
INSERT INTO t2 (sal, id, val, counter) VALUES (3000, 4, 11, 4);
|
||||||
|
create aggregate function f1(x double) returns double
|
||||||
|
begin
|
||||||
|
declare z double default 0;
|
||||||
|
declare continue handler for not found return z;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
set z= z+x;
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
create aggregate function f2(x INT) returns CHAR(10)
|
||||||
|
begin
|
||||||
|
declare mini INT default 0;
|
||||||
|
declare continue handler for not found return mini;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
set mini= mini + x;
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
create aggregate function f3(x INT) returns CHAR(10)
|
||||||
|
begin
|
||||||
|
declare mini INT default 0;
|
||||||
|
declare continue handler for not found return mini;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
set mini= mini + x;
|
||||||
|
fetch group next row;
|
||||||
|
set mini= mini - x;
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
create aggregate function f4(x INT, y varchar(10)) returns varchar(1000)
|
||||||
|
begin
|
||||||
|
declare str varchar(1000) default '';
|
||||||
|
declare continue handler for not found return str;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
set str= concat(str,y);
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
create aggregate function f5(x INT) returns varchar(1000)
|
||||||
|
begin
|
||||||
|
declare z int default 0;
|
||||||
|
DECLARE cur1 CURSOR FOR SELECT sal FROM test.t2;
|
||||||
|
declare continue handler for not found return 0;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
set z = z+x;
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
create function f6(x int) returns int
|
||||||
|
return (select f1(sal) from t1)|
|
||||||
|
select f1(sal) from t1;
|
||||||
|
f1(sal)
|
||||||
|
5000
|
||||||
|
select f1(sal) from t1 where id>= 1 group by counter;
|
||||||
|
f1(sal)
|
||||||
|
1000
|
||||||
|
1000
|
||||||
|
1000
|
||||||
|
1000
|
||||||
|
1000
|
||||||
|
select f3(sal) from t1;
|
||||||
|
f3(sal)
|
||||||
|
1000
|
||||||
|
select f2(val) from t1;
|
||||||
|
ERROR 22007: Incorrect integer value: 'ab' for column 'x' at row 1
|
||||||
|
select val, id, c from (select f1(sal) as c from t2) as t1, t2;
|
||||||
|
val id c
|
||||||
|
10 2 17000
|
||||||
|
11 4 17000
|
||||||
|
15 3 17000
|
||||||
|
16 1 17000
|
||||||
|
18 2 17000
|
||||||
|
select f1(sal),f1(val), f1(id), f1(sal) from t2;
|
||||||
|
f1(sal) f1(val) f1(id) f1(sal)
|
||||||
|
17000 70 12 17000
|
||||||
|
select f4(sal, val) from t1;
|
||||||
|
f4(sal, val)
|
||||||
|
abcdefghij
|
||||||
|
select c from (select f1(sal) as c from t2) as t1;
|
||||||
|
c
|
||||||
|
17000
|
||||||
|
select f1((select val from t2 where 0 > 1)) from t1;
|
||||||
|
f1((select val from t2 where 0 > 1))
|
||||||
|
NULL
|
||||||
|
select f1((select val from t2 where id= 1)) from t1;
|
||||||
|
f1((select val from t2 where id= 1))
|
||||||
|
80
|
||||||
|
select f5(sal) from t1;
|
||||||
|
f5(sal)
|
||||||
|
0
|
||||||
|
SELECT f1(sal)*f1(sal) FROM t1;
|
||||||
|
f1(sal)*f1(sal)
|
||||||
|
25000000
|
||||||
|
SELECT (SELECT f1(sal) FROM t1) FROM t2;
|
||||||
|
(SELECT f1(sal) FROM t1)
|
||||||
|
5000
|
||||||
|
5000
|
||||||
|
5000
|
||||||
|
5000
|
||||||
|
5000
|
||||||
|
select id, f1(sal) from t1;
|
||||||
|
id f1(sal)
|
||||||
|
2 5000
|
||||||
|
select id, f1(sal) from t1 where id>= 1;
|
||||||
|
id f1(sal)
|
||||||
|
2 5000
|
||||||
|
select f1(sal), f1(sal) from t1 where id>= 1 group by counter;
|
||||||
|
f1(sal) f1(sal)
|
||||||
|
1000 1000
|
||||||
|
1000 1000
|
||||||
|
1000 1000
|
||||||
|
1000 1000
|
||||||
|
1000 1000
|
||||||
|
select f1(sal), f1(sal) from t1 where id>= 1 group by id ;
|
||||||
|
f1(sal) f1(sal)
|
||||||
|
1000 1000
|
||||||
|
1000 1000
|
||||||
|
1000 1000
|
||||||
|
2000 2000
|
||||||
|
select f1(sal) from t1 where id>= 1 group by id ;
|
||||||
|
f1(sal)
|
||||||
|
1000
|
||||||
|
1000
|
||||||
|
1000
|
||||||
|
2000
|
||||||
|
select f1(sal) from t1 where id>= 1 order by counter;
|
||||||
|
f1(sal)
|
||||||
|
5000
|
||||||
|
select f1(sal) from t1 where id>= 1 group by id order by counter;
|
||||||
|
f1(sal)
|
||||||
|
2000
|
||||||
|
1000
|
||||||
|
1000
|
||||||
|
1000
|
||||||
|
select counter, id, f1(sal) from t1 where id>= 1 group by id order by counter;
|
||||||
|
counter id f1(sal)
|
||||||
|
2 2 2000
|
||||||
|
3 3 1000
|
||||||
|
4 4 1000
|
||||||
|
5 1 1000
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by id order by counter;
|
||||||
|
id f1(sal)
|
||||||
|
2 2000
|
||||||
|
3 1000
|
||||||
|
4 1000
|
||||||
|
1 1000
|
||||||
|
drop table t1;
|
||||||
|
drop table t2;
|
||||||
|
drop function f1;
|
||||||
|
drop function f2;
|
||||||
|
drop function f3;
|
||||||
|
drop function f4;
|
||||||
|
drop function f5;
|
||||||
|
drop function f6;
|
||||||
|
create aggregate function f1(x INT) returns INT
|
||||||
|
begin
|
||||||
|
declare z double default 1000;
|
||||||
|
declare continue handler for not found return z;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
set z= (z&x);
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
create table t1 (sal int, id int, val int, counter int);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 10, 2);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (7000, 1, 16, 5);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 2, 18, 1);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 3, 15, 3);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 4, 11, 4);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 5, 10, 7);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 7, 13, 8);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 6, 19, 9);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (7000, 7, 12, 0);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (4000, 6, 14, 1);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (8000, 5, 19, 3);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (9000, 4, 11, 4);
|
||||||
|
INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 3, 11, 2);
|
||||||
|
select f1(sal) from t1 where id>= 1;
|
||||||
|
f1(sal)
|
||||||
|
768
|
||||||
|
drop function f1;
|
||||||
|
create aggregate function f1(x INT) returns double
|
||||||
|
begin
|
||||||
|
declare z double default 0;
|
||||||
|
declare count double default 0;
|
||||||
|
declare continue handler for not found return z/count;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
set z= z+x;
|
||||||
|
set count= count+1;
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
select f1(sal) from t1 where id>= 1;
|
||||||
|
f1(sal)
|
||||||
|
4923.076923076923
|
||||||
|
drop function f1;
|
||||||
|
create aggregate function f1(x INT) returns INT
|
||||||
|
begin
|
||||||
|
declare maxi INT default -1;
|
||||||
|
declare continue handler for not found return maxi;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
if maxi < x then
|
||||||
|
set maxi= x;
|
||||||
|
end if;
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
select f1(sal) from t1 where id>= 1;
|
||||||
|
f1(sal)
|
||||||
|
9000
|
||||||
|
drop function f1;
|
||||||
|
create aggregate function f1(x INT) returns double
|
||||||
|
begin
|
||||||
|
declare mini INT default 100000;
|
||||||
|
declare continue handler for not found return mini;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
if mini > x then
|
||||||
|
set mini = x;
|
||||||
|
end if;
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
select f1(sal) from t1 where id>= 1;
|
||||||
|
f1(sal)
|
||||||
|
1000
|
||||||
|
drop function f1;
|
||||||
|
create aggregate function f1(x INT) returns double
|
||||||
|
begin
|
||||||
|
declare z double default 0;
|
||||||
|
declare continue handler for not found return z;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
set z= z^x;
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
select f1(sal) from t1 where id>= 1;
|
||||||
|
f1(sal)
|
||||||
|
16288
|
||||||
|
drop function f1;
|
||||||
|
create aggregate function f1(x INT) returns INT
|
||||||
|
begin
|
||||||
|
declare z int default 0;
|
||||||
|
declare continue handler for not found return z;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
set z= z+x;
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
select f1(sal) from t1 where id>= 1;
|
||||||
|
f1(sal)
|
||||||
|
64000
|
||||||
|
create aggregate function f2() returns INT
|
||||||
|
begin
|
||||||
|
declare z double default 0;
|
||||||
|
declare continue handler for not found return z;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
set z= z+1;
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
select f2() from t1;
|
||||||
|
f2()
|
||||||
|
13
|
||||||
|
create table t2 (sal int, id int);
|
||||||
|
INSERT INTO t2 (sal, id) VALUES (NULL, 1);
|
||||||
|
INSERT INTO t2 (sal, id) VALUES (2000, 1);
|
||||||
|
INSERT INTO t2 (sal, id) VALUES (3000, 1);
|
||||||
|
select f1(sal) from t2;
|
||||||
|
f1(sal)
|
||||||
|
NULL
|
||||||
|
select f1(1);
|
||||||
|
f1(1)
|
||||||
|
1
|
||||||
|
create function f3() returns int
|
||||||
|
return (select f1(sal) from t1);
|
||||||
|
select f3();
|
||||||
|
f3()
|
||||||
|
64000
|
||||||
|
create function f4() returns INT
|
||||||
|
return 1;
|
||||||
|
create aggregate function f5() returns INT
|
||||||
|
begin
|
||||||
|
declare z double default 0;
|
||||||
|
declare continue handler for not found return z;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
set z= z+f3();
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
select f5() from t2;
|
||||||
|
f5()
|
||||||
|
192000
|
||||||
|
Warnings:
|
||||||
|
Note 4093 At line 6 in test.f5
|
||||||
|
Note 4093 At line 6 in test.f5
|
||||||
|
Note 4093 At line 6 in test.f5
|
||||||
|
create aggregate function f6(x INT) returns INT
|
||||||
|
begin
|
||||||
|
declare z int default 0;
|
||||||
|
declare continue handler for not found return z;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
if x then
|
||||||
|
set z= z+(select f1(sal) from t1);
|
||||||
|
end if;
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
select f6(sal) from t2;
|
||||||
|
f6(sal)
|
||||||
|
128000
|
||||||
|
Warnings:
|
||||||
|
Note 4093 At line 6 in test.f6
|
||||||
|
Note 4093 At line 6 in test.f6
|
||||||
|
select id, f1(sal) from t1 where id>= 1 group by id;
|
||||||
|
id f1(sal)
|
||||||
|
1 7000
|
||||||
|
2 7000
|
||||||
|
3 6000
|
||||||
|
4 12000
|
||||||
|
5 10000
|
||||||
|
6 10000
|
||||||
|
7 12000
|
||||||
|
select counter, f1(sal) from t1 where id>= 1 group by counter;
|
||||||
|
counter f1(sal)
|
||||||
|
0 7000
|
||||||
|
1 10000
|
||||||
|
2 2000
|
||||||
|
3 13000
|
||||||
|
4 12000
|
||||||
|
5 7000
|
||||||
|
7 2000
|
||||||
|
8 5000
|
||||||
|
9 6000
|
||||||
|
select val, f1(sal) from t1 where id>= 1 group by val;
|
||||||
|
val f1(sal)
|
||||||
|
10 3000
|
||||||
|
11 13000
|
||||||
|
12 7000
|
||||||
|
13 5000
|
||||||
|
14 4000
|
||||||
|
15 5000
|
||||||
|
16 7000
|
||||||
|
18 6000
|
||||||
|
19 14000
|
||||||
|
select counter, f1(sal) from t1 where id>= 1 group by id order by counter;
|
||||||
|
counter f1(sal)
|
||||||
|
0 12000
|
||||||
|
2 6000
|
||||||
|
2 7000
|
||||||
|
4 12000
|
||||||
|
5 7000
|
||||||
|
7 10000
|
||||||
|
9 10000
|
||||||
|
select counter, id, f1(sal), f1(sal) from t1 where id>= 1 group by id order by counter;
|
||||||
|
counter id f1(sal) f1(sal)
|
||||||
|
0 7 12000 12000
|
||||||
|
2 2 7000 7000
|
||||||
|
2 3 6000 6000
|
||||||
|
4 4 12000 12000
|
||||||
|
5 1 7000 7000
|
||||||
|
7 5 10000 10000
|
||||||
|
9 6 10000 10000
|
||||||
|
select counter, id, f1(sal), sum(distinct sal) from t1 where id>= 1 group by id order by counter desc;
|
||||||
|
counter id f1(sal) sum(distinct sal)
|
||||||
|
0 7 12000 12000
|
||||||
|
2 2 7000 7000
|
||||||
|
2 3 6000 6000
|
||||||
|
4 4 12000 12000
|
||||||
|
5 1 7000 7000
|
||||||
|
7 5 10000 10000
|
||||||
|
9 6 10000 10000
|
||||||
|
create table t3 (i int);
|
||||||
|
INSERT INTO t3 (i) select f1(sal) from t1;
|
||||||
|
select * from t3;
|
||||||
|
i
|
||||||
|
64000
|
||||||
|
create aggregate function f7(x INT) returns INT
|
||||||
|
begin
|
||||||
|
declare z int default 0;
|
||||||
|
DECLARE done BOOLEAN DEFAULT FALSE;
|
||||||
|
DECLARE a,b,c INT;
|
||||||
|
DECLARE cur1 CURSOR FOR SELECT id FROM test.t2;
|
||||||
|
declare continue handler for not found return z;
|
||||||
|
outer_loop: LOOP
|
||||||
|
FETCH GROUP NEXT ROW;
|
||||||
|
set z= z+x;
|
||||||
|
inner_block: begin
|
||||||
|
DECLARE cur2 CURSOR FOR SELECT id FROM test.t2;
|
||||||
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
||||||
|
OPEN cur2;
|
||||||
|
read_loop: LOOP
|
||||||
|
FETCH cur2 INTO a;
|
||||||
|
IF done THEN
|
||||||
|
CLOSE cur2;
|
||||||
|
LEAVE read_loop;
|
||||||
|
END IF;
|
||||||
|
END LOOP read_loop;
|
||||||
|
end inner_block;
|
||||||
|
END LOOP outer_loop;
|
||||||
|
end|
|
||||||
|
select f7(sal) from t1;
|
||||||
|
f7(sal)
|
||||||
|
64000
|
||||||
|
Warnings:
|
||||||
|
Note 4093 At line 9 in test.f7
|
||||||
|
Note 4093 At line 9 in test.f7
|
||||||
|
Note 4093 At line 9 in test.f7
|
||||||
|
Note 4093 At line 9 in test.f7
|
||||||
|
Note 4093 At line 9 in test.f7
|
||||||
|
Note 4093 At line 9 in test.f7
|
||||||
|
Note 4093 At line 9 in test.f7
|
||||||
|
Note 4093 At line 9 in test.f7
|
||||||
|
Note 4093 At line 9 in test.f7
|
||||||
|
Note 4093 At line 9 in test.f7
|
||||||
|
Note 4093 At line 9 in test.f7
|
||||||
|
Note 4093 At line 9 in test.f7
|
||||||
|
Note 4093 At line 9 in test.f7
|
||||||
|
drop table t1;
|
||||||
|
drop table t2;
|
||||||
|
drop table t3;
|
||||||
|
drop function f1;
|
||||||
|
drop function f2;
|
||||||
|
drop function f3;
|
||||||
|
drop function f4;
|
||||||
|
drop function f5;
|
||||||
|
drop function f6;
|
||||||
|
drop function f7;
|
@ -896,34 +896,34 @@ WHERE REF IS NULL AND DIVISION="MIS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_N
|
|||||||
A.DIVISION=C1.DIVISION AND A.RECEIVABLE_GROUP=C1.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=C1.CREDIT_LIMIT
|
A.DIVISION=C1.DIVISION AND A.RECEIVABLE_GROUP=C1.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=C1.CREDIT_LIMIT
|
||||||
ORDER BY TOTAL DESC;
|
ORDER BY TOTAL DESC;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived3> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived3> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived4> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived4> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived5> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived5> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived6> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived6> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived7> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived7> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived8> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived8> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived9> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived9> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived10> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived10> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived11> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived11> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived12> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived12> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived13> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived13> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived14> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived14> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived15> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived15> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived16> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived16> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived17> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived17> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived18> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived18> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived19> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived19> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived20> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived20> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived21> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived21> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived22> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived22> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived23> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived23> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived24> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived24> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived25> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived25> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived26> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived26> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived27> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived27> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived28> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived28> system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 PRIMARY <derived29> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived29> system NULL NULL NULL NULL 0 Const row not found
|
||||||
29 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
29 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||||
28 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
28 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||||
27 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
27 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||||
|
@ -2014,7 +2014,7 @@ SELECT t.b, t.c, t1.a
|
|||||||
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
|
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
|
||||||
WHERE t.b AND t.c = t1.a;
|
WHERE t.b AND t.c = t1.a;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
|
||||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
|
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
|
||||||
Warnings:
|
Warnings:
|
||||||
@ -2029,7 +2029,7 @@ SELECT t.b, t.c, t1.a
|
|||||||
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
|
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
|
||||||
WHERE t.b <> 0 AND t.c = t1.a;
|
WHERE t.b <> 0 AND t.c = t1.a;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
|
||||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
|
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
|
||||||
Warnings:
|
Warnings:
|
||||||
|
@ -209,10 +209,10 @@ Note 1051 Unknown table 'test.table1'
|
|||||||
Note 1051 Unknown table 'test.table2'
|
Note 1051 Unknown table 'test.table2'
|
||||||
DROP VIEW IF EXISTS view1,view2,view3,view4;
|
DROP VIEW IF EXISTS view1,view2,view3,view4;
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 4090 Unknown VIEW: 'test.view1'
|
Note 4091 Unknown VIEW: 'test.view1'
|
||||||
Note 4090 Unknown VIEW: 'test.view2'
|
Note 4091 Unknown VIEW: 'test.view2'
|
||||||
Note 4090 Unknown VIEW: 'test.view3'
|
Note 4091 Unknown VIEW: 'test.view3'
|
||||||
Note 4090 Unknown VIEW: 'test.view4'
|
Note 4091 Unknown VIEW: 'test.view4'
|
||||||
|
|
||||||
# Test error message when trigger does not find table
|
# Test error message when trigger does not find table
|
||||||
CREATE TABLE table1(a int);
|
CREATE TABLE table1(a int);
|
||||||
|
@ -2,7 +2,7 @@ drop table if exists t1;
|
|||||||
create table t1 (id int not null, str char(10), unique(str));
|
create table t1 (id int not null, str char(10), unique(str));
|
||||||
explain select * from t1;
|
explain select * from t1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
|
||||||
insert into t1 values (1, null),(2, null),(3, "foo"),(4, "bar");
|
insert into t1 values (1, null),(2, null),(3, "foo"),(4, "bar");
|
||||||
select * from t1 where str is null;
|
select * from t1 where str is null;
|
||||||
id str
|
id str
|
||||||
@ -218,8 +218,8 @@ EXPLAIN EXTENDED SELECT 1 FROM t1
|
|||||||
WHERE f1 > ALL( SELECT t.f1 FROM t1,t1 AS t );
|
WHERE f1 > ALL( SELECT t.f1 FROM t1,t1 AS t );
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
2 SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
2 SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
2 SUBQUERY t system NULL NULL NULL NULL 0 0.00 const row not found
|
2 SUBQUERY t system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 0
|
Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 0
|
||||||
SET SESSION sql_mode=@old_sql_mode;
|
SET SESSION sql_mode=@old_sql_mode;
|
||||||
@ -387,7 +387,7 @@ set optimizer_switch='derived_merge=off,derived_with_keys=off';
|
|||||||
EXPLAIN EXTENDED
|
EXPLAIN EXTENDED
|
||||||
SELECT * FROM ( SELECT t1.a FROM t1,t2 WHERE t2.a = t1.a ) AS t;
|
SELECT * FROM ( SELECT t1.a FROM t1,t2 WHERE t2.a = t1.a ) AS t;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 0 0.00 const row not found
|
1 PRIMARY <derived2> system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 /* select#1 */ select NULL AS `a` from (/* select#2 */ select NULL AS `a` from `test`.`t1` where 0) `t`
|
Note 1003 /* select#1 */ select NULL AS `a` from (/* select#2 */ select NULL AS `a` from `test`.`t1` where 0) `t`
|
||||||
|
@ -1204,7 +1204,7 @@ create table t1 (i int) engine=myisam;
|
|||||||
explain
|
explain
|
||||||
select * from t1;
|
select * from t1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
|
||||||
explain format=json
|
explain format=json
|
||||||
select * from t1;
|
select * from t1;
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
|
@ -1254,3 +1254,129 @@ DROP TABLE t1;
|
|||||||
#
|
#
|
||||||
# End of 10.2 tests
|
# End of 10.2 tests
|
||||||
#
|
#
|
||||||
|
#
|
||||||
|
# Start of 10.3 tests
|
||||||
|
#
|
||||||
|
drop table if exists t1, t2;
|
||||||
|
create table t1 (grp int, a bigint unsigned, c char(10) , d char(10) not null);
|
||||||
|
insert into t1 values (1,1,NULL,"a");
|
||||||
|
insert into t1 values (1,10,"b","a");
|
||||||
|
insert into t1 values (1,11,"c","a");
|
||||||
|
insert into t1 values (2,2,"c","a");
|
||||||
|
insert into t1 values (2,3,"b","b");
|
||||||
|
insert into t1 values (3,4,"E","a");
|
||||||
|
insert into t1 values (3,5,"C","b");
|
||||||
|
insert into t1 values (3,6,"D","c");
|
||||||
|
insert into t1 values (3,7,"E","c");
|
||||||
|
select grp,group_concat(c) from t1 group by grp;
|
||||||
|
grp group_concat(c)
|
||||||
|
1 b,c
|
||||||
|
2 c,b
|
||||||
|
3 E,C,D,E
|
||||||
|
select grp,group_concat(c limit 1 ) from t1 group by grp;
|
||||||
|
grp group_concat(c limit 1 )
|
||||||
|
1 b
|
||||||
|
2 c
|
||||||
|
3 E
|
||||||
|
select grp,group_concat(c limit 1,1 ) from t1 group by grp;
|
||||||
|
grp group_concat(c limit 1,1 )
|
||||||
|
1 c
|
||||||
|
2 b
|
||||||
|
3 C
|
||||||
|
select grp,group_concat(c limit 1,10 ) from t1 group by grp;
|
||||||
|
grp group_concat(c limit 1,10 )
|
||||||
|
1 c
|
||||||
|
2 b
|
||||||
|
3 C,D,E
|
||||||
|
select grp,group_concat(c limit 1000) from t1 group by grp;
|
||||||
|
grp group_concat(c limit 1000)
|
||||||
|
1 b,c
|
||||||
|
2 c,b
|
||||||
|
3 E,C,D,E
|
||||||
|
select group_concat(grp limit 0) from t1;
|
||||||
|
group_concat(grp limit 0)
|
||||||
|
|
||||||
|
select group_concat(grp limit "sdjadjs") from t1
|
||||||
|
--error ER_PARSE_ERROR
|
||||||
|
select grp,group_concat(c limit 5.5) from t1 group by grp ;
|
||||||
|
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 '"sdjadjs") from t1
|
||||||
|
--error ER_PARSE_ERROR
|
||||||
|
select grp,group_concat(c limit 5.5) f' at line 1
|
||||||
|
select grp,group_concat(distinct c limit 1,10 ) from t1 group by grp;
|
||||||
|
grp group_concat(distinct c limit 1,10 )
|
||||||
|
1 c
|
||||||
|
2 b
|
||||||
|
3 C,D
|
||||||
|
select grp,group_concat(c order by a) from t1 group by grp;
|
||||||
|
grp group_concat(c order by a)
|
||||||
|
1 b,c
|
||||||
|
2 c,b
|
||||||
|
3 E,C,D,E
|
||||||
|
select grp,group_concat(c order by a limit 2 ) from t1 group by grp;
|
||||||
|
grp group_concat(c order by a limit 2 )
|
||||||
|
1 b,c
|
||||||
|
2 c,b
|
||||||
|
3 E,C
|
||||||
|
select grp,group_concat(c order by a limit 1,1 ) from t1 group by grp;
|
||||||
|
grp group_concat(c order by a limit 1,1 )
|
||||||
|
1 c
|
||||||
|
2 b
|
||||||
|
3 C
|
||||||
|
select grp,group_concat(c order by c) from t1 group by grp;
|
||||||
|
grp group_concat(c order by c)
|
||||||
|
1 b,c
|
||||||
|
2 b,c
|
||||||
|
3 C,D,E,E
|
||||||
|
select grp,group_concat(c order by c limit 2) from t1 group by grp;
|
||||||
|
grp group_concat(c order by c limit 2)
|
||||||
|
1 b,c
|
||||||
|
2 b,c
|
||||||
|
3 C,D
|
||||||
|
select grp,group_concat(c order by c desc) from t1 group by grp;
|
||||||
|
grp group_concat(c order by c desc)
|
||||||
|
1 c,b
|
||||||
|
2 c,b
|
||||||
|
3 E,E,D,C
|
||||||
|
select grp,group_concat(c order by c desc limit 2) from t1 group by grp;
|
||||||
|
grp group_concat(c order by c desc limit 2)
|
||||||
|
1 c,b
|
||||||
|
2 c,b
|
||||||
|
3 E,E
|
||||||
|
drop table t1;
|
||||||
|
create table t2 (a int, b varchar(10));
|
||||||
|
insert into t2 values(1,'a'),(1,'b'),(NULL,'c'),(2,'x'),(2,'y');
|
||||||
|
select group_concat(a,b limit 2) from t2;
|
||||||
|
group_concat(a,b limit 2)
|
||||||
|
1a,1b
|
||||||
|
set @x=4;
|
||||||
|
prepare STMT from 'select group_concat(b limit ?) from t2';
|
||||||
|
execute STMT using @x;
|
||||||
|
group_concat(b limit ?)
|
||||||
|
a,b,c,x
|
||||||
|
set @x=2;
|
||||||
|
execute STMT using @x;
|
||||||
|
group_concat(b limit ?)
|
||||||
|
a,b
|
||||||
|
set @x=1000;
|
||||||
|
execute STMT using @x;
|
||||||
|
group_concat(b limit ?)
|
||||||
|
a,b,c,x,y
|
||||||
|
set @x=0;
|
||||||
|
execute STMT using @x;
|
||||||
|
group_concat(b limit ?)
|
||||||
|
|
||||||
|
set @x="adasfa";
|
||||||
|
execute STMT using @x;
|
||||||
|
ERROR HY000: Limit only accepts integer values
|
||||||
|
set @x=-1;
|
||||||
|
execute STMT using @x;
|
||||||
|
ERROR HY000: Incorrect arguments to EXECUTE
|
||||||
|
set @x=4;
|
||||||
|
prepare STMT from 'select group_concat(a,b limit ?) from t2';
|
||||||
|
execute STMT using @x;
|
||||||
|
group_concat(a,b limit ?)
|
||||||
|
1a,1b,2x,2y
|
||||||
|
drop table t2;
|
||||||
|
#
|
||||||
|
# End of 10.3 tests
|
||||||
|
#
|
||||||
|
@ -2066,7 +2066,7 @@ HAVING ('m') IN (
|
|||||||
SELECT v
|
SELECT v
|
||||||
FROM t2);
|
FROM t2);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found
|
||||||
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2
|
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2
|
||||||
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||||
set optimizer_switch=@tmp_optimizer_switch;
|
set optimizer_switch=@tmp_optimizer_switch;
|
||||||
|
@ -125,14 +125,14 @@ select 1, max(1) from t1i where 1=99;
|
|||||||
1 NULL
|
1 NULL
|
||||||
explain select count(*), min(7), max(7) from t1m, t1i;
|
explain select count(*), min(7), max(7) from t1m, t1i;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
|
1 SIMPLE t1m system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
|
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
|
||||||
select count(*), min(7), max(7) from t1m, t1i;
|
select count(*), min(7), max(7) from t1m, t1i;
|
||||||
count(*) min(7) max(7)
|
count(*) min(7) max(7)
|
||||||
0 NULL NULL
|
0 NULL NULL
|
||||||
explain select count(*), min(7), max(7) from t1m, t2i;
|
explain select count(*), min(7), max(7) from t1m, t2i;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
|
1 SIMPLE t1m system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
|
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
|
||||||
select count(*), min(7), max(7) from t1m, t2i;
|
select count(*), min(7), max(7) from t1m, t2i;
|
||||||
count(*) min(7) max(7)
|
count(*) min(7) max(7)
|
||||||
|
@ -3443,8 +3443,8 @@ EXECUTE stmt USING @a,@a;
|
|||||||
SHOW CREATE TABLE t1;
|
SHOW CREATE TABLE t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
t1 CREATE TABLE `t1` (
|
t1 CREATE TABLE `t1` (
|
||||||
`a` varchar(21) DEFAULT NULL,
|
`a` varchar(20) DEFAULT NULL,
|
||||||
`b` varchar(21) DEFAULT NULL
|
`b` varchar(20) DEFAULT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
|
@ -28,6 +28,9 @@ NULL
|
|||||||
select json_value('{"key1": [1,2,3], "key1":123}', '$.key1');
|
select json_value('{"key1": [1,2,3], "key1":123}', '$.key1');
|
||||||
json_value('{"key1": [1,2,3], "key1":123}', '$.key1')
|
json_value('{"key1": [1,2,3], "key1":123}', '$.key1')
|
||||||
123
|
123
|
||||||
|
select JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z');
|
||||||
|
JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z')
|
||||||
|
Mon"t"y
|
||||||
select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2');
|
select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2');
|
||||||
json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2')
|
json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2')
|
||||||
NULL
|
NULL
|
||||||
@ -725,6 +728,9 @@ json_contains_path('{"foo":"bar"}', 'one', '$[]')
|
|||||||
NULL
|
NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4042 Syntax error in JSON path in argument 3 to function 'json_contains_path' at position 3
|
Warning 4042 Syntax error in JSON path in argument 3 to function 'json_contains_path' at position 3
|
||||||
|
select JSON_VALID(0x36f0c8dccd83c5eac156da);
|
||||||
|
JSON_VALID(0x36f0c8dccd83c5eac156da)
|
||||||
|
0
|
||||||
#
|
#
|
||||||
# Start of 10.3 tests
|
# Start of 10.3 tests
|
||||||
#
|
#
|
||||||
|
@ -1340,12 +1340,12 @@ DROP TABLE t1;
|
|||||||
create table t1(f1 varchar(4));
|
create table t1(f1 varchar(4));
|
||||||
explain extended select encode(f1,'zxcv') as 'enc' from t1;
|
explain extended select encode(f1,'zxcv') as 'enc' from t1;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select encode(NULL,'zxcv') AS `enc` from `test`.`t1`
|
Note 1003 select encode(NULL,'zxcv') AS `enc` from `test`.`t1`
|
||||||
explain extended select decode(f1,'zxcv') as 'enc' from t1;
|
explain extended select decode(f1,'zxcv') as 'enc' from t1;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select decode(NULL,'zxcv') AS `enc` from `test`.`t1`
|
Note 1003 select decode(NULL,'zxcv') AS `enc` from `test`.`t1`
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -590,7 +590,7 @@ DROP PROCEDURE p1;
|
|||||||
SHOW WARNINGS;
|
SHOW WARNINGS;
|
||||||
Level Code Message
|
Level Code Message
|
||||||
Error 54321 MESSAGE_TEXT text
|
Error 54321 MESSAGE_TEXT text
|
||||||
Note 4092 At line 16 in test.p1
|
Note 4093 At line 16 in test.p1
|
||||||
CREATE PROCEDURE p1()
|
CREATE PROCEDURE p1()
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE var INT;
|
DECLARE var INT;
|
||||||
|
@ -89,6 +89,21 @@ ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 1)
|
|||||||
SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5);
|
SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5);
|
||||||
ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5)
|
ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5)
|
||||||
{"bbox": [10, 11, 10, 11], "type": "Point", "coordinates": [10, 11]}
|
{"bbox": [10, 11, 10, 11], "type": "Point", "coordinates": [10, 11]}
|
||||||
|
SELECT st_astext(st_geomfromgeojson('{"type": "MultiLineString","coordinates": []}')) as a;
|
||||||
|
a
|
||||||
|
NULL
|
||||||
|
Warnings:
|
||||||
|
Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array.
|
||||||
|
SELECT st_astext(st_geomfromgeojson('{"type": "Polygon","coordinates": []}')) as a;
|
||||||
|
a
|
||||||
|
NULL
|
||||||
|
Warnings:
|
||||||
|
Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array.
|
||||||
|
SELECT st_astext(st_geomfromgeojson('{"type": "MultiPolygon","coordinates": []}')) as a;
|
||||||
|
a
|
||||||
|
NULL
|
||||||
|
Warnings:
|
||||||
|
Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array.
|
||||||
#
|
#
|
||||||
# End of 10.2 tests
|
# End of 10.2 tests
|
||||||
#
|
#
|
||||||
|
@ -4390,7 +4390,7 @@ SELECT ST_BUFFER(Point(1,1), Point(1,1));
|
|||||||
ERROR HY000: Illegal parameter data type geometry for operation 'st_buffer'
|
ERROR HY000: Illegal parameter data type geometry for operation 'st_buffer'
|
||||||
PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_ENVELOPE(?) AS g';
|
PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_ENVELOPE(?) AS g';
|
||||||
EXECUTE stmt USING 1;
|
EXECUTE stmt USING 1;
|
||||||
ERROR HY000: Illegal parameter data type bigint for operation 'st_envelope'
|
ERROR HY000: Illegal parameter data type int for operation 'st_envelope'
|
||||||
EXECUTE stmt USING POINT(1,1);
|
EXECUTE stmt USING POINT(1,1);
|
||||||
SHOW CREATE TABLE t1;
|
SHOW CREATE TABLE t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
@ -4404,7 +4404,7 @@ DROP TABLE t1;
|
|||||||
DEALLOCATE PREPARE stmt;
|
DEALLOCATE PREPARE stmt;
|
||||||
PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_BUFFER(?,?) AS g';
|
PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_BUFFER(?,?) AS g';
|
||||||
EXECUTE stmt USING 1,1;
|
EXECUTE stmt USING 1,1;
|
||||||
ERROR HY000: Illegal parameter data type bigint for operation 'st_buffer'
|
ERROR HY000: Illegal parameter data type int for operation 'st_buffer'
|
||||||
EXECUTE stmt USING POINT(1,1),POINT(1,1);
|
EXECUTE stmt USING POINT(1,1),POINT(1,1);
|
||||||
ERROR HY000: Illegal parameter data type geometry for operation 'st_buffer'
|
ERROR HY000: Illegal parameter data type geometry for operation 'st_buffer'
|
||||||
EXECUTE stmt USING POINT(1,1),0;
|
EXECUTE stmt USING POINT(1,1),0;
|
||||||
@ -4455,7 +4455,7 @@ SELECT POINT(1,POINT(1,1));
|
|||||||
ERROR HY000: Illegal parameter data type geometry for operation 'point'
|
ERROR HY000: Illegal parameter data type geometry for operation 'point'
|
||||||
PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_GEOMFROMTEXT(?,?) AS g';
|
PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_GEOMFROMTEXT(?,?) AS g';
|
||||||
EXECUTE stmt USING 1,1;
|
EXECUTE stmt USING 1,1;
|
||||||
ERROR HY000: Illegal parameter data type bigint for operation 'st_geometryfromtext'
|
ERROR HY000: Illegal parameter data type int for operation 'st_geometryfromtext'
|
||||||
EXECUTE stmt USING POINT(1,1),POINT(1,1);
|
EXECUTE stmt USING POINT(1,1),POINT(1,1);
|
||||||
ERROR HY000: Illegal parameter data type geometry for operation 'st_geometryfromtext'
|
ERROR HY000: Illegal parameter data type geometry for operation 'st_geometryfromtext'
|
||||||
EXECUTE stmt USING 'POINT(1 1)',1;
|
EXECUTE stmt USING 'POINT(1 1)',1;
|
||||||
|
@ -1432,7 +1432,7 @@ Warnings:
|
|||||||
Note 1305 FUNCTION test.test_function does not exist
|
Note 1305 FUNCTION test.test_function does not exist
|
||||||
drop view if exists v1;
|
drop view if exists v1;
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 4090 Unknown VIEW: 'test.v1'
|
Note 4091 Unknown VIEW: 'test.v1'
|
||||||
create table test (col1 varchar(30));
|
create table test (col1 varchar(30));
|
||||||
create function test_function() returns varchar(30)
|
create function test_function() returns varchar(30)
|
||||||
begin
|
begin
|
||||||
|
@ -671,6 +671,7 @@ proc character_set_client char(32)
|
|||||||
proc collation_connection char(32)
|
proc collation_connection char(32)
|
||||||
proc db_collation char(32)
|
proc db_collation char(32)
|
||||||
proc body_utf8 longblob
|
proc body_utf8 longblob
|
||||||
|
proc aggregate enum('NONE','GROUP')
|
||||||
drop table t115;
|
drop table t115;
|
||||||
create procedure p108 () begin declare c cursor for select data_type
|
create procedure p108 () begin declare c cursor for select data_type
|
||||||
from information_schema.columns; open c; open c; end;//
|
from information_schema.columns; open c; open c; end;//
|
||||||
@ -1277,7 +1278,7 @@ drop table t1;
|
|||||||
use mysql;
|
use mysql;
|
||||||
INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL',
|
INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL',
|
||||||
'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03',
|
'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03',
|
||||||
'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a');
|
'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a', 'NONE');
|
||||||
select routine_name from information_schema.routines where ROUTINE_SCHEMA='test';
|
select routine_name from information_schema.routines where ROUTINE_SCHEMA='test';
|
||||||
routine_name
|
routine_name
|
||||||
|
|
||||||
|
@ -689,4 +689,17 @@ View Create View character_set_client collation_connection
|
|||||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union select `__3`.`c` AS `c`,`__3`.`d` AS `d` from ((select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect (select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__3` union (select 4 AS `4`,4 AS `4`) latin1 latin1_swedish_ci
|
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union select `__3`.`c` AS `c`,`__3`.`d` AS `d` from ((select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect (select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__3` union (select 4 AS `4`,4 AS `4`) latin1 latin1_swedish_ci
|
||||||
drop view v1;
|
drop view v1;
|
||||||
drop tables t1,t2,t3;
|
drop tables t1,t2,t3;
|
||||||
|
#
|
||||||
|
# MDEV-14346:incorrect result of intersect with ANY/ALL/IN subquery
|
||||||
|
#
|
||||||
|
CREATE TABLE t (i INT);
|
||||||
|
INSERT INTO t VALUES (1),(2);
|
||||||
|
SELECT * FROM t WHERE i != ANY ( SELECT 6 INTERSECT SELECT 3 );
|
||||||
|
i
|
||||||
|
select i from t where
|
||||||
|
exists ((select 6 as r from dual having t.i <> 6)
|
||||||
|
intersect
|
||||||
|
(select 3 from dual having t.i <> 3));
|
||||||
|
i
|
||||||
|
drop table t;
|
||||||
# End of 10.3 tests
|
# End of 10.3 tests
|
||||||
|
@ -1321,7 +1321,7 @@ c11 c21
|
|||||||
5 NULL
|
5 NULL
|
||||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON c11=c21;
|
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON c11=c21;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found
|
1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
||||||
SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21;
|
SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21;
|
||||||
c11 c21 c31
|
c11 c21 c31
|
||||||
|
@ -1332,7 +1332,7 @@ c11 c21
|
|||||||
5 NULL
|
5 NULL
|
||||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON c11=c21;
|
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON c11=c21;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found
|
1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
||||||
SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21;
|
SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21;
|
||||||
c11 c21 c31
|
c11 c21 c31
|
||||||
|
@ -98,11 +98,11 @@ create table t0 (c0 int);
|
|||||||
explain
|
explain
|
||||||
select * from t0 LIMIT ROWS EXAMINED 0;
|
select * from t0 LIMIT ROWS EXAMINED 0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t0 system NULL NULL NULL NULL 0 const row not found
|
1 SIMPLE t0 system NULL NULL NULL NULL 0 Const row not found
|
||||||
explain
|
explain
|
||||||
select * from t0 LIMIT ROWS EXAMINED 1;
|
select * from t0 LIMIT ROWS EXAMINED 1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t0 system NULL NULL NULL NULL 0 const row not found
|
1 SIMPLE t0 system NULL NULL NULL NULL 0 Const row not found
|
||||||
select * from t0 LIMIT ROWS EXAMINED 1;
|
select * from t0 LIMIT ROWS EXAMINED 1;
|
||||||
c0
|
c0
|
||||||
drop table t0;
|
drop table t0;
|
||||||
@ -592,7 +592,7 @@ create table t3_empty like t3;
|
|||||||
explain
|
explain
|
||||||
select max(c1) from t3_empty LIMIT ROWS EXAMINED 0;
|
select max(c1) from t3_empty LIMIT ROWS EXAMINED 0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3_empty system NULL NULL NULL NULL 0 const row not found
|
1 SIMPLE t3_empty system NULL NULL NULL NULL 0 Const row not found
|
||||||
select max(c1) from t3_empty LIMIT ROWS EXAMINED 0;
|
select max(c1) from t3_empty LIMIT ROWS EXAMINED 0;
|
||||||
max(c1)
|
max(c1)
|
||||||
NULL
|
NULL
|
||||||
|
@ -2184,13 +2184,13 @@ INSERT INTO t1 VALUES (1, 1, 10), (2, 2, 20);
|
|||||||
#
|
#
|
||||||
EXPLAIN UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10;
|
EXPLAIN UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found
|
1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
||||||
FLUSH STATUS;
|
FLUSH STATUS;
|
||||||
FLUSH TABLES;
|
FLUSH TABLES;
|
||||||
EXPLAIN EXTENDED UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10;
|
EXPLAIN EXTENDED UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
|
||||||
# Status of EXPLAIN EXTENDED query
|
# Status of EXPLAIN EXTENDED query
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
@ -2199,7 +2199,7 @@ FLUSH STATUS;
|
|||||||
FLUSH TABLES;
|
FLUSH TABLES;
|
||||||
EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
|
EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,NULL AS `c1`,NULL AS `c2` from `test`.`t1`
|
Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,NULL AS `c1`,NULL AS `c2` from `test`.`t1`
|
||||||
@ -2219,13 +2219,13 @@ Handler_read_rnd_next 4
|
|||||||
#
|
#
|
||||||
EXPLAIN UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10 WHERE t1.c3 = 10;
|
EXPLAIN UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10 WHERE t1.c3 = 10;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found
|
1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
|
||||||
FLUSH STATUS;
|
FLUSH STATUS;
|
||||||
FLUSH TABLES;
|
FLUSH TABLES;
|
||||||
EXPLAIN EXTENDED UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10 WHERE t1.c3 = 10;
|
EXPLAIN EXTENDED UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10 WHERE t1.c3 = 10;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
# Status of EXPLAIN EXTENDED query
|
# Status of EXPLAIN EXTENDED query
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
@ -2234,7 +2234,7 @@ FLUSH STATUS;
|
|||||||
FLUSH TABLES;
|
FLUSH TABLES;
|
||||||
EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c3 = 10;
|
EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c3 = 10;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,NULL AS `c1`,NULL AS `c2` from `test`.`t1` where `test`.`t1`.`c3` = 10
|
Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,NULL AS `c1`,NULL AS `c2` from `test`.`t1` where `test`.`t1`.`c3` = 10
|
||||||
@ -2571,12 +2571,12 @@ CREATE VIEW v1 (x) AS SELECT b FROM t2;
|
|||||||
#
|
#
|
||||||
EXPLAIN INSERT INTO v1 SELECT * FROM t1;
|
EXPLAIN INSERT INTO v1 SELECT * FROM t1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
|
||||||
FLUSH STATUS;
|
FLUSH STATUS;
|
||||||
FLUSH TABLES;
|
FLUSH TABLES;
|
||||||
EXPLAIN EXTENDED INSERT INTO v1 SELECT * FROM t1;
|
EXPLAIN EXTENDED INSERT INTO v1 SELECT * FROM t1;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
# Status of EXPLAIN EXTENDED query
|
# Status of EXPLAIN EXTENDED query
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Handler_read_rnd_next 1
|
Handler_read_rnd_next 1
|
||||||
@ -2584,7 +2584,7 @@ FLUSH STATUS;
|
|||||||
FLUSH TABLES;
|
FLUSH TABLES;
|
||||||
EXPLAIN EXTENDED SELECT * FROM t1;
|
EXPLAIN EXTENDED SELECT * FROM t1;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select NULL AS `a` from `test`.`t1`
|
Note 1003 select NULL AS `a` from `test`.`t1`
|
||||||
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
|
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
|
||||||
@ -2781,7 +2781,7 @@ CREATE TABLE t2 (id INT);
|
|||||||
INSERT INTO t1 VALUES (1), (2);
|
INSERT INTO t1 VALUES (1), (2);
|
||||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USING(id) GROUP BY t1.id;
|
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USING(id) GROUP BY t1.id;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found; Using temporary; Using filesort
|
1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found; Using temporary; Using filesort
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
#74
|
#74
|
||||||
@ -2879,7 +2879,7 @@ CALL p16();
|
|||||||
DROP PROCEDURE p16;
|
DROP PROCEDURE p16;
|
||||||
CALL p15();
|
CALL p15();
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
|
||||||
DROP PROCEDURE p15;
|
DROP PROCEDURE p15;
|
||||||
CALL p14();
|
CALL p14();
|
||||||
DROP PROCEDURE p14;
|
DROP PROCEDURE p14;
|
||||||
|
@ -1258,3 +1258,4 @@ DELIMITER ;
|
|||||||
ROLLBACK /* added by mysqlbinlog */;
|
ROLLBACK /* added by mysqlbinlog */;
|
||||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||||
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
|
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
|
||||||
|
mysqlbinlog Ver VER for OS at ARCH
|
||||||
|
@ -242,7 +242,7 @@ The following options may be given as the first argument:
|
|||||||
This option causes CREATE TABLE to create all TIMESTAMP
|
This option causes CREATE TABLE to create all TIMESTAMP
|
||||||
columns as NULL with DEFAULT NULL attribute, Without this
|
columns as NULL with DEFAULT NULL attribute, Without this
|
||||||
option, TIMESTAMP columns are NOT NULL and have implicit
|
option, TIMESTAMP columns are NOT NULL and have implicit
|
||||||
DEFAULT clauses. The old behavior is deprecated.
|
DEFAULT clauses.
|
||||||
--external-locking Use system (external) locking (disabled by default).
|
--external-locking Use system (external) locking (disabled by default).
|
||||||
With this option enabled you can run myisamchk to test
|
With this option enabled you can run myisamchk to test
|
||||||
(not repair) tables while the MySQL server is running.
|
(not repair) tables while the MySQL server is running.
|
||||||
@ -1118,8 +1118,19 @@ The following options may be given as the first argument:
|
|||||||
(Defaults to on; use --skip-slave-sql-verify-checksum to disable.)
|
(Defaults to on; use --skip-slave-sql-verify-checksum to disable.)
|
||||||
--slave-transaction-retries=#
|
--slave-transaction-retries=#
|
||||||
Number of times the slave SQL thread will retry a
|
Number of times the slave SQL thread will retry a
|
||||||
transaction in case it failed with a deadlock or elapsed
|
transaction in case it failed with a deadlock, elapsed
|
||||||
lock wait timeout, before giving up and stopping
|
lock wait timeout or listed in
|
||||||
|
slave_transaction_retry_errors, before giving up and
|
||||||
|
stopping
|
||||||
|
--slave-transaction-retry-errors=name
|
||||||
|
Tells the slave thread to retry transaction for
|
||||||
|
replication when a query event returns an error from the
|
||||||
|
provided list. Deadlock and elapsed lock wait timeout
|
||||||
|
errors are automatically added to this list
|
||||||
|
--slave-transaction-retry-interval=#
|
||||||
|
Interval of the slave SQL thread will retry a transaction
|
||||||
|
in case it failed with a deadlock or elapsed lock wait
|
||||||
|
timeout or listed in slave_transaction_retry_errors
|
||||||
--slave-type-conversions=name
|
--slave-type-conversions=name
|
||||||
Set of slave type conversions that are enabled. If the
|
Set of slave type conversions that are enabled. If the
|
||||||
variable is empty, no conversions are allowed and it is
|
variable is empty, no conversions are allowed and it is
|
||||||
@ -1543,7 +1554,6 @@ performance-schema-session-connect-attrs-size -1
|
|||||||
performance-schema-setup-actors-size 100
|
performance-schema-setup-actors-size 100
|
||||||
performance-schema-setup-objects-size 100
|
performance-schema-setup-objects-size 100
|
||||||
performance-schema-users-size -1
|
performance-schema-users-size -1
|
||||||
plugin-maturity unknown
|
|
||||||
port 3306
|
port 3306
|
||||||
port-open-timeout 0
|
port-open-timeout 0
|
||||||
preload-buffer-size 32768
|
preload-buffer-size 32768
|
||||||
@ -1604,9 +1614,11 @@ slave-parallel-mode conservative
|
|||||||
slave-parallel-threads 0
|
slave-parallel-threads 0
|
||||||
slave-parallel-workers 0
|
slave-parallel-workers 0
|
||||||
slave-run-triggers-for-rbr NO
|
slave-run-triggers-for-rbr NO
|
||||||
slave-skip-errors (No default value)
|
slave-skip-errors OFF
|
||||||
slave-sql-verify-checksum TRUE
|
slave-sql-verify-checksum TRUE
|
||||||
slave-transaction-retries 10
|
slave-transaction-retries 10
|
||||||
|
slave-transaction-retry-errors 1213,1205
|
||||||
|
slave-transaction-retry-interval 0
|
||||||
slave-type-conversions
|
slave-type-conversions
|
||||||
slow-launch-time 2
|
slow-launch-time 2
|
||||||
slow-query-log FALSE
|
slow-query-log FALSE
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
TRUE
|
|
||||||
1
|
|
@ -2635,7 +2635,7 @@ SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2
|
|||||||
LEFT JOIN t3 ON t2.i2 = t3.i3
|
LEFT JOIN t3 ON t2.i2 = t3.i3
|
||||||
ORDER BY t1.i1 LIMIT 5;
|
ORDER BY t1.i1 LIMIT 5;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 5 100.00 Using index
|
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 5 100.00 Using index
|
||||||
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.i1 1 100.00 Using index
|
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.i1 1 100.00 Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
@ -3159,3 +3159,51 @@ pk
|
|||||||
2
|
2
|
||||||
3
|
3
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# MDEV-13994: Bad join results with orderby_uses_equalities=on
|
||||||
|
#
|
||||||
|
CREATE TABLE books (
|
||||||
|
id int(16) NOT NULL AUTO_INCREMENT,
|
||||||
|
library_id int(16) NOT NULL DEFAULT 0,
|
||||||
|
wings_id int(12) NOT NULL DEFAULT 0,
|
||||||
|
scheduled_for_removal int(1) DEFAULT 0,
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
KEY library_idx (library_id)
|
||||||
|
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
||||||
|
INSERT INTO books VALUES (32625,8663,707,0),(32624,8663,505,1);
|
||||||
|
CREATE TABLE wings (
|
||||||
|
id int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
department_id int(11) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (id)
|
||||||
|
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
||||||
|
INSERT INTO wings VALUES (505,11745),(707,11768);
|
||||||
|
SET @save_optimizer_switch=@@optimizer_switch;
|
||||||
|
SET optimizer_switch='orderby_uses_equalities=off';
|
||||||
|
SELECT wings.id as wing_id, wings.department_id FROM wings
|
||||||
|
WHERE wings.id IN ( SELECT books.wings_id FROM books
|
||||||
|
WHERE books.library_id = 8663 AND
|
||||||
|
books.scheduled_for_removal=0 )
|
||||||
|
ORDER BY wings.id;
|
||||||
|
wing_id department_id
|
||||||
|
707 11768
|
||||||
|
SET optimizer_switch='orderby_uses_equalities=on';
|
||||||
|
SELECT wings.id as wing_id, wings.department_id FROM wings
|
||||||
|
WHERE wings.id IN ( SELECT books.wings_id FROM books
|
||||||
|
WHERE books.library_id = 8663 AND
|
||||||
|
books.scheduled_for_removal=0 )
|
||||||
|
ORDER BY wings.id;
|
||||||
|
wing_id department_id
|
||||||
|
707 11768
|
||||||
|
explain extended SELECT wings.id as wing_id, wings.department_id FROM wings
|
||||||
|
WHERE wings.id IN ( SELECT books.wings_id FROM books
|
||||||
|
WHERE books.library_id = 8663 AND
|
||||||
|
books.scheduled_for_removal=0 )
|
||||||
|
ORDER BY wings.id;
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 1 100.00 Using temporary; Using filesort
|
||||||
|
1 PRIMARY wings eq_ref PRIMARY PRIMARY 4 test.books.wings_id 1 100.00
|
||||||
|
2 MATERIALIZED books ref library_idx library_idx 4 const 1 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`wings`.`id` AS `wing_id`,`test`.`wings`.`department_id` AS `department_id` from `test`.`wings` semi join (`test`.`books`) where `test`.`books`.`library_id` = 8663 and `test`.`books`.`scheduled_for_removal` = 0 and `test`.`wings`.`id` = `test`.`books`.`wings_id` order by `test`.`wings`.`id`
|
||||||
|
set optimizer_switch= @save_optimizer_switch;
|
||||||
|
DROP TABLE books, wings;
|
||||||
|
@ -48,3 +48,76 @@ where key1<3 or key2<3;
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL # Using sort_union(key1,key2); Using where
|
1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL # Using sort_union(key1,key2); Using where
|
||||||
drop table t0, t1;
|
drop table t0, t1;
|
||||||
|
#
|
||||||
|
# MDEV-14071: wrong results with orderby_uses_equalities=on
|
||||||
|
# (duplicate of MDEV-13994)
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (i int, j int, z int,PRIMARY KEY (i,j), KEY (z)) ENGINE=InnoDB;
|
||||||
|
CREATE TABLE t2 (i int, j int, PRIMARY KEY (i,j)) ENGINE=InnoDB;
|
||||||
|
CREATE TABLE t3 (j int, n varchar(5), PRIMARY KEY (j)) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
(127,0,1),(188,0,1),(206,0,1),(218,0,1),(292,0,1),(338,0,1),(375,0,1),
|
||||||
|
(381,0,1),(409,0,1),(466,0,1),(469,0,1),(498,0,1),(656,0,1);
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
(77,4,0),(86,7,0),(96,6,0),(96,7,0),(99,9,0),(99,10,0),(99,11,0),(104,4,0),
|
||||||
|
(106,5,0),(148,6,0),(177,6,0),(181,5,0),(188,8,0),(218,8,0),(253,7,0),
|
||||||
|
(268,4,0),(338,4,0),(409,7,0),(466,8,0),(469,8,0),(498,8,0),(656,8,0);
|
||||||
|
INSERT INTO t2 VALUES
|
||||||
|
(127,7),(188,8),(188,9),(206,6),(218,8),(218,9),(292,7),(338,4),(338,5),
|
||||||
|
(375,6),(381,5),(409,7),(409,8),(466,8),(466,9),(469,8),(469,9),(498,8),
|
||||||
|
(498,9),(656,8),(656,9);
|
||||||
|
INSERT INTO t3 VALUES
|
||||||
|
(4,'four'),(5,'five'),(6,'six'),(7,'seven'),(8,'eight'),(9,'nine');
|
||||||
|
SET @save_optimizer_switch=@@optimizer_switch;
|
||||||
|
SET optimizer_switch='orderby_uses_equalities=off';
|
||||||
|
SELECT i,n
|
||||||
|
FROM t1 INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j)
|
||||||
|
WHERE i IN (SELECT i FROM t1 WHERE z=1) AND z=0 ORDER BY i;
|
||||||
|
i n
|
||||||
|
188 eight
|
||||||
|
218 eight
|
||||||
|
338 four
|
||||||
|
409 seven
|
||||||
|
466 eight
|
||||||
|
469 eight
|
||||||
|
498 eight
|
||||||
|
656 eight
|
||||||
|
SELECT i,n
|
||||||
|
FROM t1 x INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j)
|
||||||
|
WHERE EXISTS (SELECT * FROM t1 WHERE i=x.i AND z=1) AND z=0 ORDER BY i;
|
||||||
|
i n
|
||||||
|
188 eight
|
||||||
|
218 eight
|
||||||
|
338 four
|
||||||
|
409 seven
|
||||||
|
466 eight
|
||||||
|
469 eight
|
||||||
|
498 eight
|
||||||
|
656 eight
|
||||||
|
SET optimizer_switch='orderby_uses_equalities=on';
|
||||||
|
SELECT i,n
|
||||||
|
FROM t1 INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j)
|
||||||
|
WHERE i IN (SELECT i FROM t1 WHERE z=1) AND z=0 ORDER BY i;
|
||||||
|
i n
|
||||||
|
188 eight
|
||||||
|
218 eight
|
||||||
|
338 four
|
||||||
|
409 seven
|
||||||
|
466 eight
|
||||||
|
469 eight
|
||||||
|
498 eight
|
||||||
|
656 eight
|
||||||
|
SELECT i,n
|
||||||
|
FROM t1 x INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j)
|
||||||
|
WHERE EXISTS (SELECT * FROM t1 WHERE i=x.i AND z=1) AND z=0 ORDER BY i;
|
||||||
|
i n
|
||||||
|
188 eight
|
||||||
|
218 eight
|
||||||
|
338 four
|
||||||
|
409 seven
|
||||||
|
466 eight
|
||||||
|
469 eight
|
||||||
|
498 eight
|
||||||
|
656 eight
|
||||||
|
set optimizer_switch= @save_optimizer_switch;
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
|
Binary file not shown.
@ -513,6 +513,9 @@ COUNT(*)
|
|||||||
SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
|
SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
|
||||||
SUM(c)
|
SUM(c)
|
||||||
400
|
400
|
||||||
|
SELECT SUM(c+0.0) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
|
||||||
|
SUM(c+0.0)
|
||||||
|
400.0
|
||||||
ALTER TABLE t1 DROP INDEX b;
|
ALTER TABLE t1 DROP INDEX b;
|
||||||
SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
|
SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
|
@ -29,7 +29,7 @@ Table Op Msg_type Msg_text
|
|||||||
test.t1 analyze status OK
|
test.t1 analyze status OK
|
||||||
EXPLAIN SELECT b FROM t1 WHERE b between 'L' and 'N' AND a > -100;
|
EXPLAIN SELECT b FROM t1 WHERE b between 'L' and 'N' AND a > -100;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range PRIMARY,b b 67 NULL 18 Using where; Using index
|
1 SIMPLE t1 range PRIMARY,b b 67 NULL 34 Using where; Using index
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
# Bug#13007154: Crash in keys_to_use_for_scanning with ORDER BY
|
# Bug#13007154: Crash in keys_to_use_for_scanning with ORDER BY
|
||||||
@ -663,7 +663,7 @@ EXPLAIN SELECT * FROM t1 WHERE col1 = 1 AND col2 = 2
|
|||||||
AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00'
|
AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00'
|
||||||
GROUP BY 1, 2, 3;
|
GROUP BY 1, 2, 3;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 index_merge PRIMARY,col1,col2 col1,col2 8,8 NULL # Using intersect(col1,col2); Using where; Using index; Using filesort
|
1 SIMPLE t1 range PRIMARY,col1,col2 PRIMARY 5 NULL # Using where; Using filesort
|
||||||
SELECT * FROM t1 USE INDEX () WHERE col1 = 1 AND col2 = 2
|
SELECT * FROM t1 USE INDEX () WHERE col1 = 1 AND col2 = 2
|
||||||
AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00'
|
AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00'
|
||||||
GROUP BY 1, 2, 3;
|
GROUP BY 1, 2, 3;
|
||||||
|
@ -18,7 +18,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
|||||||
# # # # # # # # # 3 #
|
# # # # # # # # # 3 #
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7;
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7;
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
# # # # # # # # # 10 #
|
# # # # # # # # # 9 #
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1;
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1;
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
# # # # # # # # # 3 #
|
# # # # # # # # # 3 #
|
||||||
@ -105,7 +105,7 @@ a
|
|||||||
6
|
6
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7;
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7;
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
|
1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 9 Using where; Using index
|
||||||
SELECT * FROM t1 WHERE a <= 1;
|
SELECT * FROM t1 WHERE a <= 1;
|
||||||
a
|
a
|
||||||
-1
|
-1
|
||||||
@ -168,7 +168,7 @@ a
|
|||||||
6
|
6
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 6;
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 6;
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
|
1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 9 Using where; Using index
|
||||||
SELECT * FROM t1 WHERE a <= 7;
|
SELECT * FROM t1 WHERE a <= 7;
|
||||||
a
|
a
|
||||||
-1
|
-1
|
||||||
@ -182,7 +182,7 @@ a
|
|||||||
7
|
7
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 7;
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 7;
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
|
1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 9 Using where; Using index
|
||||||
SELECT * FROM t1 WHERE a = 1;
|
SELECT * FROM t1 WHERE a = 1;
|
||||||
a
|
a
|
||||||
1
|
1
|
||||||
@ -424,7 +424,7 @@ a
|
|||||||
5
|
5
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 6;
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 6;
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p0,p1,p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
|
1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 8 Using where; Using index
|
||||||
SELECT * FROM t1 WHERE a <= 1;
|
SELECT * FROM t1 WHERE a <= 1;
|
||||||
a
|
a
|
||||||
-1
|
-1
|
||||||
@ -474,7 +474,7 @@ a
|
|||||||
5
|
5
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 5;
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 5;
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p0,p1,p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
|
1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 8 Using where; Using index
|
||||||
SELECT * FROM t1 WHERE a <= 6;
|
SELECT * FROM t1 WHERE a <= 6;
|
||||||
a
|
a
|
||||||
-1
|
-1
|
||||||
@ -487,7 +487,7 @@ a
|
|||||||
6
|
6
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 6;
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 6;
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p0,p1,p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
|
1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 8 Using where; Using index
|
||||||
SELECT * FROM t1 WHERE a = 1;
|
SELECT * FROM t1 WHERE a = 1;
|
||||||
a
|
a
|
||||||
1
|
1
|
||||||
@ -744,13 +744,13 @@ a
|
|||||||
1001-01-01
|
1001-01-01
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-01-01';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-01-01';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index
|
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index
|
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 3 Using where; Using index
|
1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-01-01';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-01-01';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 pNULL,p2001-01-01 range a a 4 NULL 3 Using where; Using index
|
1 SIMPLE t1 pNULL,p2001-01-01 range a a 4 NULL 3 Using where; Using index
|
||||||
@ -759,26 +759,26 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t1 p1001-01-01 system a NULL NULL NULL 1
|
1 SIMPLE t1 p1001-01-01 system a NULL NULL NULL 1
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-00-00';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-00-00';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index
|
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-00-00';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-00-00';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index
|
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-00-00';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-00-00';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 3 Using where; Using index
|
1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-00-00';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-00-00';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 3 Using where; Using index
|
1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 pNULL ref a a 4 const 1 Using index
|
1 SIMPLE t1 pNULL ref a a 4 const 1 Using index
|
||||||
# Disabling warnings for the invalid date
|
# Disabling warnings for the invalid date
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index
|
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 5 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index
|
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 5 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 pNULL,p2001-01-01 index a a 4 NULL 4 Using where; Using index
|
1 SIMPLE t1 pNULL,p2001-01-01 index a a 4 NULL 4 Using where; Using index
|
||||||
@ -790,16 +790,16 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t1 pNULL ref a a 4 const 1 Using index
|
1 SIMPLE t1 pNULL ref a a 4 const 1 Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index
|
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 5 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index
|
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 index a a 4 NULL 5 Using where; Using index
|
1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 3 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index
|
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index
|
||||||
# test without index
|
# test without index
|
||||||
ALTER TABLE t1 DROP KEY a;
|
ALTER TABLE t1 DROP KEY a;
|
||||||
SELECT * FROM t1 WHERE a < '1001-01-01';
|
SELECT * FROM t1 WHERE a < '1001-01-01';
|
||||||
@ -1076,7 +1076,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 3 Using where; Using index
|
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 3 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 3 Using where; Using index
|
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 4 Using where; Using index
|
1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 4 Using where; Using index
|
||||||
@ -1104,10 +1104,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
|||||||
# Disabling warnings for the invalid date
|
# Disabling warnings for the invalid date
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
|
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
|
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 4 Using where; Using index
|
1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 4 Using where; Using index
|
||||||
@ -1119,10 +1119,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t1 pNULL ref a a 4 const 1 Using index
|
1 SIMPLE t1 pNULL ref a a 4 const 1 Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
|
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 3 Using where; Using index
|
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 pNULL,p1001-01-01 index a a 4 NULL 4 Using where; Using index
|
1 SIMPLE t1 pNULL,p1001-01-01 index a a 4 NULL 4 Using where; Using index
|
||||||
@ -1405,7 +1405,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 3 Using where; Using index
|
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 3 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 3 Using where; Using index
|
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 4 Using where; Using index
|
1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 4 Using where; Using index
|
||||||
@ -1433,10 +1433,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
|||||||
# Disabling warnings for the invalid date
|
# Disabling warnings for the invalid date
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
|
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
|
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 4 Using where; Using index
|
1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 4 Using where; Using index
|
||||||
@ -1448,10 +1448,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t1 pNULL ref a a 4 const 1 Using index
|
1 SIMPLE t1 pNULL ref a a 4 const 1 Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
|
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 3 Using where; Using index
|
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 pNULL,p1001-01-01 index a a 4 NULL 4 Using where; Using index
|
1 SIMPLE t1 pNULL,p1001-01-01 index a a 4 NULL 4 Using where; Using index
|
||||||
@ -2867,18 +2867,18 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t2 p0,p1,p2 ALL NULL NULL NULL NULL 510 Using where
|
1 SIMPLE t2 p0,p1,p2 ALL NULL NULL NULL NULL 510 Using where
|
||||||
explain partitions select * from t2 where b = 4;
|
explain partitions select * from t2 where b = 4;
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 96
|
1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 76
|
||||||
explain extended select * from t2 where b = 6;
|
explain extended select * from t2 where b = 6;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t2 ref b b 5 const 96 100.00
|
1 SIMPLE t2 ref b b 5 const 76 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = 6
|
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = 6
|
||||||
explain partitions select * from t2 where b = 6;
|
explain partitions select * from t2 where b = 6;
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 96
|
1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 76
|
||||||
explain extended select * from t2 where b in (1,3,5);
|
explain extended select * from t2 where b in (1,3,5);
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t2 ALL b NULL NULL NULL 910 51.65 Using where
|
1 SIMPLE t2 ALL b NULL NULL NULL 910 40.66 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (1,3,5)
|
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (1,3,5)
|
||||||
explain partitions select * from t2 where b in (1,3,5);
|
explain partitions select * from t2 where b in (1,3,5);
|
||||||
@ -2886,7 +2886,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
|
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
|
||||||
explain extended select * from t2 where b in (2,4,6);
|
explain extended select * from t2 where b in (2,4,6);
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t2 ALL b NULL NULL NULL 910 31.65 Using where
|
1 SIMPLE t2 ALL b NULL NULL NULL 910 25.05 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (2,4,6)
|
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (2,4,6)
|
||||||
explain partitions select * from t2 where b in (2,4,6);
|
explain partitions select * from t2 where b in (2,4,6);
|
||||||
@ -2894,7 +2894,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
|
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
|
||||||
explain extended select * from t2 where b in (7,8,9);
|
explain extended select * from t2 where b in (7,8,9);
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t2 ALL b NULL NULL NULL 910 19.12 Using where
|
1 SIMPLE t2 ALL b NULL NULL NULL 910 36.70 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (7,8,9)
|
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (7,8,9)
|
||||||
explain partitions select * from t2 where b in (7,8,9);
|
explain partitions select * from t2 where b in (7,8,9);
|
||||||
@ -2902,7 +2902,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
|
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
|
||||||
explain extended select * from t2 where b > 5;
|
explain extended select * from t2 where b > 5;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t2 ALL b NULL NULL NULL 910 29.23 Using where
|
1 SIMPLE t2 ALL b NULL NULL NULL 910 44.84 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5
|
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5
|
||||||
explain partitions select * from t2 where b > 5;
|
explain partitions select * from t2 where b > 5;
|
||||||
@ -2910,7 +2910,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
|
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
|
||||||
explain extended select * from t2 where b > 5 and b < 8;
|
explain extended select * from t2 where b > 5 and b < 8;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t2 ALL b NULL NULL NULL 910 28.13 Using where
|
1 SIMPLE t2 ALL b NULL NULL NULL 910 22.09 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5 and `test`.`t2`.`b` < 8
|
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5 and `test`.`t2`.`b` < 8
|
||||||
explain partitions select * from t2 where b > 5 and b < 8;
|
explain partitions select * from t2 where b > 5 and b < 8;
|
||||||
@ -2918,15 +2918,15 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
|
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
|
||||||
explain extended select * from t2 where b > 5 and b < 7;
|
explain extended select * from t2 where b > 5 and b < 7;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t2 range b b 5 NULL 96 100.00 Using where
|
1 SIMPLE t2 range b b 5 NULL 76 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5 and `test`.`t2`.`b` < 7
|
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5 and `test`.`t2`.`b` < 7
|
||||||
explain partitions select * from t2 where b > 5 and b < 7;
|
explain partitions select * from t2 where b > 5 and b < 7;
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 p0,p1,p2,p3,p4 range b b 5 NULL 96 Using where
|
1 SIMPLE t2 p0,p1,p2,p3,p4 range b b 5 NULL 76 Using where
|
||||||
explain extended select * from t2 where b > 0 and b < 5;
|
explain extended select * from t2 where b > 0 and b < 5;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t2 ALL b NULL NULL NULL 910 53.19 Using where
|
1 SIMPLE t2 ALL b NULL NULL NULL 910 41.65 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 0 and `test`.`t2`.`b` < 5
|
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 0 and `test`.`t2`.`b` < 5
|
||||||
explain partitions select * from t2 where b > 0 and b < 5;
|
explain partitions select * from t2 where b > 0 and b < 5;
|
||||||
@ -2960,10 +2960,10 @@ flush status;
|
|||||||
delete from t2 where b = 7;
|
delete from t2 where b = 7;
|
||||||
show status like 'Handler_read_rnd_next';
|
show status like 'Handler_read_rnd_next';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Handler_read_rnd_next 915
|
Handler_read_rnd_next 0
|
||||||
show status like 'Handler_read_key';
|
show status like 'Handler_read_key';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Handler_read_key 0
|
Handler_read_key 5
|
||||||
flush status;
|
flush status;
|
||||||
delete from t2 where b > 5;
|
delete from t2 where b > 5;
|
||||||
show status like 'Handler_read_rnd_next';
|
show status like 'Handler_read_rnd_next';
|
||||||
@ -3136,7 +3136,7 @@ drop table t2;
|
|||||||
create table t1 (s1 int);
|
create table t1 (s1 int);
|
||||||
explain partitions select 1 from t1 union all select 2;
|
explain partitions select 1 from t1 union all select 2;
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found
|
||||||
2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (a bigint unsigned not null) partition by range(a) (
|
create table t1 (a bigint unsigned not null) partition by range(a) (
|
||||||
|
@ -961,7 +961,7 @@ INSERT INTO t2 SELECT * FROM t1;
|
|||||||
# plans should be identical
|
# plans should be identical
|
||||||
EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a;
|
EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index for group-by
|
1 SIMPLE t1 range a a 5 NULL 2 Using where; Using index
|
||||||
EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a;
|
EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 range a a 5 NULL 2 Using where; Using index for group-by
|
1 SIMPLE t2 range a a 5 NULL 2 Using where; Using index for group-by
|
||||||
@ -972,7 +972,7 @@ a MAX(b)
|
|||||||
# Should be no more than 4 reads.
|
# Should be no more than 4 reads.
|
||||||
SHOW status LIKE 'handler_read_key';
|
SHOW status LIKE 'handler_read_key';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Handler_read_key 4
|
Handler_read_key 2
|
||||||
FLUSH status;
|
FLUSH status;
|
||||||
SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a;
|
SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a;
|
||||||
a MAX(b)
|
a MAX(b)
|
||||||
|
@ -415,7 +415,7 @@ select @@profiling;
|
|||||||
drop table if exists t1, t2, t3;
|
drop table if exists t1, t2, t3;
|
||||||
drop view if exists v1;
|
drop view if exists v1;
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 4090 Unknown VIEW: 'test.v1'
|
Note 4091 Unknown VIEW: 'test.v1'
|
||||||
drop function if exists f1;
|
drop function if exists f1;
|
||||||
set session profiling = OFF;
|
set session profiling = OFF;
|
||||||
set global profiling_history_size= @start_value;
|
set global profiling_history_size= @start_value;
|
||||||
|
@ -3394,7 +3394,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
|||||||
SHOW CREATE TABLE tmp1;
|
SHOW CREATE TABLE tmp1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||||
`c1` bigint(20) DEFAULT NULL
|
`c1` bigint(20) unsigned DEFAULT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
SELECT @a, @a = b'10100100101';
|
SELECT @a, @a = b'10100100101';
|
||||||
@a @a = b'10100100101'
|
@a @a = b'10100100101'
|
||||||
@ -3484,7 +3484,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
|||||||
SHOW CREATE TABLE tmp1;
|
SHOW CREATE TABLE tmp1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||||
`c1` bigint(20) DEFAULT NULL
|
`c1` bigint(20) unsigned DEFAULT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
SELECT @a, @a = 2010;
|
SELECT @a, @a = 2010;
|
||||||
@a @a = 2010
|
@a @a = 2010
|
||||||
@ -3556,7 +3556,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
|||||||
SHOW CREATE TABLE tmp1;
|
SHOW CREATE TABLE tmp1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||||
`c1` longblob DEFAULT NULL
|
`c1` longtext DEFAULT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
SELECT @a, @a = REPEAT('a', 16);
|
SELECT @a, @a = REPEAT('a', 16);
|
||||||
@a @a = REPEAT('a', 16)
|
@a @a = REPEAT('a', 16)
|
||||||
@ -3574,7 +3574,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
|||||||
SHOW CREATE TABLE tmp1;
|
SHOW CREATE TABLE tmp1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||||
`c1` longblob DEFAULT NULL
|
`c1` longtext DEFAULT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
SELECT @a, @a = REPEAT('b', 16);
|
SELECT @a, @a = REPEAT('b', 16);
|
||||||
@a @a = REPEAT('b', 16)
|
@a @a = REPEAT('b', 16)
|
||||||
@ -3592,7 +3592,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
|||||||
SHOW CREATE TABLE tmp1;
|
SHOW CREATE TABLE tmp1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||||
`c1` longblob DEFAULT NULL
|
`c1` longtext DEFAULT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
SELECT @a, @a = REPEAT('c', 16);
|
SELECT @a, @a = REPEAT('c', 16);
|
||||||
@a @a = REPEAT('c', 16)
|
@a @a = REPEAT('c', 16)
|
||||||
@ -3610,7 +3610,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
|||||||
SHOW CREATE TABLE tmp1;
|
SHOW CREATE TABLE tmp1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||||
`c1` longblob DEFAULT NULL
|
`c1` longtext DEFAULT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
SELECT @a, @a = REPEAT('d', 16);
|
SELECT @a, @a = REPEAT('d', 16);
|
||||||
@a @a = REPEAT('d', 16)
|
@a @a = REPEAT('d', 16)
|
||||||
@ -3628,7 +3628,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
|||||||
SHOW CREATE TABLE tmp1;
|
SHOW CREATE TABLE tmp1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||||
`c1` longblob DEFAULT NULL
|
`c1` longtext DEFAULT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
SELECT @a, @a = REPEAT('e', 16);
|
SELECT @a, @a = REPEAT('e', 16);
|
||||||
@a @a = REPEAT('e', 16)
|
@a @a = REPEAT('e', 16)
|
||||||
@ -3646,7 +3646,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
|||||||
SHOW CREATE TABLE tmp1;
|
SHOW CREATE TABLE tmp1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||||
`c1` longblob DEFAULT NULL
|
`c1` longtext DEFAULT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
SELECT @a, @a = REPEAT('f', 16);
|
SELECT @a, @a = REPEAT('f', 16);
|
||||||
@a @a = REPEAT('f', 16)
|
@a @a = REPEAT('f', 16)
|
||||||
@ -3772,7 +3772,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
|||||||
SHOW CREATE TABLE tmp1;
|
SHOW CREATE TABLE tmp1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||||
`c1` longblob DEFAULT NULL
|
`c1` longtext DEFAULT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
SELECT @a, @a = 'aaa';
|
SELECT @a, @a = 'aaa';
|
||||||
@a @a = 'aaa'
|
@a @a = 'aaa'
|
||||||
@ -3790,7 +3790,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
|||||||
SHOW CREATE TABLE tmp1;
|
SHOW CREATE TABLE tmp1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||||
`c1` longblob DEFAULT NULL
|
`c1` longtext DEFAULT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
SELECT @a, @a = 'aaa';
|
SELECT @a, @a = 'aaa';
|
||||||
@a @a = 'aaa'
|
@a @a = 'aaa'
|
||||||
@ -4413,7 +4413,7 @@ EXECUTE stmt USING 10;
|
|||||||
SHOW CREATE TABLE t1;
|
SHOW CREATE TABLE t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
t1 CREATE TABLE `t1` (
|
t1 CREATE TABLE `t1` (
|
||||||
`c1` bigint(21) NOT NULL
|
`c1` int(2) NOT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
EXECUTE stmt USING 10.123;
|
EXECUTE stmt USING 10.123;
|
||||||
@ -4620,10 +4620,10 @@ EXECUTE IMMEDIATE
|
|||||||
SHOW CREATE TABLE t1;
|
SHOW CREATE TABLE t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
t1 CREATE TABLE `t1` (
|
t1 CREATE TABLE `t1` (
|
||||||
`a` bigint(21) NOT NULL,
|
`a` bigint(20) NOT NULL,
|
||||||
`b` decimal(3,1) DEFAULT NULL,
|
`b` decimal(3,1) DEFAULT NULL,
|
||||||
`c` double NOT NULL,
|
`c` double NOT NULL,
|
||||||
`d` varchar(3) NOT NULL
|
`d` tinytext NOT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
EXECUTE IMMEDIATE
|
EXECUTE IMMEDIATE
|
||||||
@ -4632,7 +4632,7 @@ EXECUTE IMMEDIATE
|
|||||||
SHOW CREATE TABLE t1;
|
SHOW CREATE TABLE t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
t1 CREATE TABLE `t1` (
|
t1 CREATE TABLE `t1` (
|
||||||
`a` bigint(21) NOT NULL,
|
`a` int(2) NOT NULL,
|
||||||
`b` decimal(3,1) DEFAULT NULL,
|
`b` decimal(3,1) DEFAULT NULL,
|
||||||
`c` double NOT NULL,
|
`c` double NOT NULL,
|
||||||
`d` varchar(3) NOT NULL
|
`d` varchar(3) NOT NULL
|
||||||
@ -4998,3 +4998,159 @@ ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NE
|
|||||||
EXECUTE IMMEDIATE 'CALL p1(?)' USING IGNORE;
|
EXECUTE IMMEDIATE 'CALL p1(?)' USING IGNORE;
|
||||||
ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger
|
ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger
|
||||||
DROP PROCEDURE p1;
|
DROP PROCEDURE p1;
|
||||||
|
#
|
||||||
|
# MDEV-14434 Wrong result for CHARSET(CONCAT(?,const))
|
||||||
|
#
|
||||||
|
SET NAMES utf8;
|
||||||
|
EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(5,_latin1'a'))";
|
||||||
|
CHARSET(CONCAT(5,_latin1'a'))
|
||||||
|
latin1
|
||||||
|
EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5;
|
||||||
|
CHARSET(CONCAT(?,_latin1'a'))
|
||||||
|
latin1
|
||||||
|
EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5;
|
||||||
|
CHARSET(CONCAT(?,_latin1'a'))
|
||||||
|
latin1
|
||||||
|
EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5e0;
|
||||||
|
CHARSET(CONCAT(?,_latin1'a'))
|
||||||
|
latin1
|
||||||
|
EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIME'10:20:30';
|
||||||
|
CHARSET(CONCAT(?,_latin1'a'))
|
||||||
|
latin1
|
||||||
|
EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIMESTAMP'2001-01-01 10:20:30';
|
||||||
|
CHARSET(CONCAT(?,_latin1'a'))
|
||||||
|
latin1
|
||||||
|
EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5;
|
||||||
|
COERCIBILITY(?)
|
||||||
|
5
|
||||||
|
EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5;
|
||||||
|
COERCIBILITY(?)
|
||||||
|
5
|
||||||
|
EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5e0;
|
||||||
|
COERCIBILITY(?)
|
||||||
|
5
|
||||||
|
EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIME'10:20:30';
|
||||||
|
COERCIBILITY(?)
|
||||||
|
5
|
||||||
|
EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIMESTAMP'2001-01-01 10:20:30';
|
||||||
|
COERCIBILITY(?)
|
||||||
|
5
|
||||||
|
#
|
||||||
|
# MDEV-14435 Different UNSIGNED flag of out user variable for YEAR parameter for direct vs prepared CALL
|
||||||
|
#
|
||||||
|
CREATE PROCEDURE p1(OUT v INT UNSIGNED) SET v = 2010;
|
||||||
|
CALL p1(@a);
|
||||||
|
PREPARE stmt FROM 'CALL p1(?)';
|
||||||
|
EXECUTE stmt USING @b;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` bigint(20) unsigned DEFAULT NULL,
|
||||||
|
`b` bigint(20) unsigned DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1;
|
||||||
|
DROP PROCEDURE p1;
|
||||||
|
CREATE PROCEDURE p1(OUT v YEAR) SET v = 2010;
|
||||||
|
CALL p1(@a);
|
||||||
|
PREPARE stmt FROM 'CALL p1(?)';
|
||||||
|
EXECUTE stmt USING @b;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` bigint(20) unsigned DEFAULT NULL,
|
||||||
|
`b` bigint(20) unsigned DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1;
|
||||||
|
DROP PROCEDURE p1;
|
||||||
|
CREATE PROCEDURE p1(OUT v BIT(16)) SET v = 2010;
|
||||||
|
CALL p1(@a);
|
||||||
|
PREPARE stmt FROM 'CALL p1(?)';
|
||||||
|
EXECUTE stmt USING @b;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` bigint(20) unsigned DEFAULT NULL,
|
||||||
|
`b` bigint(20) unsigned DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1;
|
||||||
|
DROP PROCEDURE p1;
|
||||||
|
#
|
||||||
|
# MDEV-14454 Binary protocol returns wrong collation ID for SP OUT parameters
|
||||||
|
#
|
||||||
|
CREATE PROCEDURE p1(OUT v CHAR(32) CHARACTER SET utf8) SET v='aaa';
|
||||||
|
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||||
|
EXECUTE stmt1 USING @a;
|
||||||
|
CREATE TABLE t1 AS SELECT @a AS c1;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`c1` longtext CHARACTER SET utf8 DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1;
|
||||||
|
DROP PROCEDURE p1;
|
||||||
|
#
|
||||||
|
# MDEV-14467 Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler
|
||||||
|
#
|
||||||
|
EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10;
|
||||||
|
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 1 AS `1` limit 10
|
||||||
|
EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1;
|
||||||
|
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 1 AS `1` limit 10
|
||||||
|
EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1e0;
|
||||||
|
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 1 AS `1` limit 10
|
||||||
|
EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING '10';
|
||||||
|
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 1 AS `1` limit 10
|
||||||
|
EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING TIME'10:10:10';
|
||||||
|
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 1 AS `1` limit 101010
|
||||||
|
EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 1 AS a,? AS b' USING 1;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` int(1) NOT NULL,
|
||||||
|
`b` int(1) NOT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1;
|
||||||
|
EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 10 AS a,? AS b' USING 10;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` int(2) NOT NULL,
|
||||||
|
`b` int(2) NOT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1;
|
||||||
|
EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 999999999 AS a,? AS b' USING 999999999;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` int(9) NOT NULL,
|
||||||
|
`b` int(9) NOT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1;
|
||||||
|
EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 2147483647 AS a,? AS b' USING 2147483647;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` bigint(10) NOT NULL,
|
||||||
|
`b` bigint(10) NOT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -235,7 +235,7 @@ select benchmark(1,1) from t1;
|
|||||||
benchmark(1,1)
|
benchmark(1,1)
|
||||||
explain extended select benchmark(1,1) from t1;
|
explain extended select benchmark(1,1) from t1;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select benchmark(1,1) AS `benchmark(1,1)` from `test`.`t1`
|
Note 1003 select benchmark(1,1) AS `benchmark(1,1)` from `test`.`t1`
|
||||||
show status like "Qcache_queries_in_cache";
|
show status like "Qcache_queries_in_cache";
|
||||||
|
@ -2284,7 +2284,7 @@ explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44);
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
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
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 0
|
Note 1003 select 44 AS `a`,15 AS `b`,NULL AS `c` from `test`.`t2` where 0
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
#
|
#
|
||||||
# Start of 10.1 tests
|
# Start of 10.1 tests
|
||||||
|
@ -2286,7 +2286,7 @@ explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44);
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
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
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 0
|
Note 1003 select 44 AS `a`,15 AS `b`,NULL AS `c` from `test`.`t2` where 0
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
#
|
#
|
||||||
# Start of 10.1 tests
|
# Start of 10.1 tests
|
||||||
|
@ -2330,7 +2330,7 @@ insert into t4 values (1,1);
|
|||||||
explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
|
explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
|
||||||
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
|
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found
|
1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 SIMPLE t4 const id4 NULL NULL NULL 1
|
1 SIMPLE t4 const id4 NULL NULL NULL 1
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
||||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where
|
1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where
|
||||||
@ -4660,17 +4660,17 @@ DROP TABLE t1;
|
|||||||
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL);
|
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL);
|
||||||
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20;
|
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
||||||
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20;
|
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
||||||
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20;
|
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
@ -5482,7 +5482,7 @@ WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 );
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
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
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select 1 AS `i1`,8 AS `j1`,`test`.`t2`.`i2` AS `i2` from `test`.`t2` where 0
|
Note 1003 select 1 AS `i1`,8 AS `j1`,NULL AS `i2` from `test`.`t2` where 0
|
||||||
SELECT * FROM t1, t2
|
SELECT * FROM t1, t2
|
||||||
WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 );
|
WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 );
|
||||||
i1 j1 i2
|
i1 j1 i2
|
||||||
|
@ -83,7 +83,7 @@ UNIQUE KEY e_n (email,name)
|
|||||||
);
|
);
|
||||||
EXPLAIN SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
|
EXPLAIN SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 system PRIMARY,kid NULL NULL NULL 0 const row not found; Using temporary
|
1 SIMPLE t1 system PRIMARY,kid NULL NULL NULL 0 Const row not found; Using temporary
|
||||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 200
|
1 SIMPLE t2 ALL NULL NULL NULL NULL 200
|
||||||
SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
|
SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
|
||||||
email
|
email
|
||||||
|
@ -2341,7 +2341,7 @@ insert into t4 values (1,1);
|
|||||||
explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
|
explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
|
||||||
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
|
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found
|
1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 SIMPLE t4 const id4 NULL NULL NULL 1
|
1 SIMPLE t4 const id4 NULL NULL NULL 1
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
||||||
1 SIMPLE t2 hash_ALL NULL #hash#$hj 4 test.t1.id1 1 Using where; Using join buffer (flat, BNLH join)
|
1 SIMPLE t2 hash_ALL NULL #hash#$hj 4 test.t1.id1 1 Using where; Using join buffer (flat, BNLH join)
|
||||||
@ -4671,17 +4671,17 @@ DROP TABLE t1;
|
|||||||
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL);
|
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL);
|
||||||
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20;
|
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
||||||
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20;
|
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
||||||
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20;
|
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
@ -5493,7 +5493,7 @@ WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 );
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
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
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select 1 AS `i1`,8 AS `j1`,`test`.`t2`.`i2` AS `i2` from `test`.`t2` where 0
|
Note 1003 select 1 AS `i1`,8 AS `j1`,NULL AS `i2` from `test`.`t2` where 0
|
||||||
SELECT * FROM t1, t2
|
SELECT * FROM t1, t2
|
||||||
WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 );
|
WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 );
|
||||||
i1 j1 i2
|
i1 j1 i2
|
||||||
|
@ -2330,7 +2330,7 @@ insert into t4 values (1,1);
|
|||||||
explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
|
explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
|
||||||
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
|
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found
|
1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found
|
||||||
1 SIMPLE t4 const id4 NULL NULL NULL 1
|
1 SIMPLE t4 const id4 NULL NULL NULL 1
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
||||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where
|
1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where
|
||||||
@ -4660,17 +4660,17 @@ DROP TABLE t1;
|
|||||||
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL);
|
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL);
|
||||||
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20;
|
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
||||||
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20;
|
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
||||||
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20;
|
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
@ -5482,7 +5482,7 @@ WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 );
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
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
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select 1 AS `i1`,8 AS `j1`,`test`.`t2`.`i2` AS `i2` from `test`.`t2` where 0
|
Note 1003 select 1 AS `i1`,8 AS `j1`,NULL AS `i2` from `test`.`t2` where 0
|
||||||
SELECT * FROM t1, t2
|
SELECT * FROM t1, t2
|
||||||
WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 );
|
WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 );
|
||||||
i1 j1 i2
|
i1 j1 i2
|
||||||
|
@ -784,7 +784,7 @@ select * from t1 where a < 1 and a > 7;
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
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
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
|
Note 1003 select 7 AS `a` from `test`.`t1` where 0
|
||||||
select * from t1 where a < 1 and a > 7;
|
select * from t1 where a < 1 and a > 7;
|
||||||
a
|
a
|
||||||
drop table t1;
|
drop table t1;
|
||||||
@ -1508,7 +1508,7 @@ select * from t2 where col1 < 'b' and col1 > 'd';
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
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
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where 0
|
Note 1003 select 'd' AS `col1` from `test`.`t2` where 0
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
|
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
|
||||||
set use_stat_tables=@save_use_stat_tables;
|
set use_stat_tables=@save_use_stat_tables;
|
||||||
|
@ -791,7 +791,7 @@ select * from t1 where a < 1 and a > 7;
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
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
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
|
Note 1003 select 7 AS `a` from `test`.`t1` where 0
|
||||||
select * from t1 where a < 1 and a > 7;
|
select * from t1 where a < 1 and a > 7;
|
||||||
a
|
a
|
||||||
drop table t1;
|
drop table t1;
|
||||||
@ -1518,7 +1518,7 @@ select * from t2 where col1 < 'b' and col1 > 'd';
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
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
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where 0
|
Note 1003 select 'd' AS `col1` from `test`.`t2` where 0
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
|
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
|
||||||
set use_stat_tables=@save_use_stat_tables;
|
set use_stat_tables=@save_use_stat_tables;
|
||||||
|
@ -1715,7 +1715,7 @@ show warnings $$
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Warning 1012 Raising a warning
|
Warning 1012 Raising a warning
|
||||||
Error 5555 RESIGNAL to not found
|
Error 5555 RESIGNAL to not found
|
||||||
Note 4092 At line 9 in test.test_resignal
|
Note 4093 At line 9 in test.test_resignal
|
||||||
drop procedure test_resignal $$
|
drop procedure test_resignal $$
|
||||||
create procedure test_resignal()
|
create procedure test_resignal()
|
||||||
begin
|
begin
|
||||||
@ -1740,7 +1740,7 @@ show warnings $$
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Warning 1012 Raising a warning
|
Warning 1012 Raising a warning
|
||||||
Error 5555 RESIGNAL to error
|
Error 5555 RESIGNAL to error
|
||||||
Note 4092 At line 9 in test.test_resignal
|
Note 4093 At line 9 in test.test_resignal
|
||||||
drop procedure test_resignal $$
|
drop procedure test_resignal $$
|
||||||
create procedure test_resignal()
|
create procedure test_resignal()
|
||||||
begin
|
begin
|
||||||
@ -1789,7 +1789,7 @@ show warnings $$
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Error 1012 Raising a not found
|
Error 1012 Raising a not found
|
||||||
Error 5555 RESIGNAL to not found
|
Error 5555 RESIGNAL to not found
|
||||||
Note 4092 At line 9 in test.test_resignal
|
Note 4093 At line 9 in test.test_resignal
|
||||||
drop procedure test_resignal $$
|
drop procedure test_resignal $$
|
||||||
create procedure test_resignal()
|
create procedure test_resignal()
|
||||||
begin
|
begin
|
||||||
@ -1814,7 +1814,7 @@ show warnings $$
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Error 1012 Raising a not found
|
Error 1012 Raising a not found
|
||||||
Error 5555 RESIGNAL to error
|
Error 5555 RESIGNAL to error
|
||||||
Note 4092 At line 9 in test.test_resignal
|
Note 4093 At line 9 in test.test_resignal
|
||||||
drop procedure test_resignal $$
|
drop procedure test_resignal $$
|
||||||
create procedure test_resignal()
|
create procedure test_resignal()
|
||||||
begin
|
begin
|
||||||
@ -1863,7 +1863,7 @@ show warnings $$
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Error 1012 Raising an error
|
Error 1012 Raising an error
|
||||||
Error 5555 RESIGNAL to not found
|
Error 5555 RESIGNAL to not found
|
||||||
Note 4092 At line 9 in test.test_resignal
|
Note 4093 At line 9 in test.test_resignal
|
||||||
drop procedure test_resignal $$
|
drop procedure test_resignal $$
|
||||||
create procedure test_resignal()
|
create procedure test_resignal()
|
||||||
begin
|
begin
|
||||||
@ -1888,7 +1888,7 @@ show warnings $$
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Error 1012 Raising an error
|
Error 1012 Raising an error
|
||||||
Error 5555 RESIGNAL to error
|
Error 5555 RESIGNAL to error
|
||||||
Note 4092 At line 9 in test.test_resignal
|
Note 4093 At line 9 in test.test_resignal
|
||||||
drop procedure test_resignal $$
|
drop procedure test_resignal $$
|
||||||
create procedure test_resignal()
|
create procedure test_resignal()
|
||||||
begin
|
begin
|
||||||
@ -1931,7 +1931,7 @@ show warnings $$
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Warning 1264 Out of range value for column 'a' at row 1
|
Warning 1264 Out of range value for column 'a' at row 1
|
||||||
Error 5555 RESIGNAL to a not found
|
Error 5555 RESIGNAL to a not found
|
||||||
Note 4092 At line 8 in test.test_resignal
|
Note 4093 At line 8 in test.test_resignal
|
||||||
drop procedure test_resignal $$
|
drop procedure test_resignal $$
|
||||||
create procedure test_resignal()
|
create procedure test_resignal()
|
||||||
begin
|
begin
|
||||||
@ -1953,7 +1953,7 @@ show warnings $$
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Warning 1264 Out of range value for column 'a' at row 1
|
Warning 1264 Out of range value for column 'a' at row 1
|
||||||
Error 5555 RESIGNAL to an error
|
Error 5555 RESIGNAL to an error
|
||||||
Note 4092 At line 8 in test.test_resignal
|
Note 4093 At line 8 in test.test_resignal
|
||||||
drop procedure test_resignal $$
|
drop procedure test_resignal $$
|
||||||
create procedure test_resignal()
|
create procedure test_resignal()
|
||||||
begin
|
begin
|
||||||
@ -2004,7 +2004,7 @@ show warnings $$
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Error 1329 No data - zero rows fetched, selected, or processed
|
Error 1329 No data - zero rows fetched, selected, or processed
|
||||||
Error 5555 RESIGNAL to a not found
|
Error 5555 RESIGNAL to a not found
|
||||||
Note 4092 At line 10 in test.test_resignal
|
Note 4093 At line 10 in test.test_resignal
|
||||||
drop procedure test_resignal $$
|
drop procedure test_resignal $$
|
||||||
create procedure test_resignal()
|
create procedure test_resignal()
|
||||||
begin
|
begin
|
||||||
@ -2030,7 +2030,7 @@ show warnings $$
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Error 1329 No data - zero rows fetched, selected, or processed
|
Error 1329 No data - zero rows fetched, selected, or processed
|
||||||
Error 5555 RESIGNAL to an error
|
Error 5555 RESIGNAL to an error
|
||||||
Note 4092 At line 10 in test.test_resignal
|
Note 4093 At line 10 in test.test_resignal
|
||||||
drop procedure test_resignal $$
|
drop procedure test_resignal $$
|
||||||
create procedure test_resignal()
|
create procedure test_resignal()
|
||||||
begin
|
begin
|
||||||
@ -2073,7 +2073,7 @@ show warnings $$
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Error 1051 Unknown table 'test.no_such_table'
|
Error 1051 Unknown table 'test.no_such_table'
|
||||||
Error 5555 RESIGNAL to a not found
|
Error 5555 RESIGNAL to a not found
|
||||||
Note 4092 At line 8 in test.test_resignal
|
Note 4093 At line 8 in test.test_resignal
|
||||||
drop procedure test_resignal $$
|
drop procedure test_resignal $$
|
||||||
create procedure test_resignal()
|
create procedure test_resignal()
|
||||||
begin
|
begin
|
||||||
@ -2095,7 +2095,7 @@ show warnings $$
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Error 1051 Unknown table 'test.no_such_table'
|
Error 1051 Unknown table 'test.no_such_table'
|
||||||
Error 5555 RESIGNAL to an error
|
Error 5555 RESIGNAL to an error
|
||||||
Note 4092 At line 8 in test.test_resignal
|
Note 4093 At line 8 in test.test_resignal
|
||||||
drop procedure test_resignal $$
|
drop procedure test_resignal $$
|
||||||
#
|
#
|
||||||
# More complex cases
|
# More complex cases
|
||||||
@ -2142,7 +2142,7 @@ ERROR 42000: Hi, I am a useless error message
|
|||||||
show warnings $$
|
show warnings $$
|
||||||
Level Code Message
|
Level Code Message
|
||||||
Error 9999 Hi, I am a useless error message
|
Error 9999 Hi, I am a useless error message
|
||||||
Note 4092 At line 7 in test.peter_p2
|
Note 4093 At line 7 in test.peter_p2
|
||||||
drop procedure peter_p1 $$
|
drop procedure peter_p1 $$
|
||||||
drop procedure peter_p2 $$
|
drop procedure peter_p2 $$
|
||||||
CREATE PROCEDURE peter_p1 ()
|
CREATE PROCEDURE peter_p1 ()
|
||||||
@ -2198,16 +2198,16 @@ Level Code Message
|
|||||||
Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
|
Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
|
||||||
Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL'
|
Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL'
|
||||||
Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL'
|
Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL'
|
||||||
Note 4092 At line 8 in test.peter_p1
|
Note 4093 At line 8 in test.peter_p1
|
||||||
ERROR 42000: Hi, I am a useless error message
|
ERROR 42000: Hi, I am a useless error message
|
||||||
show warnings $$
|
show warnings $$
|
||||||
Level Code Message
|
Level Code Message
|
||||||
Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
|
Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
|
||||||
Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL'
|
Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL'
|
||||||
Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL'
|
Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL'
|
||||||
Note 4092 At line 8 in test.peter_p1
|
Note 4093 At line 8 in test.peter_p1
|
||||||
Error 9999 Hi, I am a useless error message
|
Error 9999 Hi, I am a useless error message
|
||||||
Note 4092 At line 10 in test.peter_p2
|
Note 4093 At line 10 in test.peter_p2
|
||||||
drop procedure peter_p1 $$
|
drop procedure peter_p1 $$
|
||||||
drop procedure peter_p2 $$
|
drop procedure peter_p2 $$
|
||||||
drop procedure if exists peter_p3 $$
|
drop procedure if exists peter_p3 $$
|
||||||
@ -2225,7 +2225,7 @@ show warnings $$
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Error 1 Original
|
Error 1 Original
|
||||||
Error 2 Original
|
Error 2 Original
|
||||||
Note 4092 At line 4 in test.peter_p3
|
Note 4093 At line 4 in test.peter_p3
|
||||||
drop procedure peter_p3 $$
|
drop procedure peter_p3 $$
|
||||||
drop table t_warn;
|
drop table t_warn;
|
||||||
drop table t_cursor;
|
drop table t_cursor;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user