Skip to content

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

Merged
systay merged 5 commits intovitessio:release-9.0from
planetscale:function-call-default
Jul 8, 2021
Merged

Fixes function call in default value of a column in CREATE TABLE statement#8425
systay merged 5 commits intovitessio:release-9.0from
planetscale:function-call-default

Conversation

@GuptaManan100
Copy link
Contributor

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)

@GuptaManan100 GuptaManan100 requested a review from frouioui July 8, 2021 05:51
@GuptaManan100 GuptaManan100 requested a review from sougou as a code owner July 8, 2021 07:11
Signed-off-by: GuptaManan100 <manan@planetscale.com>
Signed-off-by: GuptaManan100 <manan@planetscale.com>
Signed-off-by: GuptaManan100 <manan@planetscale.com>
@GuptaManan100 GuptaManan100 force-pushed the function-call-default branch from 8daa823 to 4005fb1 Compare July 8, 2021 07:23
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 pushed 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 pushed 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