Skip to content

[Bug]: CTAS keeps AUTO_INCREMENT attribute differently from MySQL #24433

Closed

Description

@Ariznawlll

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

20346ca

Other Environment Information

- MO version: 8.0.30-MatrixOne-v
- MySQL version: 8.0.45
- Verify date: 2026-05-18

Actual Behavior

CREATE TABLE ... AS SELECT * keeps AUTO_INCREMENT on the target table, which differs from MySQL.

MO:

CREATE TABLE `table02` (
  `id` int NOT NULL AUTO_INCREMENT,
  `col1` varchar(255) NOT NULL
)

MySQL:

CREATE TABLE `table02` (
  `id` int NOT NULL DEFAULT '0',
  `col1` varchar(255) NOT NULL
)

Expected Behavior

The CTAS target table should not retain AUTO_INCREMENT in this case and should match MySQL behavior.

Steps to Reproduce

drop table if exists table02;
drop table if exists table01;

create table table01 (
    id int auto_increment primary key,
    col1 varchar(255) not null
);

insert into table01 (col1) values ('Value2'), ('Value3');

create table table02 as select * from table01;

show create table table02;
desc table02;
select * from table02;

Additional information

Split from #14792 after re-verification.

Activity

  1. Ariznawlll commented on May 18, 2026

    @Ariznawlll
    CollaboratorAuthor

    Closing in favor of summary tracker #24436. This issue was split from #14792 during re-verification and is now tracked centrally in #24436.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions