2.1.3 表内有一个字段为自增列 使用 insert into select方式插入报错 2.1.4就可以

Viewed 47

在2.1.3中建表语句为:
CREATE TABLE test (
id BIGINT NOT NULL AUTO_INCREMENT(1) COMMENT 'id',
test VARCHAR(50) NULL COMMENT 'test'
) ENGINE=OLAP
UNIQUE KEY(id)
COMMENT 'test'
DISTRIBUTED BY HASH(id) BUCKETS AUTO
PROPERTIES (
"replication_allocation" = "tag.location.default: 2",
"min_load_replica_num" = "-1",
"is_being_synced" = "false",
"storage_medium" = "hdd",
"storage_format" = "V2",
"inverted_index_storage_format" = "V1",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"compaction_policy" = "time_series",
"time_series_compaction_goal_size_mbytes" = "1024",
"time_series_compaction_file_count_threshold" = "2000",
"time_series_compaction_time_threshold_seconds" = "3600",
"time_series_compaction_empty_rowsets_threshold" = "5",
"time_series_compaction_level_threshold" = "1",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false",
"group_commit_interval_ms" = "10000",
"group_commit_data_bytes" = "134217728"
);

执行的sql为:
insert into test (test) select test from test;
(insert 之前表中已存在一条数据)

执行时会报错:
Reason: column_name[id],null value for not null column, type=BIGINT. src line [];

麻烦帮忙看一下是2.1.3设置的问题还是bug呢

1 Answers

show variables; 看下2.1.3 和 2.1.4 的参数有没有什么diff。

不过还是别在低版本上搞了,建议直接拉齐到2.1.7上吧。