forked from stoneatom/stonedb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tiamu): select...in...An error was reported when the date was inc…
…luded(stoneatom#829) Cause: There is a problem with the initialization function of datetime type. The object type is not assigned. Solution: Add assignment logic for types.
- Loading branch information
Showing
3 changed files
with
136 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
CREATE TABLE t1 | ||
( | ||
t1_tinyint TINYINT DEFAULT 0, | ||
t1_int INT DEFAULT NULL, | ||
t1_bigint BIGINT, | ||
t1_decimal DECIMAL(5,2), | ||
t1_text TEXT, | ||
t1_char CHAR(5), | ||
t1_varchar VARCHAR(255) DEFAULT 'hello world!', | ||
t1_datetime DATETIME | ||
)ENGINE=tianmu; | ||
INSERT INTO t1 VALUES(); | ||
INSERT INTO t1 VALUES(NULL, NULL, NULL, NULL, '', '', '', NULL); | ||
INSERT INTO t1 VALUES(1, 123456, 987654321, 122.32, repeat('z', 20), 'aaa', repeat('a', 20), '1111-11-11 11:11:11'); | ||
INSERT INTO t1 VALUES(0, 1023456, 887654321, 222.32, repeat('y', 20), 'aaa', repeat('b', 20), '1111-11-11 11:11:11'); | ||
INSERT INTO t1 VALUES(1, -123456, -987654321, -122.32, repeat('z', 20), 'bbb', repeat('a', 20), '1111-11-11 11:11:11'); | ||
INSERT INTO t1 VALUES(0, -1023456, -887654321, -222.32, repeat('x', 20), 'bbb', repeat('b', 20), '1111-11-11 11:11:11'); | ||
SELECT * FROM t1 WHERE t1_datetime IN ('1111-11-11 11:11:11','1111-11-13 0:0:0'); | ||
t1_tinyint t1_int t1_bigint t1_decimal t1_text t1_char t1_varchar t1_datetime | ||
1 123456 987654321 122.32 zzzzzzzzzzzzzzzzzzzz aaa aaaaaaaaaaaaaaaaaaaa 1111-11-11 11:11:11 | ||
0 1023456 887654321 222.32 yyyyyyyyyyyyyyyyyyyy aaa bbbbbbbbbbbbbbbbbbbb 1111-11-11 11:11:11 | ||
1 -123456 -987654321 -122.32 zzzzzzzzzzzzzzzzzzzz bbb aaaaaaaaaaaaaaaaaaaa 1111-11-11 11:11:11 | ||
0 -1023456 -887654321 -222.32 xxxxxxxxxxxxxxxxxxxx bbb bbbbbbbbbbbbbbbbbbbb 1111-11-11 11:11:11 | ||
SELECT * FROM t1 WHERE t1_datetime = '1111-11-13 0:0:0'; | ||
t1_tinyint t1_int t1_bigint t1_decimal t1_text t1_char t1_varchar t1_datetime | ||
SELECT * FROM t1 WHERE t1_datetime = '1111-11-11 11:11:11'; | ||
t1_tinyint t1_int t1_bigint t1_decimal t1_text t1_char t1_varchar t1_datetime | ||
1 123456 987654321 122.32 zzzzzzzzzzzzzzzzzzzz aaa aaaaaaaaaaaaaaaaaaaa 1111-11-11 11:11:11 | ||
0 1023456 887654321 222.32 yyyyyyyyyyyyyyyyyyyy aaa bbbbbbbbbbbbbbbbbbbb 1111-11-11 11:11:11 | ||
1 -123456 -987654321 -122.32 zzzzzzzzzzzzzzzzzzzz bbb aaaaaaaaaaaaaaaaaaaa 1111-11-11 11:11:11 | ||
0 -1023456 -887654321 -222.32 xxxxxxxxxxxxxxxxxxxx bbb bbbbbbbbbbbbbbbbbbbb 1111-11-11 11:11:11 | ||
SELECT * FROM t1 WHERE t1_datetime < '1111-11-13 0:0:0'; | ||
t1_tinyint t1_int t1_bigint t1_decimal t1_text t1_char t1_varchar t1_datetime | ||
1 123456 987654321 122.32 zzzzzzzzzzzzzzzzzzzz aaa aaaaaaaaaaaaaaaaaaaa 1111-11-11 11:11:11 | ||
0 1023456 887654321 222.32 yyyyyyyyyyyyyyyyyyyy aaa bbbbbbbbbbbbbbbbbbbb 1111-11-11 11:11:11 | ||
1 -123456 -987654321 -122.32 zzzzzzzzzzzzzzzzzzzz bbb aaaaaaaaaaaaaaaaaaaa 1111-11-11 11:11:11 | ||
0 -1023456 -887654321 -222.32 xxxxxxxxxxxxxxxxxxxx bbb bbbbbbbbbbbbbbbbbbbb 1111-11-11 11:11:11 | ||
SELECT * FROM t1 WHERE t1_datetime > '1111-11-13 0:0:0'; | ||
t1_tinyint t1_int t1_bigint t1_decimal t1_text t1_char t1_varchar t1_datetime | ||
SELECT * FROM t1 WHERE t1_datetime > '1111-11-10 0:0:0'; | ||
t1_tinyint t1_int t1_bigint t1_decimal t1_text t1_char t1_varchar t1_datetime | ||
1 123456 987654321 122.32 zzzzzzzzzzzzzzzzzzzz aaa aaaaaaaaaaaaaaaaaaaa 1111-11-11 11:11:11 | ||
0 1023456 887654321 222.32 yyyyyyyyyyyyyyyyyyyy aaa bbbbbbbbbbbbbbbbbbbb 1111-11-11 11:11:11 | ||
1 -123456 -987654321 -122.32 zzzzzzzzzzzzzzzzzzzz bbb aaaaaaaaaaaaaaaaaaaa 1111-11-11 11:11:11 | ||
0 -1023456 -887654321 -222.32 xxxxxxxxxxxxxxxxxxxx bbb bbbbbbbbbbbbbbbbbbbb 1111-11-11 11:11:11 | ||
CREATE TABLE t2 | ||
( | ||
t1_tinyint TINYINT DEFAULT 0, | ||
t1_int INT DEFAULT NULL, | ||
t1_bigint BIGINT, | ||
t1_decimal DECIMAL(5,2), | ||
t1_text TEXT, | ||
t1_char CHAR(5), | ||
t1_varchar VARCHAR(255) DEFAULT 'hello world!', | ||
t1_datetime DATETIME | ||
)ENGINE=tianmu; | ||
INSERT INTO t2 VALUES(); | ||
INSERT INTO t2 VALUES(NULL, NULL, NULL, NULL, '', '', '', NULL); | ||
INSERT INTO t2 VALUES(1, 123456, 987654321, 122.32, repeat('z', 20), 'aaa', repeat('a', 20), '1111-11-11 22:22:22'); | ||
INSERT INTO t2 VALUES(0, 1023456, 887654321, 222.32, repeat('y', 20), 'aaa', repeat('b', 20), '1111-11-12 11:11:11'); | ||
INSERT INTO t2 VALUES(1, -123456, -987654321, -122.32, repeat('z', 20), 'bbb', repeat('a', 20), '1111-11-13 11:11:11'); | ||
INSERT INTO t2 VALUES(0, -1023456, -887654321, -222.32, repeat('x', 20), 'bbb', repeat('b', 20), '1111-11-14 11:11:11'); | ||
SELECT * FROM t2 WHERE t1_datetime IN ('1111-11-11 0:0:0','1111-11-13 11:11:11'); | ||
t1_tinyint t1_int t1_bigint t1_decimal t1_text t1_char t1_varchar t1_datetime | ||
1 -123456 -987654321 -122.32 zzzzzzzzzzzzzzzzzzzz bbb aaaaaaaaaaaaaaaaaaaa 1111-11-13 11:11:11 | ||
SELECT * FROM t1,t2 WHERE | ||
t1.t1_datetime IN ('1111-11-11 11:11:11','1111-11-13 0:0:0') and | ||
t2.t1_datetime IN ('1111-11-11 0:0:0','1111-11-13 11:11:11'); | ||
t1_tinyint t1_int t1_bigint t1_decimal t1_text t1_char t1_varchar t1_datetime t1_tinyint t1_int t1_bigint t1_decimal t1_text t1_char t1_varchar t1_datetime | ||
1 123456 987654321 122.32 zzzzzzzzzzzzzzzzzzzz aaa aaaaaaaaaaaaaaaaaaaa 1111-11-11 11:11:11 1 -123456 -987654321 -122.32 zzzzzzzzzzzzzzzzzzzz bbb aaaaaaaaaaaaaaaaaaaa 1111-11-13 11:11:11 | ||
0 1023456 887654321 222.32 yyyyyyyyyyyyyyyyyyyy aaa bbbbbbbbbbbbbbbbbbbb 1111-11-11 11:11:11 1 -123456 -987654321 -122.32 zzzzzzzzzzzzzzzzzzzz bbb aaaaaaaaaaaaaaaaaaaa 1111-11-13 11:11:11 | ||
1 -123456 -987654321 -122.32 zzzzzzzzzzzzzzzzzzzz bbb aaaaaaaaaaaaaaaaaaaa 1111-11-11 11:11:11 1 -123456 -987654321 -122.32 zzzzzzzzzzzzzzzzzzzz bbb aaaaaaaaaaaaaaaaaaaa 1111-11-13 11:11:11 | ||
0 -1023456 -887654321 -222.32 xxxxxxxxxxxxxxxxxxxx bbb bbbbbbbbbbbbbbbbbbbb 1111-11-11 11:11:11 1 -123456 -987654321 -122.32 zzzzzzzzzzzzzzzzzzzz bbb aaaaaaaaaaaaaaaaaaaa 1111-11-13 11:11:11 | ||
drop table t1 ,t2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--source include/have_tianmu.inc | ||
|
||
CREATE TABLE t1 | ||
( | ||
t1_tinyint TINYINT DEFAULT 0, | ||
t1_int INT DEFAULT NULL, | ||
t1_bigint BIGINT, | ||
t1_decimal DECIMAL(5,2), | ||
t1_text TEXT, | ||
t1_char CHAR(5), | ||
t1_varchar VARCHAR(255) DEFAULT 'hello world!', | ||
t1_datetime DATETIME | ||
)ENGINE=tianmu; | ||
|
||
INSERT INTO t1 VALUES(); | ||
INSERT INTO t1 VALUES(NULL, NULL, NULL, NULL, '', '', '', NULL); | ||
INSERT INTO t1 VALUES(1, 123456, 987654321, 122.32, repeat('z', 20), 'aaa', repeat('a', 20), '1111-11-11 11:11:11'); | ||
INSERT INTO t1 VALUES(0, 1023456, 887654321, 222.32, repeat('y', 20), 'aaa', repeat('b', 20), '1111-11-11 11:11:11'); | ||
INSERT INTO t1 VALUES(1, -123456, -987654321, -122.32, repeat('z', 20), 'bbb', repeat('a', 20), '1111-11-11 11:11:11'); | ||
INSERT INTO t1 VALUES(0, -1023456, -887654321, -222.32, repeat('x', 20), 'bbb', repeat('b', 20), '1111-11-11 11:11:11'); | ||
|
||
SELECT * FROM t1 WHERE t1_datetime IN ('1111-11-11 11:11:11','1111-11-13 0:0:0'); | ||
|
||
SELECT * FROM t1 WHERE t1_datetime = '1111-11-13 0:0:0'; | ||
|
||
SELECT * FROM t1 WHERE t1_datetime = '1111-11-11 11:11:11'; | ||
|
||
SELECT * FROM t1 WHERE t1_datetime < '1111-11-13 0:0:0'; | ||
|
||
SELECT * FROM t1 WHERE t1_datetime > '1111-11-13 0:0:0'; | ||
|
||
SELECT * FROM t1 WHERE t1_datetime > '1111-11-10 0:0:0'; | ||
|
||
|
||
CREATE TABLE t2 | ||
( | ||
t1_tinyint TINYINT DEFAULT 0, | ||
t1_int INT DEFAULT NULL, | ||
t1_bigint BIGINT, | ||
t1_decimal DECIMAL(5,2), | ||
t1_text TEXT, | ||
t1_char CHAR(5), | ||
t1_varchar VARCHAR(255) DEFAULT 'hello world!', | ||
t1_datetime DATETIME | ||
)ENGINE=tianmu; | ||
|
||
INSERT INTO t2 VALUES(); | ||
INSERT INTO t2 VALUES(NULL, NULL, NULL, NULL, '', '', '', NULL); | ||
INSERT INTO t2 VALUES(1, 123456, 987654321, 122.32, repeat('z', 20), 'aaa', repeat('a', 20), '1111-11-11 22:22:22'); | ||
INSERT INTO t2 VALUES(0, 1023456, 887654321, 222.32, repeat('y', 20), 'aaa', repeat('b', 20), '1111-11-12 11:11:11'); | ||
INSERT INTO t2 VALUES(1, -123456, -987654321, -122.32, repeat('z', 20), 'bbb', repeat('a', 20), '1111-11-13 11:11:11'); | ||
INSERT INTO t2 VALUES(0, -1023456, -887654321, -222.32, repeat('x', 20), 'bbb', repeat('b', 20), '1111-11-14 11:11:11'); | ||
|
||
SELECT * FROM t2 WHERE t1_datetime IN ('1111-11-11 0:0:0','1111-11-13 11:11:11'); | ||
|
||
SELECT * FROM t1,t2 WHERE | ||
t1.t1_datetime IN ('1111-11-11 11:11:11','1111-11-13 0:0:0') and | ||
t2.t1_datetime IN ('1111-11-11 0:0:0','1111-11-13 11:11:11'); | ||
|
||
|
||
drop table t1 ,t2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters