Skip to content

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

Closed

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)

Activity

  1. added
    type/bugThe issue is confirmed as a bug.
    good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.
    on May 7, 2019
  2. changed the title [-]Incompatible issues about create table with default expression[/-] [+]Incompatible with MySQL 8.0 about create table with default expression[/+] on May 7, 2019
  3. ghost removed
    type/bugThe issue is confirmed as a bug.
    on Jul 14, 2020
  4. morgo commented on Sep 20, 2021

    @morgo
    Contributor

    The matching parser issue is pingcap/parser#1347

  5. added a commit that references this issue on Apr 7, 2022
    a936646
  6. reopened this on Oct 11, 2022
  7. CbcWestwolf commented on Jan 5, 2023

    @CbcWestwolf
    Member

    Implement curdate()/current_date in #40326

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

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