-
Notifications
You must be signed in to change notification settings - Fork 387
Closed
Description
Here https://clickhouse.com/docs/en/sql-reference/statements/create/table#with-explicit-schema
It is listed as
CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster]
(
name1 [type1] [NULL|NOT NULL] [DEFAULT|MATERIALIZED|EPHEMERAL|ALIAS expr1] [compression_codec] [TTL expr1] [COMMENT 'comment for column'],
name2 [type2] [NULL|NOT NULL] [DEFAULT|MATERIALIZED|EPHEMERAL|ALIAS expr2] [compression_codec] [TTL expr2] [COMMENT 'comment for column'],
...
) ENGINE = engine
COMMENT 'comment for table'
But if I try to create a table with a column with comment I get an error using the order above.
ClickHouse client version 23.10.1.1976 (official build).
Connecting to localhost:9000 as user admin.
Connected to ClickHouse server version 23.10.1 revision 54466.
625795cd2cec :) create table x( `test` Nullable(String) CODEC(ZSTD) COMMENT 'Some comment') Engine=Memory;
Syntax error: failed at position 53 ('COMMENT'):
create table x( `test` Nullable(String) CODEC(ZSTD) COMMENT 'Some comment') Engine=Memory;
Expected one of: TTL, PRIMARY KEY, token, Comma, ClosingRoundBracket
But if I change the order it works.
ClickHouse client version 23.10.1.1976 (official build).
Connecting to localhost:9000 as user admin.
Connected to ClickHouse server version 23.10.1 revision 54466.
625795cd2cec :) create table x( `test` Nullable(String) COMMENT 'Some comment' CODEC(ZSTD)) Engine=Memory;
CREATE TABLE x
(
`test` Nullable(String) COMMENT 'Some comment' CODEC(ZSTD)
)
ENGINE = Memory
Query id: 7aee263b-70a9-44e1-a1f9-dd70d512a994
Ok.
0 rows in set. Elapsed: 0.005 sec.
Metadata
Metadata
Assignees
Labels
No labels