fix: fix default value cannot accept negative number (#3217)

* fix: fix default value cannot accept negative number

* chore: apply suggestions from CR
This commit is contained in:
Weny Xu
2024-01-23 12:33:13 +09:00
committed by GitHub
parent 364754afa2
commit 007b63dd9d
5 changed files with 61 additions and 1 deletions

View File

@@ -126,3 +126,20 @@ CREATE TABLE test_multiple_inline_pk_definitions ("timestamp" TIMESTAMP TIME IND
Error: 1004(InvalidArguments), Illegal primary keys definition: not allowed to inline multiple primary keys in columns options
CREATE TABLE neg_default_value(i INT DEFAULT -1024, ts TIMESTAMP TIME INDEX);
Affected Rows: 0
desc TABLE neg_default_value;
+--------+----------------------+-----+------+---------+---------------+
| Column | Type | Key | Null | Default | Semantic Type |
+--------+----------------------+-----+------+---------+---------------+
| i | Int32 | | YES | -1024 | FIELD |
| ts | TimestampMillisecond | PRI | NO | | TIMESTAMP |
+--------+----------------------+-----+------+---------+---------------+
DROP TABLE neg_default_value;
Affected Rows: 0

View File

@@ -52,3 +52,8 @@ CREATE TABLE test_multiple_pk_definitions ("timestamp" TIMESTAMP TIME INDEX, hos
CREATE TABLE test_multiple_inline_pk_definitions ("timestamp" TIMESTAMP TIME INDEX, host STRING PRIMARY KEY, "value" DOUBLE PRIMARY KEY);
CREATE TABLE neg_default_value(i INT DEFAULT -1024, ts TIMESTAMP TIME INDEX);
desc TABLE neg_default_value;
DROP TABLE neg_default_value;

View File

@@ -46,3 +46,23 @@ DROP TABLE presentations;
Affected Rows: 0
CREATE TABLE neg_default_value(i INT DEFAULT -1024, ts TIMESTAMP TIME INDEX);
Affected Rows: 0
INSERT INTO neg_default_value(ts) values ('2000-01-01 00:00:00+00:00');
Affected Rows: 1
SELECT * FROM neg_default_value;
+-------+---------------------+
| i | ts |
+-------+---------------------+
| -1024 | 2000-01-01T00:00:00 |
+-------+---------------------+
DROP TABLE neg_default_value;
Affected Rows: 0

View File

@@ -23,3 +23,11 @@ insert into presentations values (1, 'Patrick Damme', 'Analytical Query Processi
DROP TABLE integers;
DROP TABLE presentations;
CREATE TABLE neg_default_value(i INT DEFAULT -1024, ts TIMESTAMP TIME INDEX);
INSERT INTO neg_default_value(ts) values ('2000-01-01 00:00:00+00:00');
SELECT * FROM neg_default_value;
DROP TABLE neg_default_value;