-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fixes function call in default value of a column in CREATE TABLE statement #8425
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
Merged
systay
merged 5 commits into
vitessio:release-9.0
from
planetscale:function-call-default
Jul 8, 2021
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
da7da4a
fixed function call in default value of a column
GuptaManan100 f469d19
added additional tests
GuptaManan100 4005fb1
added cluster for mysql80 tests
GuptaManan100 df40b76
ran make generate_ci_workflows
GuptaManan100 747abf3
remove unnecessary components
GuptaManan100 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # DO NOT MODIFY: THIS FILE IS GENERATED USING "make generate_ci_workflows" | ||
|
|
||
| name: Cluster (mysql80) | ||
| on: [push, pull_request] | ||
| jobs: | ||
|
|
||
| build: | ||
| runs-on: ubuntu-20.04 | ||
|
|
||
| steps: | ||
| - name: Set up Go | ||
| uses: actions/setup-go@v1 | ||
| with: | ||
| go-version: 1.15 | ||
|
|
||
| - name: Check out code | ||
| uses: actions/checkout@v2 | ||
|
|
||
| - name: Get dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y mysql-server mysql-client make unzip g++ etcd curl git wget eatmydata | ||
| sudo service mysql stop | ||
| sudo service etcd stop | ||
| sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/ | ||
| sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld | ||
| go mod download | ||
|
|
||
| wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb | ||
| sudo apt-get install -y gnupg2 | ||
| sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb | ||
| sudo apt-get update | ||
| sudo apt-get install percona-xtrabackup-24 | ||
|
|
||
| - name: Run cluster endtoend test | ||
| timeout-minutes: 30 | ||
| run: | | ||
| source build.env | ||
| eatmydata -- go run test.go -docker=false -print-log -follow -shard mysql80 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /* | ||
| Copyright 2019 The Vitess Authors. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package vtgate | ||
|
|
||
| import ( | ||
| "flag" | ||
| "os" | ||
| "testing" | ||
|
|
||
| "vitess.io/vitess/go/mysql" | ||
| "vitess.io/vitess/go/test/endtoend/cluster" | ||
| ) | ||
|
|
||
| var ( | ||
| clusterInstance *cluster.LocalProcessCluster | ||
| vtParams mysql.ConnParams | ||
| KeyspaceName = "ks" | ||
| Cell = "test" | ||
| ) | ||
|
|
||
| func TestMain(m *testing.M) { | ||
| defer cluster.PanicHandler(nil) | ||
| flag.Parse() | ||
|
|
||
| exitCode := func() int { | ||
| clusterInstance = cluster.NewCluster(Cell, "localhost") | ||
| defer clusterInstance.Teardown() | ||
|
|
||
| // Start topo server | ||
| err := clusterInstance.StartTopo() | ||
| if err != nil { | ||
| return 1 | ||
| } | ||
|
|
||
| // Start keyspace | ||
| keyspace := &cluster.Keyspace{ | ||
| Name: KeyspaceName, | ||
| } | ||
| err = clusterInstance.StartUnshardedKeyspace(*keyspace, 0, false) | ||
| if err != nil { | ||
| return 1 | ||
| } | ||
|
|
||
| // Start vtgate | ||
| err = clusterInstance.StartVtgate() | ||
| if err != nil { | ||
| return 1 | ||
| } | ||
| vtParams = mysql.ConnParams{ | ||
| Host: clusterInstance.Hostname, | ||
| Port: clusterInstance.VtgateMySQLPort, | ||
| } | ||
| return m.Run() | ||
| }() | ||
| os.Exit(exitCode) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| /* | ||
| Copyright 2019 The Vitess Authors. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package vtgate | ||
|
|
||
| import ( | ||
| "context" | ||
| "testing" | ||
|
|
||
| "vitess.io/vitess/go/test/endtoend/cluster" | ||
|
|
||
| "github.com/stretchr/testify/require" | ||
|
|
||
| "vitess.io/vitess/go/mysql" | ||
| "vitess.io/vitess/go/sqltypes" | ||
| ) | ||
|
|
||
| func TestFunctionInDefault(t *testing.T) { | ||
| defer cluster.PanicHandler(t) | ||
| ctx := context.Background() | ||
| conn, err := mysql.Connect(ctx, &vtParams) | ||
| require.NoError(t, err) | ||
| defer conn.Close() | ||
|
|
||
| exec(t, conn, `create table function_default (x varchar(25) DEFAULT (TRIM(" check ")))`) | ||
| exec(t, conn, "drop table function_default") | ||
|
|
||
| exec(t, conn, `create table function_default (x varchar(25) DEFAULT "check")`) | ||
| exec(t, conn, "drop table function_default") | ||
| } | ||
|
|
||
| func exec(t *testing.T, conn *mysql.Conn, query string) *sqltypes.Result { | ||
| t.Helper() | ||
| qr, err := conn.ExecuteFetch(query, 1000, true) | ||
| require.NoError(t, err, "for query: "+query) | ||
| return qr | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.