Skip to content

Commit

Permalink
MDEV-16398: Spider Creates Query With Non-Existent Function
Browse files Browse the repository at this point in the history
The problem occurs because the statement generated by Spider used an
internal function name, ADD_TIME.

This problem has been corrected by the fix for bug MDEV-16878 within the
server, which enables Spider to generate the statement using the actual
SQL function name.  I have made some additional changes within Spider to fix
related problems that I observed while testing.

Author:
  Jacob Mathew.

First Reviewer:
  Alexander Barkov.

Second Reviewer:
  Kentoku Shiba.

Cherry-Picked:
  Commit 4b6dccc on branch bb-10.3-MDEV-16398
  • Loading branch information
Jacob Mathew committed Aug 13, 2018
1 parent f6d4f62 commit e39eb18
Show file tree
Hide file tree
Showing 7 changed files with 213 additions and 57 deletions.
12 changes: 6 additions & 6 deletions storage/spider/mysql-test/spider/include/init_spider.inc
Expand Up @@ -250,7 +250,7 @@ if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
format_id int not null default 0,
gtrid_length int not null default 0,
bqual_length int not null default 0,
data char(128) charset binary not null default '',
data binary(128) not null default '',
status char(8) not null default '',
PRIMARY KEY (data, format_id, gtrid_length),
KEY idx1 (status)
Expand All @@ -260,7 +260,7 @@ if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
format_id int not null default 0,
gtrid_length int not null default 0,
bqual_length int not null default 0,
data char(128) charset binary not null default '',
data binary(128) not null default '',
scheme char(64) not null default '',
host char(64) not null default '',
port char(5) not null default '',
Expand All @@ -282,7 +282,7 @@ if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
format_id int not null default 0,
gtrid_length int not null default 0,
bqual_length int not null default 0,
data char(128) charset binary not null default '',
data binary(128) not null default '',
scheme char(64) not null default '',
host char(64) not null default '',
port char(5) not null default '',
Expand Down Expand Up @@ -337,8 +337,8 @@ if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
CREATE TABLE mysql.spider_link_mon_servers(
db_name char(64) not null default '',
table_name char(199) not null default '',
link_id char(5) not null default '',
sid int not null default 0,
link_id char(64) not null default '',
sid int unsigned not null default 0,
server char(64) default null,
scheme char(64) default null,
host char(64) default null,
Expand All @@ -360,7 +360,7 @@ if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
CREATE TABLE mysql.spider_link_failed_log(
db_name char(64) not null default '',
table_name char(199) not null default '',
link_id int not null default 0,
link_id char(64) not null default '',
failed_time timestamp not null default current_timestamp
) ENGINE=MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS mysql.spider_table_position_for_recovery;
Expand Down
2 changes: 1 addition & 1 deletion storage/spider/mysql-test/spider/r/auto_increment.result
Expand Up @@ -154,7 +154,7 @@ col_a col_b col_c
connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select `col_a`,`col_b`,`col_c` from `auto_test_remote`.`tbl_a`
select t0.`col_a` `col_a`,t0.`col_b` `col_b`,t0.`col_c` `col_c` from `auto_test_remote`.`tbl_a` t0
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT col_a, col_b, col_c FROM tbl_a ORDER BY col_a;
col_a col_b col_c
Expand Down
101 changes: 81 additions & 20 deletions storage/spider/mysql-test/spider/r/timestamp.result
Expand Up @@ -40,8 +40,10 @@ SELECT 1;

create table
connection child2_1;
CHILD2_1_DROP_TABLES
CHILD2_1_CREATE_TABLES
CHILD2_1_DROP_TABLE
CHILD2_1_DROP_TABLE_F
CHILD2_1_CREATE_TABLE
CHILD2_1_CREATE_TABLE_F
TRUNCATE TABLE mysql.general_log;
connection master_1;
DROP TABLE IF EXISTS tbl_a;
Expand All @@ -51,7 +53,12 @@ col_dt DATETIME,
col_ts TIMESTAMP NOT NULL
DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY(col_a),
UNIQUE INDEX i_ts (col_ts)
) MASTER_1_ENGINE MASTER_1_AUTO_INCREMENT_2_1 MASTER_1_COMMENT_2_1
CREATE TABLE tbl_f (
col_d DATE,
col_t TIME
) ENGINE=Spider COMMENT='database "ts_test_remote", table "tbl_f", srv "s_2_1"'
SHOW CREATE TABLE tbl_a;
Table Create Table
tbl_a CREATE TABLE `tbl_a` (
Expand All @@ -61,6 +68,12 @@ tbl_a CREATE TABLE `tbl_a` (
PRIMARY KEY (`col_a`),
UNIQUE KEY `i_ts` (`col_ts`)
) ENGINE=SPIDER AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COMMENT='database "ts_test_remote", table "tbl_a", srv "s_2_1"'
SHOW CREATE TABLE tbl_f;
Table Create Table
tbl_f CREATE TABLE `tbl_f` (
`col_d` date DEFAULT NULL,
`col_t` time DEFAULT NULL
) ENGINE=SPIDER DEFAULT CHARSET=latin1 COMMENT='database "ts_test_remote", table "tbl_f", srv "s_2_1"'

Set a different time zone that has DST
SET time_zone='+01:00';
Expand Down Expand Up @@ -101,7 +114,7 @@ col_a col_dt col_ts unix_timestamp(col_ts)
connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a`
select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a;
col_a col_dt col_ts unix_timestamp(col_ts)
Expand All @@ -127,7 +140,7 @@ col_a col_dt col_ts unix_timestamp(col_ts)
connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a`
select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a;
col_a col_dt col_ts unix_timestamp(col_ts)
Expand All @@ -153,7 +166,7 @@ col_a col_dt col_ts unix_timestamp(col_ts)
connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a`
select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a;
col_a col_dt col_ts unix_timestamp(col_ts)
Expand Down Expand Up @@ -181,7 +194,7 @@ connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` for update
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a`
select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a;
col_a col_dt col_ts unix_timestamp(col_ts)
Expand Down Expand Up @@ -239,13 +252,13 @@ col_a col_dt col_ts unix_timestamp(col_ts)
connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` where (`col_ts` > '2017-12-31 23:00:00') order by `col_ts`
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` where (`col_ts` < '2018-10-28 01:30:00') order by `col_ts`
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` where ('2018-10-28 01:30:00' > `col_ts`) order by `col_ts`
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` where `col_ts` >= '2018-10-28 00:30:00' and `col_ts` <= '2018-10-28 01:30:00' and (`col_ts` between '2018-10-28 00:30:00' and '2018-10-28 01:30:00') order by `col_ts`
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` where `col_ts` >= '2018-10-28 00:30:00' and `col_ts` <= '2018-10-28 01:30:00' and ((`col_ts` >= '2018-10-28 00:30:00') and (`col_ts` <= '2018-10-28 01:30:00')) order by `col_ts`
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` where (`col_ts` > '2018-03-25 01:00:00') order by `col_ts`
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` where (`col_ts` > '1970-01-01 00:00:01') order by `col_ts`
select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` > '2017-12-31 23:00:00')
select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` < '2018-10-28 01:30:00')
select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where ('2018-10-28 01:30:00' > t0.`col_ts`)
select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` between '2018-10-28 00:30:00' and '2018-10-28 01:30:00')
select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where ((t0.`col_ts` >= '2018-10-28 00:30:00') and (t0.`col_ts` <= '2018-10-28 01:30:00'))
select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` > '2018-03-25 01:00:00')
select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` > '1970-01-01 00:00:01')
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a;
col_a col_dt col_ts unix_timestamp(col_ts)
Expand Down Expand Up @@ -326,13 +339,13 @@ col_a col_dt col_ts unix_timestamp(col_ts)
connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` where (`col_ts` > '2017-12-31 23:00:00')
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` where (`col_ts` < '2018-10-28 01:30:00')
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` where ('2018-10-28 01:30:00' > `col_ts`)
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` where (`col_ts` between '2018-10-28 00:30:00' and '2018-10-28 01:30:00')
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` where ((`col_ts` >= '2018-10-28 00:30:00') and (`col_ts` <= '2018-10-28 01:30:00'))
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` where (`col_ts` > '2018-03-25 01:00:00')
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` where (`col_ts` > '1970-01-01 00:00:01')
select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` > '2017-12-31 23:00:00')
select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` < '2018-10-28 01:30:00')
select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where ('2018-10-28 01:30:00' > t0.`col_ts`)
select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` between '2018-10-28 00:30:00' and '2018-10-28 01:30:00')
select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where ((t0.`col_ts` >= '2018-10-28 00:30:00') and (t0.`col_ts` <= '2018-10-28 01:30:00'))
select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` > '2018-03-25 01:00:00')
select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` > '1970-01-01 00:00:01')
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a;
col_a col_dt col_ts unix_timestamp(col_ts)
Expand All @@ -343,6 +356,54 @@ col_a col_dt col_ts unix_timestamp(col_ts)
5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
6 2038-01-19 04:14:07 2038-01-19 04:14:07 2147483647

Test the TIMESTAMP function
connection master_1;
INSERT INTO tbl_f VALUES ('2018-06-24', '01:23:45'),
('2018-06-24', '01:23:45'),
('2018-08-01', '12:34:56');
connection child2_1;
TRUNCATE TABLE mysql.general_log;
connection master_1;
SELECT * FROM tbl_f;
col_d col_t
2018-06-24 01:23:45
2018-06-24 01:23:45
2018-08-01 12:34:56
SELECT TIMESTAMP(col_d, col_t) FROM tbl_f;
TIMESTAMP(col_d, col_t)
2018-06-24 01:23:45
2018-06-24 01:23:45
2018-08-01 12:34:56
SELECT TIMESTAMP('2018-06-25', col_t) FROM tbl_f;
TIMESTAMP('2018-06-25', col_t)
2018-06-25 01:23:45
2018-06-25 01:23:45
2018-06-25 12:34:56
SELECT TIMESTAMP(col_d, '10:43:21') FROM tbl_f;
TIMESTAMP(col_d, '10:43:21')
2018-06-24 10:43:21
2018-06-24 10:43:21
2018-08-01 10:43:21
SELECT TIMESTAMP('2018-06-25', '10:43:21') FROM tbl_f;
TIMESTAMP('2018-06-25', '10:43:21')
2018-06-25 10:43:21
2018-06-25 10:43:21
2018-06-25 10:43:21
connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select t0.`col_d` `col_d`,t0.`col_t` `col_t` from `ts_test_remote`.`tbl_f` t0
select (timestamp(t0.`col_d` , t0.`col_t`)) `TIMESTAMP(col_d, col_t)` from `ts_test_remote`.`tbl_f` t0
select (timestamp('2018-06-25' , t0.`col_t`)) `TIMESTAMP('2018-06-25', col_t)` from `ts_test_remote`.`tbl_f` t0
select (timestamp(t0.`col_d` , '10:43:21')) `TIMESTAMP(col_d, '10:43:21')` from `ts_test_remote`.`tbl_f` t0
select (timestamp('2018-06-25' , '10:43:21')) `TIMESTAMP('2018-06-25', '10:43:21')` from `ts_test_remote`.`tbl_f` t0
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT col_d, col_t FROM tbl_f;
col_d col_t
2018-06-24 01:23:45
2018-06-24 01:23:45
2018-08-01 12:34:56

Restore Time Zone settings
connection master_1;
SET GLOBAL time_zone=DEFAULT;
Expand Down
85 changes: 74 additions & 11 deletions storage/spider/mysql-test/spider/t/timestamp.test
Expand Up @@ -66,13 +66,17 @@ if ($USE_CHILD_GROUP2)
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_1_DROP_TABLES;
echo CHILD2_1_CREATE_TABLES;
echo CHILD2_1_DROP_TABLE;
echo CHILD2_1_DROP_TABLE_F;
echo CHILD2_1_CREATE_TABLE;
echo CHILD2_1_CREATE_TABLE_F;
}
--disable_warnings
eval $CHILD2_1_DROP_TABLES;
eval $CHILD2_1_DROP_TABLE;
eval $CHILD2_1_DROP_TABLE_F;
--enable_warnings
eval $CHILD2_1_CREATE_TABLES;
eval $CHILD2_1_CREATE_TABLE;
eval $CHILD2_1_CREATE_TABLE_F;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
Expand All @@ -98,7 +102,7 @@ echo CREATE TABLE tbl_a (
col_ts TIMESTAMP NOT NULL
DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY(col_a),

UNIQUE INDEX i_ts (col_ts)
) MASTER_1_ENGINE MASTER_1_AUTO_INCREMENT_2_1 MASTER_1_COMMENT_2_1;
eval CREATE TABLE tbl_a (
col_a INT UNSIGNED NOT NULL AUTO_INCREMENT,
Expand All @@ -108,8 +112,17 @@ eval CREATE TABLE tbl_a (
PRIMARY KEY(col_a),
UNIQUE INDEX i_ts (col_ts)
) $MASTER_1_ENGINE $MASTER_1_AUTO_INCREMENT_2_1 $MASTER_1_COMMENT_2_1;
echo CREATE TABLE tbl_f (
col_d DATE,
col_t TIME
) $MASTER_1_ENGINE $MASTER_1_COMMENT_2_1_F;
eval CREATE TABLE tbl_f (
col_d DATE,
col_t TIME
) $MASTER_1_ENGINE $MASTER_1_COMMENT_2_1_F;
--enable_query_log
SHOW CREATE TABLE tbl_a;
SHOW CREATE TABLE tbl_f;

--echo
--echo Set a different time zone that has DST
Expand Down Expand Up @@ -171,7 +184,7 @@ if ($USE_CHILD_GROUP2)
{
eval $CHILD2_1_SELECT_ARGUMENT1;
}
eval $CHILD2_1_SELECT_TABLES;
eval $CHILD2_1_SELECT_TABLE;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
Expand Down Expand Up @@ -214,7 +227,7 @@ if ($USE_CHILD_GROUP2)
{
eval $CHILD2_1_SELECT_ARGUMENT1;
}
eval $CHILD2_1_SELECT_TABLES;
eval $CHILD2_1_SELECT_TABLE;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
Expand Down Expand Up @@ -256,7 +269,7 @@ if ($USE_CHILD_GROUP2)
{
eval $CHILD2_1_SELECT_ARGUMENT1;
}
eval $CHILD2_1_SELECT_TABLES;
eval $CHILD2_1_SELECT_TABLE;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
Expand Down Expand Up @@ -299,7 +312,7 @@ if ($USE_CHILD_GROUP2)
{
eval $CHILD2_1_SELECT_ARGUMENT1;
}
eval $CHILD2_1_SELECT_TABLES;
eval $CHILD2_1_SELECT_TABLE;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
Expand Down Expand Up @@ -347,7 +360,7 @@ if ($USE_CHILD_GROUP2)
{
eval $CHILD2_1_SELECT_ARGUMENT1;
}
eval $CHILD2_1_SELECT_TABLES;
eval $CHILD2_1_SELECT_TABLE;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
Expand Down Expand Up @@ -425,7 +438,57 @@ if ($USE_CHILD_GROUP2)
{
eval $CHILD2_1_SELECT_ARGUMENT1;
}
eval $CHILD2_1_SELECT_TABLES;
eval $CHILD2_1_SELECT_TABLE;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}

--echo
--echo Test the TIMESTAMP function
--connection master_1
INSERT INTO tbl_f VALUES ('2018-06-24', '01:23:45'),
('2018-06-24', '01:23:45'),
('2018-08-01', '12:34:56');
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
SELECT * FROM tbl_f;
SELECT TIMESTAMP(col_d, col_t) FROM tbl_f;
SELECT TIMESTAMP('2018-06-25', col_t) FROM tbl_f;
SELECT TIMESTAMP(col_d, '10:43:21') FROM tbl_f;
SELECT TIMESTAMP('2018-06-25', '10:43:21') FROM tbl_f;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
eval $CHILD2_1_SELECT_ARGUMENT1;
}
eval $CHILD2_1_SELECT_TABLE_F;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
Expand Down

0 comments on commit e39eb18

Please sign in to comment.