Skip to content

Incompatible with MySQL 8.0 about create table with default expression #10377

@lonng

Description

@lonng

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
➜  ~ tidiff 'create table ttest ( a int(10) default (rand()))'
MySQL(127.0.0.1:3306)> create table ttest ( a int(10) default (rand()))
Query OK (0.007 sec)

TiDB(127.0.0.1:4000)> create table ttest ( a int(10) default (rand()))
Error 1105: line 1 column 40 near "rand()))" (total length 48)

➜  ~ tidiff 'desc ttest'
MySQL(127.0.0.1:3306)> desc ttest
+------------------------------------------------------------+
| Field | Type    | Null | Key | Default | Extra             |
+------------------------------------------------------------+
| a     | int(10) | YES  |     | rand()  | DEFAULT_GENERATED |
+------------------------------------------------------------+
1 row in set (0.003 sec)

TiDB(127.0.0.1:4000)> desc ttest
Error 1146: Table 'test.ttest' doesn't exist
  1. What did you expect to see?

Create table successfully.

  1. What did you see instead?

Error message show above.

  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
TiDB(127.0.0.1:4000)> select tidb_version()
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                                                            |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v2.1.8-24-g7b36cdfb6-dirty
Git Commit Hash: 7b36cdfb6e8a4c279fc360ed79cf1c499b553688
Git Branch: failpoint-2.1
UTC Build Time: 2019-04-30 08:26:17
GoVersion: go version go1.12 darwin/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.002 sec)

Metadata

Metadata

Assignees

Labels

good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.type/compatibility

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions