-
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(common): limit min signed int64 value to -9223372036854775807 #1206
[summary] In Tianmu engine: For int64, -9223372036854775807 is reserved to indicate as `NULL_64` flag, so we limit min value of int64 to -9223372036854775806. For int32, -2147483648 is reserved to indicate as `NULL_32` flag, we limit min value of int32 to -2147483647.
- Loading branch information
1 parent
cf31f0a
commit bc15bbe
Showing
3 changed files
with
46 additions
and
1 deletion.
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,18 @@ | ||
# | ||
# Test signed boundary | ||
# | ||
DROP DATABASE IF EXISTS signed_boundary; | ||
CREATE TABLE int32_(c_max int, c_min int) engine = tianmu; | ||
INSERT INTO int32_ values(-2147483647, 2147483647); | ||
INSERT INTO int32_ values(-2147483648, 2147483647); | ||
ERROR 22003: Out of range[-2147483647, 2147483647] for column 'c_max' value: -2147483648 | ||
INSERT INTO int32_ values(-2147483647, 2147483648); | ||
ERROR 22003: Out of range value for column 'c_min' at row 1 | ||
DROP TABLE int32_; | ||
CREATE TABLE int64_(c_max bigint, c_min bigint) engine = tianmu; | ||
INSERT INTO int64_ values(-9223372036854775806, 9223372036854775807); | ||
INSERT INTO int64_ values(-9223372036854775807, 9223372036854775807); | ||
ERROR 22003: Out of range[-9223372036854775807, 9223372036854775807] for column 'c_max' value: -9223372036854775807 | ||
INSERT INTO int64_ values(-9223372036854775806, 9223372036854775808); | ||
ERROR 22003: Out of range value for column 'c_min' at row 1 | ||
DROP TABLE int64_; |
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,27 @@ | ||
--source include/have_tianmu.inc | ||
|
||
--echo # | ||
--echo # Test signed boundary | ||
--echo # | ||
|
||
--disable_warnings | ||
DROP DATABASE IF EXISTS signed_boundary; | ||
--enable_warnings | ||
|
||
# int32 limit | ||
CREATE TABLE int32_(c_max int, c_min int) engine = tianmu; | ||
INSERT INTO int32_ values(-2147483647, 2147483647); | ||
--error 1264 | ||
INSERT INTO int32_ values(-2147483648, 2147483647); | ||
--error 1264 | ||
INSERT INTO int32_ values(-2147483647, 2147483648); | ||
DROP TABLE int32_; | ||
|
||
# int64 limit | ||
CREATE TABLE int64_(c_max bigint, c_min bigint) engine = tianmu; | ||
INSERT INTO int64_ values(-9223372036854775806, 9223372036854775807); | ||
--error 1264 | ||
INSERT INTO int64_ values(-9223372036854775807, 9223372036854775807); | ||
--error 1264 | ||
INSERT INTO int64_ values(-9223372036854775806, 9223372036854775808); | ||
DROP TABLE int64_; |
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