Skip to content

Incompatible with MySQL 8.0 about the CAST string to JSON #10390

@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 'select cast("2018-01-02 01:01:01.111111" as json)'
MySQL(127.0.0.1:3306)> select cast("2018-01-02 01:01:01.111111" as json)
Error 3141: Invalid JSON text in argument 1 to function cast_as_json: "The document root must not be followed by other values." at position 4.

TiDB(127.0.0.1:4000)> select cast("2018-01-02 01:01:01.111111" as json)
+--------------------------------------------+
| cast("2018-01-02 01:01:01.111111" as json) |
+--------------------------------------------+
| 2018                                       |
+--------------------------------------------+
1 row in set (0.003 sec)
  1. What did you expect to see?

The error should be produced.

  1. What did you see instead?

Returns an unexpected result.

  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.003 sec)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions