mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-06 21:32:58 +00:00
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:
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user