Merge branch '10.4' into 10.5

This commit is contained in:
Oleksandr Byelkin 2023-11-08 12:59:00 +01:00
commit 6cfd2ba397
396 changed files with 10324 additions and 5797 deletions

View file

@ -435,6 +435,7 @@ int main(int argc,char *argv[])
if (error > 0)
break;
error= -error; /* don't exit with negative error codes */
/*
Command was well-formed, but failed on the server. Might succeed
on retry (if conditions on server change etc.), but needs --force
@ -1208,24 +1209,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
else
if (mysql_query(mysql,buff))
{
if (mysql_errno(mysql)!=1290)
{
my_printf_error(0,"unable to change password; error: '%s'",
error_flags, mysql_error(mysql));
}
else
{
/*
We don't try to execute 'update mysql.user set..'
because we can't perfectly find out the host
*/
my_printf_error(0,"\n"
"You cannot use 'password' command as mysqld runs\n"
" with grant tables disabled (was started with"
" --skip-grant-tables).\n"
"Use: \"mysqladmin flush-privileges password '*'\""
" instead", error_flags);
}
my_printf_error(0,"unable to change password; error: '%s'",
error_flags, mysql_error(mysql));
ret = -1;
}
password_done:

View file

@ -3169,8 +3169,13 @@ int main(int argc, char** argv)
if (tmpdir.list)
free_tmpdir(&tmpdir);
if (result_file && result_file != stdout)
my_fclose(result_file, MYF(0));
if (result_file)
{
if (result_file != stdout)
my_fclose(result_file, MYF(0));
else
fflush(result_file);
}
cleanup();
/* We cannot free DBUG, it is used in global destructors after exit(). */
my_end(my_end_arg | MY_DONT_FREE_DBUG);

View file

@ -1836,8 +1836,13 @@ static FILE* open_sql_file_for_table(const char* table, int flags)
static void free_resources()
{
if (md_result_file && md_result_file != stdout)
my_fclose(md_result_file, MYF(0));
if (md_result_file)
{
if (md_result_file != stdout)
my_fclose(md_result_file, MYF(0));
else
fflush(md_result_file);
}
if (get_table_name_result)
mysql_free_result(get_table_name_result);
if (routine_res)

View file

@ -28,6 +28,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
#include <winioctl.h>
#endif
#ifdef HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE
#include <linux/falloc.h>
#endif
typedef struct {
File fd;
my_bool init_ibd_done;
@ -160,9 +164,18 @@ static int write_compressed(File fd, uchar *data, size_t len, size_t pagesize)
if (datasize < n_bytes) {
/* This punches a "hole" in the file. */
size_t hole_bytes = n_bytes - datasize;
if (my_seek(fd, hole_bytes, MY_SEEK_CUR, MYF(MY_WME | MY_NABP))
== MY_FILEPOS_ERROR)
return 1;
my_off_t off = my_seek(fd, hole_bytes, MY_SEEK_CUR, MYF(MY_WME | MY_NABP));
if (off == MY_FILEPOS_ERROR)
return 1;
#ifdef HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE
/* punch holes harder for filesystems (like XFS) that
heuristically decide whether leave a hole after the
above or not based on the current access pattern
(which is sequential write and not at all typical for
what InnoDB will be doing with the file later */
fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
off - hole_bytes, hole_bytes);
#endif
}
written += n_bytes;
ptr += n_bytes;

View file

@ -110,8 +110,135 @@ static inline void set_rec_bits(uint16 bits, uchar *ptr, uchar ofs, uint len)
#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
extern int ha_compare_text(CHARSET_INFO *, const uchar *, size_t,
const uchar *, size_t , my_bool);
/*
Compare two VARCHAR values.
@param charset_info - The character set and collation
@param a - The pointer to the first string
@param a_length - The length of the first string
@param b - The pointer to the second string
@param b_length - The length of the second string
@param b_is_prefix - Whether "b" is a prefix of "a",
e.g. in a prefix key (partial length key).
@returns - The result of comparison
- If "b_is_prefix" is FALSE, then the two strings are compared
taking into account the PAD SPACE/NO PAD attribute of the collation.
- If "b_is_prefix" is TRUE, then trailing spaces are compared in NO PAD style.
This is done e.g. when we compare a column value to its prefix key value
(the value of "a" to the value of "key_a"):
CREATE TABLE t1 (a VARCHAR(10), KEY(key_a(5));
*/
static inline int ha_compare_char_varying(CHARSET_INFO *charset_info,
const uchar *a, size_t a_length,
const uchar *b, size_t b_length,
my_bool b_is_prefix)
{
if (!b_is_prefix)
return charset_info->coll->strnncollsp(charset_info, a, a_length,
b, b_length);
return charset_info->coll->strnncoll(charset_info,
a, a_length,
b, b_length, TRUE/*prefix*/);
}
/*
Compare two CHAR values of the same declared character length,
e.g. CHAR(5) to CHAR(5).
@param charset_info - The character set and collation
@param a - The pointer to the first string
@param a_length - The length of the first string
@param b - The pointer to the second string
@param b_length - The length of the second string
@param nchars - The declared length (in characters)
@param b_is_prefix - Whether "b" is a prefix of "a",
e.g. in a prefix key (partial length key).
@returns - The result of comparison
- If "b_is_prefix" is FALSE, then the two strings are compared
taking into account the PAD SPACE/NO PAD attribute of the collation.
Additionally, this function assumes that the underlying storage could
optionally apply trailing space compression, so values can come into this
comparison function in different states:
- all trailing spaces removed
- some trailing spaced removed
- no trailing spaces removed (exactly "nchars" characters on the two sides)
This function virtually reconstructs trailing spaces up to the defined
length specified in "nchars".
If either of the sides have more than "nchar" characters,
then only leftmost "nchar" characters are compared.
- If "b_is_prefix" is TRUE, then trailing spaces are compared in NO PAD style.
This is done e.g. when we compare a column value to its prefix key value
(the value of "a" to the value of "key_a"):
CREATE TABLE t1 (a CHAR(10), KEY(key_a(5));
*/
static inline int ha_compare_char_fixed(CHARSET_INFO *charset_info,
const uchar *a, size_t a_length,
const uchar *b, size_t b_length,
size_t nchars,
my_bool b_is_prefix)
{
if (!b_is_prefix)
return charset_info->coll->strnncollsp_nchars(charset_info,
a, a_length,
b, b_length,
nchars,
MY_STRNNCOLLSP_NCHARS_EMULATE_TRIMMED_TRAILING_SPACES);
return charset_info->coll->strnncoll(charset_info,
a, a_length,
b, b_length, TRUE/*prefix*/);
}
/*
A function to compare words of a text.
This is a common operation in full-text search:
SELECT MATCH (title) AGAINST ('word') FROM t1;
*/
static inline int ha_compare_word(CHARSET_INFO *charset_info,
const uchar *a, size_t a_length,
const uchar *b, size_t b_length)
{
return charset_info->coll->strnncollsp(charset_info,
a, a_length,
b, b_length);
}
/*
A function to compare a word of a text to a word prefix.
This is a common operation in full-text search:
SELECT MATCH (title) AGAINST ('wor*' IN BOOLEAN MODE) FROM t1;
*/
static inline int ha_compare_word_prefix(CHARSET_INFO *charset_info,
const uchar *a, size_t a_length,
const uchar *b, size_t b_length)
{
return charset_info->coll->strnncoll(charset_info,
a, a_length,
b, b_length,
TRUE/*b_is_prefix*/);
}
/*
Compare words (full match or prefix match), e.g. for full-text search.
*/
static inline int ha_compare_word_or_prefix(CHARSET_INFO *charset_info,
const uchar *a, size_t a_length,
const uchar *b, size_t b_length,
my_bool b_is_prefix)
{
if (!b_is_prefix)
return ha_compare_word(charset_info, a, a_length, b, b_length);
return ha_compare_word_prefix(charset_info, a, a_length, b, b_length);
}
extern int ha_key_cmp(HA_KEYSEG *keyseg, const uchar *a,
const uchar *b, uint key_length, uint nextflag,
uint *diff_pos);

@ -1 +1 @@
Subproject commit 3393fe35d378744e12636766931cf5109cc6c2e5
Subproject commit ae565eea90dd3053a5a7857e7cdad93342dbc645

View file

@ -34,7 +34,7 @@ CHECK TABLE
to check tables within the tablespace\&.
.PP
If checksum mismatches are found, you would normally restore the tablespace from backup or start the server and attempt to use
\fBmysqldump\fR
\fBmariadb-dump\fR
to make a backup of the tables within the tablespace\&.
.PP
Invoke
@ -75,9 +75,9 @@ Displays help and exits\&.
.sp -1
.IP \(bu 2.3
.\}
\fB\-c, --count\fR
\fB\-a \fR\fB\fInum\fB, --allow-mismatches=#\fR
.sp
Print a count of the number of pages in the file\&.
Maximum checksum mismatch allowed before innochecksum terminates. Defaults to 0, which terminates on the first mismatch\&.
.RE
.sp
.RS 4
@ -88,9 +88,9 @@ Print a count of the number of pages in the file\&.
.sp -1
.IP \(bu 2.3
.\}
\fB\-d, --debug\fR
\fB\-c, --count\fR
.sp
Debug mode; prints checksums for each page\&.
Print a count of the number of pages in the file\&.
.RE
.sp
.RS 4
@ -140,7 +140,7 @@ Synonym for \fB--help\fR\&.
.sp -1
.IP \(bu 2.3
.\}
\fB\-l, --leaf\fR
\fB\-f, --leaf\fR
.sp
Examine leaf index pages\&.
.RE
@ -153,6 +153,19 @@ Examine leaf index pages\&.
.sp -1
.IP \(bu 2.3
.\}
\fB\-l \fR\fB\fIfn\fB, --log=fn\fR\fR
.sp
Log output to the specified filename, fn\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-m \fR\fB\fInum\fB, --merge=#\fR\fR
.sp
Leaf page count if merge given number of consecutive pages\&.
@ -166,6 +179,19 @@ Leaf page count if merge given number of consecutive pages\&.
.sp -1
.IP \(bu 2.3
.\}
\fB\-n, --no-check\fR\fR
.sp
Ignore the checksum verification. Until MariaDB 10.6, must be used with the --write option\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-p \fR\fB\fInum\fB, --page-num=#\fR\fR
.sp
Check only this page number\&.
@ -179,6 +205,32 @@ Check only this page number\&.
.sp -1
.IP \(bu 2.3
.\}
\fB\-D \fR\fB\fIname\fB, --page-type-dump=name\fR\fR
.sp
Dump the page type info for each page in a tablespace\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-S, --page-type-summary\fR\fR
.sp
Display a count of each page type in a tablespace\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-s \fR\fB\fInum\fB, --start-page\fR\fR
.sp
Start at this page number\&.
@ -205,6 +257,32 @@ Skip corrupt pages\&.
.sp -1
.IP \(bu 2.3
.\}
\fB\-C \fR\fB\fIname\fB, --strict-check=name\fR\fR
.sp
Specify the strict checksum algorithm. One of: crc32, innodb, none. If not specified, validates against innodb, crc32 and none. Removed in MariaDB 10.6\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-w \fR\fB\fIname\fB, --write=name\fR\fR
.sp
Rewrite the checksum algorithm. One of crc32, innodb, none. An exclusive lock is obtained during use. Use in conjunction with the -no-check option to rewrite an invalid checksum. Removed in MariaDB 10.6\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-v, --verbose\fR
.sp
Verbose mode; print a progress indicator every five seconds\&.
@ -225,7 +303,7 @@ Displays version information and exits\&.
.SH "COPYRIGHT"
.br
.PP
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2023 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP

View file

@ -1,3 +1,3 @@
# The time on ANALYSE FORMAT=JSON is rather variable
--replace_regex /("(r_total_time_ms|r_table_time_ms|r_other_time_ms|r_buffer_size|r_filling_time_ms)": )[^, \n]*/\1"REPLACED"/
--replace_regex /("(r_[a-z_]*_time_ms|r_buffer_size)": )[^, \n]*/\1"REPLACED"/

View file

@ -58,11 +58,6 @@ DROP TABLE t1;
# CHAR
# MyISAM is buggy on CHAR+BTREE+UNIQUE+PREFIX (see MDEV-30048), disable for now
# Other engines work fine
if (`SELECT UPPER(@@storage_engine) != 'MYISAM'`)
{
EXECUTE IMMEDIATE REPLACE(
'CREATE TABLE t1 ( '
' a CHAR(20) COLLATE <COLLATION>,'
@ -72,7 +67,6 @@ SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('ss ');
INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
DROP TABLE t1;
}
EXECUTE IMMEDIATE REPLACE(
'CREATE TABLE t1 ( '

View file

@ -0,0 +1,54 @@
--echo #
--echo # MDEV-30048 Prefix keys for CHAR work differently for MyISAM vs InnoDB
--echo #
SET NAMES utf8mb3;
#
# Engines have different conditions based on the column size
# determining when to use trailing space compressions in key values,
# so let's test different column sizes for better coverage.
#
#
# CHAR(10)
#
CREATE TABLE t1 (a CHAR(10) COLLATE utf8mb3_unicode_nopad_ci, UNIQUE KEY(a));
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('ss'),('ß');
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(10) COLLATE utf8mb3_unicode_nopad_ci, UNIQUE KEY(a(2)));
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('ss'),('ß');
DROP TABLE t1;
#
# CHAR(120)
#
CREATE TABLE t1 (a CHAR(120) COLLATE utf8mb3_unicode_nopad_ci, UNIQUE KEY(a));
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('ss'),('ß');
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(120) COLLATE utf8mb3_unicode_nopad_ci, UNIQUE KEY(a(100)));
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('ss'),('ß');
DROP TABLE t1;
--echo #
--echo # MDEV-30050 Inconsistent results of DISTINCT with NOPAD
--echo #
CREATE TABLE t1 (c CHAR(100) COLLATE utf8mb3_unicode_nopad_ci);
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('ss'),('ß');
SET big_tables=0;
SELECT DISTINCT c FROM t1;
SET big_tables=1;
SELECT DISTINCT c FROM t1;
DROP TABLE t1;
SET big_tables=DEFAULT;

View file

@ -1,6 +1,8 @@
SET SESSION character_set_connection=latin2;
SET SESSION character_set_client=cp1250;
--disable_service_connection
--echo #
--echo # Test litteral
--echo #
@ -129,3 +131,5 @@ EXPLAIN EXTENDED SELECT '';
EXPLAIN EXTENDED SELECT _latin1'';
EXPLAIN EXTENDED SELECT N'';
EXPLAIN EXTENDED SELECT '' '';
--enable_service_connection

View file

@ -162,7 +162,7 @@ INSERT INTO t1 VALUES
--echo
--echo # Execute select with invalid timestamp, desc ordering
SELECT *
FROM t1
FROM t1 FORCE INDEX(PRIMARY)
WHERE ts BETWEEN '0000-00-00' AND '2010-00-01 00:00:00'
ORDER BY ts DESC
LIMIT 2;
@ -171,7 +171,7 @@ LIMIT 2;
--echo # Should use index condition
EXPLAIN
SELECT *
FROM t1
FROM t1 FORCE INDEX(PRIMARY)
WHERE ts BETWEEN '0000-00-00' AND '2010-00-01 00:00:00'
ORDER BY ts DESC
LIMIT 2;
@ -458,6 +458,7 @@ INSERT INTO t2 VALUES (11,1);
INSERT INTO t2 VALUES (12,2);
INSERT INTO t2 VALUES (15,4);
analyze table t1,t2 persistent for all;
set @save_optimizer_switch= @@optimizer_switch;
set optimizer_switch='semijoin=off';
@ -730,6 +731,7 @@ INSERT INTO t2 VALUES
('Ill'), ('eckqzsflbzaffti'), ('w'), ('she'), ('gxbwypqtjzwywwer'), ('w');
insert into t2 select seq from seq_1_to_100;
analyze table t1,t2 persistent for all;
SET SESSION optimizer_switch='index_condition_pushdown=off';
--replace_column 9 #
EXPLAIN

View file

@ -154,7 +154,17 @@ sub collect_test_cases ($$$$) {
{
push (@$cases, @this_case);
}
else
elsif ($::opt_skip_not_found)
{
push @$cases, My::Test->new
(
name => "$sname.$tname",
shortname => $tname,
skip => 1,
comment => 'not found',
);
}
else
{
mtr_error("Could not find '$tname' in '$sname' suite");
}
@ -614,7 +624,7 @@ sub make_combinations($$@)
{
my ($test, $test_combs, @combinations) = @_;
return ($test) if $test->{'skip'} or not @combinations;
return ($test) unless @combinations;
if ($combinations[0]->{skip}) {
$test->{skip} = 1;
$test->{comment} = $combinations[0]->{skip} unless $test->{comment};
@ -647,6 +657,8 @@ sub make_combinations($$@)
}
}
return ($test) if $test->{'skip'};
my @cases;
foreach my $comb (@combinations)
{

View file

@ -76,6 +76,30 @@ if (-t STDOUT) {
}
}
# On Windows, stdio does not support line buffering
# This can make MTR output from multiple forked processes interleaved, messed up.
# Below is DYI stdout line buffering.
my $out_line="";
# Flush buffered line
sub flush_out {
print $out_line;
$out_line = "";
}
# Print to stdout
sub print_out {
if(IS_WIN32PERL) {
$out_line .= $_[0];
# Flush buffered output on new lines.
if (rindex($_[0], "\n") != -1) {
flush_out();
}
} else {
print($_[0]);
}
}
sub titlebar_stat($) {
sub time_format($) {
@ -116,10 +140,10 @@ sub _mtr_report_test_name ($) {
return unless defined $verbose;
print _name(). _timestamp();
printf "%-40s ", $tname;
print_out _name(). _timestamp();
print_out (sprintf "%-40s ", $tname);
my $worker = $tinfo->{worker};
print "w$worker " if defined $worker;
print_out "w$worker " if defined $worker;
return $tname;
}
@ -661,14 +685,14 @@ sub mtr_report (@) {
{
my @s = split /\[ (\S+) \]/, _name() . "@_\n";
if (@s > 1) {
print $s[0];
print_out $s[0];
&$set_color($s[1]);
print "[ $s[1] ]";
print_out "[ $s[1] ]";
&$set_color('reset');
print $s[2];
print_out $s[2];
titlebar_stat($s[1]) if $set_titlebar;
} else {
print $s[0];
print_out $s[0];
}
}
}
@ -676,6 +700,7 @@ sub mtr_report (@) {
# Print warning to screen
sub mtr_warning (@) {
flush_out();
print STDERR _name(). _timestamp().
"mysql-test-run: WARNING: ". join(" ", @_). "\n";
}
@ -683,7 +708,7 @@ sub mtr_warning (@) {
# Print error to screen and then exit
sub mtr_error (@) {
IO::Handle::flush(\*STDOUT) if IS_WINDOWS;
flush_out();
print STDERR _name(). _timestamp().
"mysql-test-run: *** ERROR: ". join(" ", @_). "\n";
if (IS_WINDOWS)

View file

@ -1,5 +1,3 @@
#remove this include after fix MDEV-27871
--source include/no_view_protocol.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
@ -248,7 +246,9 @@ SET sql_mode=DEFAULT;
--echo # in Item::print_item_w_name on SELECT w/ optimizer_trace enabled
--echo #
--disable_view_protocol
SELECT '' LIMIT 0;
--enable_view_protocol
--error ER_WRONG_COLUMN_NAME
CREATE TABLE t1 AS SELECT '';
@ -320,7 +320,9 @@ create or replace table t2 (b int);
insert into t1 values(111111111),(-2147483648);
insert into t2 values(1),(2);
--enable_metadata
--disable_view_protocol
select t1.a as a1 from t1 as t1,t2 order by t2.b,t1.a;
--enable_view_protocol
--disable_metadata
drop table t1,t2;

View file

@ -151,7 +151,8 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "1Kb",
"join_type": "BNL",
"r_filtered": 100
"r_filtered": 100,
"r_unpack_time_ms": "REPLACED"
}
}
}
@ -192,7 +193,8 @@ ANALYZE
"buffer_size": "1Kb",
"join_type": "BNL",
"attached_condition": "tbl1.c > tbl2.c",
"r_filtered": 15.83333333
"r_filtered": 15.83333333,
"r_unpack_time_ms": "REPLACED"
}
}
}
@ -652,7 +654,8 @@ ANALYZE
"buffer_size": "65",
"join_type": "BNL",
"attached_condition": "<in_optimizer>(t2.b,t2.b in (subquery#2))",
"r_filtered": null
"r_filtered": null,
"r_unpack_time_ms": "REPLACED"
},
"subqueries": [
{
@ -742,7 +745,8 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "1",
"join_type": "BNL",
"r_filtered": null
"r_filtered": null,
"r_unpack_time_ms": "REPLACED"
},
"subqueries": [
{
@ -774,7 +778,8 @@ ANALYZE
"buffer_size": "65",
"join_type": "BNL",
"attached_condition": "t2.f2 = t3.f3",
"r_filtered": null
"r_filtered": null,
"r_unpack_time_ms": "REPLACED"
}
}
}

View file

@ -0,0 +1,87 @@
#
# MDEV-30830: ANALYZE FORMAT=JSON: r_unpack_time_ms is empty for the hashed joins
#
#
# First, check a regular BNL-join
#
create table t1 (
a int,
b int
);
insert into t1 select seq, seq/3 from seq_0_to_99;
create table t2 (
a int,
b int
);
insert into t2 select seq, seq/5 from seq_0_to_99;
set @js='$out';
set @out=(select json_extract(@js,'$**.block-nl-join.r_unpack_time_ms'));
select cast(json_extract(@out,'$[0]') as DOUBLE) > 0;
cast(json_extract(@out,'$[0]') as DOUBLE) > 0
1
drop table t1,t2;
#
# Now, check the hashed, BNL-H join
#
create table t1 (
a int,
b int
);
insert into t1 select seq, seq/3 from seq_0_to_499;
create table t2 (
a int,
b int
);
insert into t2 select seq, seq/5 from seq_0_to_499;
set @tmp=@@join_cache_level, join_cache_level=6;
select '$out' as X;
X
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 500,
"r_rows": 500,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
"attached_condition": "t1.a < 700 and t1.b is not null"
},
"block-nl-join": {
"table": {
"table_name": "t2",
"access_type": "hash_ALL",
"key": "#hash#$hj",
"key_length": "5",
"used_key_parts": ["b"],
"ref": ["test.t1.b"],
"r_loops": 1,
"rows": 500,
"r_rows": 500,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 20,
"attached_condition": "t2.a < 100"
},
"buffer_type": "flat",
"buffer_size": "18Kb",
"join_type": "BNLH",
"attached_condition": "t2.b = t1.b",
"r_filtered": 100,
"r_unpack_time_ms": "REPLACED"
}
}
}
set @out=(select json_extract(@js,'$**.block-nl-join.r_unpack_time_ms'));
select cast(json_extract(@out,'$[0]') as DOUBLE) > 0;
cast(json_extract(@out,'$[0]') as DOUBLE) > 0
1
set join_cache_level=@tmp;
drop table t1, t2;

View file

@ -0,0 +1,77 @@
#
# Tests to check that r_something_time_ms is non-zero in
# ANALYZE FORMAT=JSON <statement>
#
--source include/default_optimizer_switch.inc
--source include/have_sequence.inc
# The tests here are large so that we get non-zero timings
--source include/big_test.inc
--echo #
--echo # MDEV-30830: ANALYZE FORMAT=JSON: r_unpack_time_ms is empty for the hashed joins
--echo #
--echo #
--echo # First, check a regular BNL-join
--echo #
create table t1 (
a int,
b int
);
insert into t1 select seq, seq/3 from seq_0_to_99;
create table t2 (
a int,
b int
);
insert into t2 select seq, seq/5 from seq_0_to_99;
let $out=`
analyze format=json
select * from t1, t2
where
t1.a < 700 and
t2.a < 100
and t1.b=t2.b
`;
evalp set @js='$out';
set @out=(select json_extract(@js,'$**.block-nl-join.r_unpack_time_ms'));
select cast(json_extract(@out,'$[0]') as DOUBLE) > 0;
drop table t1,t2;
--echo #
--echo # Now, check the hashed, BNL-H join
--echo #
create table t1 (
a int,
b int
);
insert into t1 select seq, seq/3 from seq_0_to_499;
create table t2 (
a int,
b int
);
insert into t2 select seq, seq/5 from seq_0_to_499;
set @tmp=@@join_cache_level, join_cache_level=6;
let $out=`
analyze format=json
select * from t1, t2
where
t1.a < 700 and
t2.a < 100
and t1.b=t2.b
`;
--source include/analyze-format.inc
evalp select '$out' as X;
set @out=(select json_extract(@js,'$**.block-nl-join.r_unpack_time_ms'));
select cast(json_extract(@out,'$[0]') as DOUBLE) > 0;
set join_cache_level=@tmp;
drop table t1, t2;

View file

@ -441,7 +441,8 @@ ANALYZE
"buffer_size": "65",
"join_type": "BNL",
"attached_condition": "t3.a = t0.a",
"r_filtered": 10
"r_filtered": 10,
"r_unpack_time_ms": "REPLACED"
}
}
}
@ -516,7 +517,8 @@ ANALYZE
"buffer_size": "119",
"join_type": "BNL",
"attached_condition": "t5.a = t6.a",
"r_filtered": 21.42857143
"r_filtered": 21.42857143,
"r_unpack_time_ms": "REPLACED"
}
}
}

View file

@ -1,67 +1,67 @@
drop table if exists t1, t2;
select CASE "b" when "a" then 1 when "b" then 2 END;
CASE "b" when "a" then 1 when "b" then 2 END
select CASE "b" when "a" then 1 when "b" then 2 END as exp;
exp
2
select CASE "c" when "a" then 1 when "b" then 2 END;
CASE "c" when "a" then 1 when "b" then 2 END
select CASE "c" when "a" then 1 when "b" then 2 END as exp;
exp
NULL
select CASE "c" when "a" then 1 when "b" then 2 ELSE 3 END;
CASE "c" when "a" then 1 when "b" then 2 ELSE 3 END
select CASE "c" when "a" then 1 when "b" then 2 ELSE 3 END as exp;
exp
3
select CASE BINARY "b" when "a" then 1 when "B" then 2 WHEN "b" then "ok" END;
CASE BINARY "b" when "a" then 1 when "B" then 2 WHEN "b" then "ok" END
select CASE BINARY "b" when "a" then 1 when "B" then 2 WHEN "b" then "ok" END as exp;
exp
ok
select CASE "b" when "a" then 1 when binary "B" then 2 WHEN "b" then "ok" END;
CASE "b" when "a" then 1 when binary "B" then 2 WHEN "b" then "ok" END
select CASE "b" when "a" then 1 when binary "B" then 2 WHEN "b" then "ok" END as exp;
exp
ok
select CASE concat("a","b") when concat("ab","") then "a" when "b" then "b" end;
CASE concat("a","b") when concat("ab","") then "a" when "b" then "b" end
select CASE concat("a","b") when concat("ab","") then "a" when "b" then "b" end as exp;
exp
a
select CASE when 1=0 then "true" else "false" END;
CASE when 1=0 then "true" else "false" END
select CASE when 1=0 then "true" else "false" END as exp;
exp
false
select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END
select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END as exp;
exp
one
explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END as exp;
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 case 1 when 1 then 'one' when 2 then 'two' else 'more' end AS `CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END`
select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END;
CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END
Note 1003 select case 1 when 1 then 'one' when 2 then 'two' else 'more' end AS `exp`
select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END as exp;
exp
two
select (CASE "two" when "one" then "1" WHEN "two" then "2" END) | 0;
(CASE "two" when "one" then "1" WHEN "two" then "2" END) | 0
select (CASE "two" when "one" then "1" WHEN "two" then "2" END) | 0 as exp;
exp
2
select (CASE "two" when "one" then 1.00 WHEN "two" then 2.00 END) +0.0;
(CASE "two" when "one" then 1.00 WHEN "two" then 2.00 END) +0.0
select (CASE "two" when "one" then 1.00 WHEN "two" then 2.00 END) +0.0 as exp;
exp
2.00
select case 1/0 when "a" then "true" else "false" END;
case 1/0 when "a" then "true" else "false" END
select case 1/0 when "a" then "true" else "false" END as exp;
exp
false
Warnings:
Warning 1365 Division by 0
select case 1/0 when "a" then "true" END;
case 1/0 when "a" then "true" END
select case 1/0 when "a" then "true" END as exp;
exp
NULL
Warnings:
Warning 1365 Division by 0
select (case 1/0 when "a" then "true" END) | 0;
(case 1/0 when "a" then "true" END) | 0
select (case 1/0 when "a" then "true" END) | 0 as exp;
exp
NULL
Warnings:
Warning 1365 Division by 0
select (case 1/0 when "a" then "true" END) + 0.0;
(case 1/0 when "a" then "true" END) + 0.0
select (case 1/0 when "a" then "true" END) + 0.0 as exp;
exp
NULL
Warnings:
Warning 1365 Division by 0
select case when 1>0 then "TRUE" else "FALSE" END;
case when 1>0 then "TRUE" else "FALSE" END
select case when 1>0 then "TRUE" else "FALSE" END as exp;
exp
TRUE
select case when 1<0 then "TRUE" else "FALSE" END;
case when 1<0 then "TRUE" else "FALSE" END
select case when 1<0 then "TRUE" else "FALSE" END as exp;
exp
FALSE
create table t1 (a int);
insert into t1 values(1),(2),(3),(4);
@ -133,12 +133,12 @@ WHEN _latin1'a' COLLATE latin1_swedish_ci THEN 2
END;
ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_danish_ci,EXPLICIT), (latin1_swedish_ci,EXPLICIT) for operation 'case'
SELECT
CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'A' THEN '1' ELSE 2 END,
CASE _latin1'a' COLLATE latin1_bin WHEN _latin1'A' THEN '1' ELSE 2 END,
CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_swedish_ci THEN '1' ELSE 2 END,
CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END
CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'A' THEN '1' ELSE 2 END as e1,
CASE _latin1'a' COLLATE latin1_bin WHEN _latin1'A' THEN '1' ELSE 2 END as e2,
CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_swedish_ci THEN '1' ELSE 2 END as e3,
CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END as e4
;
CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'A' THEN '1' ELSE 2 END CASE _latin1'a' COLLATE latin1_bin WHEN _latin1'A' THEN '1' ELSE 2 END CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_swedish_ci THEN '1' ELSE 2 END CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END
e1 e2 e3 e4
1 2 1 2
CREATE TABLE t1 SELECT COALESCE(_latin1'a',_latin2'a');
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'coalesce'
@ -403,8 +403,8 @@ DROP TABLE t1;
#
# End of 10.1 test
#
select case 'foo' when time'10:00:00' then 'never' when '0' then 'bug' else 'ok' end;
case 'foo' when time'10:00:00' then 'never' when '0' then 'bug' else 'ok' end
select case 'foo' when time'10:00:00' then 'never' when '0' then 'bug' else 'ok' end as exp;
exp
ok
Warnings:
Warning 1292 Truncated incorrect time value: 'foo'
@ -434,8 +434,8 @@ Warning 1292 Truncated incorrect time value: 'foo'
Warning 1292 Truncated incorrect time value: 'foo'
Warning 1292 Truncated incorrect time value: 'foo'
drop table t1;
select case '20:10:05' when date'2020-10-10' then 'never' when time'20:10:5' then 'ok' else 'bug' end;
case '20:10:05' when date'2020-10-10' then 'never' when time'20:10:5' then 'ok' else 'bug' end
select case '20:10:05' when date'2020-10-10' then 'never' when time'20:10:5' then 'ok' else 'bug' end as exp;
exp
ok
#
# End of 10.2 test

View file

@ -2,31 +2,29 @@
# Testing of CASE
#
#remove this include after fix MDEV-27871
--source include/no_view_protocol.inc
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
select CASE "b" when "a" then 1 when "b" then 2 END;
select CASE "c" when "a" then 1 when "b" then 2 END;
select CASE "c" when "a" then 1 when "b" then 2 ELSE 3 END;
select CASE BINARY "b" when "a" then 1 when "B" then 2 WHEN "b" then "ok" END;
select CASE "b" when "a" then 1 when binary "B" then 2 WHEN "b" then "ok" END;
select CASE concat("a","b") when concat("ab","") then "a" when "b" then "b" end;
select CASE when 1=0 then "true" else "false" END;
select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END;
select (CASE "two" when "one" then "1" WHEN "two" then "2" END) | 0;
select (CASE "two" when "one" then 1.00 WHEN "two" then 2.00 END) +0.0;
select case 1/0 when "a" then "true" else "false" END;
select case 1/0 when "a" then "true" END;
select (case 1/0 when "a" then "true" END) | 0;
select (case 1/0 when "a" then "true" END) + 0.0;
select case when 1>0 then "TRUE" else "FALSE" END;
select case when 1<0 then "TRUE" else "FALSE" END;
select CASE "b" when "a" then 1 when "b" then 2 END as exp;
select CASE "c" when "a" then 1 when "b" then 2 END as exp;
select CASE "c" when "a" then 1 when "b" then 2 ELSE 3 END as exp;
select CASE BINARY "b" when "a" then 1 when "B" then 2 WHEN "b" then "ok" END as exp;
select CASE "b" when "a" then 1 when binary "B" then 2 WHEN "b" then "ok" END as exp;
select CASE concat("a","b") when concat("ab","") then "a" when "b" then "b" end as exp;
select CASE when 1=0 then "true" else "false" END as exp;
select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END as exp;
explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END as exp;
select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END as exp;
select (CASE "two" when "one" then "1" WHEN "two" then "2" END) | 0 as exp;
select (CASE "two" when "one" then 1.00 WHEN "two" then 2.00 END) +0.0 as exp;
select case 1/0 when "a" then "true" else "false" END as exp;
select case 1/0 when "a" then "true" END as exp;
select (case 1/0 when "a" then "true" END) | 0 as exp;
select (case 1/0 when "a" then "true" END) + 0.0 as exp;
select case when 1>0 then "TRUE" else "FALSE" END as exp;
select case when 1<0 then "TRUE" else "FALSE" END as exp;
#
# Test bug when using GROUP BY on CASE
@ -83,10 +81,10 @@ SELECT CASE _latin1'a' COLLATE latin1_general_ci
END;
SELECT
CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'A' THEN '1' ELSE 2 END,
CASE _latin1'a' COLLATE latin1_bin WHEN _latin1'A' THEN '1' ELSE 2 END,
CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_swedish_ci THEN '1' ELSE 2 END,
CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END
CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'A' THEN '1' ELSE 2 END as e1,
CASE _latin1'a' COLLATE latin1_bin WHEN _latin1'A' THEN '1' ELSE 2 END as e2,
CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_swedish_ci THEN '1' ELSE 2 END as e3,
CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END as e4
;
#
@ -297,7 +295,7 @@ DROP TABLE t1;
#
# should not convert all values to time
select case 'foo' when time'10:00:00' then 'never' when '0' then 'bug' else 'ok' end;
select case 'foo' when time'10:00:00' then 'never' when '0' then 'bug' else 'ok' end as exp;
select 'foo' in (time'10:00:00','0');
create table t1 (a time);
@ -308,7 +306,7 @@ select 'foo' in (a,'0') from t1;
drop table t1;
# first comparison should be as date, second as time
select case '20:10:05' when date'2020-10-10' then 'never' when time'20:10:5' then 'ok' else 'bug' end;
select case '20:10:05' when date'2020-10-10' then 'never' when time'20:10:5' then 'ok' else 'bug' end as exp;
--echo #
--echo # End of 10.2 test

View file

@ -69,95 +69,95 @@ cast(cast("20:01:01" as time) as datetime)
select cast(cast("8:46:06.23434" AS time) as decimal(32,10));
cast(cast("8:46:06.23434" AS time) as decimal(32,10))
84606.0000000000
select cast(cast("2011-04-05 8:46:06.23434" AS datetime) as decimal(32,6));
cast(cast("2011-04-05 8:46:06.23434" AS datetime) as decimal(32,6))
select cast(cast("2011-04-05 8:46:06.23434" AS datetime) as decimal(32,6)) as exp;
exp
20110405084606.000000
#
# Check handling of cast with microseconds
#
select cast(cast(20010203101112.121314 as double) as datetime);
cast(cast(20010203101112.121314 as double) as datetime)
select cast(cast(20010203101112.121314 as double) as datetime) as exp;
exp
2001-02-03 10:11:12
select cast(cast(010203101112.12 as double) as datetime);
cast(cast(010203101112.12 as double) as datetime)
select cast(cast(010203101112.12 as double) as datetime) as exp;
exp
2001-02-03 10:11:12
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime);
cast(cast(20010203101112.121314 as decimal(32,6)) as datetime)
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime) as exp;
exp
2001-02-03 10:11:12
select cast(20010203101112.121314 as datetime);
cast(20010203101112.121314 as datetime)
select cast(20010203101112.121314 as datetime) as exp;
exp
2001-02-03 10:11:12
select cast(110203101112.121314 as datetime);
cast(110203101112.121314 as datetime)
select cast(110203101112.121314 as datetime) as exp;
exp
2011-02-03 10:11:12
select cast(cast(010203101112.12 as double) as datetime);
cast(cast(010203101112.12 as double) as datetime)
select cast(cast(010203101112.12 as double) as datetime) as exp;
exp
2001-02-03 10:11:12
select cast("2011-02-03 10:11:12.123456" as datetime);
cast("2011-02-03 10:11:12.123456" as datetime)
select cast("2011-02-03 10:11:12.123456" as datetime) as exp;
exp
2011-02-03 10:11:12
select cast("2011-02-03 10:11:12.123456" as datetime(0));
cast("2011-02-03 10:11:12.123456" as datetime(0))
select cast("2011-02-03 10:11:12.123456" as datetime(0)) as exp;
exp
2011-02-03 10:11:12
select cast("2011-02-03 10:11:12.123456" as datetime(5));
cast("2011-02-03 10:11:12.123456" as datetime(5))
select cast("2011-02-03 10:11:12.123456" as datetime(5)) as exp;
exp
2011-02-03 10:11:12.12345
select cast("2011-02-03 10:11:12.123456" as datetime(6));
cast("2011-02-03 10:11:12.123456" as datetime(6))
select cast("2011-02-03 10:11:12.123456" as datetime(6)) as exp;
exp
2011-02-03 10:11:12.123456
select cast("2011-02-03 10:11:12" as datetime(6));
cast("2011-02-03 10:11:12" as datetime(6))
select cast("2011-02-03 10:11:12" as datetime(6)) as exp;
exp
2011-02-03 10:11:12.000000
select cast(cast(20010203101112.5 as double) as datetime(1));
cast(cast(20010203101112.5 as double) as datetime(1))
select cast(cast(20010203101112.5 as double) as datetime(1)) as exp;
exp
2001-02-03 10:11:12.5
select cast(cast(010203101112.12 as double) as datetime(2));
cast(cast(010203101112.12 as double) as datetime(2))
select cast(cast(010203101112.12 as double) as datetime(2)) as exp;
exp
2001-02-03 10:11:12.12
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6));
cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6))
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6)) as exp;
exp
2001-02-03 10:11:12.121314
select cast(20010203101112.121314 as datetime(6));
cast(20010203101112.121314 as datetime(6))
select cast(20010203101112.121314 as datetime(6)) as exp;
exp
2001-02-03 10:11:12.121314
select cast(110203101112.121314 as datetime(6));
cast(110203101112.121314 as datetime(6))
select cast(110203101112.121314 as datetime(6)) as exp;
exp
2011-02-03 10:11:12.121314
select cast(cast(010203101112.12 as double) as datetime(6));
cast(cast(010203101112.12 as double) as datetime(6))
select cast(cast(010203101112.12 as double) as datetime(6)) as exp;
exp
2001-02-03 10:11:12.120000
select cast("2011-02-03 10:11:12.123456" as time);
cast("2011-02-03 10:11:12.123456" as time)
select cast("2011-02-03 10:11:12.123456" as time) as exp;
exp
10:11:12
select cast("2011-02-03 10:11:12.123456" as time(6));
cast("2011-02-03 10:11:12.123456" as time(6))
select cast("2011-02-03 10:11:12.123456" as time(6)) as exp;
exp
10:11:12.123456
select cast("10:11:12.123456" as time);
cast("10:11:12.123456" as time)
select cast("10:11:12.123456" as time) as exp;
exp
10:11:12
select cast("10:11:12.123456" as time(0));
cast("10:11:12.123456" as time(0))
select cast("10:11:12.123456" as time(0)) as exp;
exp
10:11:12
select cast("10:11:12.123456" as time(5));
cast("10:11:12.123456" as time(5))
select cast("10:11:12.123456" as time(5)) as exp;
exp
10:11:12.12345
select cast("10:11:12.123456" as time(6));
cast("10:11:12.123456" as time(6))
select cast("10:11:12.123456" as time(6)) as exp;
exp
10:11:12.123456
select cast("10:11:12" as time(6));
cast("10:11:12" as time(6))
select cast("10:11:12" as time(6)) as exp;
exp
10:11:12.000000
select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time);
cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time)
select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time) as exp;
exp
08:46:06
select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time(6));
cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time(6))
select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time(6)) as exp;
exp
08:46:06.000000
select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time);
cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time)
select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time) as exp;
exp
08:46:06
select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time(6));
cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time(6))
select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time(6)) as exp;
exp
08:46:06.123456
select cast(NULL as unsigned), cast(1/0 as unsigned);
cast(NULL as unsigned) cast(1/0 as unsigned)

View file

@ -2,10 +2,6 @@
# Test of cast function
#
#remove this include after fix MDEV-27871
# discuss what to do with "set names binary"
--source include/no_view_protocol.inc
# For TIME->DATETIME conversion
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
@ -27,41 +23,41 @@ select cast(null as double(5,2));
select cast(12.444 as double);
select cast(cast("20:01:01" as time) as datetime);
select cast(cast("8:46:06.23434" AS time) as decimal(32,10));
select cast(cast("2011-04-05 8:46:06.23434" AS datetime) as decimal(32,6));
select cast(cast("2011-04-05 8:46:06.23434" AS datetime) as decimal(32,6)) as exp;
--echo #
--echo # Check handling of cast with microseconds
--echo #
select cast(cast(20010203101112.121314 as double) as datetime);
select cast(cast(010203101112.12 as double) as datetime);
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime);
select cast(20010203101112.121314 as datetime);
select cast(110203101112.121314 as datetime);
select cast(cast(010203101112.12 as double) as datetime);
select cast(cast(20010203101112.121314 as double) as datetime) as exp;
select cast(cast(010203101112.12 as double) as datetime) as exp;
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime) as exp;
select cast(20010203101112.121314 as datetime) as exp;
select cast(110203101112.121314 as datetime) as exp;
select cast(cast(010203101112.12 as double) as datetime) as exp;
select cast("2011-02-03 10:11:12.123456" as datetime);
select cast("2011-02-03 10:11:12.123456" as datetime(0));
select cast("2011-02-03 10:11:12.123456" as datetime(5));
select cast("2011-02-03 10:11:12.123456" as datetime(6));
select cast("2011-02-03 10:11:12" as datetime(6));
select cast(cast(20010203101112.5 as double) as datetime(1));
select cast(cast(010203101112.12 as double) as datetime(2));
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6));
select cast(20010203101112.121314 as datetime(6));
select cast(110203101112.121314 as datetime(6));
select cast(cast(010203101112.12 as double) as datetime(6));
select cast("2011-02-03 10:11:12.123456" as datetime) as exp;
select cast("2011-02-03 10:11:12.123456" as datetime(0)) as exp;
select cast("2011-02-03 10:11:12.123456" as datetime(5)) as exp;
select cast("2011-02-03 10:11:12.123456" as datetime(6)) as exp;
select cast("2011-02-03 10:11:12" as datetime(6)) as exp;
select cast(cast(20010203101112.5 as double) as datetime(1)) as exp;
select cast(cast(010203101112.12 as double) as datetime(2)) as exp;
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6)) as exp;
select cast(20010203101112.121314 as datetime(6)) as exp;
select cast(110203101112.121314 as datetime(6)) as exp;
select cast(cast(010203101112.12 as double) as datetime(6)) as exp;
select cast("2011-02-03 10:11:12.123456" as time);
select cast("2011-02-03 10:11:12.123456" as time(6));
select cast("10:11:12.123456" as time);
select cast("10:11:12.123456" as time(0));
select cast("10:11:12.123456" as time(5));
select cast("10:11:12.123456" as time(6));
select cast("10:11:12" as time(6));
select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time);
select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time(6));
select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time);
select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time(6));
select cast("2011-02-03 10:11:12.123456" as time) as exp;
select cast("2011-02-03 10:11:12.123456" as time(6)) as exp;
select cast("10:11:12.123456" as time) as exp;
select cast("10:11:12.123456" as time(0)) as exp;
select cast("10:11:12.123456" as time(5)) as exp;
select cast("10:11:12.123456" as time(6)) as exp;
select cast("10:11:12" as time(6)) as exp;
select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time) as exp;
select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time(6)) as exp;
select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time) as exp;
select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time(6)) as exp;
#
# Bug #28250: Run-Time Check Failure #3 - The variable 'value' is being used
@ -162,7 +158,10 @@ select cast(1 as double(64,63));
#
set names binary;
select cast(_latin1'test' as char character set latin2);
#enable after MDEV-32461 fix
--disable_view_protocol
select cast(_koi8r'ÔÅÓÔ' as char character set cp1251);
--enable_view_protocol
create table t1 select cast(_koi8r'ÔÅÓÔ' as char character set cp1251) as t;
show create table t1;
drop table t1;
@ -170,6 +169,8 @@ drop table t1;
#
# CAST to CHAR with/without length
#
#enable after MDEV-32461 fix
--disable_view_protocol
select
cast(_latin1'ab' AS char) as c1,
cast(_latin1'a ' AS char) as c2,
@ -177,6 +178,7 @@ select
cast(_latin1'a ' AS char(2)) as c4,
hex(cast(_latin1'a' AS char(2))) as c5;
select cast(1000 as CHAR(3));
--enable_view_protocol
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t1 select
@ -237,12 +239,15 @@ select cast("1:2:3" as TIME) = "1:02:03";
#
CREATE TABLE t1 (a enum ('aac','aab','aaa') not null);
INSERT INTO t1 VALUES ('aaa'),('aab'),('aac');
#enable after MDEV-32461 fix
--disable_view_protocol
# these two should be in enum order
SELECT a, CAST(a AS CHAR) FROM t1 ORDER BY CAST(a AS UNSIGNED) ;
SELECT a, CAST(a AS CHAR(3)) FROM t1 ORDER BY CAST(a AS CHAR(2)), a;
# these two should be in alphabetic order
SELECT a, CAST(a AS UNSIGNED) FROM t1 ORDER BY CAST(a AS CHAR) ;
SELECT a, CAST(a AS CHAR(2)) FROM t1 ORDER BY CAST(a AS CHAR(3)), a;
--enable_view_protocol
DROP TABLE t1;
#
@ -344,9 +349,12 @@ select cast(NULL as decimal(6)) as t1;
# Bug #17903: cast to char results in binary
#
set names latin1;
#enable after MDEV-32461 fix
--disable_view_protocol
select hex(cast('a' as char(2) binary));
select hex(cast('a' as binary(2)));
select hex(cast('a' as char(2) binary));
--enable_view_protocol
#
# Bug#29898: Item_date_typecast::val_int doesn't reset the null_value flag.
@ -476,11 +484,14 @@ drop table t1;
#
# CAST (... BINARY)
#
#enable after MDEV-32461 fix
--disable_view_protocol
select collation(cast("a" as char(10) binary));
select collation(cast("a" as char(10) charset utf8 binary));
select collation(cast("a" as char(10) ascii binary));
select collation(cast("a" as char(10) binary charset utf8));
select collation(cast("a" as char(10) binary ascii));
--enable_view_protocol
--echo #
--echo # MDEV-11030 Assertion `precision > 0' failed in decimal_bin_size
@ -762,7 +773,10 @@ INSERT INTO t1 VALUES (-1.0);
SELECT * FROM t1;
DROP TABLE t1;
#enable after MDEV-32461 fix
--disable_view_protocol
SELECT CAST(-1e0 AS UNSIGNED);
--enable_view_protocol
CREATE TABLE t1 (a BIGINT UNSIGNED);
INSERT INTO t1 VALUES (-1e0);
SELECT * FROM t1;

View file

@ -308,5 +308,15 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t1;
#
# MDEV-32586 incorrect error about cyclic reference about JSON type virtual column
#
create table t1 (a int, b json as (a));
drop table t1;
create table t1 (a int, b int as (a) check (b > 0));
insert t1 (a) values (1);
insert t1 (a) values (-1);
ERROR 23000: CONSTRAINT `t1.b` failed for `test`.`t1`
drop table t1;
#
# End of 10.4 tests
#

View file

@ -231,6 +231,19 @@ alter table t1 force;
show create table t1;
drop table t1;
--echo #
--echo # MDEV-32586 incorrect error about cyclic reference about JSON type virtual column
--echo #
create table t1 (a int, b json as (a));
drop table t1;
create table t1 (a int, b int as (a) check (b > 0));
insert t1 (a) values (1);
--error ER_CONSTRAINT_FAILED
insert t1 (a) values (-1);
drop table t1;
--echo #
--echo # End of 10.4 tests
--echo #

View file

@ -3382,6 +3382,50 @@ INSERT INTO t VALUES (0,0);
DELETE FROM t WHERE c2<c1;
DROP TABLE t;
#
# MDEV-28835 Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on INSERT
#
SET NAMES latin1,character_set_connection=binary;
# Binary format, binary result
SELECT DATE_FORMAT('2004-02-02','%W');
DATE_FORMAT('2004-02-02','%W')
Monday
SELECT HEX(DATE_FORMAT('2004-02-02','%W'));
HEX(DATE_FORMAT('2004-02-02','%W'))
4D6F6E646179
SELECT DATE_FORMAT(TIME'-01:01:01','%h');
DATE_FORMAT(TIME'-01:01:01','%h')
-01
SELECT HEX(DATE_FORMAT(TIME'-01:01:01','%h'));
HEX(DATE_FORMAT(TIME'-01:01:01','%h'))
2D3031
# latin1 format, binary result
SELECT DATE_FORMAT('2004-02-02',_latin1'%W');
DATE_FORMAT('2004-02-02',_latin1'%W')
Monday
SELECT HEX(DATE_FORMAT('2004-02-02',_latin1'%W'));
HEX(DATE_FORMAT('2004-02-02',_latin1'%W'))
4D6F6E646179
SELECT DATE_FORMAT(TIME'-01:01:01',_latin1'%h');
DATE_FORMAT(TIME'-01:01:01',_latin1'%h')
-01
SELECT HEX(DATE_FORMAT(TIME'-01:01:01',_latin1'%h'));
HEX(DATE_FORMAT(TIME'-01:01:01',_latin1'%h'))
2D3031
# Binary format, latin1 result
SET NAMES latin1;
SELECT DATE_FORMAT('2004-02-02',_binary'%W');
DATE_FORMAT('2004-02-02',_binary'%W')
Monday
SELECT HEX(DATE_FORMAT('2004-02-02',_binary'%W'));
HEX(DATE_FORMAT('2004-02-02',_binary'%W'))
4D6F6E646179
SELECT DATE_FORMAT(TIME'-01:01:01',_binary'%h');
DATE_FORMAT(TIME'-01:01:01',_binary'%h')
-01
SELECT HEX(DATE_FORMAT(TIME'-01:01:01',_binary'%h'));
HEX(DATE_FORMAT(TIME'-01:01:01',_binary'%h'))
2D3031
#
# End of 10.4 tests
#
#

View file

@ -225,6 +225,31 @@ INSERT INTO t VALUES (0,0);
DELETE FROM t WHERE c2<c1;
DROP TABLE t;
--echo #
--echo # MDEV-28835 Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on INSERT
--echo #
SET NAMES latin1,character_set_connection=binary;
--echo # Binary format, binary result
SELECT DATE_FORMAT('2004-02-02','%W');
SELECT HEX(DATE_FORMAT('2004-02-02','%W'));
SELECT DATE_FORMAT(TIME'-01:01:01','%h');
SELECT HEX(DATE_FORMAT(TIME'-01:01:01','%h'));
--echo # latin1 format, binary result
SELECT DATE_FORMAT('2004-02-02',_latin1'%W');
SELECT HEX(DATE_FORMAT('2004-02-02',_latin1'%W'));
SELECT DATE_FORMAT(TIME'-01:01:01',_latin1'%h');
SELECT HEX(DATE_FORMAT(TIME'-01:01:01',_latin1'%h'));
--echo # Binary format, latin1 result
SET NAMES latin1;
SELECT DATE_FORMAT('2004-02-02',_binary'%W');
SELECT HEX(DATE_FORMAT('2004-02-02',_binary'%W'));
SELECT DATE_FORMAT(TIME'-01:01:01',_binary'%h');
SELECT HEX(DATE_FORMAT(TIME'-01:01:01',_binary'%h'));
--echo #
--echo # End of 10.4 tests
--echo #

View file

@ -641,8 +641,8 @@ check table t1 extended;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);
least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci)
select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1;
f1
a
create table t1
select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1;
@ -653,12 +653,11 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t1;
select case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate
latin5_turkish_ci then 2 else 3 end;
case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate
latin5_turkish_ci then 2 else 3 end
latin5_turkish_ci then 2 else 3 end as exp;
exp
3
select concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);
concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci)
select concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as exp;
exp
abc
#
# Bug#11765016 57926: ILLEGAL MIX OF COLLATIONS FOR OPERATION 'UNION' .. USING CONCAT/FUNCTION/

View file

@ -1,5 +1,3 @@
#remove this include after fix MDEV-27871
--source include/no_view_protocol.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
@ -248,16 +246,16 @@ drop table t1;
#
# Bug#41627 Illegal mix of collations in LEAST / GREATEST / CASE
#
select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);
select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1;
create table t1
select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1;
show create table t1;
drop table t1;
select case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate
latin5_turkish_ci then 2 else 3 end;
latin5_turkish_ci then 2 else 3 end as exp;
select concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);
select concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as exp;
--echo #

View file

@ -1,6 +1,4 @@
# remove this include in 10.6 version,
# if MDEV-27871 will be fix
--source include/no_view_protocol.inc
-- source include/have_eucjpms.inc

View file

@ -5954,13 +5954,13 @@ DROP TABLE t1;
# MDEV-7661 Unexpected result for: CAST(0xHHHH AS CHAR CHARACTER SET xxx) for incorrect byte sequences
#
set sql_mode='';
SELECT HEX(CAST(0xA341 AS CHAR CHARACTER SET gb2312));
HEX(CAST(0xA341 AS CHAR CHARACTER SET gb2312))
SELECT HEX(CAST(0xA341 AS CHAR CHARACTER SET gb2312)) as exp;
exp
3F41
Warnings:
Warning 1300 Invalid gb2312 character string: '\xA3A'
SELECT HEX(CONVERT(CAST(0xA341 AS CHAR CHARACTER SET gb2312) USING utf8));
HEX(CONVERT(CAST(0xA341 AS CHAR CHARACTER SET gb2312) USING utf8))
SELECT HEX(CONVERT(CAST(0xA341 AS CHAR CHARACTER SET gb2312) USING utf8)) as exp;
exp
3F41
Warnings:
Warning 1300 Invalid gb2312 character string: '\xA3A'

View file

@ -449,8 +449,8 @@ DROP TABLE t1;
#enable after fix MDEV-27871
--disable_view_protocol
set sql_mode='';
SELECT HEX(CAST(0xA341 AS CHAR CHARACTER SET gb2312));
SELECT HEX(CONVERT(CAST(0xA341 AS CHAR CHARACTER SET gb2312) USING utf8));
SELECT HEX(CAST(0xA341 AS CHAR CHARACTER SET gb2312)) as exp;
SELECT HEX(CONVERT(CAST(0xA341 AS CHAR CHARACTER SET gb2312) USING utf8)) as exp;
set sql_mode=default;
--enable_view_protocol

View file

@ -209,9 +209,6 @@ DROP TABLE t1;
--echo # WL#3664 WEIGHT_STRING
--echo #
# enable view-protocol after fix MDEV-27871
--disable_view_protocol
set names sjis;
--source include/weight_string.inc
--source include/weight_string_l1.inc
@ -223,8 +220,6 @@ set collation_connection=sjis_bin;
--source include/weight_string_l1.inc
--source include/weight_string_8140.inc
--enable_view_protocol
--echo #
--echo # End of 5.6 tests
--echo #

View file

@ -7964,8 +7964,8 @@ hex(weight_string(cast(_latin1 0xDF6368 as char),25, 4,0xC0))
#
# Bug#33077 weight of supplementary characters is not 0xfffd
#
select hex(weight_string(_utf8mb4 0xF0908080 /* U+10000 */ collate utf8mb4_unicode_ci));
hex(weight_string(_utf8mb4 0xF0908080 /* U+10000 */ collate utf8mb4_unicode_ci))
select hex(weight_string(_utf8mb4 0xF0908080 /* U+10000 */ collate utf8mb4_unicode_ci)) as exp;
exp
FFFD
#
# Bug#53064 garbled data when using utf8_german2_ci collation

View file

@ -552,10 +552,7 @@ set @@collation_connection=ucs2_czech_ci;
--echo #
--echo # Bug#33077 weight of supplementary characters is not 0xfffd
--echo #
#enable_after_fix MDEV-27871
--disable_view_protocol
select hex(weight_string(_utf8mb4 0xF0908080 /* U+10000 */ collate utf8mb4_unicode_ci));
--enable_view_protocol
select hex(weight_string(_utf8mb4 0xF0908080 /* U+10000 */ collate utf8mb4_unicode_ci)) as exp;
--echo #
--echo # Bug#53064 garbled data when using utf8_german2_ci collation

View file

@ -2958,5 +2958,69 @@ HEX(OCT(a))
DROP TABLE t;
SET NAMES utf8;
#
# MDEV-28835 Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on INSERT
#
SET sql_mode='',character_set_connection=utf32;
CREATE TABLE t (c ENUM ('','')) CHARACTER SET utf32;
Warnings:
Note 1291 Column 'c' has duplicated value '' in ENUM
INSERT INTO t VALUES (DATE_FORMAT('2004-02-02','%W'));
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
DROP TABLE t;
SET sql_mode=DEFAULT;
# utf32 format, utf32 result
SELECT DATE_FORMAT('2004-02-02','%W');
DATE_FORMAT('2004-02-02','%W')
Monday
SELECT HEX(DATE_FORMAT('2004-02-02','%W'));
HEX(DATE_FORMAT('2004-02-02','%W'))
0000004D0000006F0000006E000000640000006100000079
SELECT DATE_FORMAT(TIME'-01:01:01','%h');
DATE_FORMAT(TIME'-01:01:01','%h')
-01
SELECT HEX(DATE_FORMAT(TIME'-01:01:01','%h'));
HEX(DATE_FORMAT(TIME'-01:01:01','%h'))
0000002D0000003000000031
# utf8 format, utf32 result
SELECT DATE_FORMAT('2004-02-02',_utf8'%W');
DATE_FORMAT('2004-02-02',_utf8'%W')
Monday
SELECT HEX(DATE_FORMAT('2004-02-02',_utf8'%W'));
HEX(DATE_FORMAT('2004-02-02',_utf8'%W'))
0000004D0000006F0000006E000000640000006100000079
SELECT DATE_FORMAT(TIME'-01:01:01',_utf8'%h');
DATE_FORMAT(TIME'-01:01:01',_utf8'%h')
-01
SELECT HEX(DATE_FORMAT(TIME'-01:01:01',_utf8'%h'));
HEX(DATE_FORMAT(TIME'-01:01:01',_utf8'%h'))
0000002D0000003000000031
# utf32 format, utf8 result
SET NAMES utf8;
SELECT DATE_FORMAT('2004-02-02',CONVERT('%W' USING utf32));
DATE_FORMAT('2004-02-02',CONVERT('%W' USING utf32))
Monday
SELECT HEX(DATE_FORMAT('2004-02-02',CONVERT('%W' USING utf32)));
HEX(DATE_FORMAT('2004-02-02',CONVERT('%W' USING utf32)))
4D6F6E646179
SELECT DATE_FORMAT(TIME'-01:01:01',CONVERT('%h' USING utf32));
DATE_FORMAT(TIME'-01:01:01',CONVERT('%h' USING utf32))
-01
SELECT HEX(DATE_FORMAT(TIME'-01:01:01',CONVERT('%h' USING utf32)));
HEX(DATE_FORMAT(TIME'-01:01:01',CONVERT('%h' USING utf32)))
2D3031
# non-BMP characters in format, utf8mb3 result
# expect non-convertable characters to be replaced to '?'
SET NAMES utf8mb3;
SET @format= CONCAT(CONVERT('%h' USING utf32),
_utf32 0x0010FFFF /*a non-BMP character*/,
CONVERT('%i' USING utf32));
SELECT DATE_FORMAT(TIME'11:22:33',@format);
DATE_FORMAT(TIME'11:22:33',@format)
11?22
SELECT HEX(DATE_FORMAT(TIME'11:22:33',@format));
HEX(DATE_FORMAT(TIME'11:22:33',@format))
31313F3232
#
# End of 10.4 tests
#

View file

@ -1120,6 +1120,48 @@ SELECT HEX(OCT(a)) FROM t;
DROP TABLE t;
SET NAMES utf8;
--echo #
--echo # MDEV-28835 Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on INSERT
--echo #
# --view-protocol does not yet work well with character set introducers
--disable_view_protocol
SET sql_mode='',character_set_connection=utf32;
CREATE TABLE t (c ENUM ('','')) CHARACTER SET utf32;
INSERT INTO t VALUES (DATE_FORMAT('2004-02-02','%W'));
DROP TABLE t;
SET sql_mode=DEFAULT;
--echo # utf32 format, utf32 result
SELECT DATE_FORMAT('2004-02-02','%W');
SELECT HEX(DATE_FORMAT('2004-02-02','%W'));
SELECT DATE_FORMAT(TIME'-01:01:01','%h');
SELECT HEX(DATE_FORMAT(TIME'-01:01:01','%h'));
--echo # utf8 format, utf32 result
SELECT DATE_FORMAT('2004-02-02',_utf8'%W');
SELECT HEX(DATE_FORMAT('2004-02-02',_utf8'%W'));
SELECT DATE_FORMAT(TIME'-01:01:01',_utf8'%h');
SELECT HEX(DATE_FORMAT(TIME'-01:01:01',_utf8'%h'));
--echo # utf32 format, utf8 result
SET NAMES utf8;
SELECT DATE_FORMAT('2004-02-02',CONVERT('%W' USING utf32));
SELECT HEX(DATE_FORMAT('2004-02-02',CONVERT('%W' USING utf32)));
SELECT DATE_FORMAT(TIME'-01:01:01',CONVERT('%h' USING utf32));
SELECT HEX(DATE_FORMAT(TIME'-01:01:01',CONVERT('%h' USING utf32)));
--echo # non-BMP characters in format, utf8mb3 result
--echo # expect non-convertable characters to be replaced to '?'
SET NAMES utf8mb3;
SET @format= CONCAT(CONVERT('%h' USING utf32),
_utf32 0x0010FFFF /*a non-BMP character*/,
CONVERT('%i' USING utf32));
SELECT DATE_FORMAT(TIME'11:22:33',@format);
SELECT HEX(DATE_FORMAT(TIME'11:22:33',@format));
--enable_view_protocol
--echo #
--echo # End of 10.4 tests

View file

@ -830,6 +830,20 @@ INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
ERROR 23000: Duplicate entry 'ß ' for key 'a'
DROP TABLE t1;
EXECUTE IMMEDIATE REPLACE(
'CREATE TABLE t1 ( '
' a CHAR(20) COLLATE <COLLATION>,'
'UNIQUE(a(3)))',
'<COLLATION>', @@collation_connection);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(20) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci DEFAULT NULL,
UNIQUE KEY `a` (`a`(3))
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t1 VALUES ('ss ');
INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
DROP TABLE t1;
EXECUTE IMMEDIATE REPLACE(
'CREATE TABLE t1 ( '
' a CHAR(20) COLLATE <COLLATION>,'
'UNIQUE(a(3)) USING HASH)',
@ -906,6 +920,145 @@ INSERT INTO t1 VALUES ('ss ');
INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
DROP TABLE t1;
SET DEFAULT_STORAGE_ENGINE=DEFAULT;
SET default_storage_engine=MyISAM;
#
# MDEV-30048 Prefix keys for CHAR work differently for MyISAM vs InnoDB
#
SET NAMES utf8mb3;
CREATE TABLE t1 (a CHAR(10) COLLATE utf8mb3_unicode_nopad_ci, UNIQUE KEY(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(10) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci DEFAULT NULL,
UNIQUE KEY `a` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t1 VALUES ('ss'),('ß');
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(10) COLLATE utf8mb3_unicode_nopad_ci, UNIQUE KEY(a(2)));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(10) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci DEFAULT NULL,
UNIQUE KEY `a` (`a`(2))
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t1 VALUES ('ss'),('ß');
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(120) COLLATE utf8mb3_unicode_nopad_ci, UNIQUE KEY(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(120) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci DEFAULT NULL,
UNIQUE KEY `a` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t1 VALUES ('ss'),('ß');
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(120) COLLATE utf8mb3_unicode_nopad_ci, UNIQUE KEY(a(100)));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(120) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci DEFAULT NULL,
UNIQUE KEY `a` (`a`(100))
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t1 VALUES ('ss'),('ß');
DROP TABLE t1;
#
# MDEV-30050 Inconsistent results of DISTINCT with NOPAD
#
CREATE TABLE t1 (c CHAR(100) COLLATE utf8mb3_unicode_nopad_ci);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` char(100) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t1 VALUES ('ss'),('ß');
SET big_tables=0;
Warnings:
Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
SELECT DISTINCT c FROM t1;
c
ss
ß
SET big_tables=1;
Warnings:
Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
SELECT DISTINCT c FROM t1;
c
ss
ß
DROP TABLE t1;
SET big_tables=DEFAULT;
Warnings:
Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
SET default_storage_engine=MEMORY;
#
# MDEV-30048 Prefix keys for CHAR work differently for MyISAM vs InnoDB
#
SET NAMES utf8mb3;
CREATE TABLE t1 (a CHAR(10) COLLATE utf8mb3_unicode_nopad_ci, UNIQUE KEY(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(10) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci DEFAULT NULL,
UNIQUE KEY `a` (`a`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t1 VALUES ('ss'),('ß');
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(10) COLLATE utf8mb3_unicode_nopad_ci, UNIQUE KEY(a(2)));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(10) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci DEFAULT NULL,
UNIQUE KEY `a` (`a`(2))
) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t1 VALUES ('ss'),('ß');
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(120) COLLATE utf8mb3_unicode_nopad_ci, UNIQUE KEY(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(120) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci DEFAULT NULL,
UNIQUE KEY `a` (`a`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t1 VALUES ('ss'),('ß');
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(120) COLLATE utf8mb3_unicode_nopad_ci, UNIQUE KEY(a(100)));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(120) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci DEFAULT NULL,
UNIQUE KEY `a` (`a`(100))
) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t1 VALUES ('ss'),('ß');
DROP TABLE t1;
#
# MDEV-30050 Inconsistent results of DISTINCT with NOPAD
#
CREATE TABLE t1 (c CHAR(100) COLLATE utf8mb3_unicode_nopad_ci);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` char(100) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t1 VALUES ('ss'),('ß');
SET big_tables=0;
Warnings:
Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
SELECT DISTINCT c FROM t1;
c
ss
ß
SET big_tables=1;
Warnings:
Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
SELECT DISTINCT c FROM t1;
c
ss
ß
DROP TABLE t1;
SET big_tables=DEFAULT;
Warnings:
Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
SET default_storage_engine=DEFAULT;
#
# End of 10.4 tests
#

View file

@ -65,6 +65,14 @@ SET DEFAULT_STORAGE_ENGINE=HEAP;
SET DEFAULT_STORAGE_ENGINE=DEFAULT;
SET default_storage_engine=MyISAM;
--source include/ctype_utf8mb3_uca_char.inc
SET default_storage_engine=MEMORY;
--source include/ctype_utf8mb3_uca_char.inc
SET default_storage_engine=DEFAULT;
--echo #
--echo # End of 10.4 tests
--echo #

View file

@ -1,4 +1,3 @@
drop table if exists t1;
create table t1 (a char(10), tmsp timestamp);
insert into t1 set a = 1;
insert delayed into t1 set a = 2;
@ -259,7 +258,6 @@ INSERT DELAYED INTO t1 SET b= b();
ERROR 42000: FUNCTION test.b does not exist
DROP TABLE t1;
End of 5.0 tests
DROP TABLE IF EXISTS t1,t2;
SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
CREATE TABLE `t1` (
`id` int(11) PRIMARY KEY auto_increment,
@ -293,7 +291,6 @@ set global low_priority_updates = 1;
select @@global.low_priority_updates;
@@global.low_priority_updates
1
drop table if exists t1;
create table t1 (a int, b int);
insert into t1 values (1,1);
lock table t1 read;
@ -322,7 +319,6 @@ set global low_priority_updates = @old_delayed_updates;
#
# Bug #47682 strange behaviour of INSERT DELAYED
#
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (f1 integer);
CREATE TABLE t2 (f1 integer);
FLUSH TABLES WITH READ LOCK;
@ -335,8 +331,6 @@ End of 5.1 tests
#
# Bug #47274 assert in open_table on CREATE TABLE <already existing>
#
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1 ( f1 INTEGER AUTO_INCREMENT, PRIMARY KEY (f1));
# The following CREATE TABLEs before gave an assert.
INSERT DELAYED t1 VALUES (4);
@ -352,14 +346,12 @@ CREATE TABLE t2 (f1 INTEGER);
INSERT DELAYED t1 VALUES (7);
CREATE TABLE t1 LIKE t2;
ERROR 42S01: Table 't1' already exists
DROP TABLE t2;
DROP TABLE t1;
DROP TABLE t2, t1;
#
# Bug#54332 Deadlock with two connections doing LOCK TABLE+INSERT DELAYED
#
# This test is not supposed to work under --ps-protocol since
# INSERT DELAYED doesn't work under LOCK TABLES with this protocol.
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
CREATE TABLE t3 (a INT);
@ -450,7 +442,6 @@ DROP TABLE t1, t2, t3;
#
connect con1,localhost,root,,;
connection default;
drop table if exists t1, t2, tm;
create table t1(a int);
create table t2(a int);
create table tm(a int) engine=merge union=(t1, t2);

View file

@ -21,9 +21,6 @@ select @@global.default_storage_engine in
("memory","myisam","archive","blackhole") as `TRUE`;
enable_query_log;
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (a char(10), tmsp timestamp);
insert into t1 set a = 1;
insert delayed into t1 set a = 2;
@ -276,9 +273,6 @@ DROP TABLE t1;
#
# Bug#27358 INSERT DELAYED does not honour SQL_MODE of the client
#
--disable_warnings
DROP TABLE IF EXISTS t1,t2;
--enable_warnings
SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
CREATE TABLE `t1` (
`id` int(11) PRIMARY KEY auto_increment,
@ -315,9 +309,6 @@ set @old_delayed_updates = @@global.low_priority_updates;
set global low_priority_updates = 1;
select @@global.low_priority_updates;
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (a int, b int);
insert into t1 values (1,1);
lock table t1 read;
@ -351,10 +342,6 @@ set global low_priority_updates = @old_delayed_updates;
--echo # Bug #47682 strange behaviour of INSERT DELAYED
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
CREATE TABLE t1 (f1 integer);
CREATE TABLE t2 (f1 integer);
@ -378,11 +365,6 @@ DROP TABLE t1, t2;
--echo # Bug #47274 assert in open_table on CREATE TABLE <already existing>
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
--enable_warnings
CREATE TABLE t1 ( f1 INTEGER AUTO_INCREMENT, PRIMARY KEY (f1));
--echo # The following CREATE TABLEs before gave an assert.
@ -404,9 +386,7 @@ INSERT DELAYED t1 VALUES (7);
--error ER_TABLE_EXISTS_ERROR
CREATE TABLE t1 LIKE t2;
DROP TABLE t2;
DROP TABLE t1;
DROP TABLE t2, t1;
--echo #
--echo # Bug#54332 Deadlock with two connections doing LOCK TABLE+INSERT DELAYED
@ -417,10 +397,6 @@ DROP TABLE t1;
--disable_ps_protocol
--disable_view_protocol
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
CREATE TABLE t3 (a INT);
@ -573,9 +549,6 @@ DROP TABLE t1, t2, t3;
--disable_view_protocol
connect (con1,localhost,root,,);
connection default;
--disable_warnings
drop table if exists t1, t2, tm;
--enable_warnings
create table t1(a int);
create table t2(a int);
create table tm(a int) engine=merge union=(t1, t2);

View file

@ -16,6 +16,7 @@ analyze table t1;
--echo # Delete with limit (quick select - range acces)
--echo #
--disable_view_protocol
start transaction;
--enable_info
delete from t1 where (select count(*) from t1 b where b.c1=t1.c1) = 500 limit 1;
@ -111,6 +112,7 @@ rollback;
start transaction;
delete from t1 where (select count(*) from t1 b where b.c1=t1.c1) = 500 order by c2 desc limit 10 returning c1,c2;
rollback;
--enable_view_protocol
drop view v1;
drop table t1;

View file

@ -18414,4 +18414,120 @@ a SUBQ
4 1=11373
5 1=11612
drop table t1,t2,t3;
#
# MDEV-32064: usage of splittable derived table in query
# with IN subquery in WHERE
#
CREATE TABLE t1 (
id int unsigned NOT NULL,
valint1 int unsigned,
valdouble double,
valdate datetime,
PRIMARY KEY (id),
KEY (valint1),
KEY (valint1,valdate)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES
(1,3289763,1,'2021-02-09 18:31:35'),(2,3289750,1,'2021-02-09 18:31:35'),
(3,3289780,1173,'2021-02-09 18:31:35'),(4,3289762,2,'2021-02-09 18:31:36'),
(5,3289774,2334,'2021-02-09 18:31:36'),(6,3289739,1934,'2021-02-09 18:31:36'),
(7,3289761,1,'2021-02-09 18:31:37'),(8,3289763,1,'2021-02-10 11:05:19'),
(9,3289750,1,'2021-02-10 11:05:19'),(10,3289780,0,'2021-02-10 11:05:35'),
(11,3289762,2,'2021-02-10 11:05:47'),(12,3289774,429,'2021-02-10 11:05:47'),
(13,3289739,1958,'2021-02-10 11:06:00'),(14,3289761,1,'2021-02-10 11:06:08'),
(15,3289957,0,'2021-02-10 13:04:44'),(16,3289988,1993,'2021-02-10 13:04:45'),
(17,3289951,1896,'2021-02-10 13:04:59'),(18,3289957,1994,'2021-02-10 13:07:40'),
(19,3289988,5,'2021-02-10 13:07:40'),(20,3289951,1897,'2021-02-10 13:07:40'),
(21,3289594,0,'2021-02-11 14:19:38'),(22,3289642,0,'2021-02-11 14:19:38'),
(23,3289626,2150,'2021-02-11 14:19:38'),(24,3289562,0,'2021-02-11 14:19:39'),
(25,3289593,1046,'2021-02-11 14:19:39'),(26,3289496,1,'2021-02-11 14:19:45'),
(27,3289475,1074,'2021-02-11 14:19:50'),(28,3289658,1155,'2021-02-11 14:19:56'),
(29,3289595,0,'2021-02-11 14:20:01'),(30,3290334,903,'2021-02-11 16:22:44'),
(31,3290284,479,'2021-02-11 16:23:00'),(32,3290327,236,'2021-02-11 16:23:00'),
(33,3290854,0,'2021-02-15 17:29:59'),(34,3290824,0,'2021-02-15 17:30:13'),
(35,3290875,0,'2021-02-15 17:30:14'),(36,3290897,2,'2021-02-15 17:30:19'),
(37,3290800,0,'2021-02-15 17:30:24'),(38,3290822,0,'2021-02-15 17:30:25'),
(39,3290901,2667,'2021-02-15 17:30:30'),(40,3290835,0,'2021-02-15 17:30:36'),
(41,3290875,0,'2021-02-15 17:35:33'),(42,3290824,1330,'2021-02-15 17:35:39'),
(43,3290854,769,'2021-02-15 17:35:44'),(44,3290897,2,'2021-02-15 17:35:50'),
(45,3290822,748,'2021-02-15 17:35:50'),(46,3290800,1007,'2021-02-15 17:35:56'),
(47,3290901,7018,'2021-02-15 17:35:56'),(48,3290835,779,'2021-02-15 17:36:17'),
(49,3290824,1329,'2021-02-15 17:40:30'),(50,3290875,764,'2021-02-15 17:40:31'),
(51,3290854,763,'2021-02-15 17:40:36'),(52,3290897,2347,'2021-02-15 17:40:47'),
(53,3290822,1,'2021-02-15 17:41:01'),(54,3290800,1018,'2021-02-15 17:41:07'),
(55,3290901,3936,'2021-02-15 17:41:08'),(56,3290835,784,'2021-02-15 17:41:24'),
(57,3290824,1313,'2021-02-15 17:44:47'),(58,3290875,758,'2021-02-15 17:44:48'),
(59,3290854,767,'2021-02-15 17:44:48'),(60,3290897,2438,'2021-02-15 17:44:48'),
(61,3290822,738,'2021-02-15 17:44:49'),(62,3290800,1003,'2021-02-15 17:44:54'),
(63,3290901,4686,'2021-02-15 17:44:55'),(64,3290835,778,'2021-02-15 17:45:13'),
(65,3290824,1303,'2021-02-15 17:51:16'),(66,3290875,753,'2021-02-15 17:51:16'),
(67,3290854,766,'2021-02-15 17:51:22'),(68,3290897,1,'2021-02-15 17:51:22'),
(69,3290822,743,'2021-02-15 17:51:28'),(70,3290901,5718,'2021-02-15 17:51:33'),
(71,3290800,1018,'2021-02-15 17:51:34'),(72,3290835,785,'2021-02-15 17:51:48'),
(73,3290824,1310,'2021-02-15 18:21:30'),(74,3290875,754,'2021-02-15 18:21:30'),
(75,3290854,782,'2021-02-15 18:21:36'),(76,3290897,2,'2021-02-15 18:21:36'),
(77,3290822,745,'2021-02-15 18:21:53'),(78,3290800,1011,'2021-02-15 18:21:54'),
(79,3290901,8998,'2021-02-15 18:21:54'),(80,3290835,0,'2021-02-15 18:22:00'),
(81,3290936,0,'2021-02-15 18:25:28'),(82,3290895,0,'2021-02-15 18:25:28'),
(83,3290832,0,'2021-02-15 18:25:28'),(84,3290878,796,'2021-02-15 18:25:52'),
(85,3290900,730,'2021-02-15 18:25:52'),(86,3290856,0,'2021-02-15 18:26:11'),
(87,3290904,816,'2021-02-15 18:26:17'),(88,3290882,0,'2021-02-15 18:26:25'),
(89,3290883,1031,'2021-02-15 18:27:16'),(90,3290918,1749,'2021-02-15 18:27:17'),
(91,3290831,0,'2021-02-15 18:59:11'),(92,3290884,477,'2021-02-15 18:59:12'),
(93,3290899,483,'2021-02-15 18:59:12'),(94,3290848,486,'2021-02-15 18:59:35'),
(95,3290880,487,'2021-02-15 18:59:35'),(96,3290798,0,'2021-02-15 18:59:52'),
(97,3290777,983,'2021-02-15 19:00:10'),(98,3290811,488,'2021-02-15 19:00:10'),
(99,3290917,1283,'2021-02-15 19:00:36'),(100,3290858,482,'2021-02-15 19:00:42');
CREATE TABLE t2 (a int) ENGINE=MYISAM;
INSERT INTO t2 VALUES
(3289475),(3289496),(3289562),(3289593),(3289594),(3289595),(3289626),
(3289642),(3289658),(3289739),(3289750),(3289761),(3289762),(3289763),
(3289774),(3289780),(3289951),(3289957),(3289988),(3290034),(1231562);
ANALYZE TABLE t1,t2;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
EXPLAIN SELECT t1.valdouble, t1.valint1
FROM t1,
(SELECT max(t.valdate) AS maxdate, t.valint1 FROM t1 t GROUP BY t.valint1)
AS dt
WHERE t1.valint1 = dt.valint1 AND
t1.valdate = dt.maxdate AND
t1.valint1 IN (SELECT * FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <subquery3> ALL distinct_key NULL NULL NULL 21
1 PRIMARY t1 ref valint1,valint1_2 valint1 5 test.t2.a 2 Using index condition; Using where
1 PRIMARY <derived2> ref key0 key0 11 test.t1.valdate,test.t1.valint1 5
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 21 Using where
2 DERIVED t range valint1,valint1_2 valint1_2 5 NULL 51 Using index for group-by; Using temporary; Using filesort
SELECT t1.valdouble, t1.valint1
FROM t1,
(SELECT max(t.valdate) AS maxdate, t.valint1 FROM t1 t GROUP BY t.valint1)
AS dt
WHERE t1.valint1 = dt.valint1 AND
t1.valdate = dt.maxdate AND
t1.valint1 IN (SELECT * FROM t2);
valdouble valint1
1074 3289475
1 3289496
0 3289562
1046 3289593
0 3289594
0 3289595
2150 3289626
0 3289642
1155 3289658
1958 3289739
1 3289750
1 3289761
2 3289762
1 3289763
429 3289774
0 3289780
1897 3289951
1994 3289957
5 3289988
DROP TABLE t1,t2;
# End of 10.4 tests

View file

@ -4013,4 +4013,92 @@ eval $q;
drop table t1,t2,t3;
--echo #
--echo # MDEV-32064: usage of splittable derived table in query
--echo # with IN subquery in WHERE
--echo #
CREATE TABLE t1 (
id int unsigned NOT NULL,
valint1 int unsigned,
valdouble double,
valdate datetime,
PRIMARY KEY (id),
KEY (valint1),
KEY (valint1,valdate)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES
(1,3289763,1,'2021-02-09 18:31:35'),(2,3289750,1,'2021-02-09 18:31:35'),
(3,3289780,1173,'2021-02-09 18:31:35'),(4,3289762,2,'2021-02-09 18:31:36'),
(5,3289774,2334,'2021-02-09 18:31:36'),(6,3289739,1934,'2021-02-09 18:31:36'),
(7,3289761,1,'2021-02-09 18:31:37'),(8,3289763,1,'2021-02-10 11:05:19'),
(9,3289750,1,'2021-02-10 11:05:19'),(10,3289780,0,'2021-02-10 11:05:35'),
(11,3289762,2,'2021-02-10 11:05:47'),(12,3289774,429,'2021-02-10 11:05:47'),
(13,3289739,1958,'2021-02-10 11:06:00'),(14,3289761,1,'2021-02-10 11:06:08'),
(15,3289957,0,'2021-02-10 13:04:44'),(16,3289988,1993,'2021-02-10 13:04:45'),
(17,3289951,1896,'2021-02-10 13:04:59'),(18,3289957,1994,'2021-02-10 13:07:40'),
(19,3289988,5,'2021-02-10 13:07:40'),(20,3289951,1897,'2021-02-10 13:07:40'),
(21,3289594,0,'2021-02-11 14:19:38'),(22,3289642,0,'2021-02-11 14:19:38'),
(23,3289626,2150,'2021-02-11 14:19:38'),(24,3289562,0,'2021-02-11 14:19:39'),
(25,3289593,1046,'2021-02-11 14:19:39'),(26,3289496,1,'2021-02-11 14:19:45'),
(27,3289475,1074,'2021-02-11 14:19:50'),(28,3289658,1155,'2021-02-11 14:19:56'),
(29,3289595,0,'2021-02-11 14:20:01'),(30,3290334,903,'2021-02-11 16:22:44'),
(31,3290284,479,'2021-02-11 16:23:00'),(32,3290327,236,'2021-02-11 16:23:00'),
(33,3290854,0,'2021-02-15 17:29:59'),(34,3290824,0,'2021-02-15 17:30:13'),
(35,3290875,0,'2021-02-15 17:30:14'),(36,3290897,2,'2021-02-15 17:30:19'),
(37,3290800,0,'2021-02-15 17:30:24'),(38,3290822,0,'2021-02-15 17:30:25'),
(39,3290901,2667,'2021-02-15 17:30:30'),(40,3290835,0,'2021-02-15 17:30:36'),
(41,3290875,0,'2021-02-15 17:35:33'),(42,3290824,1330,'2021-02-15 17:35:39'),
(43,3290854,769,'2021-02-15 17:35:44'),(44,3290897,2,'2021-02-15 17:35:50'),
(45,3290822,748,'2021-02-15 17:35:50'),(46,3290800,1007,'2021-02-15 17:35:56'),
(47,3290901,7018,'2021-02-15 17:35:56'),(48,3290835,779,'2021-02-15 17:36:17'),
(49,3290824,1329,'2021-02-15 17:40:30'),(50,3290875,764,'2021-02-15 17:40:31'),
(51,3290854,763,'2021-02-15 17:40:36'),(52,3290897,2347,'2021-02-15 17:40:47'),
(53,3290822,1,'2021-02-15 17:41:01'),(54,3290800,1018,'2021-02-15 17:41:07'),
(55,3290901,3936,'2021-02-15 17:41:08'),(56,3290835,784,'2021-02-15 17:41:24'),
(57,3290824,1313,'2021-02-15 17:44:47'),(58,3290875,758,'2021-02-15 17:44:48'),
(59,3290854,767,'2021-02-15 17:44:48'),(60,3290897,2438,'2021-02-15 17:44:48'),
(61,3290822,738,'2021-02-15 17:44:49'),(62,3290800,1003,'2021-02-15 17:44:54'),
(63,3290901,4686,'2021-02-15 17:44:55'),(64,3290835,778,'2021-02-15 17:45:13'),
(65,3290824,1303,'2021-02-15 17:51:16'),(66,3290875,753,'2021-02-15 17:51:16'),
(67,3290854,766,'2021-02-15 17:51:22'),(68,3290897,1,'2021-02-15 17:51:22'),
(69,3290822,743,'2021-02-15 17:51:28'),(70,3290901,5718,'2021-02-15 17:51:33'),
(71,3290800,1018,'2021-02-15 17:51:34'),(72,3290835,785,'2021-02-15 17:51:48'),
(73,3290824,1310,'2021-02-15 18:21:30'),(74,3290875,754,'2021-02-15 18:21:30'),
(75,3290854,782,'2021-02-15 18:21:36'),(76,3290897,2,'2021-02-15 18:21:36'),
(77,3290822,745,'2021-02-15 18:21:53'),(78,3290800,1011,'2021-02-15 18:21:54'),
(79,3290901,8998,'2021-02-15 18:21:54'),(80,3290835,0,'2021-02-15 18:22:00'),
(81,3290936,0,'2021-02-15 18:25:28'),(82,3290895,0,'2021-02-15 18:25:28'),
(83,3290832,0,'2021-02-15 18:25:28'),(84,3290878,796,'2021-02-15 18:25:52'),
(85,3290900,730,'2021-02-15 18:25:52'),(86,3290856,0,'2021-02-15 18:26:11'),
(87,3290904,816,'2021-02-15 18:26:17'),(88,3290882,0,'2021-02-15 18:26:25'),
(89,3290883,1031,'2021-02-15 18:27:16'),(90,3290918,1749,'2021-02-15 18:27:17'),
(91,3290831,0,'2021-02-15 18:59:11'),(92,3290884,477,'2021-02-15 18:59:12'),
(93,3290899,483,'2021-02-15 18:59:12'),(94,3290848,486,'2021-02-15 18:59:35'),
(95,3290880,487,'2021-02-15 18:59:35'),(96,3290798,0,'2021-02-15 18:59:52'),
(97,3290777,983,'2021-02-15 19:00:10'),(98,3290811,488,'2021-02-15 19:00:10'),
(99,3290917,1283,'2021-02-15 19:00:36'),(100,3290858,482,'2021-02-15 19:00:42');
CREATE TABLE t2 (a int) ENGINE=MYISAM;
INSERT INTO t2 VALUES
(3289475),(3289496),(3289562),(3289593),(3289594),(3289595),(3289626),
(3289642),(3289658),(3289739),(3289750),(3289761),(3289762),(3289763),
(3289774),(3289780),(3289951),(3289957),(3289988),(3290034),(1231562);
ANALYZE TABLE t1,t2;
let $q=
SELECT t1.valdouble, t1.valint1
FROM t1,
(SELECT max(t.valdate) AS maxdate, t.valint1 FROM t1 t GROUP BY t.valint1)
AS dt
WHERE t1.valint1 = dt.valint1 AND
t1.valdate = dt.maxdate AND
t1.valint1 IN (SELECT * FROM t2);
eval EXPLAIN $q;
eval $q;
DROP TABLE t1,t2;
--echo # End of 10.4 tests

View file

@ -468,7 +468,8 @@ ANALYZE
"buffer_size": "1Kb",
"join_type": "BNL",
"attached_condition": "trigcond(t11.col1 = t10.col1)",
"r_filtered": 10
"r_filtered": 10,
"r_unpack_time_ms": "REPLACED"
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,19 +1,17 @@
#
# Dynamic column function test
#
# enable view-protocol after fix MDEV-27871
-- source include/no_view_protocol.inc
--source include/default_charset.inc
--echo #
--echo # column create
--echo #
select hex(COLUMN_CREATE(1, NULL AS char character set utf8));
select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8));
select hex(COLUMN_CREATE(1, 1212 AS char character set utf8));
select hex(COLUMN_CREATE(1, 12.12 AS char character set utf8));
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS char character set utf8));
select hex(COLUMN_CREATE(1, NULL AS char character set utf8)) as exp;
select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8)) as ex;
select hex(COLUMN_CREATE(1, 1212 AS char character set utf8)) as ex;
select hex(COLUMN_CREATE(1, 12.12 AS char character set utf8)) as ex;
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS char character set utf8)) as ex;
select hex(COLUMN_CREATE(1, NULL AS unsigned int));
select hex(COLUMN_CREATE(1, 1212 AS unsigned int));
select hex(COLUMN_CREATE(1, 7 AS unsigned int));
@ -23,7 +21,7 @@ select hex(COLUMN_CREATE(1, 128 AS unsigned int));
select hex(COLUMN_CREATE(1, 12.12 AS unsigned int));
select hex(COLUMN_CREATE(1, ~0));
select hex(COLUMN_CREATE(1, -1));
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS unsigned int));
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS unsigned int)) as ex;
select hex(COLUMN_CREATE(1, NULL AS int));
select hex(COLUMN_CREATE(1, 1212 AS int));
select hex(COLUMN_CREATE(1, 7 AS int));
@ -31,11 +29,11 @@ select hex(COLUMN_CREATE(1, 8 AS int));
select hex(COLUMN_CREATE(1, 127 AS int));
select hex(COLUMN_CREATE(1, 128 AS int));
select hex(COLUMN_CREATE(1, 12.12 AS int));
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS int));
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS int)) as ex;
select hex(COLUMN_CREATE(1, NULL AS double));
select hex(COLUMN_CREATE(1, 1212 AS double));
select hex(COLUMN_CREATE(1, 12.12 AS double));
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS double));
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS double)) as ex;
select hex(COLUMN_CREATE(1, NULL AS decimal));
select hex(COLUMN_CREATE(1, 1212 AS decimal));
select hex(COLUMN_CREATE(1, 7 AS decimal));
@ -43,13 +41,13 @@ select hex(COLUMN_CREATE(1, 8 AS decimal));
select hex(COLUMN_CREATE(1, 127 AS decimal));
select hex(COLUMN_CREATE(1, 128 AS decimal));
select hex(COLUMN_CREATE(1, 12.12 AS decimal));
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS decimal));
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS decimal)) as ex;
select hex(COLUMN_CREATE(1, NULL AS date));
select hex(COLUMN_CREATE(1, "2011-04-05" AS date));
select hex(COLUMN_CREATE(1, NULL AS time));
select hex(COLUMN_CREATE(1, "0:45:49.000001" AS time));
select hex(COLUMN_CREATE(1, NULL AS datetime));
select hex(COLUMN_CREATE(1, "2011-04-05 0:45:49.000001" AS datetime));
select hex(COLUMN_CREATE(1, "2011-04-05 0:45:49.000001" AS datetime)) as ex;
select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8,
2, 1212 AS unsigned int,
3, 1212 AS int,
@ -57,7 +55,7 @@ select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8,
4+1, 12.12 AS decimal,
6, "2011-04-05" AS date,
7, "- 0:45:49.000001" AS time,
8, "2011-04-05 0:45:49.000001" AS datetime));
8, "2011-04-05 0:45:49.000001" AS datetime)) as ex;
explain extended
select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8,
2, 1212 AS unsigned int,
@ -66,353 +64,353 @@ select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8,
4+1, 12.12 AS decimal,
6, "2011-04-05" AS date,
7, "- 0:45:49.000001" AS time,
8, "2011-04-05 0:45:49.000001" AS datetime));
8, "2011-04-05 0:45:49.000001" AS datetime)) as ex;
select hex(column_create(1, 0.0 AS decimal));
select hex(column_create(1, 1.0 AS decimal));
--echo #
--echo # column get uint
--echo #
select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int);
select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int) as ex;
explain extended
select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int);
select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int) as ex;
explain extended
select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned);
select column_get(column_create(1, 1212 AS decimal), 1 as unsigned int);
select column_get(column_create(1, 1212 AS double), 1 as unsigned int);
select column_get(column_create(1, 1212 AS int), 1 as unsigned int);
select column_get(column_create(1, "1212" AS char), 1 as unsigned int);
select column_get(column_create(1, "2011-04-05" AS date), 1 as unsigned int);
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as unsigned int);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as unsigned int);
select column_get(column_create(1, NULL AS unsigned int), 1 as unsigned int);
select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned) as ex;
select column_get(column_create(1, 1212 AS decimal), 1 as unsigned int) as ex;
select column_get(column_create(1, 1212 AS double), 1 as unsigned int) as ex;
select column_get(column_create(1, 1212 AS int), 1 as unsigned int) as ex;
select column_get(column_create(1, "1212" AS char), 1 as unsigned int) as ex;
select column_get(column_create(1, "2011-04-05" AS date), 1 as unsigned int) as ex;
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as unsigned int) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as unsigned int) as ex;
select column_get(column_create(1, NULL AS unsigned int), 1 as unsigned int) as ex;
--echo # column geint truncation & warnings
select column_get(column_create(1, -1212 AS int), 1 as unsigned int);
select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as unsigned int);
select column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as unsigned int);
select column_get(column_create(1, -1 AS decimal), 1 as unsigned int);
select column_get(column_create(1, -1212 AS int), 1 as unsigned int) as ex;
select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as unsigned int) as ex;
select column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as unsigned int) as ex;
select column_get(column_create(1, -1 AS decimal), 1 as unsigned int) as ex;
--replace_result e+029 e+29
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as unsigned int);
select column_get(column_create(1, 999.9 AS double), 1 as unsigned int);
select column_get(column_create(1, -1 AS double), 1 as unsigned int);
select column_get(column_create(1, "1212III" AS char), 1 as unsigned int);
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as unsigned int) as ex;
select column_get(column_create(1, 999.9 AS double), 1 as unsigned int) as ex;
select column_get(column_create(1, -1 AS double), 1 as unsigned int) as ex;
select column_get(column_create(1, "1212III" AS char), 1 as unsigned int) as ex;
--echo #
--echo # column get int
--echo #
select column_get(column_create(1, 1212 AS int), 1 as int);
select column_get(column_create(1, 1212 AS int), 1 as int) as ex;
explain extended
select column_get(column_create(1, 1212 AS int), 1 as int);
select column_get(column_create(1, 1212 AS int), 1 as int) as ex;
explain extended
select column_get(column_create(1, 1212 AS int), 1 as signed int);
select column_get(column_create(1, -1212 AS int), 1 as int);
select column_get(column_create(1, 1212 AS decimal), 1 as int);
select column_get(column_create(1, 1212 AS double), 1 as int);
select column_get(column_create(1, 1212 AS unsigned int), 1 as int);
select column_get(column_create(1, "1212" AS char), 1 as int);
select column_get(column_create(1, "-1212" AS char), 1 as int);
select column_get(column_create(1, "2011-04-05" AS date), 1 as int);
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as int);
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as int);
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as int);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as int);
select column_get(column_create(1, NULL AS int), 1 as int);
select column_get(column_create(1, 1212 AS int), 1 as signed int) as ex;
select column_get(column_create(1, -1212 AS int), 1 as int) as ex;
select column_get(column_create(1, 1212 AS decimal), 1 as int) as ex;
select column_get(column_create(1, 1212 AS double), 1 as int) as ex;
select column_get(column_create(1, 1212 AS unsigned int), 1 as int) as ex;
select column_get(column_create(1, "1212" AS char), 1 as int) as ex;
select column_get(column_create(1, "-1212" AS char), 1 as int) as ex;
select column_get(column_create(1, "2011-04-05" AS date), 1 as int) as ex;
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as int) as ex;
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as int) as ex;
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as int) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as int) as ex;
select column_get(column_create(1, NULL AS int), 1 as int) as ex;
--echo #column gett truncation & warnings
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as int);
select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as int);
select column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as int);
select column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as int);
select column_get(column_create(1, 999.9 AS double), 1 as int);
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as int) as ex;
select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as int) as ex;
select column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as int) as ex;
select column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as int) as ex;
select column_get(column_create(1, 999.9 AS double), 1 as int) as ex;
--replace_result e+029 e+29
select column_get(column_create(1, -99999999999999999999999999999 AS double), 1 as int);
select column_get(column_create(1, "-1212III" AS char), 1 as int);
select column_get(column_create(1, "1212III" AS char), 1 as int);
select column_get(COLUMN_CREATE(1, ~0), 1 as signed);
select column_get(COLUMN_CREATE(1, ~0), 1 as unsigned);
select column_get(COLUMN_CREATE(1, -1), 1 as signed);
select column_get(COLUMN_CREATE(1, -1), 1 as unsigned);
select column_get(column_create(1, -99999999999999999999999999999 AS double), 1 as int) as ex;
select column_get(column_create(1, "-1212III" AS char), 1 as int) as ex;
select column_get(column_create(1, "1212III" AS char), 1 as int) as ex;
select column_get(COLUMN_CREATE(1, ~0), 1 as signed) as ex;
select column_get(COLUMN_CREATE(1, ~0), 1 as unsigned) as ex;
select column_get(COLUMN_CREATE(1, -1), 1 as signed) as ex;
select column_get(COLUMN_CREATE(1, -1), 1 as unsigned) as ex;
--echo #
--echo #column get char
--echo #
select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8);
select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8) as ex;
explain extended
select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8);
select column_get(column_create(1, 1212 AS unsigned int), 1 as char charset utf8);
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as char charset utf8);
select column_get(column_create(1, 1212 AS int), 1 as char charset utf8);
select column_get(column_create(1, -1212 AS int), 1 as char charset utf8);
select column_get(column_create(1, 9223372036854775807 AS int), 1 as char charset utf8);
select column_get(column_create(1, -9223372036854775808 AS int), 1 as char charset utf8);
select column_get(column_create(1, 1212.12 AS decimal), 1 as char charset utf8);
select column_get(column_create(1, 1212.12 AS double), 1 as char charset utf8);
select column_get(column_create(1, "2011-04-05" AS date), 1 as char charset utf8);
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as char charset utf8);
select column_get(column_create(1, "8:46:06.23434" AS time(0)), 1 as char charset utf8);
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as char charset utf8);
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as char charset utf8);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as char charset utf8);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(0)), 1 as char charset utf8);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as char charset utf8);
select column_get(column_create(1, NULL AS char charset utf8), 1 as char charset utf8);
select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset binary);
select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8) as ex;
select column_get(column_create(1, 1212 AS unsigned int), 1 as char charset utf8) as ex;
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as char charset utf8) as ex;
select column_get(column_create(1, 1212 AS int), 1 as char charset utf8) as ex;
select column_get(column_create(1, -1212 AS int), 1 as char charset utf8) as ex;
select column_get(column_create(1, 9223372036854775807 AS int), 1 as char charset utf8) as ex;
select column_get(column_create(1, -9223372036854775808 AS int), 1 as char charset utf8) as ex;
select column_get(column_create(1, 1212.12 AS decimal), 1 as char charset utf8) as ex;
select column_get(column_create(1, 1212.12 AS double), 1 as char charset utf8) as ex;
select column_get(column_create(1, "2011-04-05" AS date), 1 as char charset utf8) as ex;
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as char charset utf8) as ex;
select column_get(column_create(1, "8:46:06.23434" AS time(0)), 1 as char charset utf8) as ex;
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as char charset utf8) as ex;
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as char charset utf8) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as char charset utf8) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(0)), 1 as char charset utf8) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as char charset utf8) as ex;
select column_get(column_create(1, NULL AS char charset utf8), 1 as char charset utf8) as ex;
select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset binary) as ex;
explain extended
select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset binary);
select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset binary) as ex;
--echo #
--echo # column get real
--echo #
select column_get(column_create(1, 1212.12 AS double), 1 as double);
select column_get(column_create(1, 1212.12 AS double), 1 as double) as ex;
explain extended
select column_get(column_create(1, 1212.12 AS double), 1 as double);
select column_get(column_create(1, 1212.12 AS double), 1 as double) as ex;
explain extended
select column_get(column_create(1, 1212.12 AS double), 1 as double(6,2));
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as double);
select column_get(column_create(1, 9223372036854775807 AS int), 1 as double);
select column_get(column_create(1, -9223372036854775808 AS int), 1 as double);
select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as double);
select column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as double);
select column_get(column_create(1, "2011-04-05" AS date), 1 as double);
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as double);
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as double);
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as double);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as double);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as double);
select column_get(column_create(1, 1212.12 AS double), 1 as double(6,2)) as ex;
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as double) as ex;
select column_get(column_create(1, 9223372036854775807 AS int), 1 as double) as ex;
select column_get(column_create(1, -9223372036854775808 AS int), 1 as double) as ex;
select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as double) as ex;
select column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as double) as ex;
select column_get(column_create(1, "2011-04-05" AS date), 1 as double) as ex;
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as double) as ex;
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as double) as ex;
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as double) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as double) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as double) as ex;
# The replace result is needed for windows.
select round(column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as double(20,6)),3);
select column_get(column_create(1, NULL AS double), 1 as double);
select round(column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as double(20,6)),3) as ex;
select column_get(column_create(1, NULL AS double), 1 as double) as ex;
-- echo # column get real truncation & warnings
select column_get(column_create(1, "1223.5aa" AS char), 1 as double);
select column_get(column_create(1, "aa" AS char), 1 as double);
select column_get(column_create(1, "1223.5555" AS double), 1 as double(5,2));
select column_get(column_create(1, "1223.5555" AS double), 1 as double(3,2));
select column_get(column_create(1, "1223.5aa" AS char), 1 as double) as ex;
select column_get(column_create(1, "aa" AS char), 1 as double) as ex;
select column_get(column_create(1, "1223.5555" AS double), 1 as double(5,2)) as ex;
select column_get(column_create(1, "1223.5555" AS double), 1 as double(3,2)) as ex;
--echo #
--echo # column get decimal
--echo #
select column_get(column_create(1, 1212.12 AS double), 1 as decimal);
select column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2));
select column_get(column_create(1, 1212.12 AS double), 1 as decimal) as ex;
select column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2)) as ex;
explain extended
select column_get(column_create(1, 1212.12 AS double), 1 as decimal);
select column_get(column_create(1, 1212.12 AS double), 1 as decimal) as ex;
explain extended
select column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2));
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal(20,0));
select column_get(column_create(1, 9223372036854775807 AS int), 1 as decimal(32,0));
select column_get(column_create(1, -9223372036854775808 AS int), 1 as decimal(32,0));
select column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as decimal(40,10));
select column_get(column_create(1, "2011-04-05" AS date), 1 as decimal(32,6));
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as decimal(32,6));
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as decimal(32,6));
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as decimal(32,6));
select column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime), 1 as decimal(32,6));
select column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime(6)), 1 as decimal(32,6));
select column_get(column_create(1, "2011-04-05 8:46:06.12345678" AS datetime(6)), 1 as decimal(32,8));
select column_get(column_create(1, NULL as decimal), 1 as decimal(32,10));
select column_get(column_create(1, "1223.5555" as decimal(10,5)), 1 as decimal(6,2));
select column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2)) as ex;
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal(20,0)) as ex;
select column_get(column_create(1, 9223372036854775807 AS int), 1 as decimal(32,0)) as ex;
select column_get(column_create(1, -9223372036854775808 AS int), 1 as decimal(32,0)) as ex;
select column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as decimal(40,10)) as ex;
select column_get(column_create(1, "2011-04-05" AS date), 1 as decimal(32,6)) as ex;
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as decimal(32,6)) as ex;
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as decimal(32,6)) as ex;
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as decimal(32,6)) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime), 1 as decimal(32,6)) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime(6)), 1 as decimal(32,6)) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.12345678" AS datetime(6)), 1 as decimal(32,8)) as ex;
select column_get(column_create(1, NULL as decimal), 1 as decimal(32,10)) as ex;
select column_get(column_create(1, "1223.5555" as decimal(10,5)), 1 as decimal(6,2)) as ex;
-- echo # column get decimal truncation & warnings
select column_get(column_create(1, "1223.5aa" AS char), 1 as decimal(32,10));
select column_get(column_create(1, "aa" AS char), 1 as decimal(32,10));
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal);
select column_get(column_create(1, 9223372036854775807 AS int), 1 as decimal);
select column_get(column_create(1, -9223372036854775808 AS int), 1 as decimal);
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as decimal);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as decimal);
select column_get(column_create(1, "1223.5555" as double), 1 as decimal(5,2));
select column_get(column_create(1, "-1223.5555" as double), 1 as decimal(5,2));
select column_get(column_create(1, "1223.5555" AS double), 1 as decimal(3,2));
select column_get(column_create(1, "1223.5555" AS decimal(10,5)), 1 as decimal(3,2));
select column_get(column_create(1, 0.0 AS decimal,2, 0.0 as decimal), 1 as decimal);
select column_get(column_create(1, "1223.5aa" AS char), 1 as decimal(32,10)) as ex;
select column_get(column_create(1, "aa" AS char), 1 as decimal(32,10)) as ex;
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal) as ex;
select column_get(column_create(1, 9223372036854775807 AS int), 1 as decimal) as ex;
select column_get(column_create(1, -9223372036854775808 AS int), 1 as decimal) as ex;
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as decimal) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as decimal) as ex;
select column_get(column_create(1, "1223.5555" as double), 1 as decimal(5,2)) as ex;
select column_get(column_create(1, "-1223.5555" as double), 1 as decimal(5,2)) as ex;
select column_get(column_create(1, "1223.5555" AS double), 1 as decimal(3,2)) as ex;
select column_get(column_create(1, "1223.5555" AS decimal(10,5)), 1 as decimal(3,2)) as ex;
select column_get(column_create(1, 0.0 AS decimal,2, 0.0 as decimal), 1 as decimal) as ex;
--echo #
--echo # column get datetime
--echo #
select column_get(column_create(1, 20010203101112.121314 as double), 1 as datetime);
select column_get(column_create(1, 20010203101112.121314 as decimal), 1 as datetime);
select column_get(column_create(1, 20010203101112 as unsigned int), 1 as datetime);
select column_get(column_create(1, 20010203101112 as int), 1 as datetime);
select column_get(column_create(1, "20010203101112" as char), 1 as datetime);
select column_get(column_create(1, "2001-02-03 10:11:12" as char), 1 as datetime);
select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as datetime);
select column_get(column_create(1, "2001-02-03 10:11:12.121314"), 1 as datetime);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime(0));
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime(6));
select column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as datetime);
select column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as datetime);
select column_get(column_create(1, 20010203101112.121314 as double), 1 as datetime) as ex;
select column_get(column_create(1, 20010203101112.121314 as decimal), 1 as datetime) as ex;
select column_get(column_create(1, 20010203101112 as unsigned int), 1 as datetime) as ex;
select column_get(column_create(1, 20010203101112 as int), 1 as datetime) as ex;
select column_get(column_create(1, "20010203101112" as char), 1 as datetime) as ex;
select column_get(column_create(1, "2001-02-03 10:11:12" as char), 1 as datetime) as ex;
select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as datetime) as ex;
select column_get(column_create(1, "2001-02-03 10:11:12.121314"), 1 as datetime) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime(0)) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime(6)) as ex;
select column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as datetime) as ex;
select column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as datetime) as ex;
select column_get(column_create(1, 20010203 as unsigned int), 1 as datetime);
select column_get(column_create(1, 20010203 as int), 1 as datetime);
select column_get(column_create(1, 20010203), 1 as datetime);
select column_get(column_create(1, 20010203.0), 1 as datetime);
select column_get(column_create(1, 20010203.0 as double), 1 as datetime);
select column_get(column_create(1, "2001-02-03"), 1 as datetime);
select column_get(column_create(1, "20010203"), 1 as datetime);
select column_get(column_create(1, 0), 1 as datetime);
select column_get(column_create(1, "2001021"), 1 as datetime);
select column_get(column_create(1, 20010203 as unsigned int), 1 as datetime) as ex;
select column_get(column_create(1, 20010203 as int), 1 as datetime) as ex;
select column_get(column_create(1, 20010203), 1 as datetime) as ex;
select column_get(column_create(1, 20010203.0), 1 as datetime) as ex;
select column_get(column_create(1, 20010203.0 as double), 1 as datetime) as ex;
select column_get(column_create(1, "2001-02-03"), 1 as datetime) as ex;
select column_get(column_create(1, "20010203"), 1 as datetime) as ex;
select column_get(column_create(1, 0), 1 as datetime) as ex;
select column_get(column_create(1, "2001021"), 1 as datetime) as ex;
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as datetime);
select column_get(column_create(1, "-808:46:06.23434" AS time), 1 as datetime);
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as datetime) as ex;
select column_get(column_create(1, "-808:46:06.23434" AS time), 1 as datetime) as ex;
SET timestamp=DEFAULT;
set @@sql_mode="allow_invalid_dates";
select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as datetime);
select column_get(column_create(1, "0000-00-000" AS CHAR), 1 as datetime);
select column_get(column_create(1, "2001-00-02" AS CHAR), 1 as datetime);
select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as datetime) as ex;
select column_get(column_create(1, "0000-00-000" AS CHAR), 1 as datetime) as ex;
select column_get(column_create(1, "2001-00-02" AS CHAR), 1 as datetime) as ex;
set @@sql_mode="";
-- echo # column get datetime truncation & warnings
select column_get(column_create(1, "1223.5aa" AS char), 1 as datetime);
select column_get(column_create(1, "1223.5aa" AS char), 1 as datetime) as ex;
--replace_result e+019 e+19
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as datetime);
select column_get(column_create(1, 9223372036854775807 AS int), 1 as datetime);
select column_get(column_create(1, -9223372036854775808 AS int), 1 as datetime);
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as datetime);
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as datetime) as ex;
select column_get(column_create(1, 9223372036854775807 AS int), 1 as datetime) as ex;
select column_get(column_create(1, -9223372036854775808 AS int), 1 as datetime) as ex;
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as datetime) as ex;
--replace_result e+029 e+29
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as datetime);
select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as datetime);
select column_get(column_create(1, "2011-13-01 8:46:06.23434" AS CHAR), 1 as datetime);
select column_get(column_create(1, "2011-02-30 8:46:06.23434" AS CHAR), 1 as datetime);
select column_get(column_create(1, "20010231"), 1 as datetime);
select column_get(column_create(1, "0" AS CHAR), 1 as datetime);
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as datetime) as ex;
select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as datetime) as ex;
select column_get(column_create(1, "2011-13-01 8:46:06.23434" AS CHAR), 1 as datetime) as ex;
select column_get(column_create(1, "2011-02-30 8:46:06.23434" AS CHAR), 1 as datetime) as ex;
select column_get(column_create(1, "20010231"), 1 as datetime) as ex;
select column_get(column_create(1, "0" AS CHAR), 1 as datetime) as ex;
--echo #
--echo # column get date
--echo #
select column_get(column_create(1, 20010203101112.121314 as double), 1 as date);
select column_get(column_create(1, 20010203101112.121314 as decimal), 1 as date);
select column_get(column_create(1, 20010203101112 as unsigned int), 1 as date);
select column_get(column_create(1, 20010203101112 as int), 1 as date);
select column_get(column_create(1, "20010203101112" as char), 1 as date);
select column_get(column_create(1, "2001-02-03 10:11:12" as char), 1 as date);
select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as date);
select column_get(column_create(1, "2001-02-03 10:11:12.121314"), 1 as date);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as date);
select column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as date);
select column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as date);
select column_get(column_create(1, 20010203101112.121314 as double), 1 as date) as ex;
select column_get(column_create(1, 20010203101112.121314 as decimal), 1 as date) as ex;
select column_get(column_create(1, 20010203101112 as unsigned int), 1 as date) as ex;
select column_get(column_create(1, 20010203101112 as int), 1 as date) as ex;
select column_get(column_create(1, "20010203101112" as char), 1 as date) as ex;
select column_get(column_create(1, "2001-02-03 10:11:12" as char), 1 as date) as ex;
select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as date) as ex;
select column_get(column_create(1, "2001-02-03 10:11:12.121314"), 1 as date) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as date) as ex;
select column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as date) as ex;
select column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as date) as ex;
select column_get(column_create(1, 20010203 as unsigned int), 1 as date);
select column_get(column_create(1, 20010203 as int), 1 as date);
select column_get(column_create(1, 20010203), 1 as date);
select column_get(column_create(1, 20010203.0), 1 as date);
select column_get(column_create(1, 20010203.0 as double), 1 as date);
select column_get(column_create(1, "2001-02-03"), 1 as date);
select column_get(column_create(1, "20010203"), 1 as date);
select column_get(column_create(1, 0), 1 as date);
select column_get(column_create(1, "2001021"), 1 as date);
select column_get(column_create(1, 20010203 as unsigned int), 1 as date) as ex;
select column_get(column_create(1, 20010203 as int), 1 as date) as ex;
select column_get(column_create(1, 20010203), 1 as date) as ex;
select column_get(column_create(1, 20010203.0), 1 as date) as ex;
select column_get(column_create(1, 20010203.0 as double), 1 as date) as ex;
select column_get(column_create(1, "2001-02-03"), 1 as date) as ex;
select column_get(column_create(1, "20010203"), 1 as date) as ex;
select column_get(column_create(1, 0), 1 as date) as ex;
select column_get(column_create(1, "2001021"), 1 as date) as ex;
set @@sql_mode="allow_invalid_dates";
select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as date);
select column_get(column_create(1, "0000-00-000" AS CHAR), 1 as date);
select column_get(column_create(1, "2001-00-02" AS CHAR), 1 as date);
select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as date) as ex;
select column_get(column_create(1, "0000-00-000" AS CHAR), 1 as date) as ex;
select column_get(column_create(1, "2001-00-02" AS CHAR), 1 as date) as ex;
set @@sql_mode="";
-- echo # column get date truncation & warnings
select column_get(column_create(1, "1223.5aa" AS char), 1 as date);
select column_get(column_create(1, "1223.5aa" AS char), 1 as date) as ex;
--replace_result e+019 e+19
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as date);
select column_get(column_create(1, 9223372036854775807 AS int), 1 as date);
select column_get(column_create(1, -9223372036854775808 AS int), 1 as date);
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as date);
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as date) as ex;
select column_get(column_create(1, 9223372036854775807 AS int), 1 as date) as ex;
select column_get(column_create(1, -9223372036854775808 AS int), 1 as date) as ex;
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as date) as ex;
--replace_result e+029 e+29
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as date);
select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as date);
select column_get(column_create(1, "2011-13-01 8:46:06.23434" AS CHAR), 1 as date);
select column_get(column_create(1, "2011-02-30 8:46:06.23434" AS CHAR), 1 as date);
select column_get(column_create(1, "20010231"), 1 as date);
select column_get(column_create(1, "0" AS CHAR), 1 as date);
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as date) as ex;
select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as date) as ex;
select column_get(column_create(1, "2011-13-01 8:46:06.23434" AS CHAR), 1 as date) as ex;
select column_get(column_create(1, "2011-02-30 8:46:06.23434" AS CHAR), 1 as date) as ex;
select column_get(column_create(1, "20010231"), 1 as date) as ex;
select column_get(column_create(1, "0" AS CHAR), 1 as date) as ex;
--echo #
--echo # column get time
--echo #
select column_get(column_create(1, 20010203101112.121314 as double), 1 as time);
select column_get(column_create(1, 20010203101112.121314 as decimal), 1 as time);
select column_get(column_create(1, 20010203101112 as unsigned int), 1 as time);
select column_get(column_create(1, 8080102 as unsigned int), 1 as time);
select column_get(column_create(1, 20010203101112 as int), 1 as time);
select column_get(column_create(1, -8080102 as int), 1 as time);
select column_get(column_create(1, "20010203101112" as char), 1 as time);
select column_get(column_create(1, "2001-02-03 10:11:12" as char), 1 as time);
select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as time);
select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as time(6));
select column_get(column_create(1, "2001-02-03 10:11:12.121314"), 1 as time);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as time(6));
select column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as time(6));
select column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as time(6));
select column_get(column_create(1, "830:46:06.23434" AS CHAR), 1 as time(6));
select column_get(column_create(1, "830:46:06" AS CHAR), 1 as time(6));
select cast("-830:46:06.23434" AS time(6));
select 1,cast("-830:46:06.23434" AS time(6));
select hex(column_create(1, "-830:46:06.23434" AS CHAR));
select column_get(column_create(1, "-830:46:06.23434" AS CHAR), 1 as time(6));
select column_get(column_create(1, "0" AS CHAR), 1 as time);
select column_get(column_create(1, "6" AS CHAR), 1 as time);
select column_get(column_create(1, "1:6" AS CHAR), 1 as time);
select column_get(column_create(1, "2:1:6" AS CHAR), 1 as time);
select column_get(column_create(1, 20010203101112.121314 as double), 1 as time) as ex;
select column_get(column_create(1, 20010203101112.121314 as decimal), 1 as time) as ex;
select column_get(column_create(1, 20010203101112 as unsigned int), 1 as time) as ex;
select column_get(column_create(1, 8080102 as unsigned int), 1 as time) as ex;
select column_get(column_create(1, 20010203101112 as int), 1 as time) as ex;
select column_get(column_create(1, -8080102 as int), 1 as time) as ex;
select column_get(column_create(1, "20010203101112" as char), 1 as time) as ex;
select column_get(column_create(1, "2001-02-03 10:11:12" as char), 1 as time) as ex;
select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as time) as ex;
select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as time(6)) as ex;
select column_get(column_create(1, "2001-02-03 10:11:12.121314"), 1 as time) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as time(6)) as ex;
select column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as time(6)) as ex;
select column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as time(6)) as ex;
select column_get(column_create(1, "830:46:06.23434" AS CHAR), 1 as time(6)) as ex;
select column_get(column_create(1, "830:46:06" AS CHAR), 1 as time(6)) as ex;
select cast("-830:46:06.23434" AS time(6)) as ex;
select 1,cast("-830:46:06.23434" AS time(6)) as ex;
select hex(column_create(1, "-830:46:06.23434" AS CHAR)) as ex;
select column_get(column_create(1, "-830:46:06.23434" AS CHAR), 1 as time(6)) as ex;
select column_get(column_create(1, "0" AS CHAR), 1 as time) as ex;
select column_get(column_create(1, "6" AS CHAR), 1 as time) as ex;
select column_get(column_create(1, "1:6" AS CHAR), 1 as time) as ex;
select column_get(column_create(1, "2:1:6" AS CHAR), 1 as time) as ex;
select column_get(column_create(1, 0), 1 as time);
select column_get(column_create(1, "2001021"), 1 as time);
select column_get(column_create(1, 0), 1 as time) as ex;
select column_get(column_create(1, "2001021"), 1 as time) as ex;
set @@sql_mode="allow_invalid_dates";
select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as time);
select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as time) as ex;
set @@sql_mode="";
-- echo # column get date truncation & warnings
select column_get(column_create(1, "1223.5aa" AS char), 1 as time);
select column_get(column_create(1, "1223.5aa" AS char), 1 as time(3));
select column_get(column_create(1, "1223.5aa" AS char), 1 as time) as ex;
select column_get(column_create(1, "1223.5aa" AS char), 1 as time(3)) as ex;
--replace_result e+019 e+19
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as time);
select column_get(column_create(1, 9223372036854775807 AS int), 1 as time);
select column_get(column_create(1, -9223372036854775808 AS int), 1 as time);
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as time);
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as time) as ex;
select column_get(column_create(1, 9223372036854775807 AS int), 1 as time) as ex;
select column_get(column_create(1, -9223372036854775808 AS int), 1 as time) as ex;
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as time) as ex;
--replace_result e+029 e+29
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as time);
select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as time);
select column_get(column_create(1, "2011-13-01 8:46:06.23434" AS CHAR), 1 as time);
select column_get(column_create(1, "2011-02-30 8:46:06.23434" AS CHAR), 1 as time);
select column_get(column_create(1, "2001-02-03"), 1 as time);
select column_get(column_create(1, "20010203"), 1 as time);
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as time) as ex;
select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as time) as ex;
select column_get(column_create(1, "2011-13-01 8:46:06.23434" AS CHAR), 1 as time) as ex;
select column_get(column_create(1, "2011-02-30 8:46:06.23434" AS CHAR), 1 as time) as ex;
select column_get(column_create(1, "2001-02-03"), 1 as time) as ex;
select column_get(column_create(1, "20010203"), 1 as time) as ex;
-- echo # column add
select hex(column_add(column_create(1, 1212 as integer), 2, 1212 as integer));
select hex(column_add(column_create(1, 1212 as integer), 1, 1212 as integer));
select hex(column_add(column_create(1, 1212 as integer), 1, NULL as integer));
select hex(column_add(column_create(1, 1212 as integer), 2, NULL as integer));
select hex(column_add(column_create(1, 1212 as integer), 2, 1212 as integer, 1, 11 as integer));
select column_get(column_add(column_create(1, 1212 as integer), 2, 1212 as integer, 1, 11 as integer), 1 as integer);
select column_get(column_add(column_create(1, 1212 as integer), 2, 1212 as integer, 1, 11 as integer), 2 as integer);
select hex(column_add(column_create(1, 1212 as integer), 1, 1212 as integer, 2, 11 as integer));
select hex(column_add(column_create(1, NULL as integer), 1, 1212 as integer, 2, 11 as integer));
select hex(column_add(column_create(1, 1212 as integer, 2, 1212 as integer), 1, 11 as integer));
select hex(column_add(column_create(1, 1), 1, null));
select column_list(column_add(column_create(1, 1), 1, null));
select column_list(column_add(column_create(1, 1), 1, ""));
select hex(column_add("", 1, 1));
select hex(column_add(column_create(1, 1212 as integer), 2, 1212 as integer)) as ex;
select hex(column_add(column_create(1, 1212 as integer), 1, 1212 as integer)) as ex;
select hex(column_add(column_create(1, 1212 as integer), 1, NULL as integer)) as ex;
select hex(column_add(column_create(1, 1212 as integer), 2, NULL as integer)) as ex;
select hex(column_add(column_create(1, 1212 as integer), 2, 1212 as integer, 1, 11 as integer)) as ex;
select column_get(column_add(column_create(1, 1212 as integer), 2, 1212 as integer, 1, 11 as integer), 1 as integer) as ex;
select column_get(column_add(column_create(1, 1212 as integer), 2, 1212 as integer, 1, 11 as integer), 2 as integer) as ex;
select hex(column_add(column_create(1, 1212 as integer), 1, 1212 as integer, 2, 11 as integer)) as ex;
select hex(column_add(column_create(1, NULL as integer), 1, 1212 as integer, 2, 11 as integer)) as ex;
select hex(column_add(column_create(1, 1212 as integer, 2, 1212 as integer), 1, 11 as integer)) as ex;
select hex(column_add(column_create(1, 1), 1, null)) as ex;
select column_list(column_add(column_create(1, 1), 1, null)) as ex;
select column_list(column_add(column_create(1, 1), 1, "")) as ex;
select hex(column_add("", 1, 1)) as ex;
-- echo # column delete
select hex(column_delete(column_create(1, 1212 as integer, 2, 1212 as integer), 1));
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 2));
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 3));
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 4));
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 2, 1));
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 2, 3));
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 1, 2, 3));
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 1, 2, 3, 10));
select hex(column_delete(column_create(1, 1), 1));
select hex(column_delete("", 1));
select hex(column_delete(column_create(1, 1212 as integer, 2, 1212 as integer), 1)) as ex;
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 2)) as ex;
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 3)) as ex;
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 4)) as ex;
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 2, 1)) as ex;
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 2, 3)) as ex;
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 1, 2, 3)) as ex;
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 1, 2, 3, 10)) as ex;
select hex(column_delete(column_create(1, 1), 1)) as ex;
select hex(column_delete("", 1)) as ex;
-- echo # column exists
select column_exists(column_create(1, 1212 as integer, 2, 1212 as integer), 1);
select column_exists(column_create(1, 1212 as integer, 2, 1212 as integer), 4);
select column_exists(column_create(1, 1212 as integer, 2, 1212 as integer), 1) as ex;
select column_exists(column_create(1, 1212 as integer, 2, 1212 as integer), 4) as ex;
-- echo # column list
select column_list(column_create(1, 1212 as integer, 2, 1212 as integer));
select column_list(column_create(1, 1212 as integer));
select column_list(column_create(1, NULL as integer));
select column_list(column_create(1, 1212 as integer, 2, 1212 as integer)) as ex;
select column_list(column_create(1, 1212 as integer)) as ex;
select column_list(column_create(1, NULL as integer)) as ex;
--echo #
--echo # check error handling
@ -551,11 +549,11 @@ select column_add(@a, 3, "a");
set @a=0x00020008000009000C2C010080;
select COLUMN_GET(@a, 9 AS DECIMAL);
select hex(COLUMN_CREATE(0, COLUMN_GET(@a, 9 AS DECIMAL)));
select hex(COLUMN_CREATE(0, COLUMN_GET(@a, 9 AS DECIMAL(19,0))));
select hex(COLUMN_CREATE(0, COLUMN_GET(@a, 9 AS DECIMAL))) as ex;
select hex(COLUMN_CREATE(0, COLUMN_GET(@a, 9 AS DECIMAL(19,0)))) as ex;
select hex(COLUMN_CREATE(0, COLUMN_GET(COLUMN_CREATE(0, 0.0 as decimal), 0 as decimal)));
select hex(COLUMN_CREATE(0, 0.0 as decimal));
select hex(COLUMN_CREATE(0, COLUMN_GET(COLUMN_CREATE(0, 0.0 as decimal), 0 as decimal))) as ex;
select hex(COLUMN_CREATE(0, 0.0 as decimal)) as ex;
--echo #
--echo # MDEV-4292: parse error when selecting on views using dynamic column
@ -635,11 +633,11 @@ CREATE TABLE t1 (dyncol TINYBLOB) ENGINE=MyISAM;
INSERT INTO t1 SET dyncol = COLUMN_CREATE( 7, REPEAT('k',487), 209, REPEAT('x',464) );
--error 0,ER_DYN_COL_WRONG_FORMAT
SELECT COLUMN_ADD( dyncol, 7, '22:22:22', 8, REPEAT('x',270) AS CHAR ) FROM t1;
SELECT COLUMN_ADD( dyncol, 7, '22:22:22', 8, REPEAT('x',270) AS CHAR ) as ex FROM t1;
delete from t1;
INSERT INTO t1 SET dyncol = COLUMN_CREATE( 'a', REPEAT('k',487), 'b', REPEAT('x',464) );
--error 0,ER_DYN_COL_WRONG_FORMAT
SELECT COLUMN_ADD( dyncol, 'a', '22:22:22', 'c', REPEAT('x',270) AS CHAR ) FROM t1;
SELECT COLUMN_ADD( dyncol, 'a', '22:22:22', 'c', REPEAT('x',270) AS CHAR ) as ex FROM t1;
DROP table t1;
@ -658,7 +656,7 @@ SELECT
# MySQL Bug#16997513 MY_STRTOLL10 ACCEPTING OVERFLOWED UNSIGNED LONG LONG VALUES AS NORMAL ONES
# (incorrect overflow check in my_strtoll10())
#
select column_get(column_create(1, "18446744073709552001" as char), 1 as int);
select column_get(column_create(1, "18446744073709552001" as char), 1 as int) as ex;
--echo #
--echo # MDEV-7505 - Too large scale in DECIMAL dynamic column getter crashes
@ -672,71 +670,80 @@ SELECT COLUMN_GET(`x`, 'y' AS DECIMAL(5,50));
--echo #
--echo # creation test (names)
set names utf8;
#enable after MDEV-32465 fix
--disable_view_protocol
select hex(column_create("адын", 1212));
--enable_view_protocol
select hex(column_create("1212", 1212));
select hex(column_create(1212, 2, "www", 3));
select hex(column_create("1212", 2, "www", 3));
select hex(column_create("1212", 2, 3, 3));
#enable after MDEV-32465 fix
--disable_view_protocol
select hex(column_create("1212", 2, "адын", 1, 3, 3));
--enable_view_protocol
set names latin1;
--echo # fetching column test (names)
set names utf8;
select column_get(column_create("адын", 1212), "адын" as int);
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "адын" as int);
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 1212 as int);
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "3" as int);
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 3 as int);
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 4 as int);
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "4" as int);
select column_get(column_create("адын", 1212), "адын" as int) as ex;
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "адын" as int) as ex;
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 1212 as int) as ex;
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "3" as int) as ex;
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 3 as int) as ex;
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 4 as int) as ex;
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "4" as int) as ex;
set names latin1;
--echo # column existance test (names)
set names utf8;
select column_exists(column_create("адын", 1212), "адын");
select column_exists(column_create("адын", 1212), "aады");
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "адын");
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 1212);
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "3");
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 3);
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 4);
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "4");
select column_exists(column_create("адын", 1212), "адын") as ex;
select column_exists(column_create("адын", 1212), "aады") as ex;
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "адын") as ex;
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 1212) as ex;
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "3") as ex;
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 3) as ex;
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 4) as ex;
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "4") as ex;
set names latin1;
--echo # column changing test (names)
select hex(column_add(column_create(1, "AAA"), "b", "BBB"));
select hex(column_add(column_create("1", "AAA"), "b", "BBB"));
select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), 1 as char);
select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), "b" as char);
select hex(column_add(column_create("a", "AAA"), 1, "BBB"));
select hex(column_add(column_create("a", "AAA"), "1", "BBB"));
select hex(column_add(column_create("a", 1212 as integer), "b", "1212" as integer));
select hex(column_add(column_create("a", 1212 as integer), "a", "1212" as integer));
select hex(column_add(column_create("a", 1212 as integer), "a", NULL as integer));
select hex(column_add(column_create("a", 1212 as integer), "b", NULL as integer));
select hex(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer));
select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "a" as integer);
select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "b" as integer);
select hex(column_add(column_create("a", 1212 as integer), "a", 1212 as integer, "b", 11 as integer));
select hex(column_add(column_create("a", NULL as integer), "a", 1212 as integer, "b", 11 as integer));
select hex(column_add(column_create("a", 1212 as integer, "b", 1212 as integer), "a", 11 as integer));
select hex(column_add(column_create("a", 1), "a", null));
select column_list(column_add(column_create("a", 1), "a", null));
select column_list(column_add(column_create("a", 1), "a", ""));
select hex(column_add("", "a", 1));
#enable after MDEV-32465 fix
--disable_view_protocol
select hex(column_add(column_create(1, "AAA"), "b", "BBB")) as ex;
select hex(column_add(column_create("1", "AAA"), "b", "BBB")) as ex;
select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), 1 as char) as ex;
select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), "b" as char) as ex;
select hex(column_add(column_create("a", "AAA"), 1, "BBB")) as ex;
select hex(column_add(column_create("a", "AAA"), "1", "BBB")) as ex;
--enable_view_protocol
select hex(column_add(column_create("a", 1212 as integer), "b", "1212" as integer)) as ex;
select hex(column_add(column_create("a", 1212 as integer), "a", "1212" as integer)) as ex;
select hex(column_add(column_create("a", 1212 as integer), "a", NULL as integer)) as ex;
select hex(column_add(column_create("a", 1212 as integer), "b", NULL as integer)) as ex;
select hex(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer)) as ex;
select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "a" as integer) as ex;
select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "b" as integer) as ex;
select hex(column_add(column_create("a", 1212 as integer), "a", 1212 as integer, "b", 11 as integer)) as ex;
select hex(column_add(column_create("a", NULL as integer), "a", 1212 as integer, "b", 11 as integer)) as ex;
select hex(column_add(column_create("a", 1212 as integer, "b", 1212 as integer), "a", 11 as integer)) as ex;
select hex(column_add(column_create("a", 1), "a", null)) as ex;
select column_list(column_add(column_create("a", 1), "a", null)) as ex;
select column_list(column_add(column_create("a", 1), "a", "")) as ex;
select hex(column_add("", "a", 1)) as ex;
-- echo # column delete (names)
select hex(column_delete(column_create("a", 1212 as integer, "b", 1212 as integer), "a"));
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b"));
select hex(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer));
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "c"));
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "d"));
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "a"));
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "c"));
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c"));
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c", "e"));
select hex(column_delete(column_create("a", 1), "a"));
select hex(column_delete("", "a"));
select hex(column_delete(column_create("a", 1212 as integer, "b", 1212 as integer), "a")) as ex;
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b")) as ex;
select hex(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer)) as ex;
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "c")) as ex;
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "d")) as ex;
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "a")) as ex;
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "c")) as ex;
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c")) as ex;
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c", "e")) as ex;
select hex(column_delete(column_create("a", 1), "a")) as ex;
select hex(column_delete("", "a")) as ex;
--echo #
--echo # MDEV-458 DNAMES: Server crashes on using an unquoted string
@ -765,12 +772,12 @@ drop table t1;
--echo #
--echo # MDEV-490/MDEV-491 null as arguments
--echo #
SELECT COLUMN_GET( COLUMN_CREATE( 'col', 'val' ), NULL AS CHAR );
SELECT COLUMN_GET( NULL, 'col' as char );
SELECT COLUMN_EXISTS( COLUMN_CREATE( 'col', 'val' ), NULL);
SELECT COLUMN_EXISTS( NULL, 'col');
SELECT COLUMN_CREATE( NULL, 'val' );
SELECT COLUMN_ADD( NULL, 'val', 'col');
SELECT COLUMN_GET( COLUMN_CREATE( 'col', 'val' ), NULL AS CHAR ) as ex;
SELECT COLUMN_GET( NULL, 'col' as char ) as ex;
SELECT COLUMN_EXISTS( COLUMN_CREATE( 'col', 'val' ), NULL) as ex;
SELECT COLUMN_EXISTS( NULL, 'col') as ex;
SELECT COLUMN_CREATE( NULL, 'val' ) as ex;
SELECT COLUMN_ADD( NULL, 'val', 'col') as ex;
--echo #
--echo # MDEV-488: Assertion `column_name->length < 255' failed on a
@ -783,8 +790,8 @@ SELECT hex(COLUMN_CREATE(REPEAT('a',65536),1));
--echo #
--echo # JSON conversion
--echo #
select column_json(column_create("int", -1212 as int, "uint", 12334 as unsigned int, "decimal", "23.344" as decimal, "double", 1.23444e50 as double, "string", 'gdgd\\dhdjh"dhdhd' as char, "time", "0:45:49.000001" AS time, "datetime", "2011-04-05 0:45:49.000001" AS datetime, "date", "2011-04-05" AS date));
select column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date));
select column_json(column_create("int", -1212 as int, "uint", 12334 as unsigned int, "decimal", "23.344" as decimal, "double", 1.23444e50 as double, "string", 'gdgd\\dhdjh"dhdhd' as char, "time", "0:45:49.000001" AS time, "datetime", "2011-04-05 0:45:49.000001" AS datetime, "date", "2011-04-05" AS date)) as ex;
select column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date)) as ex;
--echo #
--echo # CHECK test
@ -802,8 +809,8 @@ select column_json(column_create("string", "'\"/\\`.,whatever")),hex(column_crea
--echo #
--echo # embedding test
--echo #
select column_json(column_create("val", "val", "emb", column_create("val2", "val2")));
select column_json(column_create(1, "val", 2, column_create(3, "val2")));
select column_json(column_create("val", "val", "emb", column_create("val2", "val2"))) as ex;
select column_json(column_create(1, "val", 2, column_create(3, "val2"))) as ex;
--echo #
--echo # Time encoding
@ -845,7 +852,7 @@ DROP TABLE t1;
--echo #
create table t1 (dyn blob);
insert into t1 values (column_create('name1','value1','name2','value2'));
select group_concat(cast(column_json(dyn) as char)) from t1;
select group_concat(cast(column_json(dyn) as char)) as ex from t1;
drop table t1;
@ -895,15 +902,15 @@ SELECT COLUMN_JSON(
'one', 123.456,
'two', 123.456 as DOUBLE
)
);
) as ex;
--echo #
--echo # MDEV-8521: Drastic loss of precision in COLUMN_JSON() on DOUBLEs
--echo #
select column_get(column_create('float', 1.23456789012345E+100 as double), 'float' as double);
select column_json(column_create('float', 1.23456789012345E+100 as double));
select column_json(column_create('float', 1.23456789012345E+10 as double));
select column_get(column_create('float', 1.23456789012345E+100 as double), 'float' as double) as ex;
select column_json(column_create('float', 1.23456789012345E+100 as double)) as ex;
select column_json(column_create('float', 1.23456789012345E+10 as double)) as ex;
--echo #
--echo # MDEV-9147: Character set is ignored in Dynamic Column for saved string
@ -916,13 +923,13 @@ SELECT COLUMN_GET(COLUMN_CREATE(1, 0xC2A2 AS CHAR CHARACTER SET utf8), 1 AS CHAR
--echo # MDEV-9167: COLUMN_CHECK fails on valid decimal data
--echo #
SELECT COLUMN_CHECK(COLUMN_CREATE('a',0 AS DECIMAL,'b',1 AS DECIMAL));
SELECT COLUMN_CHECK(COLUMN_CREATE('a',0 AS DECIMAL,'b',1 AS DECIMAL)) as ex;
SELECT COLUMN_CHECK(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL));
SELECT COLUMN_CHECK(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL)) as ex;
SELECT COLUMN_JSON(COLUMN_CREATE('a',0 AS DECIMAL,'b',1 AS DECIMAL));
SELECT COLUMN_JSON(COLUMN_CREATE('a',0 AS DECIMAL,'b',1 AS DECIMAL)) as ex;
SELECT COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL));
SELECT COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL)) as ex;
--echo #
@ -986,3 +993,13 @@ DROP TABLE t1;
--echo #
--echo # End of 10.2 tests
--echo #
--echo #
--echo # MDEV-32140: Valgrind/MSAN warnings in dynamic_column_update_move_left
--echo #
SELECT COLUMN_GET(COLUMN_ADD(COLUMN_CREATE(1,10),2,NULL,1,NULL),3 AS INTEGER) as ex;
SELECT HEX(COLUMN_ADD(COLUMN_CREATE(1,10),2,NULL,1,NULL)) as ex;
--echo #
--echo # End of 10.4 tests
--echo #

View file

@ -45,10 +45,12 @@ CREATE EVENT ev_drop1 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
CREATE EVENT ev_drop2 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
CREATE EVENT ev_drop3 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
USE events_test;
--disable_service_connection
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
DROP DATABASE events_conn1_test2;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
--enable_service_connection
--echo "Now testing stability - dropping db -> events while they are running"
CREATE DATABASE events_conn1_test2;

View file

@ -334,7 +334,8 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "119",
"join_type": "BNL",
"r_filtered": 100
"r_filtered": 100,
"r_unpack_time_ms": "REPLACED"
}
}
},
@ -370,7 +371,8 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "119",
"join_type": "BNL",
"r_filtered": 100
"r_filtered": 100,
"r_unpack_time_ms": "REPLACED"
}
}
}
@ -435,7 +437,8 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "119",
"join_type": "BNL",
"r_filtered": 100
"r_filtered": 100,
"r_unpack_time_ms": "REPLACED"
}
}
},
@ -471,7 +474,8 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "119",
"join_type": "BNL",
"r_filtered": 100
"r_filtered": 100,
"r_unpack_time_ms": "REPLACED"
}
}
}

View file

@ -453,7 +453,8 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "119",
"join_type": "BNL",
"r_filtered": 100
"r_filtered": 100,
"r_unpack_time_ms": "REPLACED"
}
}
},
@ -489,7 +490,8 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "119",
"join_type": "BNL",
"r_filtered": 100
"r_filtered": 100,
"r_unpack_time_ms": "REPLACED"
}
}
}
@ -553,7 +555,8 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "119",
"join_type": "BNL",
"r_filtered": 100
"r_filtered": 100,
"r_unpack_time_ms": "REPLACED"
}
}
},
@ -589,7 +592,8 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "119",
"join_type": "BNL",
"r_filtered": 100
"r_filtered": 100,
"r_unpack_time_ms": "REPLACED"
}
}
}

View file

@ -1544,7 +1544,8 @@ ANALYZE
"buffer_size": "400",
"join_type": "BKA",
"mrr_type": "Rowid-ordered scan",
"r_filtered": 100
"r_filtered": 100,
"r_unpack_time_ms": "REPLACED"
}
}
}

View file

@ -747,8 +747,9 @@ DROP TABLE t1;
#
CREATE TABLE t1 (f VARCHAR(8));
INSERT INTO t1 VALUES ('foo'),('bar');
SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) );
'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) )
SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN
BOOLEAN MODE ) ) as exp;
exp
1
SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE )) as f1, MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) as f2 from t1 ;
f1 f2

View file

@ -693,11 +693,10 @@ DROP TABLE t1;
CREATE TABLE t1 (f VARCHAR(8));
INSERT INTO t1 VALUES ('foo'),('bar');
#enable after fix MDEV-27871
--disable_view_protocol
SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) );
--enable_view_protocol
SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN
BOOLEAN MODE ) ) as exp;
SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE )) as f1, MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) as f2 from t1 ;
explain extended
SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE )) as f1, MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) as f2 from t1 ;

View file

@ -70,10 +70,9 @@ a
a
a0.0000
select concat((select x from (select 'a' as x) as t1 ),
(select y from (select 'b' as y) as t2 )) from (select 1 union select 2 )
(select y from (select 'b' as y) as t2 )) as exp from (select 1 union select 2 )
as t3;
concat((select x from (select 'a' as x) as t1 ),
(select y from (select 'b' as y) as t2 ))
exp
ab
ab
create table t1(f1 varchar(6)) charset=utf8;

View file

@ -57,15 +57,10 @@ select 'a' union select concat('a', -0.0000);
# Bug#16716: subselect in concat() may lead to a wrong result
#
#enable after fix MDEV-27871
--disable_view_protocol
select concat((select x from (select 'a' as x) as t1 ),
(select y from (select 'b' as y) as t2 )) from (select 1 union select 2 )
(select y from (select 'b' as y) as t2 )) as exp from (select 1 union select 2 )
as t3;
--enable_view_protocol
# End of 4.1 tests
#

View file

@ -113,29 +113,29 @@ Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (longblob)
Note 1105 DBUG: [1] arg=2 handler=0 (longblob)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30');
TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30')
SELECT TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30') as exp;
exp
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL);
TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL)
SELECT TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL) as exp;
exp
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30');
TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30')
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30') as exp;
exp
0
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL);
TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL)
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL) as exp;
exp
0
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
@ -351,8 +351,8 @@ Note 1105 DBUG: [2] arg=3 handler=0 (longblob)
Note 1105 DBUG: types_compatible=yes bisect=yes
DROP TABLE t1;
CREATE TABLE t1 (a DATE);
SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) FROM t1;
a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0)
SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (date)
Note 1105 DBUG: [1] arg=2 handler=0 (date)
@ -360,8 +360,8 @@ Note 1105 DBUG: [2] arg=3 handler=0 (date)
Note 1105 DBUG: [3] arg=4 handler=0 (date)
Note 1105 DBUG: [4] arg=5 handler=0 (date)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) FROM t1;
a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL)
SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (date)
Note 1105 DBUG: [1] arg=2 handler=0 (date)
@ -369,8 +369,8 @@ Note 1105 DBUG: [2] arg=3 handler=0 (date)
Note 1105 DBUG: [3] arg=4 handler=0 (date)
Note 1105 DBUG: [4] arg=5 handler=0 (date)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) FROM t1;
a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0)
SELECT a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (date)
Note 1105 DBUG: [1] arg=2 handler=0 (date)
@ -378,8 +378,8 @@ Note 1105 DBUG: [2] arg=3 handler=0 (date)
Note 1105 DBUG: [3] arg=4 handler=0 (date)
Note 1105 DBUG: [4] arg=5 handler=0 (date)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) FROM t1;
a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL)
SELECT a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (date)
Note 1105 DBUG: [1] arg=2 handler=0 (date)
@ -389,8 +389,8 @@ Note 1105 DBUG: [4] arg=5 handler=0 (date)
Note 1105 DBUG: types_compatible=yes bisect=yes
DROP TABLE t1;
CREATE TABLE t1 (a TIME);
SELECT a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0) FROM t1;
a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0)
SELECT a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
@ -398,8 +398,8 @@ Note 1105 DBUG: [2] arg=3 handler=0 (time)
Note 1105 DBUG: [3] arg=4 handler=0 (time)
Note 1105 DBUG: [4] arg=5 handler=0 (time)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL) FROM t1;
a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL)
SELECT a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
@ -407,8 +407,8 @@ Note 1105 DBUG: [2] arg=3 handler=0 (time)
Note 1105 DBUG: [3] arg=4 handler=0 (time)
Note 1105 DBUG: [4] arg=5 handler=0 (time)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0) FROM t1;
a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0)
SELECT a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
@ -416,8 +416,8 @@ Note 1105 DBUG: [2] arg=3 handler=0 (time)
Note 1105 DBUG: [3] arg=4 handler=0 (time)
Note 1105 DBUG: [4] arg=5 handler=0 (time)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL) FROM t1;
a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL)
SELECT a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
@ -427,8 +427,8 @@ Note 1105 DBUG: [4] arg=5 handler=0 (time)
Note 1105 DBUG: types_compatible=yes bisect=yes
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME);
SELECT a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0) FROM t1;
a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0)
SELECT a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
@ -438,8 +438,8 @@ Note 1105 DBUG: [4] arg=5 handler=0 (datetime)
Note 1105 DBUG: [5] arg=6 handler=0 (datetime)
Note 1105 DBUG: [6] arg=7 handler=0 (datetime)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL) FROM t1;
a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL)
SELECT a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
@ -449,8 +449,8 @@ Note 1105 DBUG: [4] arg=5 handler=0 (datetime)
Note 1105 DBUG: [5] arg=6 handler=0 (datetime)
Note 1105 DBUG: [6] arg=7 handler=0 (datetime)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0) FROM t1;
a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0)
SELECT a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
@ -460,8 +460,8 @@ Note 1105 DBUG: [4] arg=5 handler=0 (datetime)
Note 1105 DBUG: [5] arg=6 handler=0 (datetime)
Note 1105 DBUG: [6] arg=7 handler=0 (datetime)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL) FROM t1;
a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL)
SELECT a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
@ -659,26 +659,26 @@ Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: types_compatible=yes bisect=no
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME);
SELECT TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30') FROM t1;
TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30')
SELECT TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30') as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: types_compatible=yes bisect=no
SELECT TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL) FROM t1;
TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL)
SELECT TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: types_compatible=yes bisect=no
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30') FROM t1;
TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30')
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30') as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: types_compatible=yes bisect=no
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL) FROM t1;
TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL)
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
@ -797,38 +797,38 @@ Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (longblob)
Note 1105 DBUG: [1] arg=2 handler=1 (decimal)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT TIME'10:20:30' IN (1,TIME'10:20:30');
TIME'10:20:30' IN (1,TIME'10:20:30')
SELECT TIME'10:20:30' IN (1,TIME'10:20:30') as exp;
exp
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT TIME'10:20:30' IN (1,TIME'10:20:30',NULL);
TIME'10:20:30' IN (1,TIME'10:20:30',NULL)
SELECT TIME'10:20:30' IN (1,TIME'10:20:30',NULL) as exp;
exp
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32');
TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32')
SELECT TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp;
exp
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=2 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL);
TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL)
SELECT TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp;
exp
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=2 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32');
TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32')
SELECT TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp;
exp
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
@ -836,8 +836,8 @@ Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=0 (time)
Note 1105 DBUG: [3] arg=4 handler=3 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL);
TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL)
SELECT TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp;
exp
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
@ -845,38 +845,38 @@ Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=0 (time)
Note 1105 DBUG: [3] arg=4 handler=3 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT TIME'10:20:30' NOT IN (1,TIME'10:20:30');
TIME'10:20:30' NOT IN (1,TIME'10:20:30')
SELECT TIME'10:20:30' NOT IN (1,TIME'10:20:30') as exp;
exp
0
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT TIME'10:20:30' NOT IN (1,TIME'10:20:30',NULL);
TIME'10:20:30' NOT IN (1,TIME'10:20:30',NULL)
SELECT TIME'10:20:30' NOT IN (1,TIME'10:20:30',NULL) as exp;
exp
0
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32');
TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32')
SELECT TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp;
exp
0
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=2 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL);
TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL)
SELECT TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp;
exp
0
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=2 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32');
TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32')
SELECT TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp;
exp
0
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
@ -884,8 +884,8 @@ Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=0 (time)
Note 1105 DBUG: [3] arg=4 handler=3 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL);
TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL)
SELECT TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp;
exp
0
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
@ -907,28 +907,28 @@ Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (bigint)
Note 1105 DBUG: [1] arg=2 handler=1 (double)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1;
a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED))
SELECT a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (bigint)
Note 1105 DBUG: [1] arg=2 handler=1 (decimal)
Note 1105 DBUG: found a mix of UINT and SINT
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1;
a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL)
SELECT a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (bigint)
Note 1105 DBUG: [1] arg=2 handler=1 (decimal)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1;
a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED))
SELECT a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (decimal)
Note 1105 DBUG: [1] arg=2 handler=1 (bigint)
Note 1105 DBUG: [2] arg=3 handler=0 (decimal)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1;
a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL)
SELECT a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (decimal)
Note 1105 DBUG: [1] arg=2 handler=1 (bigint)
@ -946,28 +946,28 @@ Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (bigint)
Note 1105 DBUG: [1] arg=2 handler=1 (double)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1;
a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED))
SELECT a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (bigint)
Note 1105 DBUG: [1] arg=2 handler=1 (decimal)
Note 1105 DBUG: found a mix of UINT and SINT
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1;
a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL)
SELECT a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (bigint)
Note 1105 DBUG: [1] arg=2 handler=1 (decimal)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1;
a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED))
SELECT a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (decimal)
Note 1105 DBUG: [1] arg=2 handler=1 (bigint)
Note 1105 DBUG: [2] arg=3 handler=0 (decimal)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1;
a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL)
SELECT a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (decimal)
Note 1105 DBUG: [1] arg=2 handler=1 (bigint)
@ -1221,60 +1221,60 @@ Note 1105 DBUG: [1] arg=2 handler=1 (time)
Note 1105 DBUG: types_compatible=no bisect=no
DROP TABLE t1;
CREATE TABLE t1 (a TIME);
SELECT a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1;
a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32')
SELECT a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=2 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1;
a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL)
SELECT a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=2 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1;
a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32')
SELECT a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=0 (time)
Note 1105 DBUG: [3] arg=4 handler=3 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1;
a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL)
SELECT a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=0 (time)
Note 1105 DBUG: [3] arg=4 handler=3 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1;
a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32')
SELECT a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=2 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1;
a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL)
SELECT a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=2 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1;
a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32')
SELECT a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=0 (time)
Note 1105 DBUG: [3] arg=4 handler=3 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1;
a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL)
SELECT a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
@ -1513,8 +1513,8 @@ DROP TABLE t1;
#
# MDEV-11514 IN with a mixture of TIME and DATETIME returns a wrong result
#
SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32');
TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32')
SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32') as exp;
exp
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)

View file

@ -24,15 +24,10 @@ SELECT 'a' IN ('a','b',NULL);
SELECT 'a' NOT IN ('a','b');
SELECT 'a' NOT IN ('a','b',NULL);
#enable after fix MDEV-27871
--disable_view_protocol
SELECT TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30');
SELECT TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL);
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30');
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL);
--enable_view_protocol
SELECT TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30') as exp;
SELECT TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL) as exp;
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30') as exp;
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL) as exp;
SELECT TIME'10:20:30' IN ('10:20:30','10:20:30');
SELECT TIME'10:20:30' IN ('10:20:30','10:20:30',NULL);
@ -86,32 +81,27 @@ SELECT a NOT IN ('a','b','c') FROM t1;
SELECT a NOT IN ('a','b','c',NULL) FROM t1;
DROP TABLE t1;
#enable after fix MDEV-27871
--disable_view_protocol
CREATE TABLE t1 (a DATE);
SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) FROM t1;
SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) FROM t1;
SELECT a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) FROM t1;
SELECT a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) FROM t1;
SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) as exp FROM t1;
SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) as exp FROM t1;
SELECT a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) as exp FROM t1;
SELECT a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) as exp FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a TIME);
SELECT a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0) FROM t1;
SELECT a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL) FROM t1;
SELECT a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0) FROM t1;
SELECT a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL) FROM t1;
SELECT a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0) as exp FROM t1;
SELECT a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL) as exp FROM t1;
SELECT a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0) as exp FROM t1;
SELECT a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL) as exp FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME);
SELECT a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0) FROM t1;
SELECT a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL) FROM t1;
SELECT a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0) FROM t1;
SELECT a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL) FROM t1;
SELECT a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0) as exp FROM t1;
SELECT a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL) as exp FROM t1;
SELECT a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0) as exp FROM t1;
SELECT a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL) as exp FROM t1;
DROP TABLE t1;
--enable_view_protocol
--echo # Constant predicant, compatible types, no bisect
--echo # Bisect is not used because of non-constant expressions in the list
CREATE TABLE t1 (a INT);
@ -156,18 +146,13 @@ SELECT TIME'10:20:30' NOT IN (a,'10:20:30') FROM t1;
SELECT TIME'10:20:30' NOT IN (a,'10:20:30',NULL) FROM t1;
DROP TABLE t1;
#enable after fix MDEV-27871
--disable_view_protocol
CREATE TABLE t1 (a DATETIME);
SELECT TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30') FROM t1;
SELECT TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL) FROM t1;
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30') FROM t1;
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL) FROM t1;
SELECT TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30') as exp FROM t1;
SELECT TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL) as exp FROM t1;
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30') as exp FROM t1;
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL) as exp FROM t1;
DROP TABLE t1;
--enable_view_protocol
--echo # Constant predicant, incompatible types, no bisect
SELECT 1 IN (1,2e0);
SELECT 1 IN (1,2e0,NULL);
@ -189,38 +174,33 @@ SELECT 'a' IN ('a',2,NULL);
SELECT 'a' NOT IN ('a',2);
SELECT 'a' NOT IN ('a',2,NULL);
#enable after fix MDEV-27871
--disable_view_protocol
SELECT TIME'10:20:30' IN (1,TIME'10:20:30');
SELECT TIME'10:20:30' IN (1,TIME'10:20:30',NULL);
SELECT TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32');
SELECT TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL);
SELECT TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32');
SELECT TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL);
SELECT TIME'10:20:30' NOT IN (1,TIME'10:20:30');
SELECT TIME'10:20:30' NOT IN (1,TIME'10:20:30',NULL);
SELECT TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32');
SELECT TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL);
SELECT TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32');
SELECT TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL);
SELECT TIME'10:20:30' IN (1,TIME'10:20:30') as exp;
SELECT TIME'10:20:30' IN (1,TIME'10:20:30',NULL) as exp;
SELECT TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp;
SELECT TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp;
SELECT TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp;
SELECT TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp;
SELECT TIME'10:20:30' NOT IN (1,TIME'10:20:30') as exp;
SELECT TIME'10:20:30' NOT IN (1,TIME'10:20:30',NULL) as exp;
SELECT TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp;
SELECT TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp;
SELECT TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp;
SELECT TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp;
--echo # Column predicant, incompatible types, no bisect
CREATE TABLE t1 (a INT);
SELECT a IN (1,1e0) FROM t1;
SELECT a IN (1,1e0,NULL) FROM t1;
SELECT a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1;
SELECT a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1;
SELECT a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1;
SELECT a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1;
SELECT a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) as exp FROM t1;
SELECT a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) as exp FROM t1;
SELECT a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) as exp FROM t1;
SELECT a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) as exp FROM t1;
SELECT a NOT IN (1,1e0) FROM t1;
SELECT a NOT IN (1,1e0,NULL) FROM t1;
SELECT a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1;
SELECT a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1;
SELECT a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1;
SELECT a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1;
--enable_view_protocol
SELECT a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) as exp FROM t1;
SELECT a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) as exp FROM t1;
SELECT a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) as exp FROM t1;
SELECT a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) as exp FROM t1;
SELECT a IN (1,1.0) FROM t1;
SELECT a IN (1,1.0,NULL) FROM t1;
@ -279,22 +259,17 @@ SELECT a NOT IN ('a',1) FROM t1;
SELECT a NOT IN ('a',TIME'10:20:30') FROM t1;
DROP TABLE t1;
#enable after fix MDEV-27871
--disable_view_protocol
CREATE TABLE t1 (a TIME);
SELECT a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1;
SELECT a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1;
SELECT a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1;
SELECT a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1;
SELECT a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1;
SELECT a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1;
SELECT a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1;
SELECT a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1;
SELECT a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp FROM t1;
SELECT a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp FROM t1;
SELECT a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp FROM t1;
SELECT a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp FROM t1;
SELECT a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp FROM t1;
SELECT a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp FROM t1;
SELECT a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp FROM t1;
SELECT a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp FROM t1;
DROP TABLE t1;
--enable_view_protocol
#
# ROW tests
#
@ -437,12 +412,8 @@ DROP TABLE t1;
--echo #
--echo # MDEV-11514 IN with a mixture of TIME and DATETIME returns a wrong result
--echo #
#enable after fix MDEV-27871
--disable_view_protocol
SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32');
--enable_view_protocol
SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32') as exp;
PREPARE stmt FROM "SELECT
TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32')";

View file

@ -3419,8 +3419,8 @@ DROP TABLE t1;
#
# MDEV-9653 Assertion `length || !scale' failed in uint my_decimal_length_to_precision(uint, uint, bool)
#
SELECT CASE 0 WHEN 1 THEN (CASE 2 WHEN 3 THEN NULL END) WHEN 4 THEN 5 END;
CASE 0 WHEN 1 THEN (CASE 2 WHEN 3 THEN NULL END) WHEN 4 THEN 5 END
SELECT CASE 0 WHEN 1 THEN (CASE 2 WHEN 3 THEN NULL END) WHEN 4 THEN 5 END as exp;
exp
NULL
SELECT CASE 0 WHEN 1 THEN (COALESCE(NULL)) WHEN 4 THEN 5 END;
CASE 0 WHEN 1 THEN (COALESCE(NULL)) WHEN 4 THEN 5 END

View file

@ -470,10 +470,7 @@ DROP TABLE t1;
--echo #
--echo # MDEV-9653 Assertion `length || !scale' failed in uint my_decimal_length_to_precision(uint, uint, bool)
--echo #
#enable after fix MDEV-27871
--disable_view_protocol
SELECT CASE 0 WHEN 1 THEN (CASE 2 WHEN 3 THEN NULL END) WHEN 4 THEN 5 END;
--enable_view_protocol
SELECT CASE 0 WHEN 1 THEN (CASE 2 WHEN 3 THEN NULL END) WHEN 4 THEN 5 END as exp;
SELECT CASE 0 WHEN 1 THEN (COALESCE(NULL)) WHEN 4 THEN 5 END;
SELECT CASE WHEN TRUE THEN COALESCE(NULL) ELSE 4 END;

View file

@ -162,19 +162,9 @@ IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,0)))))))))))))))))))))))))))))) + 1
IF((ROUND(t1.a,2)=1), 2,0)))))))))))))))))))))))))))))) + 1 as exp
FROM t1;
a IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((R
a exp
DROP TABLE t1;
CREATE TABLE t1 (c LONGTEXT);
INSERT INTO t1 VALUES(1), (2), (3), (4), ('1234567890123456789');

View file

@ -119,8 +119,6 @@ select if(0, 18446744073709551610, 18446744073709551610);
CREATE TABLE t1(a DECIMAL(10,3));
#enable after fix MDEV-27871
--disable_view_protocol
# check : should be fast. more than few secs means failure.
SELECT t1.a,
IF((ROUND(t1.a,2)=1), 2,
@ -152,9 +150,8 @@ SELECT t1.a,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,0)))))))))))))))))))))))))))))) + 1
IF((ROUND(t1.a,2)=1), 2,0)))))))))))))))))))))))))))))) + 1 as exp
FROM t1;
--enable_view_protocol
DROP TABLE t1;
#

View file

@ -28,8 +28,8 @@ NULL
select json_value('{"key1": [1,2,3], "key1":123}', '$.key1');
json_value('{"key1": [1,2,3], "key1":123}', '$.key1')
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')
select JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z') as exp;
exp
Mon"t"y
select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2');
json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2')
@ -43,8 +43,8 @@ NULL
select json_query('{"key1":123, "key1": [1,2,3]}', '$.key1');
json_query('{"key1":123, "key1": [1,2,3]}', '$.key1')
[1,2,3]
select json_query('{"key1":123, "key1": [1,2,3]}', concat('$', repeat('.k', 1000)));
json_query('{"key1":123, "key1": [1,2,3]}', concat('$', repeat('.k', 1000)))
select json_query('{"key1":123, "key1": [1,2,3]}', concat('$', repeat('.k', 1000))) as exp;
exp
NULL
select json_array();
json_array()
@ -76,14 +76,14 @@ json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[3]', 'x')
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[4]', 'x');
json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[4]', 'x')
["a", {"b": [1, 2]}, [3, 4], "x"]
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1].b[0]', 'x');
json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1].b[0]', 'x')
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1].b[0]', 'x') as exp;
exp
["a", {"b": ["x", 1, 2]}, [3, 4]]
select json_array_insert('true', '$', 1);
json_array_insert('true', '$', 1)
NULL
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2][1]', 'y');
json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2][1]', 'y')
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2][1]', 'y') as exp;
exp
["a", {"b": [1, 2]}, [3, "y", 4]]
select json_contains('{"k1":123, "k2":345}', '123', '$.k1');
json_contains('{"k1":123, "k2":345}', '123', '$.k1')
@ -152,98 +152,98 @@ json_contains('[1, {"a":1}]', '{"a":1}')
select json_contains('[{"abc":"def", "def":"abc"}]', '["foo","bar"]');
json_contains('[{"abc":"def", "def":"abc"}]', '["foo","bar"]')
0
select json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]');
json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]')
select json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]') as exp;
exp
1
select json_contains('[{"a":"b"},{"c":"d"}]','{"c":"d"}');
json_contains('[{"a":"b"},{"c":"d"}]','{"c":"d"}')
1
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]");
json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]")
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]") as exp;
exp
1
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[10]");
json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[10]")
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[10]") as exp;
exp
0
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.ma");
json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.ma")
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.ma") as exp;
exp
0
select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1");
json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1")
select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1") as exp;
exp
1
select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1", "$.ma");
json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1", "$.ma")
select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1", "$.ma") as exp;
exp
1
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.ma");
json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.ma")
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.ma") as exp;
exp
0
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2");
json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2")
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2") as exp;
exp
1
select json_contains_path('{ "a": true }', NULL, '$.a' );
json_contains_path('{ "a": true }', NULL, '$.a' )
select json_contains_path('{ "a": true }', NULL, '$.a' ) as exp;
exp
NULL
select json_contains_path('{ "a": true }', 'all', NULL );
json_contains_path('{ "a": true }', 'all', NULL )
select json_contains_path('{ "a": true }', 'all', NULL ) as exp;
exp
NULL
select json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*');
json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*')
select json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*') as exp;
exp
1
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1");
json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1")
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1") as exp;
exp
"asd"
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.keyX", "$.keyY");
json_extract('{"key1":"asd", "key2":[2,3]}', "$.keyX", "$.keyY")
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.keyX", "$.keyY") as exp;
exp
NULL
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1", "$.key2");
json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1", "$.key2")
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1", "$.key2") as exp;
exp
["asd", [2, 3]]
select json_extract('{"key1":5, "key2":[2,3]}', "$.key1", "$.key2");
json_extract('{"key1":5, "key2":[2,3]}', "$.key1", "$.key2")
select json_extract('{"key1":5, "key2":[2,3]}', "$.key1", "$.key2") as exp;
exp
[5, [2, 3]]
select json_extract('{"key0":true, "key1":"qwe"}', "$.key1");
json_extract('{"key0":true, "key1":"qwe"}', "$.key1")
select json_extract('{"key0":true, "key1":"qwe"}', "$.key1") as exp;
exp
"qwe"
select json_extract(json_object('foo', 'foobar'),'$');
json_extract(json_object('foo', 'foobar'),'$')
select json_extract(json_object('foo', 'foobar'),'$') as exp;
exp
{"foo": "foobar"}
select json_extract('[10, 20, [30, 40]]', '$[2][*]');
json_extract('[10, 20, [30, 40]]', '$[2][*]')
select json_extract('[10, 20, [30, 40]]', '$[2][*]') as exp;
exp
[30, 40]
select json_extract('[10, 20, [{"a":3}, 30, 40]]', '$[2][*]');
json_extract('[10, 20, [{"a":3}, 30, 40]]', '$[2][*]')
select json_extract('[10, 20, [{"a":3}, 30, 40]]', '$[2][*]') as exp;
exp
[{"a": 3}, 30, 40]
select json_extract('1', '$');
json_extract('1', '$')
select json_extract('1', '$') as exp;
exp
1
select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]');
json_extract('[10, 20, [30, 40], 1, 10]', '$[1]')
select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]') as exp;
exp
20
select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]', '$[25]');
json_extract('[10, 20, [30, 40], 1, 10]', '$[1]', '$[25]')
select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]', '$[25]') as exp;
exp
[20]
select json_extract( '[{"a": [3, 4]}, {"b": 2}]', '$[0].a', '$[1].a');
json_extract( '[{"a": [3, 4]}, {"b": 2}]', '$[0].a', '$[1].a')
select json_extract( '[{"a": [3, 4]}, {"b": 2}]', '$[0].a', '$[1].a') as exp;
exp
[[3, 4]]
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word');
json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word')
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word') as exp;
exp
{"a": 1, "b": {"c": 1, "k1": "word"}, "d": [1, 2]}
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3);
json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3)
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3) as exp;
exp
{"a": 1, "b": {"c": 1}, "d": [1, 2, 3]}
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.a[2]', 2);
json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.a[2]', 2)
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.a[2]', 2) as exp;
exp
{"a": [1, 2], "b": {"c": 1}, "d": [1, 2]}
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.c', 'word');
json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.c', 'word')
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.c', 'word') as exp;
exp
{"a": 1, "b": {"c": 1}, "d": [1, 2]}
select json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]');
json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]')
select json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]') as exp;
exp
{"a": 10, "b": [2, 3], "c": "[true, false]"}
select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]');
json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]')
select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]') as exp;
exp
{"a": 10, "b": [2, 3]}
select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.b', '[true, false]');
json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.b', '[true, false]')
select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.b', '[true, false]') as exp;
exp
{"a": 10, "b": "[true, false]"}
set @j = '["a", ["b", "c"], "d"]';
select json_remove(@j, '$[0]');
@ -278,14 +278,14 @@ select * from t1;
f
{"id": 87, "name": "carrot"}
drop table t1;
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2");
json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2")
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2") as ex;
ex
1
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[1]");
json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[1]")
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[1]") as ex;
ex
1
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[10]");
json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[10]")
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[10]") as ex;
ex
0
select json_quote('"string"');
json_quote('"string"')
@ -362,43 +362,43 @@ json_keys('foo')
NULL
Warnings:
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_keys' at position 1
select json_keys('{"a":{"c":1, "d":2}, "b":2, "c":1, "a":3, "b":1, "c":2}');
json_keys('{"a":{"c":1, "d":2}, "b":2, "c":1, "a":3, "b":1, "c":2}')
select json_keys('{"a":{"c":1, "d":2}, "b":2, "c":1, "a":3, "b":1, "c":2}') as ex;
ex
["a", "b", "c"]
select json_keys('{"c1": "value 1", "c1": "value 2"}');
json_keys('{"c1": "value 1", "c1": "value 2"}')
select json_keys('{"c1": "value 1", "c1": "value 2"}') as ex;
ex
["c1"]
SET @j = '["abc", [{"k": "10"}, "def"], {"x":"abc"}, {"y":"bcd"}]';
select json_search(@j, 'one', 'abc');
json_search(@j, 'one', 'abc')
select json_search(@j, 'one', 'abc') as ex;
ex
"$[0]"
select json_search(@j, 'all', 'abc');
json_search(@j, 'all', 'abc')
select json_search(@j, 'all', 'abc') as ex;
ex
["$[0]", "$[2].x"]
select json_search(@j, 'all', 'abc', NULL, '$[2]');
json_search(@j, 'all', 'abc', NULL, '$[2]')
select json_search(@j, 'all', 'abc', NULL, '$[2]') as ex;
ex
"$[2].x"
select json_search(@j, 'all', 'abc', NULL, '$');
json_search(@j, 'all', 'abc', NULL, '$')
select json_search(@j, 'all', 'abc', NULL, '$') as ex;
ex
["$[0]", "$[2].x"]
select json_search(@j, 'all', '10', NULL, '$');
json_search(@j, 'all', '10', NULL, '$')
select json_search(@j, 'all', '10', NULL, '$') as ex;
ex
"$[1][0].k"
select json_search(@j, 'all', '10', NULL, '$[*]');
json_search(@j, 'all', '10', NULL, '$[*]')
select json_search(@j, 'all', '10', NULL, '$[*]') as ex;
ex
"$[1][0].k"
select json_search(@j, 'all', '10', NULL, '$[*][0].k');
json_search(@j, 'all', '10', NULL, '$[*][0].k')
select json_search(@j, 'all', '10', NULL, '$[*][0].k') as ex;
ex
"$[1][0].k"
select json_search(@j, 'all', '10', NULL, '$**.k');
json_search(@j, 'all', '10', NULL, '$**.k')
select json_search(@j, 'all', '10', NULL, '$**.k') as ex;
ex
"$[1][0].k"
create table t1( json_col text );
insert into t1 values
('{ "a": "foobar" }'),
('{ "a": "foobar", "b": "focus", "c": [ "arm", "foot", "shoulder" ] }');
select json_search( json_col, 'all', 'foot' ) from t1;
json_search( json_col, 'all', 'foot' )
select json_search( json_col, 'all', 'foot' ) as ex from t1;
ex
NULL
"$.c[1]"
drop table t1;
@ -468,32 +468,32 @@ json CREATE TABLE `json` (
`j` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table json;
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' );
json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' )
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' ) as ex;
ex
1
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0]' );
json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0]' )
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0]' ) as ex;
ex
1
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0]' );
json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0]' )
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0]' ) as ex;
ex
1
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0][0]' );
json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0][0]' )
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0][0]' ) as ex;
ex
1
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2]' );
json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2]' )
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2]' ) as ex;
ex
2
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0]' );
json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0]' )
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0]' ) as ex;
ex
2
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0]' );
json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0]' )
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0]' ) as ex;
ex
2
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0][0]' );
json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0][0]' )
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0][0]' ) as ex;
ex
2
select json_length( '{"a":{"b":{"d":1}}, "a":{"c":{"d":1, "j":2}}}', '$.a[0][0][0].c' );
json_length( '{"a":{"b":{"d":1}}, "a":{"c":{"d":1, "j":2}}}', '$.a[0][0][0].c' )
select json_length( '{"a":{"b":{"d":1}}, "a":{"c":{"d":1, "j":2}}}', '$.a[0][0][0].c' ) as ex;
ex
2
select json_set('1', '$[0]', 100);
json_set('1', '$[0]', 100)
@ -516,20 +516,20 @@ json_set('{"a":12}', '$[0][0].a', 100)
select json_set('{"a":12}', '$[0][1].a', 100);
json_set('{"a":12}', '$[0][1].a', 100)
{"a": 12}
select json_value('{"\\"key1":123}', '$."\\"key1"');
json_value('{"\\"key1":123}', '$."\\"key1"')
select json_value('{"\\"key1":123}', '$."\\"key1"') as ex;
ex
123
select json_value('{"\\"key1\\"":123}', '$."\\"key1\\""');
json_value('{"\\"key1\\"":123}', '$."\\"key1\\""')
select json_value('{"\\"key1\\"":123}', '$."\\"key1\\""') as ex;
ex
123
select json_value('{"key 1":123}', '$."key 1"');
json_value('{"key 1":123}', '$."key 1"')
select json_value('{"key 1":123}', '$."key 1"') as ex;
ex
123
select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[2]");
json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[2]")
select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[2]") as ex;
ex
1
select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[3]");
json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[3]")
select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[3]") as ex;
ex
0
select json_extract( '[1]', '$[0][0]' );
json_extract( '[1]', '$[0][0]' )
@ -579,26 +579,26 @@ json_set('[]', '$[0][0][0]', 100)
SELECT JSON_search( '{"": "a"}', "one", 'a');
JSON_search( '{"": "a"}', "one", 'a')
"$."
select json_merge('{"a":"b"}', '{"a":"c"}') ;
json_merge('{"a":"b"}', '{"a":"c"}')
select json_merge('{"a":"b"}', '{"a":"c"}') as ex ;
ex
{"a": ["b", "c"]}
select json_merge('{"a":{"x":"b"}}', '{"a":"c"}') ;
json_merge('{"a":{"x":"b"}}', '{"a":"c"}')
select json_merge('{"a":{"x":"b"}}', '{"a":"c"}') as ex ;
ex
{"a": [{"x": "b"}, "c"]}
select json_merge('{"a":{"u":12, "x":"b"}}', '{"a":{"x":"c"}}') ;
json_merge('{"a":{"u":12, "x":"b"}}', '{"a":{"x":"c"}}')
select json_merge('{"a":{"u":12, "x":"b"}}', '{"a":{"x":"c"}}') as ex ;
ex
{"a": {"u": 12, "x": ["b", "c"]}}
select json_merge('{"a":{"u":12, "x":"b", "r":1}}', '{"a":{"x":"c", "r":2}}') ;
json_merge('{"a":{"u":12, "x":"b", "r":1}}', '{"a":{"x":"c", "r":2}}')
select json_merge('{"a":{"u":12, "x":"b", "r":1}}', '{"a":{"x":"c", "r":2}}') as ex ;
ex
{"a": {"u": 12, "x": ["b", "c"], "r": [1, 2]}}
select json_compact('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}');
json_compact('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}')
select json_compact('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex;
ex
{"a":1,"b":[1,2,3],"c":{"aa":"v1","bb":"v2"}}
select json_loose('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}');
json_loose('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}')
select json_loose('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex;
ex
{"a": 1, "b": [1, 2, 3], "c": {"aa": "v1", "bb": "v2"}}
select json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}');
json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}')
select json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex;
ex
{
"a": 1,
"b":
@ -613,11 +613,11 @@ json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}')
"bb": "v2"
}
}
SELECT JSON_search( '{"x": "\\""}', "one", '"');
JSON_search( '{"x": "\\""}', "one", '"')
SELECT JSON_search( '{"x": "\\""}', "one", '"') as ex;
ex
"$.x"
SELECT JSON_search( '{"x": "\\""}', "one", '\\"');
JSON_search( '{"x": "\\""}', "one", '\\"')
SELECT JSON_search( '{"x": "\\""}', "one", '\\"') as ex;
ex
"$.x"
set @save_max_allowed_packet=@@max_allowed_packet;
set @save_net_buffer_length=@@net_buffer_length;
@ -630,13 +630,13 @@ net_buffer_length 1024
show variables like 'max_allowed_packet';
Variable_name Value
max_allowed_packet 2048
select json_array(repeat('a',1024),repeat('a',1024));
json_array(repeat('a',1024),repeat('a',1024))
select json_array(repeat('a',1024),repeat('a',1024)) as ex;
ex
NULL
Warnings:
Warning 1301 Result of json_array() was larger than max_allowed_packet (2048) - truncated
select json_object("a", repeat('a',1024),"b", repeat('a',1024));
json_object("a", repeat('a',1024),"b", repeat('a',1024))
select json_object("a", repeat('a',1024),"b", repeat('a',1024)) as ex;
ex
NULL
Warnings:
Warning 1301 Result of json_object() was larger than max_allowed_packet (2048) - truncated
@ -674,31 +674,31 @@ NULL
SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*]' );
JSON_EXTRACT( '{"foo":"bar"}', '$[*]' )
NULL
select JSON_EXTRACT('{"name":"value"}', '$.name') = 'value';
JSON_EXTRACT('{"name":"value"}', '$.name') = 'value'
select JSON_EXTRACT('{"name":"value"}', '$.name') = 'value' as ex;
ex
1
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = true;
JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = true
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = true as ex;
ex
1
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = false;
JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = false
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = false as ex;
ex
0
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = 1;
JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = 1
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = 1 as ex;
ex
1
select JSON_EXTRACT('{\"input1\":\"\\u00f6\"}', '$.\"input1\"');
JSON_EXTRACT('{\"input1\":\"\\u00f6\"}', '$.\"input1\"')
select JSON_EXTRACT('{\"input1\":\"\\u00f6\"}', '$.\"input1\"') as ex;
ex
"\u00f6"
select JSON_EXTRACT('{"foo": "bar" foobar foo invalid ', '$.foo');
JSON_EXTRACT('{"foo": "bar" foobar foo invalid ', '$.foo')
select JSON_EXTRACT('{"foo": "bar" foobar foo invalid ', '$.foo') as ex;
ex
NULL
Warnings:
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 15
SELECT JSON_OBJECT('foo', '`');
JSON_OBJECT('foo', '`')
SELECT JSON_OBJECT('foo', '`') as ex;
ex
{"foo": "`"}
SELECT JSON_OBJECT("foo", "bar`bar");
JSON_OBJECT("foo", "bar`bar")
SELECT JSON_OBJECT("foo", "bar`bar") as ex;
ex
{"foo": "bar`bar"}
SELECT JSON_SET('{}', '$.age', 87);
JSON_SET('{}', '$.age', 87)
@ -776,21 +776,21 @@ insert into t1 values (_latin1 X'7B226B657931223A2253EC227D');
select JSON_VALUE(json_col, '$.key1')= _latin1 X'53EC' from t1;
JSON_VALUE(json_col, '$.key1')= _latin1 X'53EC'
1
select REPLACE(JSON_VALUE(json_col, '$.key1'), 'null', '') = _latin1 X'53EC' from t1;
REPLACE(JSON_VALUE(json_col, '$.key1'), 'null', '') = _latin1 X'53EC'
select REPLACE(JSON_VALUE(json_col, '$.key1'), 'null', '') = _latin1 X'53EC' as exp from t1;
exp
1
drop table t1;
#
# MDEV-16750 JSON_SET mishandles unicode every second pair of arguments.
#
SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6);
JSON_SET('{}', '$.a', _utf8 0xC3B6)
SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6) as exp;
exp
{"a": "ö"}
SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6, '$.b', _utf8 0xC3B6);
JSON_SET('{}', '$.a', _utf8 0xC3B6, '$.b', _utf8 0xC3B6)
SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6, '$.b', _utf8 0xC3B6) as exp;
exp
{"a": "ö", "b": "ö"}
SELECT JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6');
JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6')
SELECT JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6') as exp;
exp
{"a": "ö", "x": 1, "b": "ö"}
#
# MDEV-17121 JSON_ARRAY_APPEND
@ -835,14 +835,14 @@ JSON_VALID( '{"a":1]' )
#
# MDEV-18886 JSON_ARRAY() does not recognise JSON argument.
#
SELECT JSON_ARRAY(_UTF8 'str', JSON_OBJECT(_LATIN1 'plugin', _LATIN1'unix_socket'));
JSON_ARRAY(_UTF8 'str', JSON_OBJECT(_LATIN1 'plugin', _LATIN1'unix_socket'))
SELECT JSON_ARRAY(_UTF8 'str', JSON_OBJECT(_LATIN1 'plugin', _LATIN1'unix_socket')) as exp;
exp
["str", {"plugin": "unix_socket"}]
SELECT CHARSET(JSON_ARRAY());
CHARSET(JSON_ARRAY())
SELECT CHARSET(JSON_ARRAY()) as exp;
exp
latin1
SELECT CHARSET(JSON_OBJECT());
CHARSET(JSON_OBJECT())
SELECT CHARSET(JSON_OBJECT()) as exp;
exp
latin1
#
# MDEV-13992 Implement JSON_MERGE_PATCH
@ -892,31 +892,31 @@ id target patch merged a
16 NULL {} NULL NULL
17 {} NULL NULL NULL
DROP TABLE merge_t;
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '{"c":"d"}');
JSON_MERGE_PATCH('{"a":"b"}', NULL, '{"c":"d"}')
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '{"c":"d"}') as exp;
exp
NULL
SELECT JSON_MERGE_PATCH(NULL, '[1,2,3]');
JSON_MERGE_PATCH(NULL, '[1,2,3]')
SELECT JSON_MERGE_PATCH(NULL, '[1,2,3]') as exp;
exp
[1, 2, 3]
SELECT JSON_MERGE_PATCH(NULL, 'a');
JSON_MERGE_PATCH(NULL, 'a')
SELECT JSON_MERGE_PATCH(NULL, 'a') as exp;
exp
NULL
Warnings:
Warning 4038 Syntax error in JSON text in argument 2 to function 'json_merge_patch' at position 1
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}');
JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}')
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}') as exp;
exp
{"d": "e"}
SELECT JSON_MERGE_PATCH();
SELECT JSON_MERGE_PATCH() as exp;
ERROR 42000: Incorrect parameter count in the call to native function 'JSON_MERGE_PATCH'
SELECT JSON_MERGE_PATCH('{}');
SELECT JSON_MERGE_PATCH('{}') as exp;
ERROR 42000: Incorrect parameter count in the call to native function 'JSON_MERGE_PATCH'
SELECT JSON_MERGE_PATCH('{', '[1,2,3]');
JSON_MERGE_PATCH('{', '[1,2,3]')
SELECT JSON_MERGE_PATCH('{', '[1,2,3]') as exp;
exp
NULL
Warnings:
Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_merge_patch'
SELECT JSON_MERGE_PATCH('{"a":"b"}', '[1,');
JSON_MERGE_PATCH('{"a":"b"}', '[1,')
SELECT JSON_MERGE_PATCH('{"a":"b"}', '[1,') as exp;
exp
NULL
Warnings:
Warning 4037 Unexpected end of JSON text in argument 2 to function 'json_merge_patch'
@ -1379,8 +1379,8 @@ insert into t200 values
}
]
}');
select JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200;
JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives'))
select JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) as exp from t200;
exp
[
{
"range_scan_alternatives":
@ -1410,8 +1410,8 @@ JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives'))
["123"]
}
]
select JSON_PRETTY(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200;
JSON_PRETTY(JSON_EXTRACT(a, '$**.analyzing_range_alternatives'))
select JSON_PRETTY(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) as exp from t200;
exp
[
{
"range_scan_alternatives":
@ -1441,8 +1441,8 @@ JSON_PRETTY(JSON_EXTRACT(a, '$**.analyzing_range_alternatives'))
["123"]
}
]
select JSON_LOOSE(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200;
JSON_LOOSE(JSON_EXTRACT(a, '$**.analyzing_range_alternatives'))
select JSON_LOOSE(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) as exp from t200;
exp
[{"range_scan_alternatives": [{"index": "a_b", "ranges": ["2 <= a <= 2 AND 4 <= b <= 4", "123"], "rowid_ordered": true, "using_mrr": false, "index_only": true, "rows": 1, "cost": 1.1752, "chosen": true}], "analyzing_roworder_intersect": {"cause": "too few roworder scans"}, "analyzing_index_merge_union": [], "test_one_line_array": ["123"]}]
drop table t200;
#
@ -1615,11 +1615,11 @@ DROP TABLE t2;
#
# MDEV-27018 IF and COALESCE lose "json" property
#
SELECT json_object('a', if(1, json_object('b', 'c'), json_object('e', 'f')));
json_object('a', if(1, json_object('b', 'c'), json_object('e', 'f')))
SELECT json_object('a', if(1, json_object('b', 'c'), json_object('e', 'f'))) as exp;
exp
{"a": {"b": "c"}}
SELECT json_object('a', coalesce(json_object('b', 'c')));
json_object('a', coalesce(json_object('b', 'c')))
SELECT json_object('a', coalesce(json_object('b', 'c'))) as exp;
exp
{"a": {"b": "c"}}
#
# MDEV-26392: Crash with json_get_path_next and 10.5.12

View file

@ -10,19 +10,13 @@ select json_value('{"key1":123}', '$.key1');
select json_value('{"key1":[1,2,3]}', '$.key1');
select json_value('{"key1": [1,2,3], "key1":123}', '$.key1');
#enable after fix MDEV-27871
--disable_view_protocol
select JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z');
--enable_view_protocol
select JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z') as exp;
select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2');
select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key1');
select json_query('{"key1": 1}', '$.key1');
select json_query('{"key1":123, "key1": [1,2,3]}', '$.key1');
#enable after fix MDEV-27871
--disable_view_protocol
select json_query('{"key1":123, "key1": [1,2,3]}', concat('$', repeat('.k', 1000)));
--enable_view_protocol
select json_query('{"key1":123, "key1": [1,2,3]}', concat('$', repeat('.k', 1000))) as exp;
select json_array();
select json_array(1);
@ -39,15 +33,9 @@ select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1]', 'x');
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2]', 'x');
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[3]', 'x');
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[4]', 'x');
#enable after fix MDEV-27871
--disable_view_protocol
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1].b[0]', 'x');
--enable_view_protocol
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1].b[0]', 'x') as exp;
select json_array_insert('true', '$', 1);
#enable after fix MDEV-27871
--disable_view_protocol
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2][1]', 'y');
--enable_view_protocol
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2][1]', 'y') as exp;
select json_contains('{"k1":123, "k2":345}', '123', '$.k1');
select json_contains('"you"', '"you"');
@ -72,45 +60,45 @@ select json_contains('{"a":1}', '{}');
select json_contains('[1, {"a":1}]', '{}');
select json_contains('[1, {"a":1}]', '{"a":1}');
select json_contains('[{"abc":"def", "def":"abc"}]', '["foo","bar"]');
#enable after fix MDEV-27871
--disable_view_protocol
select json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]');
--disable_view_protocol
select json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]') as exp;
select json_contains('[{"a":"b"},{"c":"d"}]','{"c":"d"}');
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]");
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[10]");
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.ma");
select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1");
select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1", "$.ma");
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.ma");
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2");
select json_contains_path('{ "a": true }', NULL, '$.a' );
select json_contains_path('{ "a": true }', 'all', NULL );
select json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*');
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]") as exp;
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[10]") as exp;
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.ma") as exp;
select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1") as exp;
select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1", "$.ma") as exp;
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.ma") as exp;
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2") as exp;
select json_contains_path('{ "a": true }', NULL, '$.a' ) as exp;
select json_contains_path('{ "a": true }', 'all', NULL ) as exp;
select json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*') as exp;
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1");
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.keyX", "$.keyY");
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1", "$.key2");
select json_extract('{"key1":5, "key2":[2,3]}', "$.key1", "$.key2");
select json_extract('{"key0":true, "key1":"qwe"}', "$.key1");
select json_extract(json_object('foo', 'foobar'),'$');
select json_extract('[10, 20, [30, 40]]', '$[2][*]');
select json_extract('[10, 20, [{"a":3}, 30, 40]]', '$[2][*]');
select json_extract('1', '$');
select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]');
select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]', '$[25]');
select json_extract( '[{"a": [3, 4]}, {"b": 2}]', '$[0].a', '$[1].a');
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1") as exp;
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.keyX", "$.keyY") as exp;
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1", "$.key2") as exp;
select json_extract('{"key1":5, "key2":[2,3]}', "$.key1", "$.key2") as exp;
select json_extract('{"key0":true, "key1":"qwe"}', "$.key1") as exp;
select json_extract(json_object('foo', 'foobar'),'$') as exp;
select json_extract('[10, 20, [30, 40]]', '$[2][*]') as exp;
select json_extract('[10, 20, [{"a":3}, 30, 40]]', '$[2][*]') as exp;
select json_extract('1', '$') as exp;
select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]') as exp;
select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]', '$[25]') as exp;
select json_extract( '[{"a": [3, 4]}, {"b": 2}]', '$[0].a', '$[1].a') as exp;
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word');
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3);
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.a[2]', 2);
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.c', 'word');
#enable after MDEV-32454 fix
--disable_view_protocol
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word') as exp;
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3) as exp;
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.a[2]', 2) as exp;
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.c', 'word') as exp;
select json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]');
select json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]') as exp;
--enable_view_protocol
select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]');
select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.b', '[true, false]');
select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]') as exp;
select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.b', '[true, false]') as exp;
set @j = '["a", ["b", "c"], "d"]';
select json_remove(@j, '$[0]');
@ -127,9 +115,9 @@ show create table t1;
select * from t1;
drop table t1;
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2");
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[1]");
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[10]");
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2") as ex;
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[1]") as ex;
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[10]") as ex;
select json_quote('"string"');
create table t1 as select json_quote('foo');
@ -149,11 +137,14 @@ select json_merge('a','b');
select json_merge('{"a":"b"}','{"c":"d"}');
SELECT JSON_MERGE('[1, 2]', '{"id": 47}');
#enable after MDEV-32454 fix
--disable_view_protocol
select json_type('{"k1":123, "k2":345}');
select json_type('[123, "k2", 345]');
select json_type("true");
select json_type('123');
select json_type('123.12');
--enable_view_protocol
select json_keys('{"a":{"c":1, "d":2}, "b":2}');
select json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.a");
@ -162,28 +153,31 @@ select json_keys('foo');
#
# mdev-12789 JSON_KEYS returns duplicate keys twice
#
select json_keys('{"a":{"c":1, "d":2}, "b":2, "c":1, "a":3, "b":1, "c":2}');
select json_keys('{"c1": "value 1", "c1": "value 2"}');
select json_keys('{"a":{"c":1, "d":2}, "b":2, "c":1, "a":3, "b":1, "c":2}') as ex;
select json_keys('{"c1": "value 1", "c1": "value 2"}') as ex;
SET @j = '["abc", [{"k": "10"}, "def"], {"x":"abc"}, {"y":"bcd"}]';
select json_search(@j, 'one', 'abc');
select json_search(@j, 'all', 'abc');
select json_search(@j, 'all', 'abc', NULL, '$[2]');
select json_search(@j, 'all', 'abc', NULL, '$');
select json_search(@j, 'all', '10', NULL, '$');
select json_search(@j, 'all', '10', NULL, '$[*]');
select json_search(@j, 'all', '10', NULL, '$[*][0].k');
select json_search(@j, 'all', '10', NULL, '$**.k');
select json_search(@j, 'one', 'abc') as ex;
select json_search(@j, 'all', 'abc') as ex;
select json_search(@j, 'all', 'abc', NULL, '$[2]') as ex;
select json_search(@j, 'all', 'abc', NULL, '$') as ex;
select json_search(@j, 'all', '10', NULL, '$') as ex;
select json_search(@j, 'all', '10', NULL, '$[*]') as ex;
select json_search(@j, 'all', '10', NULL, '$[*][0].k') as ex;
select json_search(@j, 'all', '10', NULL, '$**.k') as ex;
create table t1( json_col text );
insert into t1 values
('{ "a": "foobar" }'),
('{ "a": "foobar", "b": "focus", "c": [ "arm", "foot", "shoulder" ] }');
select json_search( json_col, 'all', 'foot' ) from t1;
select json_search( json_col, 'all', 'foot' ) as ex from t1;
drop table t1;
#enable after MDEV-32454 fix
--disable_view_protocol
select json_unquote('"abc"');
select json_unquote('abc');
--enable_view_protocol
#
# MDEV-13703 Illegal mix of collations for operation 'json_object' on using JSON_UNQUOTE as an argument.
#
@ -193,9 +187,14 @@ insert into t1 values ('abc'),('def');
select json_object('foo', json_unquote(json_object('bar', c)),'qux', c) as fld from t1;
drop table t1;
#enable after MDEV-32454 fix
--disable_view_protocol
select json_object("a", json_object("b", "abcd"));
select json_object("a", '{"b": "abcd"}');
select json_object("a", json_compact('{"b": "abcd"}'));
--enable_view_protocol
select json_compact(NULL);
select json_depth(json_compact(NULL));
@ -214,15 +213,15 @@ create table json (j INT);
show create table json;
drop table json;
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' );
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0]' );
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0]' );
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0][0]' );
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2]' );
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0]' );
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0]' );
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0][0]' );
select json_length( '{"a":{"b":{"d":1}}, "a":{"c":{"d":1, "j":2}}}', '$.a[0][0][0].c' );
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' ) as ex;
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0]' ) as ex;
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0]' ) as ex;
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0][0]' ) as ex;
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2]' ) as ex;
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0]' ) as ex;
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0]' ) as ex;
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0][0]' ) as ex;
select json_length( '{"a":{"b":{"d":1}}, "a":{"c":{"d":1, "j":2}}}', '$.a[0][0][0].c' ) as ex;
select json_set('1', '$[0]', 100);
select json_set('1', '$[0][0]', 100);
@ -232,12 +231,12 @@ select json_set('{"a":12}', '$[0].a', 100);
select json_set('{"a":12}', '$[0][0].a', 100);
select json_set('{"a":12}', '$[0][1].a', 100);
select json_value('{"\\"key1":123}', '$."\\"key1"');
select json_value('{"\\"key1\\"":123}', '$."\\"key1\\""');
select json_value('{"key 1":123}', '$."key 1"');
select json_value('{"\\"key1":123}', '$."\\"key1"') as ex;
select json_value('{"\\"key1\\"":123}', '$."\\"key1\\""') as ex;
select json_value('{"key 1":123}', '$."key 1"') as ex;
select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[2]");
select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[3]");
select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[2]") as ex;
select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[3]") as ex;
select json_extract( '[1]', '$[0][0]' );
select json_extract( '[1]', '$[1][0]' );
@ -265,21 +264,24 @@ SELECT JSON_search( '{"": "a"}', "one", 'a');
# MDEV-11858 json_merge() concatenates instead of merging.
#
select json_merge('{"a":"b"}', '{"a":"c"}') ;
select json_merge('{"a":{"x":"b"}}', '{"a":"c"}') ;
select json_merge('{"a":{"u":12, "x":"b"}}', '{"a":{"x":"c"}}') ;
select json_merge('{"a":{"u":12, "x":"b", "r":1}}', '{"a":{"x":"c", "r":2}}') ;
select json_merge('{"a":"b"}', '{"a":"c"}') as ex ;
select json_merge('{"a":{"x":"b"}}', '{"a":"c"}') as ex ;
select json_merge('{"a":{"u":12, "x":"b"}}', '{"a":{"x":"c"}}') as ex ;
select json_merge('{"a":{"u":12, "x":"b", "r":1}}', '{"a":{"x":"c", "r":2}}') as ex ;
select json_compact('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}');
select json_loose('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}');
select json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}');
select json_compact('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex;
#enable after MDEV-32454 fix
--disable_view_protocol
select json_loose('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex;
select json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex;
--enable_view_protocol
#
# MDEV-11856 json_search doesn't search for values with double quotes character (")
#
SELECT JSON_search( '{"x": "\\""}', "one", '"');
SELECT JSON_search( '{"x": "\\""}', "one", '\\"');
SELECT JSON_search( '{"x": "\\""}', "one", '"') as ex;
SELECT JSON_search( '{"x": "\\""}', "one", '\\"') as ex;
#
# MDEV-11833 JSON functions don't seem to respect max_allowed_packet.
@ -293,8 +295,8 @@ set @@global.max_allowed_packet=2048;
show variables like 'net_buffer_length';
show variables like 'max_allowed_packet';
select json_array(repeat('a',1024),repeat('a',1024));
select json_object("a", repeat('a',1024),"b", repeat('a',1024));
select json_array(repeat('a',1024),repeat('a',1024)) as ex;
select json_object("a", repeat('a',1024),"b", repeat('a',1024)) as ex;
--connection default
set @@global.max_allowed_packet = @save_max_allowed_packet;
@ -344,22 +346,22 @@ SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*]' );
# MDEV-12604 Comparison of JSON_EXTRACT result differs with Mysql.
#
select JSON_EXTRACT('{"name":"value"}', '$.name') = 'value';
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = true;
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = false;
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = 1;
select JSON_EXTRACT('{\"input1\":\"\\u00f6\"}', '$.\"input1\"');
select JSON_EXTRACT('{"name":"value"}', '$.name') = 'value' as ex;
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = true as ex;
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = false as ex;
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = 1 as ex;
select JSON_EXTRACT('{\"input1\":\"\\u00f6\"}', '$.\"input1\"') as ex;
#
# MDEV-129892 JSON_EXTRACT returns data for invalid JSON
#
select JSON_EXTRACT('{"foo": "bar" foobar foo invalid ', '$.foo');
select JSON_EXTRACT('{"foo": "bar" foobar foo invalid ', '$.foo') as ex;
#
# MDEV-13138 JSON_OBJECT returns null with strings containing backticks.
#
SELECT JSON_OBJECT('foo', '`');
SELECT JSON_OBJECT("foo", "bar`bar");
SELECT JSON_OBJECT('foo', '`') as ex;
SELECT JSON_OBJECT("foo", "bar`bar") as ex;
#
# MDEV-13324 JSON_SET returns NULL instead of object.
@ -457,16 +459,19 @@ select json_array(1,user(),compress(5.140264e+307));
create table t1(json_col TEXT) DEFAULT CHARSET=latin1;
insert into t1 values (_latin1 X'7B226B657931223A2253EC227D');
select JSON_VALUE(json_col, '$.key1')= _latin1 X'53EC' from t1;
select REPLACE(JSON_VALUE(json_col, '$.key1'), 'null', '') = _latin1 X'53EC' from t1;
select REPLACE(JSON_VALUE(json_col, '$.key1'), 'null', '') = _latin1 X'53EC' as exp from t1;
drop table t1;
--echo #
--echo # MDEV-16750 JSON_SET mishandles unicode every second pair of arguments.
--echo #
SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6);
SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6, '$.b', _utf8 0xC3B6);
SELECT JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6');
#enable after MDEV-32454 fix
--disable_view_protocol
SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6) as exp;
SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6, '$.b', _utf8 0xC3B6) as exp;
SELECT JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6') as exp;
--enable_view_protocol
--echo #
--echo # MDEV-17121 JSON_ARRAY_APPEND
@ -509,9 +514,9 @@ select JSON_VALID( '{"a":1]' );
--echo #
--echo # MDEV-18886 JSON_ARRAY() does not recognise JSON argument.
--echo #
SELECT JSON_ARRAY(_UTF8 'str', JSON_OBJECT(_LATIN1 'plugin', _LATIN1'unix_socket'));
SELECT CHARSET(JSON_ARRAY());
SELECT CHARSET(JSON_OBJECT());
SELECT JSON_ARRAY(_UTF8 'str', JSON_OBJECT(_LATIN1 'plugin', _LATIN1'unix_socket')) as exp;
SELECT CHARSET(JSON_ARRAY()) as exp;
SELECT CHARSET(JSON_OBJECT()) as exp;
--echo #
--echo # MDEV-13992 Implement JSON_MERGE_PATCH
@ -545,17 +550,17 @@ SELECT id, target, patch,
FROM merge_t ORDER BY id;
DROP TABLE merge_t;
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '{"c":"d"}');
SELECT JSON_MERGE_PATCH(NULL, '[1,2,3]');
SELECT JSON_MERGE_PATCH(NULL, 'a');
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}');
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '{"c":"d"}') as exp;
SELECT JSON_MERGE_PATCH(NULL, '[1,2,3]') as exp;
SELECT JSON_MERGE_PATCH(NULL, 'a') as exp;
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}') as exp;
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
SELECT JSON_MERGE_PATCH();
SELECT JSON_MERGE_PATCH() as exp;
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
SELECT JSON_MERGE_PATCH('{}');
SELECT JSON_MERGE_PATCH('{', '[1,2,3]');
SELECT JSON_MERGE_PATCH('{"a":"b"}', '[1,');
SELECT JSON_MERGE_PATCH('{}') as exp;
SELECT JSON_MERGE_PATCH('{', '[1,2,3]') as exp;
SELECT JSON_MERGE_PATCH('{"a":"b"}', '[1,') as exp;
--echo #
--echo # MDEV-22976 CAST(JSON_EXTRACT() AS DECIMAL) does not handle boolean values
@ -601,6 +606,7 @@ DROP TABLE json_test;
--enable_metadata
--disable_ps_protocol
--disable_view_protocol
SELECT
JSON_VALID('{"id": 1, "name": "Monty"}') AS json_valid,
@ -612,6 +618,7 @@ SELECT
JSON_LENGTH('{"a": 1, "b": {"c": 30}}') AS json_length,
JSON_DEPTH('[10, {"a": 20}]') AS json_depnth;
--enable_view_protocol
--enable_ps_protocol
--disable_metadata
@ -674,10 +681,13 @@ SELECT JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a');
--echo #
--vertical_results
#enable after fix MDEV-28649
--disable_view_protocol
SELECT
JSON_OBJECT("cond", true) AS j1,
JSON_OBJECT("cond", COALESCE(true, false)) j2,
JSON_OBJECT("cond", COALESCE(COALESCE(true, false))) j3;
--enable_view_protocol
--horizontal_results
CREATE TABLE t1 (a INT);
@ -742,7 +752,10 @@ INSERT INTO t1 VALUES (TRUE, TRUE), (TRUE, FALSE), (FALSE, TRUE), (FALSE, FALSE)
SELECT JSON_VALID(JSON_ARRAYAGG(a)) FROM t1;
SELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1;
SELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1 GROUP BY b;
#enable after MDEV-32454 fix
--disable_view_protocol
SELECT JSON_ARRAYAGG(TRUE), JSON_ARRAYAGG(FALSE) FROM t1;
--enable_view_protocol
DROP TABLE t1;
-- echo #
@ -908,9 +921,9 @@ insert into t200 values
}');
select JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200;
select JSON_PRETTY(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200;
select JSON_LOOSE(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200;
select JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) as exp from t200;
select JSON_PRETTY(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) as exp from t200;
select JSON_LOOSE(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) as exp from t200;
drop table t200;
--echo #
@ -1019,9 +1032,12 @@ create table t1 (a varchar(254));
insert into t1 values (concat('x64-', repeat('a', 60)));
insert into t1 values (concat('x64-', repeat('b', 60)));
insert into t1 values (concat('x64-', repeat('c', 60)));
#enable after MDEV-32454 fix
--disable_view_protocol
--disable_ps2_protocol
select json_arrayagg(a) from t1;
--enable_ps2_protocol
--enable_view_protocol
drop table t1;
SET group_concat_max_len= default;
@ -1068,8 +1084,8 @@ DROP TABLE t2;
--echo # MDEV-27018 IF and COALESCE lose "json" property
--echo #
SELECT json_object('a', if(1, json_object('b', 'c'), json_object('e', 'f')));
SELECT json_object('a', coalesce(json_object('b', 'c')));
SELECT json_object('a', if(1, json_object('b', 'c'), json_object('e', 'f'))) as exp;
SELECT json_object('a', coalesce(json_object('b', 'c'))) as exp;
--echo #
--echo # MDEV-26392: Crash with json_get_path_next and 10.5.12

View file

@ -931,8 +931,8 @@ STDDEV_POP(ROUND(0,@A:=2009))
#
CREATE TABLE t1 ( pk int NOT NULL, i1 int NOT NULL, d1 date NOT NULL, t1 time);
INSERT INTO t1 VALUES (7,9,'2007-08-15','03:55:02'),(8,7,'1993-06-05','04:17:51'),(9,7,'2034-07-01','17:31:12'),(10,0,'1998-08-24','08:09:27');
SELECT DISTINCT STDDEV_SAMP(EXPORT_SET(t1, -1379790335835635712, (i1 + 'o'), (MD5(d1)))) FROM t1;
STDDEV_SAMP(EXPORT_SET(t1, -1379790335835635712, (i1 + 'o'), (MD5(d1))))
SELECT DISTINCT STDDEV_SAMP(EXPORT_SET(t1, -1379790335835635712, (i1 + 'o'), (MD5(d1)))) as exp FROM t1;
exp
NULL
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'o'

View file

@ -685,10 +685,7 @@ SELECT STDDEV_POP(ROUND(0,@A:=2009)) FROM (SELECT 1 UNION SELECT 2) fake_table;
CREATE TABLE t1 ( pk int NOT NULL, i1 int NOT NULL, d1 date NOT NULL, t1 time);
INSERT INTO t1 VALUES (7,9,'2007-08-15','03:55:02'),(8,7,'1993-06-05','04:17:51'),(9,7,'2034-07-01','17:31:12'),(10,0,'1998-08-24','08:09:27');
#enable after fix MDEV-27871
--disable_view_protocol
SELECT DISTINCT STDDEV_SAMP(EXPORT_SET(t1, -1379790335835635712, (i1 + 'o'), (MD5(d1)))) FROM t1;
--enable_view_protocol
SELECT DISTINCT STDDEV_SAMP(EXPORT_SET(t1, -1379790335835635712, (i1 + 'o'), (MD5(d1)))) as exp FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(128));

View file

@ -149,8 +149,8 @@ select @invoked;
@invoked
10
set @invoked := 0;
select benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093));
benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093))
select benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093)) as exp;
exp
0
select @invoked;
@invoked
@ -1170,11 +1170,11 @@ INET6_NTOA(INET6_ATON('1:2:3:4:5:6:7::'))
SELECT INET6_NTOA(INET6_ATON('0000:0000::0000:0001'));
INET6_NTOA(INET6_ATON('0000:0000::0000:0001'))
::1
SELECT INET6_NTOA(INET6_ATON('1234:5678:9abc:def0:4321:8765:cba9:0fed'));
INET6_NTOA(INET6_ATON('1234:5678:9abc:def0:4321:8765:cba9:0fed'))
SELECT INET6_NTOA(INET6_ATON('1234:5678:9abc:def0:4321:8765:cba9:0fed')) as exp;
exp
1234:5678:9abc:def0:4321:8765:cba9:fed
SELECT INET6_NTOA(INET6_ATON('0000:0000:0000:0000:0000:0000:0000:0001'));
INET6_NTOA(INET6_ATON('0000:0000:0000:0000:0000:0000:0000:0001'))
SELECT INET6_NTOA(INET6_ATON('0000:0000:0000:0000:0000:0000:0000:0001')) as exp;
exp
::1
SELECT INET6_NTOA(INET6_ATON('::C0A8:0102'));
INET6_NTOA(INET6_ATON('::C0A8:0102'))

View file

@ -158,10 +158,7 @@ select @invoked;
set @invoked := 0;
--disable_ps2_protocol
#enable after fix MDEV-27871
--disable_view_protocol
select benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093));
--enable_view_protocol
select benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093)) as exp;
--enable_ps2_protocol
# Returns 1000, due to rand() preventing caching.
select @invoked;
@ -952,11 +949,8 @@ SELECT INET6_NTOA(INET6_ATON('1:2:3:4:5::7:8'));
SELECT INET6_NTOA(INET6_ATON('1:2:3:4:5:6::8'));
SELECT INET6_NTOA(INET6_ATON('1:2:3:4:5:6:7::'));
SELECT INET6_NTOA(INET6_ATON('0000:0000::0000:0001'));
#enable after fix MDEV-27871
--disable_view_protocol
SELECT INET6_NTOA(INET6_ATON('1234:5678:9abc:def0:4321:8765:cba9:0fed'));
SELECT INET6_NTOA(INET6_ATON('0000:0000:0000:0000:0000:0000:0000:0001'));
--enable_view_protocol
SELECT INET6_NTOA(INET6_ATON('1234:5678:9abc:def0:4321:8765:cba9:0fed')) as exp;
SELECT INET6_NTOA(INET6_ATON('0000:0000:0000:0000:0000:0000:0000:0001')) as exp;
SELECT INET6_NTOA(INET6_ATON('::C0A8:0102'));
SELECT INET6_NTOA(INET6_ATON('::c0a8:0102'));
SELECT INET6_NTOA(INET6_ATON('::192.168.1.2'));

View file

@ -17,35 +17,35 @@ extract(MICROSECOND FROM "1999-01-02 10:11:12.000123")
select date_format("1997-12-31 23:59:59.000002", "%f");
date_format("1997-12-31 23:59:59.000002", "%f")
000002
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000 99:99:99.999999" DAY_MICROSECOND);
date_add("1997-12-31 23:59:59.000002",INTERVAL "10000 99:99:99.999999" DAY_MICROSECOND)
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000 99:99:99.999999" DAY_MICROSECOND) as exp;
exp
2025-05-23 04:40:39.000001
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99:99.999999" HOUR_MICROSECOND);
date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99:99.999999" HOUR_MICROSECOND)
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99:99.999999" HOUR_MICROSECOND) as exp;
exp
1999-02-21 17:40:39.000001
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99.999999" MINUTE_MICROSECOND);
date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99.999999" MINUTE_MICROSECOND)
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99.999999" MINUTE_MICROSECOND) as exp;
exp
1998-01-07 22:41:39.000001
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000.999999" SECOND_MICROSECOND);
date_add("1997-12-31 23:59:59.000002",INTERVAL "10000.999999" SECOND_MICROSECOND)
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000.999999" SECOND_MICROSECOND) as exp;
exp
1998-01-01 02:46:40.000001
select date_add("1997-12-31 23:59:59.000002",INTERVAL "999999" MICROSECOND);
date_add("1997-12-31 23:59:59.000002",INTERVAL "999999" MICROSECOND)
select date_add("1997-12-31 23:59:59.000002",INTERVAL "999999" MICROSECOND) as exp;
exp
1998-01-01 00:00:00.000001
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1 1:1:1.000002" DAY_MICROSECOND);
date_sub("1998-01-01 00:00:00.000001",INTERVAL "1 1:1:1.000002" DAY_MICROSECOND)
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1 1:1:1.000002" DAY_MICROSECOND) as exp;
exp
1997-12-30 22:58:58.999999
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1:1.000002" HOUR_MICROSECOND);
date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1:1.000002" HOUR_MICROSECOND)
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1:1.000002" HOUR_MICROSECOND) as exp;
exp
1997-12-31 22:58:58.999999
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1.000002" MINUTE_MICROSECOND);
date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1.000002" MINUTE_MICROSECOND)
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1.000002" MINUTE_MICROSECOND) as exp;
exp
1997-12-31 23:58:58.999999
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1.000002" SECOND_MICROSECOND);
date_sub("1998-01-01 00:00:00.000001",INTERVAL "1.000002" SECOND_MICROSECOND)
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1.000002" SECOND_MICROSECOND) as exp;
exp
1997-12-31 23:59:58.999999
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "000002" MICROSECOND);
date_sub("1998-01-01 00:00:00.000001",INTERVAL "000002" MICROSECOND)
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "000002" MICROSECOND) as exp;
exp
1997-12-31 23:59:59.999999
select adddate("1997-12-31 23:59:59.000001", 10);
adddate("1997-12-31 23:59:59.000001", 10)
@ -98,47 +98,47 @@ NULL
select makedate(100,1);
makedate(100,1)
0100-01-01
select addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002");
addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002")
select addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002") as exp;
exp
1998-01-02 01:01:01.000001
select subtime("1997-12-31 23:59:59.000001", "1 1:1:1.000002");
subtime("1997-12-31 23:59:59.000001", "1 1:1:1.000002")
select subtime("1997-12-31 23:59:59.000001", "1 1:1:1.000002") as exp;
exp
1997-12-30 22:58:57.999999
select addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999")
select addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999") as exp;
exp
NULL
Warnings:
Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '1998-01-01 01:01:01.999999'
select subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999")
select subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999") as exp;
exp
NULL
Warnings:
Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '1998-01-01 01:01:01.999999'
select subtime("01:00:00.999999", "02:00:00.999998");
subtime("01:00:00.999999", "02:00:00.999998")
select subtime("01:00:00.999999", "02:00:00.999998") as exp;
exp
-00:59:59.999999
select subtime("02:01:01.999999", "01:01:01.999999");
subtime("02:01:01.999999", "01:01:01.999999")
select subtime("02:01:01.999999", "01:01:01.999999") as exp;
exp
01:00:00
select timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002");
timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002")
select timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002") as exp;
exp
838:59:59.999999
Warnings:
Warning 1292 Truncated incorrect time value: '8807:59:59.999999'
select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002");
timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002")
select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002") as exp;
exp
46:58:57.999999
select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002");
timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002")
select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002") as exp;
exp
-24:00:00.000001
select timediff("1997-12-31 23:59:59.000001","23:59:59.000001");
timediff("1997-12-31 23:59:59.000001","23:59:59.000001")
select timediff("1997-12-31 23:59:59.000001","23:59:59.000001") as exp;
exp
NULL
select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001");
timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001")
select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001") as exp;
exp
-00:00:00.000001
select timediff("2005-01-11 15:48:49.999999", "2005-01-11 15:48:50");
timediff("2005-01-11 15:48:49.999999", "2005-01-11 15:48:50")
select timediff("2005-01-11 15:48:49.999999", "2005-01-11 15:48:50") as exp;
exp
-00:00:00.000001
select maketime(10,11,12);
maketime(10,11,12)
@ -262,14 +262,14 @@ a
select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f");
str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f")
2003-01-02 10:11:12.001200
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10'),time('00:00:00');
timediff('2008-09-29 20:10:10','2008-09-30 20:10:10') time('00:00:00')
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10'),time('00:00:00') as exp;
timediff('2008-09-29 20:10:10','2008-09-30 20:10:10') exp
-24:00:00 00:00:00
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00');
timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00')
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00') as exp;
exp
0
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00');
timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00')
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00') as exp;
exp
1
SELECT CAST(time('-73:42:12') AS DECIMAL);
CAST(time('-73:42:12') AS DECIMAL)

View file

@ -13,20 +13,17 @@ select extract(SECOND_MICROSECOND FROM "1999-01-02 10:11:12.000123");
select extract(MICROSECOND FROM "1999-01-02 10:11:12.000123");
select date_format("1997-12-31 23:59:59.000002", "%f");
#enable after fix MDEV-27871
--disable_view_protocol
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000 99:99:99.999999" DAY_MICROSECOND);
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99:99.999999" HOUR_MICROSECOND);
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99.999999" MINUTE_MICROSECOND);
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000.999999" SECOND_MICROSECOND);
select date_add("1997-12-31 23:59:59.000002",INTERVAL "999999" MICROSECOND);
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000 99:99:99.999999" DAY_MICROSECOND) as exp;
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99:99.999999" HOUR_MICROSECOND) as exp;
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99.999999" MINUTE_MICROSECOND) as exp;
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000.999999" SECOND_MICROSECOND) as exp;
select date_add("1997-12-31 23:59:59.000002",INTERVAL "999999" MICROSECOND) as exp;
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1 1:1:1.000002" DAY_MICROSECOND);
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1:1.000002" HOUR_MICROSECOND);
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1.000002" MINUTE_MICROSECOND);
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1.000002" SECOND_MICROSECOND);
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "000002" MICROSECOND);
--enable_view_protocol
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1 1:1:1.000002" DAY_MICROSECOND) as exp;
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1:1.000002" HOUR_MICROSECOND) as exp;
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1.000002" MINUTE_MICROSECOND) as exp;
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1.000002" SECOND_MICROSECOND) as exp;
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "000002" MICROSECOND) as exp;
#Date functions
select adddate("1997-12-31 23:59:59.000001", 10);
@ -54,27 +51,21 @@ select makedate(100,1);
#Time functions
select addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002");
select subtime("1997-12-31 23:59:59.000001", "1 1:1:1.000002");
#enable after fix MDEV-27871
--disable_view_protocol
select addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
select subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
--enable_view_protocol
select subtime("01:00:00.999999", "02:00:00.999998");
select subtime("02:01:01.999999", "01:01:01.999999");
select addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002") as exp;
select subtime("1997-12-31 23:59:59.000001", "1 1:1:1.000002") as exp;
select addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999") as exp;
select subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999") as exp;
select subtime("01:00:00.999999", "02:00:00.999998") as exp;
select subtime("02:01:01.999999", "01:01:01.999999") as exp;
# PS doesn't support fractional seconds
--disable_ps_protocol
#enable after fix MDEV-27871
--disable_view_protocol
select timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002");
select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002");
select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002");
--enable_view_protocol
select timediff("1997-12-31 23:59:59.000001","23:59:59.000001");
select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001");
select timediff("2005-01-11 15:48:49.999999", "2005-01-11 15:48:50");
select timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002") as exp;
select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002") as exp;
select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002") as exp;
select timediff("1997-12-31 23:59:59.000001","23:59:59.000001") as exp;
select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001") as exp;
select timediff("2005-01-11 15:48:49.999999", "2005-01-11 15:48:50") as exp;
--enable_ps_protocol
select maketime(10,11,12);
@ -152,12 +143,9 @@ select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f");
#
# calculations involving negative time values ignored sign
#enable after fix MDEV-27871
--disable_view_protocol
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10'),time('00:00:00');
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00');
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00');
--enable_view_protocol
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10'),time('00:00:00') as exp;
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00') as exp;
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00') as exp;
# show that conversion to DECIMAL no longer drops sign
SELECT CAST(time('-73:42:12') AS DECIMAL);

View file

@ -88,19 +88,14 @@ INTERVAL(0.0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
8
SELECT INTERVAL(0.0, CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL));
INTERVAL(0.0, CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL))
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL)) as exp;
exp
8
SELECT INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL));
INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL))
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL)) as exp;
exp
8
End of 5.0 tests
drop table if exists t1;
@ -167,8 +162,8 @@ DROP TABLE t1, t2;
#
CREATE TABLE t1 (pk INT PRIMARY KEY);
INSERT INTO t1 VALUES (10),(11);
SELECT INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 ) FROM t1;
INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 )
SELECT INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 ) as exp FROM t1;
exp
8
8
Warnings:

View file

@ -63,16 +63,13 @@ SELECT INTERVAL(0.0, NULL);
SELECT INTERVAL(0.0, CAST(NULL AS DECIMAL));
SELECT INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL));
SELECT INTERVAL(0.0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
#enable after fix MDEV-27871
--disable_view_protocol
SELECT INTERVAL(0.0, CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL));
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL)) as exp;
SELECT INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL));
--enable_view_protocol
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL)) as exp;
--echo End of 5.0 tests
@ -108,13 +105,10 @@ DROP TABLE t1, t2;
--echo #
--echo # MDEV-4512 Valgrind warnings in my_long10_to_str_8bit on INTERVAL and DATE_ADD with incorrect types
--echo #
#enable after fix MDEV-27871
--disable_view_protocol
CREATE TABLE t1 (pk INT PRIMARY KEY);
INSERT INTO t1 VALUES (10),(11);
SELECT INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 ) FROM t1;
SELECT INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 ) as exp FROM t1;
DROP TABLE t1;
--enable_view_protocol
--echo #
--echo # End of 5.3 tests

View file

@ -5272,5 +5272,17 @@ SELECT GROUP_CONCAT( UpdateXML( '<a>new year</a>', '/a', '2019-01-01 00:00:00' )
f
2019-01-01 00:00:00F}^i
#
# MDEV-31184 Remove parser tokens DECODE_MARIADB_SYM and DECODE_ORACLE_SYM
#
SELECT DECODE();
ERROR 42000: Incorrect parameter count in the call to native function 'DECODE'
SELECT DECODE(NULL);
ERROR 42000: Incorrect parameter count in the call to native function 'DECODE'
SELECT DECODE(NULL,NULL);
DECODE(NULL,NULL)
NULL
SELECT DECODE(NULL, NULL, NULL);
ERROR 42000: Incorrect parameter count in the call to native function 'DECODE'
#
# End of 10.4 tests
#

View file

@ -2313,6 +2313,19 @@ DROP TABLE t1,t2;
SELECT GROUP_CONCAT( UpdateXML( '<a>new year</a>', '/a', '2019-01-01 00:00:00' ), ENCODE('text','pass') ) AS f;
--echo #
--echo # MDEV-31184 Remove parser tokens DECODE_MARIADB_SYM and DECODE_ORACLE_SYM
--echo #
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
SELECT DECODE();
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
SELECT DECODE(NULL);
SELECT DECODE(NULL,NULL);
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
SELECT DECODE(NULL, NULL, NULL);
--echo #
--echo # End of 10.4 tests
--echo #

View file

@ -9,8 +9,8 @@ period_add("9602",-12) period_diff(199505,"9404")
select now()-now(),weekday(curdate())-weekday(now()),unix_timestamp()-unix_timestamp(now());
now()-now() weekday(curdate())-weekday(now()) unix_timestamp()-unix_timestamp(now())
0 0 0
select from_unixtime(unix_timestamp("1994-03-02 10:11:12")),from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s"),from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0;
from_unixtime(unix_timestamp("1994-03-02 10:11:12")) from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s") from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0
select from_unixtime(unix_timestamp("1994-03-02 10:11:12")) as e1,from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s") as e2,from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0 as e3;
e1 e2 e3
1994-03-02 10:11:12 1994-03-02 10:11:12 19940302101112
select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"),
sec_to_time(time_to_sec("0:30:47")/6.21);
@ -45,20 +45,20 @@ Warning 1292 Truncated incorrect seconds value: '99999999999999999999999999999'
select now()-curdate()*1000000-curtime();
now()-curdate()*1000000-curtime()
0
select strcmp(current_timestamp(),concat(current_date()," ",current_time()));
strcmp(current_timestamp(),concat(current_date()," ",current_time()))
select strcmp(current_timestamp(),concat(current_date()," ",current_time())) as exp;
exp
0
select strcmp(localtime(),concat(current_date()," ",current_time()));
strcmp(localtime(),concat(current_date()," ",current_time()))
select strcmp(localtime(),concat(current_date()," ",current_time())) as exp;
exp
0
select strcmp(localtimestamp(),concat(current_date()," ",current_time()));
strcmp(localtimestamp(),concat(current_date()," ",current_time()))
select strcmp(localtimestamp(),concat(current_date()," ",current_time())) as exp;
exp
0
select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w");
date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")
select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w") as exp;
exp
January Thursday 2nd 1997 97 01 02 03 04 05 4
select date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w"));
date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w"))
select date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w")) as exp;
exp
January Thursday 2nd 1997 97 01 02 12 00 00 4
select dayofmonth("1997-01-02"),dayofmonth(19970323);
dayofmonth("1997-01-02") dayofmonth(19970323)
@ -179,11 +179,11 @@ time_format(131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T') date_format(19980131131415,'%H|
select time_format(010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
time_format(010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T') date_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T')
01|01|1|1|00|AM|01:00:15 AM|15|01:00:15 01|01|1|1|00|AM|01:00:15 AM|15|01:00:15
select date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w')
select date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w') as exp;
exp
13|01|13|1|14|PM|01:14:15 PM|15|13:14:15| January|Saturday|31st|1998|98|Sat|Jan|031|01|31|01|15|6
select date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w')
select date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w') as exp;
exp
NULL
select date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND);
date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)
@ -297,14 +297,14 @@ date_add("1997-12-31 23:59:59",INTERVAL "10000:1" DAY_HOUR)
select date_add("1997-12-31 23:59:59",INTERVAL "-100 1" YEAR_MONTH);
date_add("1997-12-31 23:59:59",INTERVAL "-100 1" YEAR_MONTH)
1897-11-30 23:59:59
select date_add("1997-12-31 23:59:59",INTERVAL "10000:99:99" HOUR_SECOND);
date_add("1997-12-31 23:59:59",INTERVAL "10000:99:99" HOUR_SECOND)
select date_add("1997-12-31 23:59:59",INTERVAL "10000:99:99" HOUR_SECOND) as exp;
exp
1999-02-21 17:40:38
select date_add("1997-12-31 23:59:59",INTERVAL " -10000 99:99" DAY_MINUTE);
date_add("1997-12-31 23:59:59",INTERVAL " -10000 99:99" DAY_MINUTE)
select date_add("1997-12-31 23:59:59",INTERVAL " -10000 99:99" DAY_MINUTE) as exp;
exp
1970-08-11 19:20:59
select date_add("1997-12-31 23:59:59",INTERVAL "10000 99:99:99" DAY_SECOND);
date_add("1997-12-31 23:59:59",INTERVAL "10000 99:99:99" DAY_SECOND)
select date_add("1997-12-31 23:59:59",INTERVAL "10000 99:99:99" DAY_SECOND) as exp;
exp
2025-05-23 04:40:38
select "1997-12-31 23:59:59" + INTERVAL 1 SECOND;
"1997-12-31 23:59:59" + INTERVAL 1 SECOND
@ -427,11 +427,11 @@ quarter
SELECT EXTRACT(QUARTER FROM '2004-12-15') AS quarter;
quarter
4
SELECT DATE_SUB(str_to_date('9999-12-31 00:01:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE);
DATE_SUB(str_to_date('9999-12-31 00:01:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE)
SELECT DATE_SUB(str_to_date('9999-12-31 00:01:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE) as exp;
exp
9999-12-31 00:00:00
SELECT DATE_ADD(str_to_date('9999-12-30 23:59:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE);
DATE_ADD(str_to_date('9999-12-30 23:59:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE)
SELECT DATE_ADD(str_to_date('9999-12-30 23:59:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE) as exp;
exp
9999-12-31 00:00:00
SELECT "1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND;
"1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND
@ -439,8 +439,8 @@ SELECT "1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND;
SELECT "1900-01-01 00:00:00" + INTERVAL "1:2147483647" MINUTE_SECOND;
"1900-01-01 00:00:00" + INTERVAL "1:2147483647" MINUTE_SECOND
1968-01-20 03:15:07
SELECT "1900-01-01 00:00:00" + INTERVAL "100000000:214748364700" MINUTE_SECOND;
"1900-01-01 00:00:00" + INTERVAL "100000000:214748364700" MINUTE_SECOND
SELECT "1900-01-01 00:00:00" + INTERVAL "100000000:214748364700" MINUTE_SECOND as exp;
exp
8895-03-27 22:11:40
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<37 SECOND;
"1900-01-01 00:00:00" + INTERVAL 1<<37 SECOND
@ -466,8 +466,8 @@ SELECT "1900-01-01 00:00:00" + INTERVAL 1<<30 HOUR;
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
SELECT "1900-01-01 00:00:00" + INTERVAL "1000000000:214748364700" MINUTE_SECOND;
"1900-01-01 00:00:00" + INTERVAL "1000000000:214748364700" MINUTE_SECOND
SELECT "1900-01-01 00:00:00" + INTERVAL "1000000000:214748364700" MINUTE_SECOND as exp;
exp
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
@ -856,14 +856,14 @@ last_day("1997-12-1")+0
select last_day("1997-12-1")+0.0;
last_day("1997-12-1")+0.0
19971231.0
select strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0;
strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0
select strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0 as exp;
exp
1
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%T"), utc_time())=0;
strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%T"), utc_time())=0
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%T"), utc_time())=0 as exp;
exp
1
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0;
strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0 as exp;
exp
1
select strcmp(date_format(utc_timestamp(),"%T"), utc_time())=0;
strcmp(date_format(utc_timestamp(),"%T"), utc_time())=0
@ -1239,8 +1239,8 @@ set time_zone= @@global.time_zone;
select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE;
str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE
22:10:00
select str_to_date("1997-00-04 22:23:00","%Y-%m-%D") + interval 10 minute;
str_to_date("1997-00-04 22:23:00","%Y-%m-%D") + interval 10 minute
select str_to_date("1997-00-04 22:23:00","%Y-%m-%D") + interval 10 minute as exp;
exp
NULL
Warnings:
Warning 1292 Truncated incorrect date value: '1997-00-04 22:23:00'
@ -1310,8 +1310,8 @@ DATE_ADD(20071108, INTERVAL 1 DAY)
select LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND;
LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND
2007-12-30 23:59:59
select date_add('1000-01-01 00:00:00', interval '1.03:02:01.05' day_microsecond);
date_add('1000-01-01 00:00:00', interval '1.03:02:01.05' day_microsecond)
select date_add('1000-01-01 00:00:00', interval '1.03:02:01.05' day_microsecond) as exp;
exp
1000-01-02 03:02:01.050000
select date_add('1000-01-01 00:00:00', interval '1.02' day_microsecond);
date_add('1000-01-01 00:00:00', interval '1.02' day_microsecond)
@ -1756,8 +1756,8 @@ UNIX_TIMESTAMP('2015-06-00')
NULL
Warnings:
Warning 1292 Incorrect datetime value: '2015-06-00'
SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s'));
UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s'))
SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s')) as exp;
exp
NULL
Warnings:
Warning 1411 Incorrect datetime value: '0000-00-00 10:30:30' for function str_to_date
@ -1775,8 +1775,8 @@ UNIX_TIMESTAMP('2015-06-00')
NULL
Warnings:
Warning 1292 Incorrect datetime value: '2015-06-00'
SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s'));
UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s'))
SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s')) as exp;
exp
NULL
Warnings:
Warning 1411 Incorrect datetime value: '0000-00-00 10:30:30' for function str_to_date
@ -1847,8 +1847,8 @@ cast('131415.123e0' as time)
NULL
Warnings:
Warning 1292 Incorrect time value: '131415.123e0'
select cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04';
cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04'
select cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04' as exp;
exp
0
select least(time('1:2:3'), '01:02:04', null) div 1;
least(time('1:2:3'), '01:02:04', null) div 1
@ -1902,8 +1902,9 @@ f2
0
drop table t1;
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow');
convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow')
select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06'
as datetime)), 'UTC', 'Europe/Moscow') as exp;
exp
NULL
SET timestamp=DEFAULT;
create table t1 (f1 integer, f2 date);
@ -1972,17 +1973,17 @@ SET timestamp=UNIX_TIMESTAMP('2014-06-01 10:20:30');
select greatest(cast("0-0-0" as date), cast("10:20:05" as time));
greatest(cast("0-0-0" as date), cast("10:20:05" as time))
2014-06-01 10:20:05
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00';
greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00'
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00' as exp;
exp
0
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01';
greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01'
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01' as exp;
exp
0
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01 10:20:05';
greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01 10:20:05'
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01 10:20:05' as exp;
exp
1
select cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6));
cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6))
select cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6)) as exp;
exp
2014-06-01 10:20:05.000000
SET timestamp=DEFAULT;
select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010');
@ -3016,66 +3017,66 @@ Warning 1292 Truncated incorrect time value: '-1441:00:00'
#
CREATE TABLE t1 (d DATE);
INSERT INTO t1 VALUES ('2005-07-20'),('2012-12-21');
SELECT REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' ) FROM t1;
REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' )
SELECT REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' ) as exp FROM t1;
exp
NULL
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
Warning 1441 Datetime function: datetime field overflow
SELECT REPLACE( ADDDATE( d, INTERVAL '0.6732771076944444' HOUR_SECOND ), '2', 'x' ) FROM t1;
REPLACE( ADDDATE( d, INTERVAL '0.6732771076944444' HOUR_SECOND ), '2', 'x' )
SELECT REPLACE( ADDDATE( d, INTERVAL '0.6732771076944444' HOUR_SECOND ), '2', 'x' ) as exp FROM t1;
exp
NULL
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
Warning 1441 Datetime function: datetime field overflow
SELECT CAST(ADDDATE( d, INTERVAL 6732771076944444 SECOND) AS CHAR) FROM t1;
CAST(ADDDATE( d, INTERVAL 6732771076944444 SECOND) AS CHAR)
SELECT CAST(ADDDATE( d, INTERVAL 6732771076944444 SECOND) AS CHAR) as exp FROM t1;
exp
NULL
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
Warning 1441 Datetime function: datetime field overflow
SELECT CAST(ADDDATE( d, INTERVAL '67327710769444:44' HOUR_SECOND) AS CHAR) FROM t1;
CAST(ADDDATE( d, INTERVAL '67327710769444:44' HOUR_SECOND) AS CHAR)
SELECT CAST(ADDDATE( d, INTERVAL '67327710769444:44' HOUR_SECOND) AS CHAR) as exp FROM t1;
exp
NULL
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
Warning 1441 Datetime function: datetime field overflow
SELECT CAST(ADDDATE( d, INTERVAL '673277107694:44:44' HOUR_SECOND) AS CHAR) FROM t1;
CAST(ADDDATE( d, INTERVAL '673277107694:44:44' HOUR_SECOND) AS CHAR)
SELECT CAST(ADDDATE( d, INTERVAL '673277107694:44:44' HOUR_SECOND) AS CHAR) as exp FROM t1;
exp
NULL
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
Warning 1441 Datetime function: datetime field overflow
DROP TABLE t1;
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:23:59:59' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '3652423:23:59:59' DAY_SECOND)
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:23:59:59' DAY_SECOND) as exp;
exp
9999-12-31 23:59:59
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:59:59' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:59:59' DAY_SECOND)
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:59:59' DAY_SECOND) as exp;
exp
9999-12-31 23:59:59
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:59' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:59' DAY_SECOND)
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:59' DAY_SECOND) as exp;
exp
9999-12-31 23:59:59
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND)
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND) as exp;
exp
9999-12-31 23:59:59
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND)
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND) as exp;
exp
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND)
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND) as exp;
exp
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND)
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND) as exp;
exp
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
@ -3098,8 +3099,8 @@ NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
DROP TABLE t1;
SELECT CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR));
CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR))
SELECT CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR)) as exp;
exp
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow

View file

@ -12,10 +12,7 @@ select from_days(to_days("960101")),to_days(960201)-to_days("19960101"),to_days(
select period_add("9602",-12),period_diff(199505,"9404") ;
select now()-now(),weekday(curdate())-weekday(now()),unix_timestamp()-unix_timestamp(now());
#enable after fix MDEV-27871
--disable_view_protocol
select from_unixtime(unix_timestamp("1994-03-02 10:11:12")),from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s"),from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0;
--enable_view_protocol
select from_unixtime(unix_timestamp("1994-03-02 10:11:12")) as e1,from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s") as e2,from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0 as e3;
select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"),
sec_to_time(time_to_sec("0:30:47")/6.21);
select sec_to_time(9001.1), time_to_sec('15:12:22.123456'), time_to_sec(15.5566778899);
@ -27,14 +24,11 @@ select sec_to_time(-9001.1), sec_to_time(-9001.1) / 1,
select sec_to_time(90011e-1), sec_to_time(1234567890123e30);
select sec_to_time(1234567890123), sec_to_time('99999999999999999999999999999');
select now()-curdate()*1000000-curtime();
#enable after fix MDEV-27871
--disable_view_protocol
select strcmp(current_timestamp(),concat(current_date()," ",current_time()));
select strcmp(localtime(),concat(current_date()," ",current_time()));
select strcmp(localtimestamp(),concat(current_date()," ",current_time()));
select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w");
select date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w"));
--enable_view_protocol
select strcmp(current_timestamp(),concat(current_date()," ",current_time())) as exp;
select strcmp(localtime(),concat(current_date()," ",current_time())) as exp;
select strcmp(localtimestamp(),concat(current_date()," ",current_time())) as exp;
select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w") as exp;
select date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w")) as exp;
select dayofmonth("1997-01-02"),dayofmonth(19970323);
select month("1997-01-02"),year("98-02-03"),dayofyear("1997-12-31");
select month("2001-02-00"),year("2001-00-00");
@ -84,11 +78,8 @@ select time_format(000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(199801310000
select time_format(010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
select time_format(131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
select time_format(010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
#enable after fix MDEV-27871
--disable_view_protocol
select date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
select date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
--enable_view_protocol
select date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w') as exp;
select date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w') as exp;
select date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND);
select date_add("1997-12-31 23:59:59",INTERVAL 1 MINUTE);
select date_add("1997-12-31 23:59:59",INTERVAL 1 HOUR);
@ -127,12 +118,9 @@ select date_add("1997-12-31 23:59:59",INTERVAL "10000:1" MINUTE_SECOND);
select date_add("1997-12-31 23:59:59",INTERVAL "-10000:1" HOUR_MINUTE);
select date_add("1997-12-31 23:59:59",INTERVAL "10000:1" DAY_HOUR);
select date_add("1997-12-31 23:59:59",INTERVAL "-100 1" YEAR_MONTH);
#enable after fix MDEV-27871
--disable_view_protocol
select date_add("1997-12-31 23:59:59",INTERVAL "10000:99:99" HOUR_SECOND);
select date_add("1997-12-31 23:59:59",INTERVAL " -10000 99:99" DAY_MINUTE);
select date_add("1997-12-31 23:59:59",INTERVAL "10000 99:99:99" DAY_SECOND);
--enable_view_protocol
select date_add("1997-12-31 23:59:59",INTERVAL "10000:99:99" HOUR_SECOND) as exp;
select date_add("1997-12-31 23:59:59",INTERVAL " -10000 99:99" DAY_MINUTE) as exp;
select date_add("1997-12-31 23:59:59",INTERVAL "10000 99:99:99" DAY_SECOND) as exp;
select "1997-12-31 23:59:59" + INTERVAL 1 SECOND;
select INTERVAL 1 DAY + "1997-12-31";
select "1998-01-01 00:00:00" - INTERVAL 1 SECOND;
@ -181,21 +169,15 @@ SELECT EXTRACT(QUARTER FROM '2004-12-15') AS quarter;
#
# MySQL Bugs: #12356: DATE_SUB or DATE_ADD incorrectly returns null
#
#enable after fix MDEV-27871
--disable_view_protocol
SELECT DATE_SUB(str_to_date('9999-12-31 00:01:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE);
SELECT DATE_ADD(str_to_date('9999-12-30 23:59:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE);
--enable_view_protocol
SELECT DATE_SUB(str_to_date('9999-12-31 00:01:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE) as exp;
SELECT DATE_ADD(str_to_date('9999-12-30 23:59:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE) as exp;
#
# Test big intervals (Bug #3498)
#
SELECT "1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND;
SELECT "1900-01-01 00:00:00" + INTERVAL "1:2147483647" MINUTE_SECOND;
#enable after fix MDEV-27871
--disable_view_protocol
SELECT "1900-01-01 00:00:00" + INTERVAL "100000000:214748364700" MINUTE_SECOND;
--disable_view_protocol
SELECT "1900-01-01 00:00:00" + INTERVAL "100000000:214748364700" MINUTE_SECOND as exp;
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<37 SECOND;
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<31 MINUTE;
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<20 HOUR;
@ -203,7 +185,7 @@ SELECT "1900-01-01 00:00:00" + INTERVAL 1<<20 HOUR;
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<38 SECOND;
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<33 MINUTE;
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<30 HOUR;
SELECT "1900-01-01 00:00:00" + INTERVAL "1000000000:214748364700" MINUTE_SECOND;
SELECT "1900-01-01 00:00:00" + INTERVAL "1000000000:214748364700" MINUTE_SECOND as exp;
#
# Bug #614 (multiple extracts in where)
@ -445,12 +427,9 @@ select last_day("1997-12-1")+0.0;
# Test SAPDB UTC_% functions. This part is TZ dependant (It is supposed that
# TZ variable set to GMT-3
#enable after fix MDEV-27871
--disable_view_protocol
select strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0;
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%T"), utc_time())=0;
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0;
--enable_view_protocol
select strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0 as exp;
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%T"), utc_time())=0 as exp;
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0 as exp;
select strcmp(date_format(utc_timestamp(),"%T"), utc_time())=0;
select strcmp(date_format(utc_timestamp(),"%Y-%m-%d"), utc_date())=0;
select strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0;
@ -753,10 +732,7 @@ set time_zone= @@global.time_zone;
#
select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE;
#enable after fix MDEV-27871
--disable_view_protocol
select str_to_date("1997-00-04 22:23:00","%Y-%m-%D") + interval 10 minute;
--enable_view_protocol
select str_to_date("1997-00-04 22:23:00","%Y-%m-%D") + interval 10 minute as exp;
#
# Bug #21103: DATE column not compared as DATE
@ -846,10 +822,7 @@ select LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND;
# show that we treat fractions of seconds correctly (zerofill from right to
# six places) even if we left out fields on the left.
#enable after fix MDEV-27871
--disable_view_protocol
select date_add('1000-01-01 00:00:00', interval '1.03:02:01.05' day_microsecond);
--enable_view_protocol
select date_add('1000-01-01 00:00:00', interval '1.03:02:01.05' day_microsecond) as exp;
select date_add('1000-01-01 00:00:00', interval '1.02' day_microsecond);
@ -1090,19 +1063,13 @@ SET timestamp=DEFAULT;
SELECT UNIX_TIMESTAMP(STR_TO_DATE('201506', "%Y%m"));
SELECT UNIX_TIMESTAMP('2015-06-00');
#enable after fix MDEV-27871
--disable_view_protocol
SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s'));
--enable_view_protocol
SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s')) as exp;
set sql_mode= 'TRADITIONAL';
SELECT @@sql_mode;
SELECT UNIX_TIMESTAMP(STR_TO_DATE('201506', "%Y%m"));
SELECT UNIX_TIMESTAMP('2015-06-00');
#enable after fix MDEV-27871
--disable_view_protocol
SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s'));
--enable_view_protocol
SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s')) as exp;
set sql_mode= default;
@ -1131,10 +1098,7 @@ select time('10 02:03:04') + interval 1 year;
# specially constructed queries to reach obscure places in the code
# not touched by the more "normal" queries (and to increase the coverage)
select cast('131415.123e0' as time);
#enable after fix MDEV-27871
--disable_view_protocol
select cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04';
--enable_view_protocol
select cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04' as exp;
select least(time('1:2:3'), '01:02:04', null) div 1;
select truncate(least(time('1:2:3'), '01:02:04', null), 6);
select cast(least(time('1:2:3'), '01:02:04', null) as decimal(3,1));
@ -1171,12 +1135,10 @@ drop table t1;
#
# lp:731815 Crash/valgrind warning Item::send with 5.1-micro
#
#enable after fix MDEV-27871
--disable_view_protocol
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow');
select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06'
as datetime)), 'UTC', 'Europe/Moscow') as exp;
SET timestamp=DEFAULT;
--enable_view_protocol
#
# lp:736370 Datetime functions in subquery context cause wrong result and bogus warnings in mysql-5.1-micr
@ -1247,13 +1209,10 @@ drop table t1;
SET timestamp=UNIX_TIMESTAMP('2014-06-01 10:20:30');
select greatest(cast("0-0-0" as date), cast("10:20:05" as time));
#enable after fix MDEV-27871
--disable_view_protocol
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00';
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01';
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01 10:20:05';
select cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6));
--enable_view_protocol
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00' as exp;
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01' as exp;
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01 10:20:05' as exp;
select cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6)) as exp;
SET timestamp=DEFAULT;
select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010');
@ -1852,28 +1811,25 @@ SELECT
--echo #
--echo # MDEV-10787 Assertion `ltime->neg == 0' failed in void date_to_datetime(MYSQL_TIME*)
--echo #
#enable after fix MDEV-27871
--disable_view_protocol
CREATE TABLE t1 (d DATE);
INSERT INTO t1 VALUES ('2005-07-20'),('2012-12-21');
SELECT REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' ) FROM t1;
SELECT REPLACE( ADDDATE( d, INTERVAL '0.6732771076944444' HOUR_SECOND ), '2', 'x' ) FROM t1;
SELECT CAST(ADDDATE( d, INTERVAL 6732771076944444 SECOND) AS CHAR) FROM t1;
SELECT CAST(ADDDATE( d, INTERVAL '67327710769444:44' HOUR_SECOND) AS CHAR) FROM t1;
SELECT CAST(ADDDATE( d, INTERVAL '673277107694:44:44' HOUR_SECOND) AS CHAR) FROM t1;
SELECT REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' ) as exp FROM t1;
SELECT REPLACE( ADDDATE( d, INTERVAL '0.6732771076944444' HOUR_SECOND ), '2', 'x' ) as exp FROM t1;
SELECT CAST(ADDDATE( d, INTERVAL 6732771076944444 SECOND) AS CHAR) as exp FROM t1;
SELECT CAST(ADDDATE( d, INTERVAL '67327710769444:44' HOUR_SECOND) AS CHAR) as exp FROM t1;
SELECT CAST(ADDDATE( d, INTERVAL '673277107694:44:44' HOUR_SECOND) AS CHAR) as exp FROM t1;
DROP TABLE t1;
# Maximum possible DAY_SECOND values in various formats
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:23:59:59' DAY_SECOND);
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:59:59' DAY_SECOND);
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:59' DAY_SECOND);
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND);
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:23:59:59' DAY_SECOND) as exp;
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:59:59' DAY_SECOND) as exp;
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:59' DAY_SECOND) as exp;
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND) as exp;
# Out-of-range INTERVAL DAY_SECOND values
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND);
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND);
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND);
--disable_view_protocol
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND) as exp;
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND) as exp;
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND) as exp;
--echo #
--echo # MDEV-13202 Assertion `ltime->neg == 0' failed in date_to_datetime
@ -1889,7 +1845,7 @@ INSERT INTO t1 VALUES (1, '1970-01-01');
SELECT CONCAT(DATE_SUB(d, INTERVAL 17300000 HOUR)) FROM t1;
DROP TABLE t1;
SELECT CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR));
SELECT CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR)) as exp;
--echo #

View file

@ -1,44 +1,44 @@
select st_asgeojson(geomfromtext('POINT(1 1)'));
st_asgeojson(geomfromtext('POINT(1 1)'))
select st_asgeojson(geomfromtext('POINT(1 1)')) as exp;
exp
{"type": "Point", "coordinates": [1, 1]}
select st_asgeojson(geomfromtext('LINESTRING(10 10,20 10,20 20,10 20,10 10)'));
st_asgeojson(geomfromtext('LINESTRING(10 10,20 10,20 20,10 20,10 10)'))
select st_asgeojson(geomfromtext('LINESTRING(10 10,20 10,20 20,10 20,10 10)')) as exp;
exp
{"type": "LineString", "coordinates": [[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]}
select st_asgeojson(geomfromtext('POLYGON((10 10,20 10,20 20,10 20,10 10))'));
st_asgeojson(geomfromtext('POLYGON((10 10,20 10,20 20,10 20,10 10))'))
select st_asgeojson(geomfromtext('POLYGON((10 10,20 10,20 20,10 20,10 10))')) as exp;
exp
{"type": "Polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}
select st_asgeojson(geomfromtext('MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))'));
st_asgeojson(geomfromtext('MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))'))
select st_asgeojson(geomfromtext('MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))')) as exp;
exp
{"type": "MultiPolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}
select st_asgeojson(geomfromtext('multilinestring((10 10,20 10,20 20,10 20,10 10))'));
st_asgeojson(geomfromtext('multilinestring((10 10,20 10,20 20,10 20,10 10))'))
select st_asgeojson(geomfromtext('multilinestring((10 10,20 10,20 20,10 20,10 10))')) as exp;
exp
{"type": "MultiLineString", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}
select st_asgeojson(geomfromtext('multipoint(10 10,20 10,20 20,10 20,10 10)'));
st_asgeojson(geomfromtext('multipoint(10 10,20 10,20 20,10 20,10 10)'))
select st_asgeojson(geomfromtext('multipoint(10 10,20 10,20 20,10 20,10 10)')) as exp;
exp
{"type": "MultiPoint", "coordinates": [[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]}
select st_asgeojson(st_geomfromtext('GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))'));
st_asgeojson(st_geomfromtext('GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))'))
select st_asgeojson(st_geomfromtext('GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))')) as exp;
exp
{"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [100, 0]}, {"type": "LineString", "coordinates": [[101, 0], [102, 1]]}]}
SELECT st_astext(st_geomfromgeojson('{"type":"point","coordinates":[1,2]}'));
st_astext(st_geomfromgeojson('{"type":"point","coordinates":[1,2]}'))
SELECT st_astext(st_geomfromgeojson('{"type":"point","coordinates":[1,2]}')) as exp;
exp
POINT(1 2)
SELECT st_astext(st_geomfromgeojson('{"type":"LineString","coordinates":[[1,2],[4,5],[7,8]]}'));
st_astext(st_geomfromgeojson('{"type":"LineString","coordinates":[[1,2],[4,5],[7,8]]}'))
SELECT st_astext(st_geomfromgeojson('{"type":"LineString","coordinates":[[1,2],[4,5],[7,8]]}')) as exp;
exp
LINESTRING(1 2,4 5,7 8)
SELECT st_astext(st_geomfromgeojson('{"type": "polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'));
st_astext(st_geomfromgeojson('{"type": "polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'))
SELECT st_astext(st_geomfromgeojson('{"type": "polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}')) as exp;
exp
POLYGON((10 10,20 10,20 20,10 20,10 10))
SELECT st_astext(st_geomfromgeojson('{"type":"multipoint","coordinates":[[1,2],[4,5],[7,8]]}'));
st_astext(st_geomfromgeojson('{"type":"multipoint","coordinates":[[1,2],[4,5],[7,8]]}'))
SELECT st_astext(st_geomfromgeojson('{"type":"multipoint","coordinates":[[1,2],[4,5],[7,8]]}')) as exp;
exp
MULTIPOINT(1 2,4 5,7 8)
SELECT st_astext(st_geomfromgeojson('{"type": "multilinestring", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'));
st_astext(st_geomfromgeojson('{"type": "multilinestring", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'))
SELECT st_astext(st_geomfromgeojson('{"type": "multilinestring", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}')) as exp;
exp
MULTILINESTRING((10 10,20 10,20 20,10 20,10 10))
SELECT st_astext(st_geomfromgeojson('{"type": "multipolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}'));
st_astext(st_geomfromgeojson('{"type": "multipolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}'))
SELECT st_astext(st_geomfromgeojson('{"type": "multipolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}')) as exp;
exp
MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))
SELECT st_astext(st_geomfromgeojson('{"type": "GeometryCollection", "geometries": [{"type": "Point","coordinates": [100.0, 0.0]}, {"type": "LineString","coordinates": [[101.0, 0.0],[102.0, 1.0]]}]}'));
st_astext(st_geomfromgeojson('{"type": "GeometryCollection", "geometries": [{"type": "Point","coordinates": [100.0, 0.0]}, {"type": "LineString","coordinates": [[101.0, 0.0],[102.0, 1.0]]}]}'))
SELECT st_astext(st_geomfromgeojson('{"type": "GeometryCollection", "geometries": [{"type": "Point","coordinates": [100.0, 0.0]}, {"type": "LineString","coordinates": [[101.0, 0.0],[102.0, 1.0]]}]}')) as exp;
exp
GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))
SELECT st_astext(st_geomfromgeojson('{"type":"point"}'));
st_astext(st_geomfromgeojson('{"type":"point"}'))
@ -55,27 +55,27 @@ st_astext(st_geomfromgeojson('{"type""point"}'))
NULL
Warnings:
Warning 4038 Syntax error in JSON text in argument 1 to function 'st_geomfromgeojson' at position 7
SELECT st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }'));
st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }'))
SELECT st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }')) as exp;
exp
POINT(102 0.5)
SELECT st_astext(st_geomfromgeojson('{ "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "type": "Feature" }'));
st_astext(st_geomfromgeojson('{ "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "type": "Feature" }'))
SELECT st_astext(st_geomfromgeojson('{ "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "type": "Feature" }')) as exp;
exp
POINT(102 0.5)
SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'));
st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'))
SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}')) as exp;
exp
GEOMETRYCOLLECTION(POINT(102 0.5))
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',5));
ERROR HY000: Incorrect option value: '5' for function ST_GeomFromGeoJSON
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',1));
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',1)) as exp;
ERROR 22023: Invalid GIS data provided to function ST_GeomFromGeoJSON.
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2));
ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2))
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2)) as exp;
exp
POINT(5.3 15)
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3));
ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3))
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3)) as exp;
exp
POINT(5.3 15)
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4));
ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4))
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4)) as exp;
exp
POINT(5.3 15)
SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),2);
ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),2)
@ -107,16 +107,16 @@ a
NULL
Warnings:
Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array.
SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }");
ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }")
SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }") as exp;
exp
NULL
SELECT ST_ASTEXT (ST_GEOMFROMGEOJSON ('{ "type": "GEOMETRYCOLLECTION", "coordinates": [102.0, 0.0]}'));
ST_ASTEXT (ST_GEOMFROMGEOJSON ('{ "type": "GEOMETRYCOLLECTION", "coordinates": [102.0, 0.0]}'))
SELECT ST_ASTEXT (ST_GEOMFROMGEOJSON ('{ "type": "GEOMETRYCOLLECTION", "coordinates": [102.0, 0.0]}')) as exp;
exp
NULL
Warnings:
Warning 4048 Incorrect GeoJSON format specified for st_geomfromgeojson function.
SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON('{"type": ["POINT"], "coINates": [0,0] }'));
ST_ASTEXT(ST_GEOMFROMGEOJSON('{"type": ["POINT"], "coINates": [0,0] }'))
SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON('{"type": ["POINT"], "coINates": [0,0] }')) as exp;
exp
NULL
Warnings:
Warning 4048 Incorrect GeoJSON format specified for st_geomfromgeojson function.

View file

@ -1,46 +1,39 @@
-- source include/have_geometry.inc
#enable after fix MDEV-27871
--disable_view_protocol
select st_asgeojson(geomfromtext('POINT(1 1)'));
select st_asgeojson(geomfromtext('LINESTRING(10 10,20 10,20 20,10 20,10 10)'));
select st_asgeojson(geomfromtext('POLYGON((10 10,20 10,20 20,10 20,10 10))'));
select st_asgeojson(geomfromtext('MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))'));
select st_asgeojson(geomfromtext('multilinestring((10 10,20 10,20 20,10 20,10 10))'));
select st_asgeojson(geomfromtext('multipoint(10 10,20 10,20 20,10 20,10 10)'));
select st_asgeojson(st_geomfromtext('GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))'));
select st_asgeojson(geomfromtext('POINT(1 1)')) as exp;
select st_asgeojson(geomfromtext('LINESTRING(10 10,20 10,20 20,10 20,10 10)')) as exp;
select st_asgeojson(geomfromtext('POLYGON((10 10,20 10,20 20,10 20,10 10))')) as exp;
select st_asgeojson(geomfromtext('MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))')) as exp;
select st_asgeojson(geomfromtext('multilinestring((10 10,20 10,20 20,10 20,10 10))')) as exp;
select st_asgeojson(geomfromtext('multipoint(10 10,20 10,20 20,10 20,10 10)')) as exp;
select st_asgeojson(st_geomfromtext('GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))')) as exp;
SELECT st_astext(st_geomfromgeojson('{"type":"point","coordinates":[1,2]}'));
SELECT st_astext(st_geomfromgeojson('{"type":"LineString","coordinates":[[1,2],[4,5],[7,8]]}'));
SELECT st_astext(st_geomfromgeojson('{"type": "polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'));
SELECT st_astext(st_geomfromgeojson('{"type":"multipoint","coordinates":[[1,2],[4,5],[7,8]]}'));
SELECT st_astext(st_geomfromgeojson('{"type": "multilinestring", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'));
SELECT st_astext(st_geomfromgeojson('{"type": "multipolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}'));
SELECT st_astext(st_geomfromgeojson('{"type": "GeometryCollection", "geometries": [{"type": "Point","coordinates": [100.0, 0.0]}, {"type": "LineString","coordinates": [[101.0, 0.0],[102.0, 1.0]]}]}'));
--enable_view_protocol
SELECT st_astext(st_geomfromgeojson('{"type":"point","coordinates":[1,2]}')) as exp;
SELECT st_astext(st_geomfromgeojson('{"type":"LineString","coordinates":[[1,2],[4,5],[7,8]]}')) as exp;
SELECT st_astext(st_geomfromgeojson('{"type": "polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}')) as exp;
SELECT st_astext(st_geomfromgeojson('{"type":"multipoint","coordinates":[[1,2],[4,5],[7,8]]}')) as exp;
SELECT st_astext(st_geomfromgeojson('{"type": "multilinestring", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}')) as exp;
SELECT st_astext(st_geomfromgeojson('{"type": "multipolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}')) as exp;
SELECT st_astext(st_geomfromgeojson('{"type": "GeometryCollection", "geometries": [{"type": "Point","coordinates": [100.0, 0.0]}, {"type": "LineString","coordinates": [[101.0, 0.0],[102.0, 1.0]]}]}')) as exp;
SELECT st_astext(st_geomfromgeojson('{"type":"point"}'));
SELECT st_astext(st_geomfromgeojson('{"type":"point"'));
SELECT st_astext(st_geomfromgeojson('{"type""point"}'));
#enable after fix MDEV-27871
--disable_view_protocol
SELECT st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }'));
SELECT st_astext(st_geomfromgeojson('{ "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "type": "Feature" }'));
SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'));
SELECT st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }')) as exp;
SELECT st_astext(st_geomfromgeojson('{ "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "type": "Feature" }')) as exp;
SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}')) as exp;
--error ER_WRONG_VALUE_FOR_TYPE
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',5));
--error ER_GIS_INVALID_DATA
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',1));
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',1)) as exp;
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2));
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3));
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4));
--enable_view_protocol
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2)) as exp;
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3)) as exp;
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4)) as exp;
SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),2);
SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),1);
@ -53,20 +46,15 @@ SELECT st_astext(st_geomfromgeojson('{"type": "MultiLineString","coordinates": [
SELECT st_astext(st_geomfromgeojson('{"type": "Polygon","coordinates": []}')) as a;
SELECT st_astext(st_geomfromgeojson('{"type": "MultiPolygon","coordinates": []}')) as a;
#enable after fix MDEV-27871
--disable_view_protocol
SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }");
SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }") as exp;
#
# MDEV-25461 Assertion `je->state == JST_KEY' failed in Geometry::create_from_json.
#
SELECT ST_ASTEXT (ST_GEOMFROMGEOJSON ('{ "type": "GEOMETRYCOLLECTION", "coordinates": [102.0, 0.0]}'));
SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON('{"type": ["POINT"], "coINates": [0,0] }'));
--enable_view_protocol
SELECT ST_ASTEXT (ST_GEOMFROMGEOJSON ('{ "type": "GEOMETRYCOLLECTION", "coordinates": [102.0, 0.0]}')) as exp;
SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON('{"type": ["POINT"], "coINates": [0,0] }')) as exp;
--echo #
--echo # End of 10.2 tests
--echo #

View file

@ -463,8 +463,8 @@ gc geometrycollection YES NULL
gm geometry YES NULL
fid int(11) NO NULL
DROP TABLE t1;
SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))
SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)')))) as exp;
exp
POINT(1 4)
explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
id select_type table type possible_keys key key_len ref rows filtered Extra
@ -696,11 +696,11 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (pointfromtext('point(1,1)'));
ERROR 23000: Column 'fl' cannot be null
drop table t1;
select (asWKT(geomfromwkb((0x000000000140240000000000004024000000000000))));
(asWKT(geomfromwkb((0x000000000140240000000000004024000000000000))))
select (asWKT(geomfromwkb((0x000000000140240000000000004024000000000000)))) as exp;
exp
POINT(10 10)
select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440))));
(asWKT(geomfromwkb((0x010100000000000000000024400000000000002440))))
select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440)))) as exp;
exp
POINT(10 10)
create table t1 (g GEOMETRY);
select * from t1;
@ -1135,30 +1135,30 @@ NULL
select envelope(0x0100000000030000000100000000000010);
envelope(0x0100000000030000000100000000000010)
NULL
select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1);
geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1)
select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1) as exp;
exp
NULL
select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1);
geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1)
select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1) as exp;
exp
NULL
#
# MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy
#
SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) )));
Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) )))
SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) ))) as exp;
exp
NULL
#
# MDEV-4295 Server crashes in get_point on a query with Area, AsBinary, MultiPoint
#
SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2))));
Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2))))
SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2)))) as exp;
exp
NULL
End of 5.1 tests
select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'));
ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'))
select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))')) as exp;
exp
1.5
select ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))'));
ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))'))
select ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))')) as exp;
exp
160
DROP DATABASE IF EXISTS gis_ogs;
CREATE DATABASE gis_ogs;
@ -1369,16 +1369,16 @@ FROM road_segments
WHERE fid = 102;
AsText(EndPoint(centerline))
POINT(44 31)
SELECT IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary)))
SELECT IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) as exp
FROM named_places
WHERE name = 'Goose Island';
IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary)))
exp
1
# Conformance Item T20
SELECT IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary)))
SELECT IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) as exp
FROM named_places
WHERE name = 'Goose Island';
IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary)))
exp
1
# Conformance Item T21
SELECT GLength(centerline)
@ -1477,11 +1477,10 @@ Area(shores)
8
# Conformance Item T37
SELECT ST_Equals(boundary,
PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) as exp
FROM named_places
WHERE name = 'Goose Island';
ST_Equals(boundary,
PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
exp
1
# Conformance Item T38
SELECT ST_Disjoint(centerlines, boundary)
@ -1519,11 +1518,11 @@ AND divided_routes.name = 'Route 75';
Crosses(road_segments.centerline, divided_routes.centerlines)
1
# Conformance Item T43
SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines) as exp
FROM road_segments, divided_routes
WHERE road_segments.fid = 102
AND divided_routes.name = 'Route 75';
ST_Intersects(road_segments.centerline, divided_routes.centerlines)
exp
1
# Conformance Item T44
SELECT ST_Contains(forests.boundary, named_places.boundary)
@ -1594,21 +1593,15 @@ select st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.134484524621,
-95.9673049102515 36.1343976584193)'),
geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) ;
st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.134484524621,
geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) as exp ;
exp
0.008148695928146028
select st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.134484524621,
-95.9673049102515 36.1343976584193) ')) ;
st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.
-95.9673049102515 36.1343976584193) ')) as exp ;
exp
0.008148695928146028
#
# MDEV-4310 geometry function equals hangs forever.
@ -1670,13 +1663,13 @@ ENVELOPE(0x0100000000030000000100000000000010)
NULL
#should not crash
SELECT
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1);
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1)
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1) as exp;
exp
NULL
#should not crash
SELECT
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1);
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1)
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1) as exp;
exp
NULL
#
# MDEV-3819 missing constraints for spatial column types
@ -1685,8 +1678,8 @@ create table t1 (pt point);
insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))'));
ERROR 22007: Incorrect POINT value: 'POLYGON((1 1,2 2,2 1,1 1))' for column `test`.`t1`.`pt` at row 1
drop table t1;
SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100));
st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100))
SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100)) as exp;
exp
GEOMETRYCOLLECTION EMPTY
CREATE VIEW v1 AS SELECT POINT(1,1) AS p;
SHOW CREATE VIEW v1;
@ -1824,14 +1817,14 @@ drop table t1;
select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,0 0)'));
ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,0 0)'))
1
select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)'));
ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)'))
select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)')) as exp;
exp
0
#
# MDEV-7514 GIS: PointOnSurface returns NULL instead of the point.
#
SELECT ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))')));
ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))')))
SELECT ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))'))) as exp;
exp
NULL
#
# MDEV-7529 GIS: ST_Relate returns unexpected results for POINT relations

View file

@ -83,11 +83,15 @@ SELECT fid, Dimension(g) FROM gis_geometry;
SELECT fid, GeometryType(g) FROM gis_geometry;
SELECT fid, IsEmpty(g) FROM gis_geometry;
SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
--disable_view_protocol
explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
--enable_view_protocol
SELECT fid, X(g) FROM gis_point;
SELECT fid, Y(g) FROM gis_point;
--disable_view_protocol
explain extended select X(g),Y(g) FROM gis_point;
--enable_view_protocol
SELECT fid, AsText(StartPoint(g)) FROM gis_line;
SELECT fid, AsText(EndPoint(g)) FROM gis_line;
@ -95,7 +99,9 @@ SELECT fid, GLength(g) FROM gis_line;
SELECT fid, NumPoints(g) FROM gis_line;
SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
SELECT fid, IsClosed(g) FROM gis_line;
--disable_view_protocol
explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line;
--enable_view_protocol
SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
SELECT fid, Area(g) FROM gis_polygon;
@ -113,14 +119,18 @@ SELECT fid, NumGeometries(g) from gis_multi_point;
SELECT fid, NumGeometries(g) from gis_multi_line;
SELECT fid, NumGeometries(g) from gis_multi_polygon;
SELECT fid, NumGeometries(g) from gis_geometrycollection;
--disable_view_protocol
explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
--enable_view_protocol
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
--disable_view_protocol
explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
--enable_view_protocol
#query plan for view protocol doesn't contain database name
--disable_view_protocol
@ -157,13 +167,18 @@ ALTER TABLE t1 ADD fid INT NOT NULL;
SHOW FIELDS FROM t1;
DROP TABLE t1;
SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)')))) as exp;
--disable_view_protocol
explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))));
--enable_view_protocol
SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
--disable_view_protocol
explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
#select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6)),issimple(PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),issimple(GeometryFromText('POINT(1 4)')), issimple(AsWKB(GeometryFromText('POINT(1 4)')));
explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6));
--enable_view_protocol
create table t1 (a geometry not null);
insert into t1 values (GeomFromText('Point(1 2)'));
@ -380,10 +395,10 @@ insert into t1 values (pointfromtext('point(1,1)'));
drop table t1;
#enable after fix MDEV-27871
#enable after MDEV-32456
--disable_view_protocol
select (asWKT(geomfromwkb((0x000000000140240000000000004024000000000000))));
select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440))));
select (asWKT(geomfromwkb((0x000000000140240000000000004024000000000000)))) as exp;
select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440)))) as exp;
--enable_view_protocol
--enable_metadata
@ -846,30 +861,27 @@ select astext(0x0100000000030000000100000000000010);
select astext(st_centroid(0x0100000000030000000100000000000010));
select astext(st_exteriorring(0x0100000000030000000100000000000010));
select envelope(0x0100000000030000000100000000000010);
#enable after fix MDEV-27871
--disable_view_protocol
select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1);
select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1);
select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1) as exp;
select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1) as exp;
--echo #
--echo # MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy
--echo #
SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) )));
SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) ))) as exp;
--echo #
--echo # MDEV-4295 Server crashes in get_point on a query with Area, AsBinary, MultiPoint
--echo #
SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2))));
SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2)))) as exp;
--echo End of 5.1 tests
#bug 850775 ST_AREA does not work on GEOMETRYCOLLECTIONs in maria-5.3-gis
select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'));
select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))')) as exp;
#bug 855336 ST_LENGTH does not work on GEOMETRYCOLLECTIONs
select ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))'));
select ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))')) as exp;
--enable_view_protocol
# Conformance tests
#
@ -1178,20 +1190,15 @@ SELECT AsText(EndPoint(centerline))
FROM road_segments
WHERE fid = 102;
#enable after fix MDEV-27871
--disable_view_protocol
SELECT IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary)))
SELECT IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) as exp
FROM named_places
WHERE name = 'Goose Island';
--echo # Conformance Item T20
SELECT IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary)))
SELECT IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) as exp
FROM named_places
WHERE name = 'Goose Island';
--enable_view_protocol
--echo # Conformance Item T21
SELECT GLength(centerline)
FROM road_segments
@ -1272,15 +1279,11 @@ SELECT Area(shores)
FROM ponds
WHERE fid = 120;
#enable after fix MDEV-27871
--disable_view_protocol
--echo # Conformance Item T37
SELECT ST_Equals(boundary,
PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) as exp
FROM named_places
WHERE name = 'Goose Island';
--enable_view_protocol
--echo # Conformance Item T38
SELECT ST_Disjoint(centerlines, boundary)
@ -1312,17 +1315,12 @@ FROM road_segments, divided_routes
WHERE road_segments.fid = 102
AND divided_routes.name = 'Route 75';
#enable after fix MDEV-27871
--disable_view_protocol
--echo # Conformance Item T43
SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines) as exp
FROM road_segments, divided_routes
WHERE road_segments.fid = 102
AND divided_routes.name = 'Route 75';
--enable_view_protocol
--echo # Conformance Item T44
SELECT ST_Contains(forests.boundary, named_places.boundary)
FROM forests, named_places
@ -1382,20 +1380,17 @@ USE test;
--echo # BUG #1043845 st_distance() results are incorrect depending on variable order
--echo #
#enable after fix MDEV-27871
--disable_view_protocol
select st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.134484524621,
-95.9673049102515 36.1343976584193)'),
geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) ;
geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) as exp ;
select st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.134484524621,
-95.9673049102515 36.1343976584193) ')) ;
-95.9673049102515 36.1343976584193) ')) as exp ;
--enable_view_protocol
--echo #
--echo # MDEV-4310 geometry function equals hangs forever.
@ -1457,16 +1452,13 @@ SELECT ASTEXT(0x0100000000030000000100000000000010);
--echo #should not crash
SELECT ENVELOPE(0x0100000000030000000100000000000010);
#enable after fix MDEV-27871
--disable_view_protocol
--echo #should not crash
SELECT
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1);
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1) as exp;
--echo #should not crash
SELECT
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1);
--enable_view_protocol
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1) as exp;
--echo #
--echo # MDEV-3819 missing constraints for spatial column types
@ -1480,10 +1472,7 @@ drop table t1;
#
# MDEV-7516 Assertion `!cur_p->event' failed in Gcalc_scan_iterator::arrange_event(int, int)
#
#enable after fix MDEV-27871
--disable_view_protocol
SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100));
--enable_view_protocol
SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100)) as exp;
#
# MDEV-7779 View definition changes upon creation
@ -1579,15 +1568,12 @@ drop table t1;
--echo # MDEV-7510 GIS: IsRing returns false for a primitive triangle.
--echo #
select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,0 0)'));
#enable after fix MDEV-27871
--disable_view_protocol
select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)'));
select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)')) as exp;
--echo #
--echo # MDEV-7514 GIS: PointOnSurface returns NULL instead of the point.
--echo #
SELECT ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))')));
--enable_view_protocol
SELECT ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))'))) as exp;
--echo #
--echo # MDEV-7529 GIS: ST_Relate returns unexpected results for POINT relations

View file

@ -101,7 +101,6 @@ ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table
** SHOW INDEX FROM t6 will succeed because there exist a privilege on a column combination on t6.
SHOW INDEX FROM t6;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t6 1 i 1 s1 A NULL NULL NULL YES BTREE
** CHECK TABLE requires any privilege on any column combination and should succeed for t6:
CHECK TABLE t6;
Table Op Msg_type Msg_text

View file

@ -1,9 +1,5 @@
set local sql_mode="";
set global sql_mode="";
drop table if exists t1,t2;
drop view if exists v1,v2;
drop function if exists f1;
drop function if exists f2;
show tables from INFORMATION_SCHEMA like 'T%';
Tables_in_information_schema (T%)
TABLES
@ -17,6 +13,10 @@ create database mbase;
use `inf%`;
show tables;
Tables_in_inf%
#
# Bug#18113 SELECT * FROM information_schema.xxx crashes server
# Bug#17204 second CALL to procedure crashes Server
#
grant all privileges on `inf%`.* to 'mysqltest_1'@'localhost';
grant all privileges on `mbase`.* to 'mysqltest_1'@'localhost';
create table t1 (f1 int);
@ -65,6 +65,9 @@ drop database `inf%`;
drop procedure mbase.p1;
drop database mbase;
disconnect user1;
#
# Bug#18282 INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views
#
use test;
create table t1 (i int);
create function f1 () returns int return (select max(i) from t1);
@ -88,6 +91,10 @@ v2 VIEW VIEW
drop function f1;
drop function f2;
drop view v1, v2;
#
# Bug#20543 select on information_schema strange warnings, view, different
# schemas/users
#
create database testdb_1;
create user testdb_1@localhost;
grant all on testdb_1.* to testdb_1@localhost with grant option;
@ -216,6 +223,9 @@ disconnect testdb_2;
connection default;
drop user testdb_1@localhost;
drop user testdb_2@localhost;
#
# Bug#22763 Disrepancy between SHOW CREATE VIEW and I_S.VIEWS
#
create database testdb_1;
create table testdb_1.t1 (a int);
create view testdb_1.v1 as select * from testdb_1.t1;
@ -246,11 +256,14 @@ connection user1;
disconnect user1;
connection default;
set global sql_mode=default;
#
# MDEV-20549 SQL SECURITY DEFINER does not work for INFORMATION_SCHEMA tables
#
create user foo@localhost;
grant select on test.* to foo@localhost;
create procedure rootonly() select 1;
create sql security definer view v1d as select current_user(),user from information_schema.processlist;
create sql security invoker view v1i as select current_user(),user from information_schema.processlist;
create sql security definer view v1d as select current_user(),user from information_schema.processlist where command!='daemon';
create sql security invoker view v1i as select current_user(),user from information_schema.processlist where command!='daemon';
create sql security definer view v2d as select table_name from information_schema.tables where table_schema='mysql' and table_name like '%user%';
create sql security invoker view v2i as select table_name from information_schema.tables where table_schema='mysql' and table_name like '%user%';
create sql security definer view v3d as select schema_name from information_schema.schemata where schema_name like '%mysql%';
@ -325,3 +338,50 @@ disconnect foo;
drop view v1d, v1i, v2d, v2i, v3d, v3i, v4d, v4i, v5d, v5i;
drop user foo@localhost;
drop procedure rootonly;
#
# End of 10.2 tests
#
#
# MDEV-32500 Information schema leaks table names and structure to unauthorized users
#
create database db;
create table db.t1 (x int, key(x)) engine=InnoDB;
create table db.t2 (a int, b int, c int, unique(b), check(c>b), foreign key(c) references db.t1(x)) engine=InnoDB;
create table db.t3 (d int, e int, f int, unique(e), check(f>e), foreign key(f) references db.t1(x),
foreign key(e) references db.t2(b),
foreign key(d) references db.t3(f)
) engine=InnoDB;
create user u@localhost;
grant select (a) on db.t2 to u@localhost;
grant update (d) on db.t3 to u@localhost;
connect con1,localhost,u,,db;
select table_name, column_name from information_schema.columns where table_name like 't_';
table_name column_name
t2 a
t3 d
select table_name, column_name from information_schema.key_column_usage where table_name like 't_';
table_name column_name
select table_name, unique_constraint_name, referenced_table_name from information_schema.referential_constraints where table_name like 't_';
table_name unique_constraint_name referenced_table_name
t3 x NULL
t3 b NULL
t3 f t3
select table_name, constraint_name, constraint_type from information_schema.table_constraints where table_name like 't_';
table_name constraint_name constraint_type
t3 e UNIQUE
t3 CONSTRAINT_1 CHECK
t3 t3_ibfk_1 FOREIGN KEY
t3 t3_ibfk_2 FOREIGN KEY
t3 t3_ibfk_3 FOREIGN KEY
show index in t2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
show index in t3;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t3 1 d 1 d A 0 NULL NULL YES BTREE
disconnect con1;
connection default;
drop user u@localhost;
drop database db;
#
# End of 10.4 tests
#

View file

@ -1,19 +1,12 @@
# this test mostly test privilege control (what doesn't work
# in the embedded server by default). So skip the test in embedded-server mode.
-- source include/not_embedded.inc
-- source include/have_innodb.inc
-- source include/testdb_only.inc
set local sql_mode="";
set global sql_mode="";
--disable_warnings
drop table if exists t1,t2;
drop view if exists v1,v2;
drop function if exists f1;
drop function if exists f2;
--enable_warnings
--replace_result 'Tables_in_INFORMATION_SCHEMA (T%)' 'Tables_in_information_schema (T%)'
--sorted_result
show tables from INFORMATION_SCHEMA like 'T%';
@ -22,9 +15,10 @@ create database mbase;
use `inf%`;
show tables;
#
# Bug#18113 SELECT * FROM information_schema.xxx crashes server
# Bug#17204 second CALL to procedure crashes Server
--echo #
--echo # Bug#18113 SELECT * FROM information_schema.xxx crashes server
--echo # Bug#17204 second CALL to procedure crashes Server
--echo #
# Crash happened when one selected data from one of INFORMATION_SCHEMA
# tables and in order to build its contents server had to open view which
# used stored function and table or view on which one had not global or
@ -86,9 +80,9 @@ drop procedure mbase.p1;
drop database mbase;
disconnect user1;
#
# Bug#18282 INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views
#
--echo #
--echo # Bug#18282 INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views
--echo #
use test;
create table t1 (i int);
create function f1 () returns int return (select max(i) from t1);
@ -107,11 +101,10 @@ drop function f2;
drop view v1, v2;
--enable_view_protocol
#
# Bug#20543 select on information_schema strange warnings, view, different
# schemas/users
#
#
--echo #
--echo # Bug#20543 select on information_schema strange warnings, view, different
--echo # schemas/users
--echo #
--disable_service_connection
create database testdb_1;
create user testdb_1@localhost;
@ -222,9 +215,9 @@ connection default;
drop user testdb_1@localhost;
drop user testdb_2@localhost;
#
# Bug#22763 Disrepancy between SHOW CREATE VIEW and I_S.VIEWS
#
--echo #
--echo # Bug#22763 Disrepancy between SHOW CREATE VIEW and I_S.VIEWS
--echo #
create database testdb_1;
create table testdb_1.t1 (a int);
create view testdb_1.v1 as select * from testdb_1.t1;
@ -256,15 +249,15 @@ connection default;
set global sql_mode=default;
#
# MDEV-20549 SQL SECURITY DEFINER does not work for INFORMATION_SCHEMA tables
#
--echo #
--echo # MDEV-20549 SQL SECURITY DEFINER does not work for INFORMATION_SCHEMA tables
--echo #
create user foo@localhost;
grant select on test.* to foo@localhost;
create procedure rootonly() select 1;
create sql security definer view v1d as select current_user(),user from information_schema.processlist;
create sql security invoker view v1i as select current_user(),user from information_schema.processlist;
create sql security definer view v1d as select current_user(),user from information_schema.processlist where command!='daemon';
create sql security invoker view v1i as select current_user(),user from information_schema.processlist where command!='daemon';
create sql security definer view v2d as select table_name from information_schema.tables where table_schema='mysql' and table_name like '%user%';
create sql security invoker view v2i as select table_name from information_schema.tables where table_schema='mysql' and table_name like '%user%';
create sql security definer view v3d as select schema_name from information_schema.schemata where schema_name like '%mysql%';
@ -300,3 +293,40 @@ drop view v1d, v1i, v2d, v2i, v3d, v3i, v4d, v4i, v5d, v5i;
drop user foo@localhost;
drop procedure rootonly;
--enable_service_connection
--echo #
--echo # End of 10.2 tests
--echo #
--echo #
--echo # MDEV-32500 Information schema leaks table names and structure to unauthorized users
--echo #
create database db;
create table db.t1 (x int, key(x)) engine=InnoDB;
create table db.t2 (a int, b int, c int, unique(b), check(c>b), foreign key(c) references db.t1(x)) engine=InnoDB;
create table db.t3 (d int, e int, f int, unique(e), check(f>e), foreign key(f) references db.t1(x),
foreign key(e) references db.t2(b),
foreign key(d) references db.t3(f)
) engine=InnoDB;
create user u@localhost;
grant select (a) on db.t2 to u@localhost;
grant update (d) on db.t3 to u@localhost;
--connect con1,localhost,u,,db
--sorted_result
select table_name, column_name from information_schema.columns where table_name like 't_';
select table_name, column_name from information_schema.key_column_usage where table_name like 't_';
select table_name, unique_constraint_name, referenced_table_name from information_schema.referential_constraints where table_name like 't_';
select table_name, constraint_name, constraint_type from information_schema.table_constraints where table_name like 't_';
show index in t2;
show index in t3;
--disconnect con1
--connection default
drop user u@localhost;
drop database db;
--echo #
--echo # End of 10.4 tests
--echo #

View file

@ -156,7 +156,7 @@ INSERT INTO t1 VALUES
# Execute select with invalid timestamp, desc ordering
SELECT *
FROM t1
FROM t1 FORCE INDEX(PRIMARY)
WHERE ts BETWEEN '0000-00-00' AND '2010-00-01 00:00:00'
ORDER BY ts DESC
LIMIT 2;
@ -167,7 +167,7 @@ ts c
# Should use index condition
EXPLAIN
SELECT *
FROM t1
FROM t1 FORCE INDEX(PRIMARY)
WHERE ts BETWEEN '0000-00-00' AND '2010-00-01 00:00:00'
ORDER BY ts DESC
LIMIT 2;
@ -429,6 +429,12 @@ CREATE TABLE t2 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL);
INSERT INTO t2 VALUES (11,1);
INSERT INTO t2 VALUES (12,2);
INSERT INTO t2 VALUES (15,4);
analyze table t1,t2 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
set @save_optimizer_switch= @@optimizer_switch;
set optimizer_switch='semijoin=off';
EXPLAIN
@ -687,6 +693,12 @@ CREATE TABLE t2 (a varchar(1024), KEY (a(512)));
INSERT INTO t2 VALUES
('Ill'), ('eckqzsflbzaffti'), ('w'), ('she'), ('gxbwypqtjzwywwer'), ('w');
insert into t2 select seq from seq_1_to_100;
analyze table t1,t2 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SET SESSION optimizer_switch='index_condition_pushdown=off';
EXPLAIN
SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND (t1.b<0 OR t1.b>0)

View file

@ -395,7 +395,8 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BNL",
"r_filtered": 100
"r_filtered": 100,
"r_unpack_time_ms": "REPLACED"
}
}
}
@ -478,7 +479,8 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BNL",
"r_filtered": 100
"r_filtered": 100,
"r_unpack_time_ms": "REPLACED"
}
}
}

View file

@ -426,7 +426,8 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "65",
"join_type": "BNL",
"r_filtered": 100
"r_filtered": 100,
"r_unpack_time_ms": "REPLACED"
}
}
}
@ -509,7 +510,8 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "65",
"join_type": "BNL",
"r_filtered": 100
"r_filtered": 100,
"r_unpack_time_ms": "REPLACED"
}
}
}

View file

@ -6270,5 +6270,131 @@ ERROR HY001: Could not create a join buffer. Please check and adjust the value o
SET JOIN_buffer_size=16384;
SELECT * FROM information_schema.statistics JOIN information_schema.COLUMNS USING (table_name,column_name);
#
# MDEV-32351: Join buffer used for outer join with ON condition
# depending only on outer tables
#
CREATE TABLE t1 (b int NOT NULL, PRIMARY KEY (b)) ENGINE=MYISAM;
INSERT INTO t1 select seq from seq_1_to_10000;
CREATE TABLE t2 (b int NOT NULL, d varchar(255), KEY (b)) ENGINE=MYISAM ;
INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
CREATE TABLE t3 (c int NOT NULL, PRIMARY KEY (c)) ENGINE=MYISAM ;
INSERT INTO t3 select seq from seq_1_to_3000;
CREATE TABLE t4 (c int NOT NULL, PRIMARY KEY (c)) ENGINE=MYISAM;
INSERT INTO t4 select seq from seq_1_to_3000;
ANALYZE TABLE t1,t2,t3,t4;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
test.t4 analyze status Engine-independent statistics collected
test.t4 analyze status OK
set join_cache_level=0;
EXPLAIN SELECT COUNT(*)
FROM t1
LEFT JOIN t2 ON t1.b = t2.b
LEFT JOIN t3 ON t2.d = t3.c
LEFT JOIN t4 ON t3.c=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 10000 Using index
1 SIMPLE t2 ref b b 4 test.t1.b 1
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.d 1 Using where; Using index
1 SIMPLE t4 index NULL PRIMARY 4 NULL 3000 Using where; Using index
SELECT COUNT(*)
FROM t1
LEFT JOIN t2 ON t1.b = t2.b
LEFT JOIN t3 ON t2.d = t3.c
LEFT JOIN t4 ON t3.c=1;
COUNT(*)
12999
set join_cache_level=default;
EXPLAIN SELECT COUNT(*)
FROM t1
LEFT JOIN t2 ON t1.b = t2.b
LEFT JOIN t3 ON t2.d = t3.c
LEFT JOIN t4 ON t3.c=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 10000 Using index
1 SIMPLE t2 ref b b 4 test.t1.b 1
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.d 1 Using where; Using index
1 SIMPLE t4 index NULL PRIMARY 4 NULL 3000 Using where; Using index; Using join buffer (flat, BNL join)
SELECT COUNT(*)
FROM t1
LEFT JOIN t2 ON t1.b = t2.b
LEFT JOIN t3 ON t2.d = t3.c
LEFT JOIN t4 ON t3.c=1;
COUNT(*)
12999
DROP TABLE t1,t2,t3,t4;
CREATE TABLE t1 (b int NOT NULL, PRIMARY KEY (b));
INSERT INTO t1 select seq from seq_1_to_10;
CREATE TABLE t2 (b int NOT NULL, d varchar(255), KEY (b)) ;
INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
CREATE TABLE t3 (c int NOT NULL, PRIMARY KEY (c)) ;
INSERT INTO t3 select seq from seq_1_to_3;
CREATE TABLE t4 (c int NOT NULL, PRIMARY KEY (c)) ;
INSERT INTO t4 select seq from seq_1_to_3;
set join_cache_level=0;
EXPLAIN SELECT *
FROM t1
LEFT JOIN t2 ON t1.b = t2.b
LEFT JOIN t3 ON t2.d = t3.c
LEFT JOIN t4 ON t3.c=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 10 Using index
1 SIMPLE t2 ALL b NULL NULL NULL 3 Using where
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.d 1 Using where; Using index
1 SIMPLE t4 index NULL PRIMARY 4 NULL 3 Using where; Using index
SELECT *
FROM t1
LEFT JOIN t2 ON t1.b = t2.b
LEFT JOIN t3 ON t2.d = t3.c
LEFT JOIN t4 ON t3.c=1;
b b d c c
1 1 1 1 1
1 1 1 1 2
1 1 1 1 3
2 2 2 2 NULL
3 3 3 3 NULL
4 NULL NULL NULL NULL
5 NULL NULL NULL NULL
6 NULL NULL NULL NULL
7 NULL NULL NULL NULL
8 NULL NULL NULL NULL
9 NULL NULL NULL NULL
10 NULL NULL NULL NULL
set join_cache_level=default;
EXPLAIN SELECT *
FROM t1
LEFT JOIN t2 ON t1.b = t2.b
LEFT JOIN t3 ON t2.d = t3.c
LEFT JOIN t4 ON t3.c=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 10 Using index
1 SIMPLE t2 ALL b NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.d 1 Using where; Using index
1 SIMPLE t4 index NULL PRIMARY 4 NULL 3 Using where; Using index; Using join buffer (flat, BNL join)
SELECT *
FROM t1
LEFT JOIN t2 ON t1.b = t2.b
LEFT JOIN t3 ON t2.d = t3.c
LEFT JOIN t4 ON t3.c=1;
b b d c c
1 1 1 1 1
1 1 1 1 2
1 1 1 1 3
2 2 2 2 NULL
3 3 3 3 NULL
4 NULL NULL NULL NULL
5 NULL NULL NULL NULL
6 NULL NULL NULL NULL
7 NULL NULL NULL NULL
8 NULL NULL NULL NULL
9 NULL NULL NULL NULL
10 NULL NULL NULL NULL
DROP TABLE t1,t2,t3,t4;
#
# End of 10.4 tests
#

View file

@ -4247,6 +4247,64 @@ SET JOIN_buffer_size=16384;
SELECT * FROM information_schema.statistics JOIN information_schema.COLUMNS USING (table_name,column_name);
--enable_result_log
--echo #
--echo # MDEV-32351: Join buffer used for outer join with ON condition
--echo # depending only on outer tables
--echo #
--source include/have_sequence.inc
CREATE TABLE t1 (b int NOT NULL, PRIMARY KEY (b)) ENGINE=MYISAM;
INSERT INTO t1 select seq from seq_1_to_10000;
CREATE TABLE t2 (b int NOT NULL, d varchar(255), KEY (b)) ENGINE=MYISAM ;
INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
CREATE TABLE t3 (c int NOT NULL, PRIMARY KEY (c)) ENGINE=MYISAM ;
INSERT INTO t3 select seq from seq_1_to_3000;
CREATE TABLE t4 (c int NOT NULL, PRIMARY KEY (c)) ENGINE=MYISAM;
INSERT INTO t4 select seq from seq_1_to_3000;
ANALYZE TABLE t1,t2,t3,t4;
let $q1=
SELECT COUNT(*)
FROM t1
LEFT JOIN t2 ON t1.b = t2.b
LEFT JOIN t3 ON t2.d = t3.c
LEFT JOIN t4 ON t3.c=1;
set join_cache_level=0;
eval EXPLAIN $q1;
eval $q1;
set join_cache_level=default;
eval EXPLAIN $q1;
eval $q1;
DROP TABLE t1,t2,t3,t4;
CREATE TABLE t1 (b int NOT NULL, PRIMARY KEY (b));
INSERT INTO t1 select seq from seq_1_to_10;
CREATE TABLE t2 (b int NOT NULL, d varchar(255), KEY (b)) ;
INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
CREATE TABLE t3 (c int NOT NULL, PRIMARY KEY (c)) ;
INSERT INTO t3 select seq from seq_1_to_3;
CREATE TABLE t4 (c int NOT NULL, PRIMARY KEY (c)) ;
INSERT INTO t4 select seq from seq_1_to_3;
let $q2=
SELECT *
FROM t1
LEFT JOIN t2 ON t1.b = t2.b
LEFT JOIN t3 ON t2.d = t3.c
LEFT JOIN t4 ON t3.c=1;
set join_cache_level=0;
eval EXPLAIN $q2;
eval $q2;
set join_cache_level=default;
eval EXPLAIN $q2;
eval $q2;
DROP TABLE t1,t2,t3,t4;
--echo #
--echo # End of 10.4 tests
--echo #

View file

@ -0,0 +1,103 @@
#
# MDEV-32351: Significant slowdown for query with many outer joins
#
CREATE TABLE t1 (b int NOT NULL, PRIMARY KEY (b)) ENGINE=MYISAM;
INSERT INTO t1 select seq from seq_1_to_10000;
CREATE TABLE t2 (b int NOT NULL, d varchar(255), KEY (b)) ENGINE=MYISAM ;
INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
CREATE TABLE t3 (c int NOT NULL, PRIMARY KEY (c)) ENGINE=MYISAM ;
INSERT INTO t3 select seq from seq_1_to_3000;
CREATE TABLE t4 (c int NOT NULL, PRIMARY KEY (c)) ENGINE=MYISAM;
INSERT INTO t4 select seq from seq_1_to_3000;
ANALYZE TABLE t1,t2,t3,t4;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
test.t4 analyze status Engine-independent statistics collected
test.t4 analyze status OK
create table t1_t2 as
select
t1.b as t1_b, t2.b as t2_b, t2.d as t2_d
FROM t1
LEFT JOIN t2 ON t1.b = t2.b;
SET statement debug_dbug='+d,analyze_print_r_unpack_ops' for
analyze
format=json
SELECT COUNT(*)
FROM t1_t2
LEFT JOIN t3 ON t2_d = t3.c
LEFT JOIN t4 ON t3.c=1
select '$js' as JSON;
JSON
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"const_condition": "1",
"table": {
"table_name": "t1_t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 10000,
"r_rows": 10000,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100
},
"table": {
"table_name": "t3",
"access_type": "eq_ref",
"possible_keys": ["PRIMARY"],
"key": "PRIMARY",
"key_length": "4",
"used_key_parts": ["c"],
"ref": ["test.t1_t2.t2_d"],
"r_loops": 10000,
"rows": 1,
"r_rows": 0.0003,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
"attached_condition": "trigcond(t1_t2.t2_d = t3.c and trigcond(t1_t2.t2_d is not null))",
"using_index": true
},
"block-nl-join": {
"table": {
"table_name": "t4",
"access_type": "index",
"key": "PRIMARY",
"key_length": "4",
"used_key_parts": ["c"],
"r_loops": 1,
"rows": 3000,
"r_rows": 3000,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
"using_index": true
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BNL",
"attached_condition": "trigcond(trigcond(t3.c = 1))",
"r_filtered": 0.04333,
"r_unpack_time_ms": "REPLACED",
"r_unpack_ops": 3000
}
}
}
# This must show 3000, not 30000000:
select json_extract('$js', '\$**.r_unpack_ops') as R_UNPACK_OPS;
R_UNPACK_OPS
[3000]
SET debug_dbug=@old_debug;
drop table t1,t2,t3,t4;
drop table t1_t2;

View file

@ -0,0 +1,43 @@
--source include/have_sequence.inc
--source include/have_debug.inc
--echo #
--echo # MDEV-32351: Significant slowdown for query with many outer joins
--echo #
CREATE TABLE t1 (b int NOT NULL, PRIMARY KEY (b)) ENGINE=MYISAM;
INSERT INTO t1 select seq from seq_1_to_10000;
CREATE TABLE t2 (b int NOT NULL, d varchar(255), KEY (b)) ENGINE=MYISAM ;
INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
CREATE TABLE t3 (c int NOT NULL, PRIMARY KEY (c)) ENGINE=MYISAM ;
INSERT INTO t3 select seq from seq_1_to_3000;
CREATE TABLE t4 (c int NOT NULL, PRIMARY KEY (c)) ENGINE=MYISAM;
INSERT INTO t4 select seq from seq_1_to_3000;
ANALYZE TABLE t1,t2,t3,t4;
create table t1_t2 as
select
t1.b as t1_b, t2.b as t2_b, t2.d as t2_d
FROM t1
LEFT JOIN t2 ON t1.b = t2.b;
let $q=
SET statement debug_dbug='+d,analyze_print_r_unpack_ops' for
analyze
format=json
SELECT COUNT(*)
FROM t1_t2
LEFT JOIN t3 ON t2_d = t3.c
LEFT JOIN t4 ON t3.c=1;
echo $q;
let $js=`$q`;
--source include/analyze-format.inc
evalp select '$js' as JSON;
--echo # This must show 3000, not 30000000:
evalp select json_extract('$js', '\$**.r_unpack_ops') as R_UNPACK_OPS;
SET debug_dbug=@old_debug;
drop table t1,t2,t3,t4;
drop table t1_t2;

View file

@ -231,8 +231,8 @@ load data infile 'MYSQL_TEST_DIR/t/loaddata.test' into table t1;
Got one of the listed errors
select * from t1;
a b c
select load_file("MYSQL_TEST_DIR/t/loaddata.test");
load_file("MYSQL_TEST_DIR/t/loaddata.test")
select load_file("MYSQL_TEST_DIR/t/loaddata.test") as exp;
exp
NULL
drop table t1, t2;
create table t1(f1 int);
@ -405,8 +405,8 @@ after 4 \r 5C72
before 5 tab 09746162
after 5 tab 09746162
TRUNCATE t2;
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt");
LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt")
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt") as exp;
exp
3 \tx
4 \r
5 tab
@ -424,8 +424,8 @@ after 4 \r 5C72
before 5 tab 09746162
after 5 tab 09746162
TRUNCATE t2;
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt");
LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt")
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt") exp;
exp
3 \\tx
4 \\r
5 tab
@ -445,8 +445,8 @@ before 5 tab 09746162
after 5 tab 09746162
TRUNCATE t2;
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt");
LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt")
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt") as ep;
ep
3 \\tx
4 \\r
5 tab
@ -466,8 +466,8 @@ before 5 tab 09746162
after 5 tab 09746162
TRUNCATE t2;
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt");
LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt")
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt") as exp;
exp
3 \tx
4 \r
5 tab
@ -478,8 +478,9 @@ DROP TABLE t1,t2;
# Bug #51893: crash with certain characters given to load_file
# function on windows
#
select load_file(0x0A9FB76C661B409C4BEC88098C5DD71B1072F9691F2E827D7EC8F092B299868A3CE196C04F0FB18CAB4E1557EB72331D812379DE7A75CA21C32E7C722C59E5CC33EF262EF04187B0F0EE756FA984DF2EAD37B1E4ADB064C3C5038F2E3B2D661B1C1150AAEB5425512E14D7506166D92D4533872E662F4B2D1428AAB5CCA72E75AA2EF325E196A5A02E2E8278873C64375845994B0F39BE2FF7B478332A7B0AA5E48877C47B6F513E997848AF8CCB8A899F3393AB35333CF0871E36698193862D486B4B9078B70C0A0A507B8A250F3F876F5A067632D5E65193E4445A1EC3A2C9B4C6F07AC334F0F62BC33357CB502E9B1C19D2398B6972AEC2EF21630F8C9134C4F7DD662D8AD7BDC9E19C46720F334B66C22D4BF32ED275144E20E7669FFCF6FC143667C9F02A577F32960FA9F2371BE1FA90E49CBC69C01531F140556854D588DD0E55E1307D78CA38E975CD999F9AEA604266329EE62BFB5ADDA67F549E211ECFBA906C60063696352ABB82AA782D25B17E872EA587871F450446DB1BAE0123D20404A8F2D2698B371002E986C8FCB969A99FF0E150A2709E2ED7633D02ADA87D5B3C9487D27B2BD9D21E2EC3215DCC3CDCD884371281B95A2E9987AAF82EB499C058D9C3E7DC1B66635F60DB121C72F929622DD47B6B2E69F59FF2AE6B63CC2EC60FFBA20EA50569DBAB5DAEFAEB4F03966C9637AB55662EDD28439155A82D053A5299448EDB2E7BEB0F62889E2F84E6C7F34B3212C9AAC32D521D5AB8480993F1906D5450FAB342A0FA6ED223E178BAC036B81E15783604C32A961EA1EF20BE2EBB93D34ED37BC03142B7583303E4557E48551E4BD7CBDDEA146D5485A5D212C35189F0BD6497E66912D2780A59A53B532E12C0A5ED1EC0445D96E8F2DD825221CFE4A65A87AA21DC8750481B9849DD81694C3357A0ED9B78D608D8EDDE28FAFBEC17844DE5709F41E121838DB55639D77E32A259A416D7013B2EB1259FDE1B498CBB9CAEE1D601DF3C915EA91C69B44E6B72062F5F4B3C73F06F2D5AD185E1692E2E0A01E7DD5133693681C52EE13B2BE42D03BDCF48E4E133CF06662339B778E1C3034F9939A433E157449172F7969ACCE1F5D2F65A4E09E4A5D5611EBEDDDBDB0C0C0A);
load_file(0x0A9FB76C661B409C4BEC88098C5DD71B1072F9691F2E827D7EC8F092B299868A3CE196C04F0FB18CAB4E1557EB72331D812379DE7A75CA21C32E7C722C59E5CC33EF262EF04187B0F0EE756FA984DF2EAD37B1E4ADB064C3C5038F2E3B2D661B1C1150AAEB5425512E14D7506166D92D4533872E662F4B2D142
select
load_file(0x0A9FB76C661B409C4BEC88098C5DD71B1072F9691F2E827D7EC8F092B299868A3CE196C04F0FB18CAB4E1557EB72331D812379DE7A75CA21C32E7C722C59E5CC33EF262EF04187B0F0EE756FA984DF2EAD37B1E4ADB064C3C5038F2E3B2D661B1C1150AAEB5425512E14D7506166D92D4533872E662F4B2D1428AAB5CCA72E75AA2EF325E196A5A02E2E8278873C64375845994B0F39BE2FF7B478332A7B0AA5E48877C47B6F513E997848AF8CCB8A899F3393AB35333CF0871E36698193862D486B4B9078B70C0A0A507B8A250F3F876F5A067632D5E65193E4445A1EC3A2C9B4C6F07AC334F0F62BC33357CB502E9B1C19D2398B6972AEC2EF21630F8C9134C4F7DD662D8AD7BDC9E19C46720F334B66C22D4BF32ED275144E20E7669FFCF6FC143667C9F02A577F32960FA9F2371BE1FA90E49CBC69C01531F140556854D588DD0E55E1307D78CA38E975CD999F9AEA604266329EE62BFB5ADDA67F549E211ECFBA906C60063696352ABB82AA782D25B17E872EA587871F450446DB1BAE0123D20404A8F2D2698B371002E986C8FCB969A99FF0E150A2709E2ED7633D02ADA87D5B3C9487D27B2BD9D21E2EC3215DCC3CDCD884371281B95A2E9987AAF82EB499C058D9C3E7DC1B66635F60DB121C72F929622DD47B6B2E69F59FF2AE6B63CC2EC60FFBA20EA50569DBAB5DAEFAEB4F03966C9637AB55662EDD28439155A82D053A5299448EDB2E7BEB0F62889E2F84E6C7F34B3212C9AAC32D521D5AB8480993F1906D5450FAB342A0FA6ED223E178BAC036B81E15783604C32A961EA1EF20BE2EBB93D34ED37BC03142B7583303E4557E48551E4BD7CBDDEA146D5485A5D212C35189F0BD6497E66912D2780A59A53B532E12C0A5ED1EC0445D96E8F2DD825221CFE4A65A87AA21DC8750481B9849DD81694C3357A0ED9B78D608D8EDDE28FAFBEC17844DE5709F41E121838DB55639D77E32A259A416D7013B2EB1259FDE1B498CBB9CAEE1D601DF3C915EA91C69B44E6B72062F5F4B3C73F06F2D5AD185E1692E2E0A01E7DD5133693681C52EE13B2BE42D03BDCF48E4E133CF06662339B778E1C3034F9939A433E157449172F7969ACCE1F5D2F65A4E09E4A5D5611EBEDDDBDB0C0C0A) as exp;
exp
NULL
End of 5.0 tests
CREATE TABLE t1 (a int);

View file

@ -159,8 +159,6 @@ select * from t1;
#
# It should not be possible to load from a file outside of vardir
#enable after fix MDEV-27871
--disable_view_protocol
--error 1238
set @@secure_file_priv= 0;
@ -173,11 +171,10 @@ select * from t1;
# Test "load_file" returns NULL
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval select load_file("$MYSQL_TEST_DIR/t/loaddata.test");
eval select load_file("$MYSQL_TEST_DIR/t/loaddata.test") as exp;
# cleanup
drop table t1, t2;
--enable_view_protocol
#
# Bug#27586: Wrong autoinc value assigned by LOAD DATA in the
@ -447,15 +444,10 @@ SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION
TRUNCATE t2;
#enable after fix MDEV-27871
--disable_view_protocol
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval SELECT LOAD_FILE("$file");
eval SELECT LOAD_FILE("$file") as exp;
--remove_file $file
--enable_view_protocol
--echo 1.2 NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
@ -471,14 +463,10 @@ SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION
TRUNCATE t2;
#enable after fix MDEV-27871
--disable_view_protocol
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval SELECT LOAD_FILE("$file");
eval SELECT LOAD_FILE("$file") exp;
--remove_file $file
--enable_view_protocol
# 2. with NO_BACKSLASH_ESCAPES off
@ -501,15 +489,10 @@ TRUNCATE t2;
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
#enable after fix MDEV-27871
--disable_view_protocol
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval SELECT LOAD_FILE("$file");
eval SELECT LOAD_FILE("$file") as ep;
--remove_file $file
--enable_view_protocol
SET sql_mode = '';
@ -531,15 +514,10 @@ TRUNCATE t2;
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
#enable after fix MDEV-27871
--disable_view_protocol
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval SELECT LOAD_FILE("$file");
eval SELECT LOAD_FILE("$file") as exp;
--remove_file $file
--enable_view_protocol
# clean up
set session sql_mode=@OLD_SQL_MODE;
DROP TABLE t1,t2;
@ -550,12 +528,8 @@ DROP TABLE t1,t2;
--echo # function on windows
--echo #
#enable after fix MDEV-27871
--disable_view_protocol
select load_file(0x0A9FB76C661B409C4BEC88098C5DD71B1072F9691F2E827D7EC8F092B299868A3CE196C04F0FB18CAB4E1557EB72331D812379DE7A75CA21C32E7C722C59E5CC33EF262EF04187B0F0EE756FA984DF2EAD37B1E4ADB064C3C5038F2E3B2D661B1C1150AAEB5425512E14D7506166D92D4533872E662F4B2D1428AAB5CCA72E75AA2EF325E196A5A02E2E8278873C64375845994B0F39BE2FF7B478332A7B0AA5E48877C47B6F513E997848AF8CCB8A899F3393AB35333CF0871E36698193862D486B4B9078B70C0A0A507B8A250F3F876F5A067632D5E65193E4445A1EC3A2C9B4C6F07AC334F0F62BC33357CB502E9B1C19D2398B6972AEC2EF21630F8C9134C4F7DD662D8AD7BDC9E19C46720F334B66C22D4BF32ED275144E20E7669FFCF6FC143667C9F02A577F32960FA9F2371BE1FA90E49CBC69C01531F140556854D588DD0E55E1307D78CA38E975CD999F9AEA604266329EE62BFB5ADDA67F549E211ECFBA906C60063696352ABB82AA782D25B17E872EA587871F450446DB1BAE0123D20404A8F2D2698B371002E986C8FCB969A99FF0E150A2709E2ED7633D02ADA87D5B3C9487D27B2BD9D21E2EC3215DCC3CDCD884371281B95A2E9987AAF82EB499C058D9C3E7DC1B66635F60DB121C72F929622DD47B6B2E69F59FF2AE6B63CC2EC60FFBA20EA50569DBAB5DAEFAEB4F03966C9637AB55662EDD28439155A82D053A5299448EDB2E7BEB0F62889E2F84E6C7F34B3212C9AAC32D521D5AB8480993F1906D5450FAB342A0FA6ED223E178BAC036B81E15783604C32A961EA1EF20BE2EBB93D34ED37BC03142B7583303E4557E48551E4BD7CBDDEA146D5485A5D212C35189F0BD6497E66912D2780A59A53B532E12C0A5ED1EC0445D96E8F2DD825221CFE4A65A87AA21DC8750481B9849DD81694C3357A0ED9B78D608D8EDDE28FAFBEC17844DE5709F41E121838DB55639D77E32A259A416D7013B2EB1259FDE1B498CBB9CAEE1D601DF3C915EA91C69B44E6B72062F5F4B3C73F06F2D5AD185E1692E2E0A01E7DD5133693681C52EE13B2BE42D03BDCF48E4E133CF06662339B778E1C3034F9939A433E157449172F7969ACCE1F5D2F65A4E09E4A5D5611EBEDDDBDB0C0C0A);
--enable_view_protocol
select
load_file(0x0A9FB76C661B409C4BEC88098C5DD71B1072F9691F2E827D7EC8F092B299868A3CE196C04F0FB18CAB4E1557EB72331D812379DE7A75CA21C32E7C722C59E5CC33EF262EF04187B0F0EE756FA984DF2EAD37B1E4ADB064C3C5038F2E3B2D661B1C1150AAEB5425512E14D7506166D92D4533872E662F4B2D1428AAB5CCA72E75AA2EF325E196A5A02E2E8278873C64375845994B0F39BE2FF7B478332A7B0AA5E48877C47B6F513E997848AF8CCB8A899F3393AB35333CF0871E36698193862D486B4B9078B70C0A0A507B8A250F3F876F5A067632D5E65193E4445A1EC3A2C9B4C6F07AC334F0F62BC33357CB502E9B1C19D2398B6972AEC2EF21630F8C9134C4F7DD662D8AD7BDC9E19C46720F334B66C22D4BF32ED275144E20E7669FFCF6FC143667C9F02A577F32960FA9F2371BE1FA90E49CBC69C01531F140556854D588DD0E55E1307D78CA38E975CD999F9AEA604266329EE62BFB5ADDA67F549E211ECFBA906C60063696352ABB82AA782D25B17E872EA587871F450446DB1BAE0123D20404A8F2D2698B371002E986C8FCB969A99FF0E150A2709E2ED7633D02ADA87D5B3C9487D27B2BD9D21E2EC3215DCC3CDCD884371281B95A2E9987AAF82EB499C058D9C3E7DC1B66635F60DB121C72F929622DD47B6B2E69F59FF2AE6B63CC2EC60FFBA20EA50569DBAB5DAEFAEB4F03966C9637AB55662EDD28439155A82D053A5299448EDB2E7BEB0F62889E2F84E6C7F34B3212C9AAC32D521D5AB8480993F1906D5450FAB342A0FA6ED223E178BAC036B81E15783604C32A961EA1EF20BE2EBB93D34ED37BC03142B7583303E4557E48551E4BD7CBDDEA146D5485A5D212C35189F0BD6497E66912D2780A59A53B532E12C0A5ED1EC0445D96E8F2DD825221CFE4A65A87AA21DC8750481B9849DD81694C3357A0ED9B78D608D8EDDE28FAFBEC17844DE5709F41E121838DB55639D77E32A259A416D7013B2EB1259FDE1B498CBB9CAEE1D601DF3C915EA91C69B44E6B72062F5F4B3C73F06F2D5AD185E1692E2E0A01E7DD5133693681C52EE13B2BE42D03BDCF48E4E133CF06662339B778E1C3034F9939A433E157449172F7969ACCE1F5D2F65A4E09E4A5D5611EBEDDDBDB0C0C0A) as exp;
--echo End of 5.0 tests

View file

@ -182,6 +182,7 @@ SET SESSION slow_query_log=default;
drop table tab_MDEV_30820, tab2;
drop function get_zero;
--enable_view_protocol
--enable_ps2_protocol
--enable_view_protocol

View file

@ -216,15 +216,6 @@ sql_text
[slow] DEALLOCATE PREPARE stmt
[slow] DROP SEQUENCE s4
#
# Clean up
#
SET SESSION debug_dbug=@saved_dbug;
TRUNCATE mysql.slow_log;
SET @@global.slow_query_log= @org_slow_query_log;
SET @@global.log_output= @org_log_output;
SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements;
DROP PROCEDURE show_slow_log;
#
# MDEV-30820: slow log Rows_examined out of range
#
CREATE TABLE `tab_MDEV_30820` (
@ -253,3 +244,12 @@ drop table tab_MDEV_30820;
#
# End of 10.4 test
#
#
# Clean up
#
SET SESSION debug_dbug=@saved_dbug;
TRUNCATE mysql.slow_log;
SET @@global.slow_query_log= @org_slow_query_log;
SET @@global.log_output= @org_log_output;
SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements;
DROP PROCEDURE show_slow_log;

View file

@ -83,18 +83,6 @@ TRUNCATE TABLE mysql.slow_log;
CALL show_slow_log();
--echo #
--echo # Clean up
--echo #
SET SESSION debug_dbug=@saved_dbug;
TRUNCATE mysql.slow_log;
SET @@global.slow_query_log= @org_slow_query_log;
SET @@global.log_output= @org_log_output;
SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements;
DROP PROCEDURE show_slow_log;
--echo #
--echo # MDEV-30820: slow log Rows_examined out of range
--echo #
@ -131,3 +119,14 @@ drop table tab_MDEV_30820;
--echo #
--echo # End of 10.4 test
--echo #
--echo #
--echo # Clean up
--echo #
SET SESSION debug_dbug=@saved_dbug;
TRUNCATE mysql.slow_log;
SET @@global.slow_query_log= @org_slow_query_log;
SET @@global.log_output= @org_log_output;
SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements;
DROP PROCEDURE show_slow_log;

21
mysql-test/main/lowercase_table2.result Normal file → Executable file
View file

@ -358,3 +358,24 @@ disconnect conn1;
drop user 'mysqltest_1'@'localhost';
drop tables a, B;
drop database db1;
#
# MDEV-32025 Crashes in MDL_key::mdl_key_init with lower-case-table-names=2
#
CREATE DATABASE `#mysql50#D+b1`;
ALTER DATABASE `#mysql50#D+b1` UPGRADE DATA DIRECTORY NAME;
SHOW CREATE DATABASE `D+b1`;
Database Create Database
D+b1 CREATE DATABASE `D+b1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */
SHOW CREATE DATABASE `d+b1`;
Database Create Database
d+b1 CREATE DATABASE `d+b1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */
DROP DATABASE `D+b1`;
CREATE DATABASE Db1;
ALTER DATABASE Db1 DEFAULT CHARACTER SET utf8;
SHOW CREATE DATABASE Db1;
Database Create Database
Db1 CREATE DATABASE `Db1` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci */
SHOW CREATE DATABASE db1;
Database Create Database
db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci */
DROP DATABASE Db1;

View file

@ -313,4 +313,20 @@ connection default;
disconnect conn1;
drop user 'mysqltest_1'@'localhost';
drop tables a, B;
drop database db1;
drop database db1;
--echo #
--echo # MDEV-32025 Crashes in MDL_key::mdl_key_init with lower-case-table-names=2
--echo #
CREATE DATABASE `#mysql50#D+b1`;
ALTER DATABASE `#mysql50#D+b1` UPGRADE DATA DIRECTORY NAME;
SHOW CREATE DATABASE `D+b1`;
SHOW CREATE DATABASE `d+b1`;
DROP DATABASE `D+b1`;
CREATE DATABASE Db1;
ALTER DATABASE Db1 DEFAULT CHARACTER SET utf8;
SHOW CREATE DATABASE Db1;
SHOW CREATE DATABASE db1;
DROP DATABASE Db1;

View file

@ -98,3 +98,47 @@ disconnect purge_control;
connection default;
disconnect locker;
DROP TABLE t1,t3;
#
# MDEV-28820 MyISAM wrong server status flags
#
create table t1 (a int);
set autocommit=0;
select @@in_transaction;
@@in_transaction
0
select * from t1;
a
select @@in_transaction;
@@in_transaction
0
connect foo,localhost,root;
drop table t1;
connection default;
set autocommit=1;
create table t1 (a int);
create table t2 (b int) engine=innodb;
set autocommit=0;
select @@in_transaction;
@@in_transaction
0
select * from t2;
b
select @@in_transaction;
@@in_transaction
1
select * from t1;
a
connection foo;
drop table t1;
connection default;
select * from t1;
a
commit;
connection foo;
disconnect foo;
connection default;
set autocommit=default;
drop table t2;
#
# End of 10.4 tests
#

View file

@ -90,3 +90,48 @@ connection default;
disconnect locker;
DROP TABLE t1,t3;
--enable_service_connection
--echo #
--echo # MDEV-28820 MyISAM wrong server status flags
--echo #
--disable_view_protocol
# MyISAM alone doesn't start a transaction or takes transactional MDL
create table t1 (a int);
set autocommit=0;
select @@in_transaction;
select * from t1;
select @@in_transaction;
connect foo,localhost,root;
drop table t1;
connection default;
set autocommit=1;
# MyISAM in a transaction (started by InnoDB) takes transactional MDL all right
create table t1 (a int);
create table t2 (b int) engine=innodb;
set autocommit=0;
select @@in_transaction;
select * from t2;
select @@in_transaction;
select * from t1;
connection foo;
send drop table t1;
connection default;
let $wait_condition=
select count(*) > 0 from information_schema.processlist
where state = "Waiting for table metadata lock";
--source include/wait_condition.inc
select * from t1;
commit;
connection foo;
reap;
disconnect foo;
connection default;
set autocommit=default;
drop table t2;
--enable_view_protocol
--echo #
--echo # End of 10.4 tests
--echo #

View file

@ -66,8 +66,10 @@ let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
--echo # Unlock and close table and wait for con1 to close too.
FLUSH TABLES;
#SELECT NOW();
--disable_service_connection
--echo # This should give no result.
SELECT * FROM t1;
--enable_service_connection
#SELECT NOW();
UNLOCK TABLES;
connection con1;

View file

@ -1,4 +1,3 @@
drop table if exists t1,t2;
select 1, 1.0, -1, "hello", NULL;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def 1 3 1 1 N 32897 0 63
@ -222,6 +221,9 @@ def v3 v3 renamed renamed 8 12 0 Y 32896 0 63
renamed
drop table t1;
drop view v1,v2,v3;
#
# End of 4.1 tests
#
select a.* from (select 2147483648 as v_large) a;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def a v_large v_large 8 10 10 N 32769 0 63
@ -301,7 +303,9 @@ def test va va f1 f1 3 11 0 Y 32768 0 63
f1
DROP VIEW v1;
DROP TABLE t1;
End of 5.0 tests
#
# End of 5.0 tests
#
create table t1(
# numeric types
bool_col bool,
@ -802,3 +806,6 @@ t1 CREATE TABLE `t1` (
`@b2:=111111111111` bigint(12) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1;
#
# End of 10.3 tests
#

Some files were not shown because too many files have changed in this diff Show more