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

Default value as an expression really only supports default value as function #54700

Open
morgo opened this issue Jul 18, 2024 · 0 comments
Open
Assignees
Labels
severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@morgo
Copy link
Contributor

morgo commented Jul 18, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

From the MySQL manual there is an example that uses a literal default specified as an expression:

CREATE TABLE t2 (b BLOB DEFAULT ('abc'));

In my actual application, I have a similar example where the literal is '0'. If you test in MySQL you can also use expressions like DEFAULT(NOW()+2), but these are also parse errors in TiDB.

2. What did you expect to see? (Required)

mysql> CREATE TABLE t2 (b BLOB DEFAULT ('abc'));
Query OK, 0 rows affected (0.03 sec)

mysql> SELECT version();
+-----------+
| version() |
+-----------+
| 8.0.32    |
+-----------+
1 row in set (0.01 sec)

3. What did you see instead (Required)

mysql> CREATE TABLE t2 (b BLOB DEFAULT ('abc'));
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 38 near "'abc'))"

4. What is your TiDB version? (Required)

mysql> SELECT tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v8.2.0-alpha-602-g9794156596
Edition: Community
Git Commit Hash: 9794156596b1bbd1270f7776fb5bcad59267c25d
Git Branch: HEAD
UTC Build Time: 2024-07-17 02:29:36
GoVersion: go1.21.10
Race Enabled: false
Check Table Before Drop: false
Store: tikv
1 row in set (0.00 sec)
@morgo morgo added the type/bug The issue is confirmed as a bug. label Jul 18, 2024
@jebter jebter added the sig/sql-infra SIG: SQL Infra label Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

2 participants