oceanbase / oceanbase/oceanbase
[Feature][mysql][兼容性]:不支持在单个语句中添加列并使其成为外键
@lyukun is already working on this.
Since May 7, 2024.
- Dominant language
- C++
- Stars
- 10.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
【版本信息】
建议贴bin/observer -V的结果,如果这次测试也涉及obproxy的版本变化,也建议贴上obproxy -V的结果
observer (OceanBase_CE 4.2.0.0)
REVISION: 1-0949c8defaa02cb7794e497969d5fcda748935f5
BUILD_BRANCH: master
BUILD_TIME: Jul 10 2023 13:02:23
BUILD_FLAGS: RelWithDebInfo|Sanity
BUILD_INFO:
Copyright (c) 2011-present OceanBase Inc.
【场景描述/复现步骤】
测试sql如下,报错为ErrorCode = 5031, SQLState = HY000, Details = Column not found,
不是not support
CREATE TABLE schema_authorwithevenlongername (
id integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
name varchar(255) NOT NULL,
height integer UNSIGNED NULL CHECK (height >= 0)
);
CREATE TABLE schema_bookwithlongname (
id integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
author_foreign_key_with_really_long_field_name_id integer NOT NULL
);
ALTER TABLE
schema_bookwithlongname
ADD
COLUMN author_other_really_long_named_i_mean_so_long_fk_id integer NOT NULL,
ADD
CONSTRAINT schema_bookwithlongn_author_other_really__6c36f4d2_fk_schema_au FOREIGN KEY (
author_other_really_long_named_i_mean_so_long_fk_id
) REFERENCES schema_authorwithevenlongername(id);
ALTER 语句拆分后执行正常,拆分后为:
ALTER TABLE schema_bookwithlongname
ADD COLUMN author_other_really_long_named_i_mean_so_long_fk_id integer NOT NULL;
ALTER TABLE schema_bookwithlongname
ADD CONSTRAINT schema_bookwithlongn_author_other_really__6c36f4d2_fk_schema_au
FOREIGN KEY (
author_other_really_long_named_i_mean_so_long_fk_id
) REFERENCES schema_authorwithevenlongername(id);
mysql5/8中正常可执行
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.