Files
greptimedb/tests/cases/standalone/common/create/create.result
Lei, HUANG cd4bf239d0 chore: relax table name constraint (#4766)
chore/relax-table-name-constraint: Updated NAME_PATTERN to allow '@' and '#' characters and adjusted tests for new table name validation rules.
2024-09-25 02:45:18 +00:00

273 lines
9.8 KiB
Plaintext

CREATE TABLE integers (i BIGINT);
Error: 2000(InvalidSyntax), Missing time index constraint
CREATE TABLE integers (i INT TIME INDEX);
Error: 1004(InvalidArguments), Invalid column option, column name: i, error: time index column data type should be timestamp
CREATE TABLE integers (i TIMESTAMP TIME INDEX NULL);
Error: 1004(InvalidArguments), Invalid column option, column name: i, error: time index column can't be null
CREATE TABLE integers (i TIMESTAMP TIME INDEX, j BIGINT, TIME INDEX(j));
Error: 2000(InvalidSyntax), Invalid time index: expected only one time index constraint but actual 2
CREATE TABLE integers (i TIMESTAMP TIME INDEX, j BIGINT, TIME INDEX(i, j));
Error: 2000(InvalidSyntax), Invalid time index: it should contain only one column in time index
CREATE TABLE integers (i TIMESTAMP TIME INDEX);
Affected Rows: 0
CREATE TABLE times (i TIMESTAMP TIME INDEX DEFAULT CURRENT_TIMESTAMP());
Affected Rows: 0
CREATE TABLE IF NOT EXISTS integers (i TIMESTAMP TIME INDEX);
Affected Rows: 0
CREATE TABLE test1 (i INTEGER, j INTEGER);
Error: 2000(InvalidSyntax), Missing time index constraint
CREATE TABLE test1 (i INTEGER, j TIMESTAMP TIME INDEX NOT NULL);
Affected Rows: 0
CREATE TABLE test2 (i INTEGER, j TIMESTAMP TIME INDEX NULL);
Error: 1004(InvalidArguments), Invalid column option, column name: j, error: time index column can't be null
CREATE TABLE test2 (i INTEGER, j TIMESTAMP TIME INDEX);
Affected Rows: 0
CREATE TABLE test2 (i INTEGER, j TIMESTAMP TIME INDEX);
Error: 4000(TableAlreadyExists), Table already exists: `greptime.public.test2`
CREATE TABLE 'N.~' (i TIMESTAMP TIME INDEX);
Error: 1004(InvalidArguments), Invalid table name: N.~
CREATE TABLE `p_perftest001@cc3kvQ_D1D9H9GOZGMIY97TWH20R1LRC8U0SFBA` (i INTEGER, j TIMESTAMP TIME INDEX);
Affected Rows: 0
DROP TABLE `p_perftest001@cc3kvQ_D1D9H9GOZGMIY97TWH20R1LRC8U0SFBA`;
Affected Rows: 0
CREATE TABLE `p_perftest001#cc3kvQ_D1D9H9GOZGMIY97TWH20R1LRC8U0SFBA` (i INTEGER, j TIMESTAMP TIME INDEX);
Affected Rows: 0
DROP TABLE `p_perftest001#cc3kvQ_D1D9H9GOZGMIY97TWH20R1LRC8U0SFBA`;
Affected Rows: 0
CREATE TABLE neg_default_value_min(i TIMESTAMP TIME INDEX, j SMALLINT DEFAULT -32768);
Affected Rows: 0
DESC TABLE neg_default_value_min;
+--------+----------------------+-----+------+---------+---------------+
| Column | Type | Key | Null | Default | Semantic Type |
+--------+----------------------+-----+------+---------+---------------+
| i | TimestampMillisecond | PRI | NO | | TIMESTAMP |
| j | Int16 | | YES | -32768 | FIELD |
+--------+----------------------+-----+------+---------+---------------+
DROP TABLE neg_default_value_min;
Affected Rows: 0
DESC TABLE integers;
+--------+----------------------+-----+------+---------+---------------+
| Column | Type | Key | Null | Default | Semantic Type |
+--------+----------------------+-----+------+---------+---------------+
| i | TimestampMillisecond | PRI | NO | | TIMESTAMP |
+--------+----------------------+-----+------+---------+---------------+
DESC TABLE test1;
+--------+----------------------+-----+------+---------+---------------+
| Column | Type | Key | Null | Default | Semantic Type |
+--------+----------------------+-----+------+---------+---------------+
| i | Int32 | | YES | | FIELD |
| j | TimestampMillisecond | PRI | NO | | TIMESTAMP |
+--------+----------------------+-----+------+---------+---------------+
DESC TABLE test2;
+--------+----------------------+-----+------+---------+---------------+
| Column | Type | Key | Null | Default | Semantic Type |
+--------+----------------------+-----+------+---------+---------------+
| i | Int32 | | YES | | FIELD |
| j | TimestampMillisecond | PRI | NO | | TIMESTAMP |
+--------+----------------------+-----+------+---------+---------------+
DROP TABLE integers;
Affected Rows: 0
DROP TABLE times;
Affected Rows: 0
DROP TABLE test1;
Affected Rows: 0
DROP TABLE test2;
Affected Rows: 0
CREATE TABLE test_pk ("timestamp" TIMESTAMP TIME INDEX, host STRING PRIMARY KEY, "value" DOUBLE);
Affected Rows: 0
DESC TABLE test_pk;
+-----------+----------------------+-----+------+---------+---------------+
| Column | Type | Key | Null | Default | Semantic Type |
+-----------+----------------------+-----+------+---------+---------------+
| timestamp | TimestampMillisecond | PRI | NO | | TIMESTAMP |
| host | String | PRI | YES | | TAG |
| value | Float64 | | YES | | FIELD |
+-----------+----------------------+-----+------+---------+---------------+
DROP TABLE test_pk;
Affected Rows: 0
CREATE TABLE test_multiple_pk_definitions ("timestamp" TIMESTAMP TIME INDEX, host STRING PRIMARY KEY, "value" DOUBLE, PRIMARY KEY(host));
Error: 1004(InvalidArguments), Illegal primary keys definition: found definitions of primary keys in multiple places
CREATE TABLE test_multiple_pk_definitions ("timestamp" TIMESTAMP TIME INDEX, host STRING PRIMARY KEY, "value" DOUBLE, PRIMARY KEY(host), PRIMARY KEY(host));
Error: 1004(InvalidArguments), Illegal primary keys definition: found definitions of primary keys in multiple places
CREATE TABLE test_multiple_inline_pk_definitions ("timestamp" TIMESTAMP TIME INDEX, host STRING PRIMARY KEY, "value" DOUBLE PRIMARY KEY);
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
CREATE TABLE test_like_1 (PK STRING PRIMARY KEY, i INTEGER DEFAULT 7, j TIMESTAMP TIME INDEX);
Affected Rows: 0
CREATE TABLE test_like_2 LIKE test_like_1;
Affected Rows: 0
CREATE TABLE test_like_2 LIKE test_like_1;
Error: 4000(TableAlreadyExists), Table already exists: `greptime.public.test_like_2`
CREATE TABLE `ExcePTuRi`(
non TIMESTAMP(6) TIME INDEX,
`iUSTO` DOUBLE DEFAULT 0.047318541668048164
)
ENGINE=mito;
Affected Rows: 0
DESC table `ExcePTuRi`;
+--------+----------------------+-----+------+----------------------+---------------+
| Column | Type | Key | Null | Default | Semantic Type |
+--------+----------------------+-----+------+----------------------+---------------+
| non | TimestampMicrosecond | PRI | NO | | TIMESTAMP |
| iUSTO | Float64 | | YES | 0.047318541668048164 | FIELD |
+--------+----------------------+-----+------+----------------------+---------------+
DESC TABLE test_like_1;
+--------+----------------------+-----+------+---------+---------------+
| Column | Type | Key | Null | Default | Semantic Type |
+--------+----------------------+-----+------+---------+---------------+
| pk | String | PRI | YES | | TAG |
| i | Int32 | | YES | 7 | FIELD |
| j | TimestampMillisecond | PRI | NO | | TIMESTAMP |
+--------+----------------------+-----+------+---------+---------------+
DESC TABLE test_like_2;
+--------+----------------------+-----+------+---------+---------------+
| Column | Type | Key | Null | Default | Semantic Type |
+--------+----------------------+-----+------+---------+---------------+
| pk | String | PRI | YES | | TAG |
| i | Int32 | | YES | 7 | FIELD |
| j | TimestampMillisecond | PRI | NO | | TIMESTAMP |
+--------+----------------------+-----+------+---------+---------------+
DROP TABLE test_like_1;
Affected Rows: 0
DROP TABLE test_like_2;
Affected Rows: 0
DROP table `ExcePTuRi`;
Affected Rows: 0
CREATE TABLE if not exists monitor (
host STRING,
ts TIMESTAMP(9) DEFAULT CURRENT_TIMESTAMP() TIME INDEX,
cpu FLOAT64 DEFAULT 0,
memory FLOAT64,
PRIMARY KEY(host)) ENGINE=mito WITH(COMMENT='create by human');
Affected Rows: 0
SHOW CREATE TABLE monitor;
+---------+-----------------------------------------------------------+
| Table | Create Table |
+---------+-----------------------------------------------------------+
| monitor | CREATE TABLE IF NOT EXISTS "monitor" ( |
| | "host" STRING NULL, |
| | "ts" TIMESTAMP(9) NOT NULL DEFAULT current_timestamp(), |
| | "cpu" DOUBLE NULL DEFAULT 0, |
| | "memory" DOUBLE NULL, |
| | TIME INDEX ("ts"), |
| | PRIMARY KEY ("host") |
| | ) |
| | |
| | ENGINE=mito |
| | WITH( |
| | comment = 'create by human' |
| | ) |
+---------+-----------------------------------------------------------+
DROP TABLE monitor;
Affected Rows: 0