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: Setting AUTO_INCREMENT starting value does not work #1059

Closed
2 of 3 tasks
davidshiz opened this issue Dec 2, 2022 · 5 comments
Closed
2 of 3 tasks

bug: Setting AUTO_INCREMENT starting value does not work #1059

davidshiz opened this issue Dec 2, 2022 · 5 comments
Assignees
Labels
A-bug Something isn't working B-SQL SQL layer prio: high High priority

Comments

@davidshiz
Copy link
Collaborator

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

  • I confirm there is no existing issue for this

Describe the problem

We can change the starting value for the AUTO_INCREMENT field if you don't want to start at 1.
But setting AUTO_INCREMENT starting value does not work in Tianmu engine.

mysql> CREATE TABLE st8 (
    -> id INT NOT NULL AUTO_INCREMENT,
    -> name VARCHAR(20) NOT NULL,
    -> PRIMARY KEY(ID)
    -> )AUTO_INCREMENT=100;
Query OK, 0 rows affected (0.04 sec)

mysql> select * from st8;
Empty set (0.02 sec)

mysql> INSERT INTO st8 (name)VALUES('Java');
Query OK, 1 row affected (0.00 sec)

mysql> select * from st8;
+----+------+
| id | name |
+----+------+
|  1 | Java |
+----+------+

Expected behavior

mysql> CREATE TABLE st8 (
    -> id INT NOT NULL AUTO_INCREMENT,
    -> name VARCHAR(20) NOT NULL,
    -> PRIMARY KEY(ID)
    -> )AUTO_INCREMENT=100;
Query OK, 0 rows affected (0.00 sec)

mysql> select * from st8;
Empty set (0.00 sec)

mysql> INSERT INTO st8 (name)VALUES('Java');
Query OK, 1 row affected (0.00 sec)

mysql> select * from st8;
+-----+------+
| id  | name |
+-----+------+
| 100 | Java |
+-----+------+
1 row in set (0.00 sec)

How To Reproduce

CREATE TABLE st8 (	
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(20) NOT NULL,
PRIMARY KEY(ID)
)AUTO_INCREMENT=100;

INSERT INTO st8 (name)VALUES('Java');

select * from st8;

Environment

[root@HAST04 ~]# /stonedb57/install/bin/mysqld --version
/stonedb57/install/bin/mysqld  Ver 5.7.36-StoneDB for Linux on x86_64 (build-)
build information as follow:
        Repository address: https://github.com/stoneatom/stonedb.git:stonedb-5.7-dev
        Branch name: stonedb-5.7-dev
        Last commit ID: 7f69d33
        Last commit time: Date:   Tue Nov 22 06:31:04 2022 +0000
        Build time: Date: Tue Nov 22 16:53:27 CST 2022
[root@HAST04 ~]# cat /etc/system-release
CentOS Linux release 7.9.2009 (Core)

Are you interested in submitting a PR to solve the problem?

  • Yes, I will!
@davidshiz davidshiz added the A-bug Something isn't working label Dec 2, 2022
@davidshiz davidshiz changed the title bug: Set AUTO_INCREMENT starting value does not work bug: Setting AUTO_INCREMENT starting value does not work Dec 2, 2022
@isredstar isredstar self-assigned this Dec 6, 2022
@isredstar
Copy link
Collaborator

ACK

@davidshiz
Copy link
Collaborator Author

The issue is not fixed @wisehead

@davidshiz davidshiz reopened this Jan 9, 2023
@haitaoguan
Copy link
Collaborator

In tianmu engine, the table structure will not display keyword "AUTO_INCREMENT".

@haitaoguan
Copy link
Collaborator

If you set auto increment, the table structure will display keyword "AUTO_INCREMENT". Otherwise,you won't know what value to take next time.

@wisehead wisehead added the B-SQL SQL layer label Jan 9, 2023
@isredstar isredstar added the prio: high High priority label Jan 13, 2023
@hustjieke hustjieke added B-storage data type, data storage, insert,update,delete, transactions and removed B-storage data type, data storage, insert,update,delete, transactions labels Jan 30, 2023
@wisehead
Copy link
Collaborator

@davidshiz please verify it, @isredstar already delivered the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-bug Something isn't working B-SQL SQL layer prio: high High priority
Projects
None yet
Development

No branches or pull requests

5 participants