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

Fixes function call in default value of a column in CREATE TABLE statement #8425

Merged
merged 5 commits into from
Jul 8, 2021

Conversation

GuptaManan100
Copy link
Member

Description

This PR fixes function call in default value of a column in CREATE TABLE statement. The function calls must be parenthesised according to the syntax.

Related Issue(s)

Checklist

  • Tests were added or are not required
  • Documentation was added or is not required

@harshit-gangal
Copy link
Member

e2e tests are failing

2021-07-07T15:16:02.5552905Z     misc_test.go:520: 
2021-07-07T15:16:02.5553418Z         	Error Trace:	misc_test.go:549
2021-07-07T15:16:02.5553949Z         	            				misc_test.go:520
2021-07-07T15:16:02.5554495Z         	Error:      	Received unexpected error:
2021-07-07T15:16:02.5557520Z         	            	vtgate: http://fv-az184-575.3ow45vhwbzuu5incsxmygykede.cx.internal.cloudapp.net:16225/: target: ks.-80.master, used tablet: test-9087 (localhost): 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 '(TRIM(' check '))
2021-07-07T15:16:02.5560411Z         	            	)' at line 2 (errno 1064) (sqlstate 42000) (CallerID: userData1): Sql: "create table function_default (\n\tx varchar(25) default (TRIM(' check '))\n)", BindVars: {}
2021-07-07T15:16:02.5562404Z         	            	target: ks.80-.master, used tablet: test-9090 (localhost): 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 '(TRIM(' check '))
2021-07-07T15:16:02.5564699Z         	            	)' at line 2 (errno 1064) (sqlstate 42000) (CallerID: userData1): Sql: "create table function_default (\n\tx varchar(25) default (TRIM(' check '))\n)", BindVars: {} (errno 1064) (sqlstate 42000) during query: create table function_default (x varchar(25) DEFAULT (TRIM(" check ")))
2021-07-07T15:16:02.5566140Z         	Test:       	TestFunctionInDefault
2021-07-07T15:16:02.5566907Z         	Messages:   	for query: create table function_default (x varchar(25) DEFAULT (TRIM(" check ")))
2021-07-07T15:16:02.5567847Z --- FAIL: TestFunctionInDefault (0.01s)

Signed-off-by: GuptaManan100 <manan@planetscale.com>
Signed-off-by: GuptaManan100 <manan@planetscale.com>
Signed-off-by: GuptaManan100 <manan@planetscale.com>
Signed-off-by: GuptaManan100 <manan@planetscale.com>
Signed-off-by: GuptaManan100 <manan@planetscale.com>
@systay systay merged commit 3706e7d into vitessio:release-9.0 Jul 8, 2021
@systay systay deleted the function-call-default branch July 8, 2021 09:11
ajm188 added a commit to tinyspeck/vitess that referenced this pull request Jul 18, 2021
git seemed to not apply this change after the formatting functions got
moved from `ast.go` to `ast_format.go`

Signed-off-by: Andrew Mason <amason@slack-corp.com>
ajm188 added a commit to tinyspeck/vitess that referenced this pull request Jul 19, 2021
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants