-
Notifications
You must be signed in to change notification settings - Fork 1.5k
spanner/spansql: The table name within ALTER DATABASE statement should be escaped with backquote #5972
Copy link
Copy link
Closed
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.priority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.
Description
Client
Cloud Spanner
Environment
Go playground
Go Environment
(This is the environment of my PC, not Go playground)
❯ go version
go version go1.17.5 darwin/arm64
❯ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/[UserName]/Library/Caches/go-build"
GOENV="/Users/[UserName]/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/[UserName]/.asdf/installs/golang/1.17.5/packages/pkg/mod"
GOOS="darwin"
GOPATH="/Users/[UserName]/.asdf/installs/golang/1.17.5/packages"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/[UserName]/.asdf/installs/golang/1.17.5/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/[UserName]/.asdf/installs/golang/1.17.5/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.17.5"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/[UserName]/git/google-cloud-go/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_c/7hkzyhtj5mxc38jm7661stc00000gq/T/go-build755299587=/tmp/go-build -gno-record-gcc-switches -fno-common"
Code
package main
import (
"fmt"
"cloud.google.com/go/spanner/spansql"
)
func main() {
ddl, _ := spansql.ParseDDL("test", "ALTER DATABASE `test-db` SET OPTIONS (optimizer_version=4, version_retention_period = '7d', enable_key_visualizer=true)")
fmt.Println(ddl.List[0].SQL())
}https://go.dev/play/p/dqrlf-0YbE6
Expected behavior
Output a valid SQL statement.
ALTER DATABASE `test-db` SET OPTIONS (optimizer_version=4, version_retention_period='7d', enable_key_visualizer=true)
Actual behavior
Output an invalid SQL statement.
The table name with hyphens should be escaped with backquotes.
ALTER DATABASE test-db SET OPTIONS (optimizer_version=4, version_retention_period='7d', enable_key_visualizer=true)
Screenshots
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.priority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.
