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

Function calls in DEFAULT value of CREATE TABLE statement #8424

Closed
GuptaManan100 opened this issue Jul 7, 2021 · 1 comment · Fixed by #8477
Closed

Function calls in DEFAULT value of CREATE TABLE statement #8424

GuptaManan100 opened this issue Jul 7, 2021 · 1 comment · Fixed by #8477

Comments

@GuptaManan100
Copy link
Member

Overview of the Issue

Default value example in the MySQL 8.0 docs that fails in Vitess but works in local MySQL 8:

417/test> CREATE TABLE t4 (uid BINARY(16) DEFAULT (UUID_TO_BIN(UUID())));
ERROR 1064 (42000): target: 417.-.master: vttablet: rpc error: code = InvalidArgument desc = You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UUID_TO_BIN(UUID()))' at line 2 (errno 1064) (sqlstate 42000) (CallerID: unsecure_grpc_client): Sql: "create table t4 (\n\tuid BINARY(16) default UUID_TO_BIN(UUID())\n)", BindVars: {}
mysql> select @@version;
+-----------+
| @@version |
+-----------+
| 8.0.25    |
+-----------+
1 row in set (0.00 sec)

mysql> CREATE TABLE t4 (uid BINARY(16) DEFAULT (UUID_TO_BIN(UUID())));
Query OK, 0 rows affected (0.01 sec)

Reproduction Steps

Run the create table statement in Vitess and MySQL

Binary version

Release 9.0 onwards

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

Successfully merging a pull request may close this issue.

2 participants