Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 原表字段char(255)使用Create table like后,新表变成了char(1) #37192

Closed
2 of 3 tasks
Danpilz opened this issue Jul 3, 2024 · 1 comment · Fixed by #37340
Closed
2 of 3 tasks

[Bug] 原表字段char(255)使用Create table like后,新表变成了char(1) #37192

Danpilz opened this issue Jul 3, 2024 · 1 comment · Fixed by #37340
Assignees

Comments

@Danpilz
Copy link

Danpilz commented Jul 3, 2024

Search before asking

  • I had searched in the issues and found no similar issues.

Version

apache-doris-2.1.3-bin-x64

What's Wrong?

这是原表,包含了char(255)类型的字段

CREATE TABLE test_doris_huan_hang
(
	`id` INT NOT NULL,
	`name` CHAR(255),
	`address` VARCHAR(8000),
	`updt_time` DATETIME,
	`money` DECIMAL(16,4),
	`double_test` DECIMAL(16,2) NOT NULL,
	`float_test` DECIMAL(16,2),
	`log_text` STRING
)
UNIQUE KEY(`id`)
DISTRIBUTED BY HASH(`id`) BUCKETS AUTO
PROPERTIES (
	"replication_num" = "3",
	"light_schema_change" = "true"
);

使用create table like创建新表

CREATE TABLE `temp_d8fd87d7cc814c1c` LIKE test_doris_huan_hang;

使用show create table发现,新创建的表的char长度变为了1,导致插入数据时报错

CREATE TABLE `temp_d8fd87d7cc814c1c` (
  `id` INT NOT NULL,
  `name` CHAR(1) NULL,
  `address` VARCHAR(8000) NULL,
  `updt_time` DATETIME NULL,
  `money` DECIMAL(16, 4) NULL,
  `double_test` DECIMAL(16, 2) NOT NULL,
  `float_test` DECIMAL(16, 2) NULL,
  `log_text` TEXT NULL
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT 'OLAP'
DISTRIBUTED BY HASH(`id`) BUCKETS AUTO
PROPERTIES (
"replication_allocation" = "tag.location.default: 3",
"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",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false",
"group_commit_interval_ms" = "10000",
"group_commit_data_bytes" = "134217728"
);

并且我测试char(254)就没有问题,只要长度小于255都不会出错,请问这是数据库的问题吗?麻烦查看下,谢谢!

What You Expected?

执行create table like需要能正确创建表结构

How to Reproduce?

按照上面的描述可复现

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@morrySnow morrySnow self-assigned this Jul 5, 2024
@morrySnow
Copy link
Contributor

reproduced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants