Skip to content

Commit e39eb18

Browse files
author
Jacob Mathew
committed
MDEV-16398: Spider Creates Query With Non-Existent Function
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
1 parent f6d4f62 commit e39eb18

File tree

7 files changed

+213
-57
lines changed

7 files changed

+213
-57
lines changed

storage/spider/mysql-test/spider/include/init_spider.inc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
250250
format_id int not null default 0,
251251
gtrid_length int not null default 0,
252252
bqual_length int not null default 0,
253-
data char(128) charset binary not null default '',
253+
data binary(128) not null default '',
254254
status char(8) not null default '',
255255
PRIMARY KEY (data, format_id, gtrid_length),
256256
KEY idx1 (status)
@@ -260,7 +260,7 @@ if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
260260
format_id int not null default 0,
261261
gtrid_length int not null default 0,
262262
bqual_length int not null default 0,
263-
data char(128) charset binary not null default '',
263+
data binary(128) not null default '',
264264
scheme char(64) not null default '',
265265
host char(64) not null default '',
266266
port char(5) not null default '',
@@ -282,7 +282,7 @@ if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
282282
format_id int not null default 0,
283283
gtrid_length int not null default 0,
284284
bqual_length int not null default 0,
285-
data char(128) charset binary not null default '',
285+
data binary(128) not null default '',
286286
scheme char(64) not null default '',
287287
host char(64) not null default '',
288288
port char(5) not null default '',
@@ -337,8 +337,8 @@ if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
337337
CREATE TABLE mysql.spider_link_mon_servers(
338338
db_name char(64) not null default '',
339339
table_name char(199) not null default '',
340-
link_id char(5) not null default '',
341-
sid int not null default 0,
340+
link_id char(64) not null default '',
341+
sid int unsigned not null default 0,
342342
server char(64) default null,
343343
scheme char(64) default null,
344344
host char(64) default null,
@@ -360,7 +360,7 @@ if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
360360
CREATE TABLE mysql.spider_link_failed_log(
361361
db_name char(64) not null default '',
362362
table_name char(199) not null default '',
363-
link_id int not null default 0,
363+
link_id char(64) not null default '',
364364
failed_time timestamp not null default current_timestamp
365365
) ENGINE=MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
366366
DROP TABLE IF EXISTS mysql.spider_table_position_for_recovery;

storage/spider/mysql-test/spider/r/auto_increment.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ col_a col_b col_c
154154
connection child2_1;
155155
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
156156
argument
157-
select `col_a`,`col_b`,`col_c` from `auto_test_remote`.`tbl_a`
157+
select t0.`col_a` `col_a`,t0.`col_b` `col_b`,t0.`col_c` `col_c` from `auto_test_remote`.`tbl_a` t0
158158
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
159159
SELECT col_a, col_b, col_c FROM tbl_a ORDER BY col_a;
160160
col_a col_b col_c

storage/spider/mysql-test/spider/r/timestamp.result

Lines changed: 81 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ SELECT 1;
4040

4141
create table
4242
connection child2_1;
43-
CHILD2_1_DROP_TABLES
44-
CHILD2_1_CREATE_TABLES
43+
CHILD2_1_DROP_TABLE
44+
CHILD2_1_DROP_TABLE_F
45+
CHILD2_1_CREATE_TABLE
46+
CHILD2_1_CREATE_TABLE_F
4547
TRUNCATE TABLE mysql.general_log;
4648
connection master_1;
4749
DROP TABLE IF EXISTS tbl_a;
@@ -51,7 +53,12 @@ col_dt DATETIME,
5153
col_ts TIMESTAMP NOT NULL
5254
DEFAULT current_timestamp() ON UPDATE current_timestamp(),
5355
PRIMARY KEY(col_a),
56+
UNIQUE INDEX i_ts (col_ts)
5457
) MASTER_1_ENGINE MASTER_1_AUTO_INCREMENT_2_1 MASTER_1_COMMENT_2_1
58+
CREATE TABLE tbl_f (
59+
col_d DATE,
60+
col_t TIME
61+
) ENGINE=Spider COMMENT='database "ts_test_remote", table "tbl_f", srv "s_2_1"'
5562
SHOW CREATE TABLE tbl_a;
5663
Table Create Table
5764
tbl_a CREATE TABLE `tbl_a` (
@@ -61,6 +68,12 @@ tbl_a CREATE TABLE `tbl_a` (
6168
PRIMARY KEY (`col_a`),
6269
UNIQUE KEY `i_ts` (`col_ts`)
6370
) ENGINE=SPIDER AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COMMENT='database "ts_test_remote", table "tbl_a", srv "s_2_1"'
71+
SHOW CREATE TABLE tbl_f;
72+
Table Create Table
73+
tbl_f CREATE TABLE `tbl_f` (
74+
`col_d` date DEFAULT NULL,
75+
`col_t` time DEFAULT NULL
76+
) ENGINE=SPIDER DEFAULT CHARSET=latin1 COMMENT='database "ts_test_remote", table "tbl_f", srv "s_2_1"'
6477

6578
Set a different time zone that has DST
6679
SET time_zone='+01:00';
@@ -101,7 +114,7 @@ col_a col_dt col_ts unix_timestamp(col_ts)
101114
connection child2_1;
102115
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
103116
argument
104-
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a`
117+
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
105118
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
106119
SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a;
107120
col_a col_dt col_ts unix_timestamp(col_ts)
@@ -127,7 +140,7 @@ col_a col_dt col_ts unix_timestamp(col_ts)
127140
connection child2_1;
128141
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
129142
argument
130-
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a`
143+
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
131144
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
132145
SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a;
133146
col_a col_dt col_ts unix_timestamp(col_ts)
@@ -153,7 +166,7 @@ col_a col_dt col_ts unix_timestamp(col_ts)
153166
connection child2_1;
154167
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
155168
argument
156-
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a`
169+
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
157170
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
158171
SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a;
159172
col_a col_dt col_ts unix_timestamp(col_ts)
@@ -181,7 +194,7 @@ connection child2_1;
181194
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
182195
argument
183196
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` for update
184-
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a`
197+
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
185198
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
186199
SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a;
187200
col_a col_dt col_ts unix_timestamp(col_ts)
@@ -239,13 +252,13 @@ col_a col_dt col_ts unix_timestamp(col_ts)
239252
connection child2_1;
240253
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
241254
argument
242-
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`
243-
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`
244-
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`
245-
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`
246-
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`
247-
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`
248-
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`
255+
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')
256+
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')
257+
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`)
258+
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')
259+
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'))
260+
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')
261+
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')
249262
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
250263
SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a;
251264
col_a col_dt col_ts unix_timestamp(col_ts)
@@ -326,13 +339,13 @@ col_a col_dt col_ts unix_timestamp(col_ts)
326339
connection child2_1;
327340
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
328341
argument
329-
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` where (`col_ts` > '2017-12-31 23:00:00')
330-
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` where (`col_ts` < '2018-10-28 01:30:00')
331-
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` where ('2018-10-28 01:30:00' > `col_ts`)
332-
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')
333-
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'))
334-
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` where (`col_ts` > '2018-03-25 01:00:00')
335-
select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` where (`col_ts` > '1970-01-01 00:00:01')
342+
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')
343+
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')
344+
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`)
345+
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')
346+
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'))
347+
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')
348+
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')
336349
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
337350
SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a;
338351
col_a col_dt col_ts unix_timestamp(col_ts)
@@ -343,6 +356,54 @@ col_a col_dt col_ts unix_timestamp(col_ts)
343356
5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
344357
6 2038-01-19 04:14:07 2038-01-19 04:14:07 2147483647
345358

359+
Test the TIMESTAMP function
360+
connection master_1;
361+
INSERT INTO tbl_f VALUES ('2018-06-24', '01:23:45'),
362+
('2018-06-24', '01:23:45'),
363+
('2018-08-01', '12:34:56');
364+
connection child2_1;
365+
TRUNCATE TABLE mysql.general_log;
366+
connection master_1;
367+
SELECT * FROM tbl_f;
368+
col_d col_t
369+
2018-06-24 01:23:45
370+
2018-06-24 01:23:45
371+
2018-08-01 12:34:56
372+
SELECT TIMESTAMP(col_d, col_t) FROM tbl_f;
373+
TIMESTAMP(col_d, col_t)
374+
2018-06-24 01:23:45
375+
2018-06-24 01:23:45
376+
2018-08-01 12:34:56
377+
SELECT TIMESTAMP('2018-06-25', col_t) FROM tbl_f;
378+
TIMESTAMP('2018-06-25', col_t)
379+
2018-06-25 01:23:45
380+
2018-06-25 01:23:45
381+
2018-06-25 12:34:56
382+
SELECT TIMESTAMP(col_d, '10:43:21') FROM tbl_f;
383+
TIMESTAMP(col_d, '10:43:21')
384+
2018-06-24 10:43:21
385+
2018-06-24 10:43:21
386+
2018-08-01 10:43:21
387+
SELECT TIMESTAMP('2018-06-25', '10:43:21') FROM tbl_f;
388+
TIMESTAMP('2018-06-25', '10:43:21')
389+
2018-06-25 10:43:21
390+
2018-06-25 10:43:21
391+
2018-06-25 10:43:21
392+
connection child2_1;
393+
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
394+
argument
395+
select t0.`col_d` `col_d`,t0.`col_t` `col_t` from `ts_test_remote`.`tbl_f` t0
396+
select (timestamp(t0.`col_d` , t0.`col_t`)) `TIMESTAMP(col_d, col_t)` from `ts_test_remote`.`tbl_f` t0
397+
select (timestamp('2018-06-25' , t0.`col_t`)) `TIMESTAMP('2018-06-25', col_t)` from `ts_test_remote`.`tbl_f` t0
398+
select (timestamp(t0.`col_d` , '10:43:21')) `TIMESTAMP(col_d, '10:43:21')` from `ts_test_remote`.`tbl_f` t0
399+
select (timestamp('2018-06-25' , '10:43:21')) `TIMESTAMP('2018-06-25', '10:43:21')` from `ts_test_remote`.`tbl_f` t0
400+
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
401+
SELECT col_d, col_t FROM tbl_f;
402+
col_d col_t
403+
2018-06-24 01:23:45
404+
2018-06-24 01:23:45
405+
2018-08-01 12:34:56
406+
346407
Restore Time Zone settings
347408
connection master_1;
348409
SET GLOBAL time_zone=DEFAULT;

storage/spider/mysql-test/spider/t/timestamp.test

Lines changed: 74 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,17 @@ if ($USE_CHILD_GROUP2)
6666
if ($OUTPUT_CHILD_GROUP2)
6767
{
6868
--disable_query_log
69-
echo CHILD2_1_DROP_TABLES;
70-
echo CHILD2_1_CREATE_TABLES;
69+
echo CHILD2_1_DROP_TABLE;
70+
echo CHILD2_1_DROP_TABLE_F;
71+
echo CHILD2_1_CREATE_TABLE;
72+
echo CHILD2_1_CREATE_TABLE_F;
7173
}
7274
--disable_warnings
73-
eval $CHILD2_1_DROP_TABLES;
75+
eval $CHILD2_1_DROP_TABLE;
76+
eval $CHILD2_1_DROP_TABLE_F;
7477
--enable_warnings
75-
eval $CHILD2_1_CREATE_TABLES;
78+
eval $CHILD2_1_CREATE_TABLE;
79+
eval $CHILD2_1_CREATE_TABLE_F;
7680
if ($OUTPUT_CHILD_GROUP2)
7781
{
7882
--enable_query_log
@@ -98,7 +102,7 @@ echo CREATE TABLE tbl_a (
98102
col_ts TIMESTAMP NOT NULL
99103
DEFAULT current_timestamp() ON UPDATE current_timestamp(),
100104
PRIMARY KEY(col_a),
101-
105+
UNIQUE INDEX i_ts (col_ts)
102106
) MASTER_1_ENGINE MASTER_1_AUTO_INCREMENT_2_1 MASTER_1_COMMENT_2_1;
103107
eval CREATE TABLE tbl_a (
104108
col_a INT UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -108,8 +112,17 @@ eval CREATE TABLE tbl_a (
108112
PRIMARY KEY(col_a),
109113
UNIQUE INDEX i_ts (col_ts)
110114
) $MASTER_1_ENGINE $MASTER_1_AUTO_INCREMENT_2_1 $MASTER_1_COMMENT_2_1;
115+
echo CREATE TABLE tbl_f (
116+
col_d DATE,
117+
col_t TIME
118+
) $MASTER_1_ENGINE $MASTER_1_COMMENT_2_1_F;
119+
eval CREATE TABLE tbl_f (
120+
col_d DATE,
121+
col_t TIME
122+
) $MASTER_1_ENGINE $MASTER_1_COMMENT_2_1_F;
111123
--enable_query_log
112124
SHOW CREATE TABLE tbl_a;
125+
SHOW CREATE TABLE tbl_f;
113126

114127
--echo
115128
--echo Set a different time zone that has DST
@@ -171,7 +184,7 @@ if ($USE_CHILD_GROUP2)
171184
{
172185
eval $CHILD2_1_SELECT_ARGUMENT1;
173186
}
174-
eval $CHILD2_1_SELECT_TABLES;
187+
eval $CHILD2_1_SELECT_TABLE;
175188
if (!$OUTPUT_CHILD_GROUP2)
176189
{
177190
--enable_query_log
@@ -214,7 +227,7 @@ if ($USE_CHILD_GROUP2)
214227
{
215228
eval $CHILD2_1_SELECT_ARGUMENT1;
216229
}
217-
eval $CHILD2_1_SELECT_TABLES;
230+
eval $CHILD2_1_SELECT_TABLE;
218231
if (!$OUTPUT_CHILD_GROUP2)
219232
{
220233
--enable_query_log
@@ -256,7 +269,7 @@ if ($USE_CHILD_GROUP2)
256269
{
257270
eval $CHILD2_1_SELECT_ARGUMENT1;
258271
}
259-
eval $CHILD2_1_SELECT_TABLES;
272+
eval $CHILD2_1_SELECT_TABLE;
260273
if (!$OUTPUT_CHILD_GROUP2)
261274
{
262275
--enable_query_log
@@ -299,7 +312,7 @@ if ($USE_CHILD_GROUP2)
299312
{
300313
eval $CHILD2_1_SELECT_ARGUMENT1;
301314
}
302-
eval $CHILD2_1_SELECT_TABLES;
315+
eval $CHILD2_1_SELECT_TABLE;
303316
if (!$OUTPUT_CHILD_GROUP2)
304317
{
305318
--enable_query_log
@@ -347,7 +360,7 @@ if ($USE_CHILD_GROUP2)
347360
{
348361
eval $CHILD2_1_SELECT_ARGUMENT1;
349362
}
350-
eval $CHILD2_1_SELECT_TABLES;
363+
eval $CHILD2_1_SELECT_TABLE;
351364
if (!$OUTPUT_CHILD_GROUP2)
352365
{
353366
--enable_query_log
@@ -425,7 +438,57 @@ if ($USE_CHILD_GROUP2)
425438
{
426439
eval $CHILD2_1_SELECT_ARGUMENT1;
427440
}
428-
eval $CHILD2_1_SELECT_TABLES;
441+
eval $CHILD2_1_SELECT_TABLE;
442+
if (!$OUTPUT_CHILD_GROUP2)
443+
{
444+
--enable_query_log
445+
--enable_result_log
446+
}
447+
}
448+
449+
--echo
450+
--echo Test the TIMESTAMP function
451+
--connection master_1
452+
INSERT INTO tbl_f VALUES ('2018-06-24', '01:23:45'),
453+
('2018-06-24', '01:23:45'),
454+
('2018-08-01', '12:34:56');
455+
if ($USE_CHILD_GROUP2)
456+
{
457+
if (!$OUTPUT_CHILD_GROUP2)
458+
{
459+
--disable_query_log
460+
--disable_result_log
461+
}
462+
--connection child2_1
463+
if ($USE_GENERAL_LOG)
464+
{
465+
TRUNCATE TABLE mysql.general_log;
466+
}
467+
if (!$OUTPUT_CHILD_GROUP2)
468+
{
469+
--enable_query_log
470+
--enable_result_log
471+
}
472+
}
473+
--connection master_1
474+
SELECT * FROM tbl_f;
475+
SELECT TIMESTAMP(col_d, col_t) FROM tbl_f;
476+
SELECT TIMESTAMP('2018-06-25', col_t) FROM tbl_f;
477+
SELECT TIMESTAMP(col_d, '10:43:21') FROM tbl_f;
478+
SELECT TIMESTAMP('2018-06-25', '10:43:21') FROM tbl_f;
479+
if ($USE_CHILD_GROUP2)
480+
{
481+
if (!$OUTPUT_CHILD_GROUP2)
482+
{
483+
--disable_query_log
484+
--disable_result_log
485+
}
486+
--connection child2_1
487+
if ($USE_GENERAL_LOG)
488+
{
489+
eval $CHILD2_1_SELECT_ARGUMENT1;
490+
}
491+
eval $CHILD2_1_SELECT_TABLE_F;
429492
if (!$OUTPUT_CHILD_GROUP2)
430493
{
431494
--enable_query_log

0 commit comments

Comments
 (0)