Files
greptimedb/tests/cases/standalone/common/create/current_timestamp.result
Lin Yihai b6cef77a5c feat: add SET DEFAULT syntax (#6421)
* feat: add `SET DEFAULT` syntax

Signed-off-by: Yihai Lin <yihai-lin@foxmail.com>

* test: add `CURRENT_TIMESTAMP()` as default value for `SET DEFAULT` syntax

Signed-off-by: Yihai Lin <yihai-lin@foxmail.com>

* refactor: Make the error types more precise.

Signed-off-by: Yihai Lin <yihai-lin@foxmail.com>

* chore: a minor error display enchancement for `SET DEFAULT`

Signed-off-by: Yihai Lin <yihai-lin@foxmail.com>

* refactor: Using `MODIFY COLUMN` for `DROP/SET DEFUALT`

Signed-off-by: Yihai Lin <yihai-lin@foxmail.com>

* chore: update `greptime-proto`

Signed-off-by: Yihai Lin <yihai-lin@foxmail.com>

---------

Signed-off-by: Yihai Lin <yihai-lin@foxmail.com>
2025-07-29 06:41:02 +00:00

71 lines
2.7 KiB
Plaintext

create table t1 (ts timestamp time index default CURRENT_TIMESTAMP);
Affected Rows: 0
show create table t1;
+-------+-----------------------------------------------------------+
| Table | Create Table |
+-------+-----------------------------------------------------------+
| t1 | CREATE TABLE IF NOT EXISTS "t1" ( |
| | "ts" TIMESTAMP(3) NOT NULL DEFAULT current_timestamp(), |
| | TIME INDEX ("ts") |
| | ) |
| | |
| | ENGINE=mito |
| | |
+-------+-----------------------------------------------------------+
create table t2 (ts timestamp time index default currEnt_tImEsTamp());
Affected Rows: 0
show create table t2;
+-------+-----------------------------------------------------------+
| Table | Create Table |
+-------+-----------------------------------------------------------+
| t2 | CREATE TABLE IF NOT EXISTS "t2" ( |
| | "ts" TIMESTAMP(3) NOT NULL DEFAULT current_timestamp(), |
| | TIME INDEX ("ts") |
| | ) |
| | |
| | ENGINE=mito |
| | |
+-------+-----------------------------------------------------------+
create table t3 (ts timestamp time index default now());
Affected Rows: 0
show create table t3;
+-------+---------------------------------------------+
| Table | Create Table |
+-------+---------------------------------------------+
| t3 | CREATE TABLE IF NOT EXISTS "t3" ( |
| | "ts" TIMESTAMP(3) NOT NULL DEFAULT now(), |
| | TIME INDEX ("ts") |
| | ) |
| | |
| | ENGINE=mito |
| | |
+-------+---------------------------------------------+
create table t4 (ts timestamp time index default now);
Error: 1001(Unsupported), Unsupported expr in default constraint: now for column: ts
drop table t1;
Affected Rows: 0
drop table t2;
Affected Rows: 0
drop table t3;
Affected Rows: 0