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

[feature] support auto_increment option after engine in ddl statement #559

Closed
hustjieke opened this issue Jan 3, 2020 · 1 comment
Closed
Assignees

Comments

@hustjieke
Copy link
Contributor

radon should support auto_increment after engine, otherwise we'll get error when prepare table in shift.
create table and insert value:

    // Create test table
    sql = `CREATE TABLE normal(
            id BIGINT(64) UNSIGNED  NOT NULL AUTO_INCREMENT,                                                                                                         
            str VARCHAR(256),                                                                                                                                        
            f FLOAT,
            d DOUBLE,                                                                                                                                                
            i INT,
            PRIMARY KEY (id)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8`
    if _, err := fromConn.Execute(sql); err == nil {
        fromConn.Execute(`INSERT INTO normal(str, f, d, i)                                                                                                           
        VALUES ("3", -3.14, 3.14, 10)`)                                                                                                                              
    }
2020/01/03 03:19:51.752256 query.go:71:    	 [ERROR] 	query[CREATE TABLE `DTtest`.`normal` (
  `id` bigint(64) unsigned NOT NULL AUTO_INCREMENT,
  `str` varchar(256) DEFAULT NULL,
  `f` float DEFAULT NULL,
  `d` double DEFAULT NULL,
  `i` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8].parser.error: syntax error at position 253 near 'auto_increment'
 2020/01/03 03:19:51.752324 server.go:246:    	 [ERROR] 	server.handle.query.from.session[5].error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use, syntax error at position 253 near 'auto_increment' (errno 1149) (sqlstate 42000)
@hustjieke hustjieke self-assigned this Jan 3, 2020
hustjieke added a commit to hustjieke/radon that referenced this issue Jan 3, 2020
…tatement radondb#559

[summary]
add a auto_increment option after engine, like: create table t(a int
auto_increment key) engine=innodb auto_increment=1.
[test case]
src/vendor/github.com/xelabs/go-mysqlstack/ddl_test.go
[patch codecov]
vendor/github.com/xelabs/go-mysqlstack/sqlparser	0.049s	coverage: 87.6% of statements
hustjieke added a commit to hustjieke/radon that referenced this issue Jan 5, 2020
…tatement radondb#559

[summary]
add a auto_increment option after engine, like: create table t(a int
auto_increment key) engine=innodb auto_increment=1.
[test case]
src/vendor/github.com/xelabs/go-mysqlstack/ddl_test.go
[patch codecov]
vendor/github.com/xelabs/go-mysqlstack/sqlparser	0.049s	coverage: 87.6% of statements
@BohuTANG
Copy link
Contributor

BohuTANG commented Jan 6, 2020

ACK

hustjieke added a commit to hustjieke/radon that referenced this issue Jan 6, 2020
…tatement radondb#559

[summary]
add a auto_increment option after engine, like: create table t(a int
auto_increment key) engine=innodb auto_increment=1.
[test case]
src/vendor/github.com/xelabs/go-mysqlstack/ddl_test.go
[patch codecov]
vendor/github.com/xelabs/go-mysqlstack/sqlparser	0.049s	coverage: 87.6% of statements
BohuTANG pushed a commit that referenced this issue Jan 7, 2020
…tatement #559

[summary]
add a auto_increment option after engine, like: create table t(a int
auto_increment key) engine=innodb auto_increment=1.
[test case]
src/vendor/github.com/xelabs/go-mysqlstack/ddl_test.go
[patch codecov]
vendor/github.com/xelabs/go-mysqlstack/sqlparser	0.049s	coverage: 87.6% of statements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants