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

Remove string concatenation in spanner DB update #2766

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/4294.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
spanner: fixed an issue in `google_spanner_database` where multi-statement updates were not formatted correctly
```
3 changes: 1 addition & 2 deletions google-beta/resource_spanner_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"fmt"
"log"
"reflect"
"strings"
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down Expand Up @@ -475,7 +474,7 @@ func resourceSpannerDatabaseUpdateEncoder(d *schema.ResourceData, meta interface
updateDdls = append(updateDdls, newDdls[i].(string))
}

obj["statements"] = strings.Join(updateDdls, ",")
obj["statements"] = updateDdls
delete(obj, "name")
delete(obj, "instance")
delete(obj, "extraStatements")
Expand Down
1 change: 1 addition & 0 deletions google-beta/resource_spanner_database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ resource "google_spanner_database" "basic" {
"CREATE TABLE t1 (t1 INT64 NOT NULL,) PRIMARY KEY(t1)",
"CREATE TABLE t2 (t2 INT64 NOT NULL,) PRIMARY KEY(t2)",
"CREATE TABLE t3 (t3 INT64 NOT NULL,) PRIMARY KEY(t3)",
"CREATE TABLE t4 (t4 INT64 NOT NULL,) PRIMARY KEY(t4)",
]
deletion_protection = false
}
Expand Down