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

spanner/spansql: (*AlterDatabase).SQL() includes incorrect commas #4550

Closed
iwata opened this issue Aug 4, 2021 · 1 comment · Fixed by #4551
Closed

spanner/spansql: (*AlterDatabase).SQL() includes incorrect commas #4550

iwata opened this issue Aug 4, 2021 · 1 comment · Fixed by #4551
Assignees
Labels
api: spanner Issues related to the Spanner API. priority: p2 Moderately-important priority. Fix may not be included in next release.

Comments

@iwata
Copy link

iwata commented Aug 4, 2021

Client

Spanner

Environment

MacOSX 11.4

Go Environment

$ go version
go version go1.16.6 darwin/amd64
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/iwata/Library/Caches/go-build"
GOENV="/Users/iwata/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/iwata/.go/pkg/mod"
GOOS="darwin"
GOPATH="/Users/iwata/.go"
GOPRIVATE="github.com/kouzoh"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/opt/go/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.6"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/iwata/.go/pkg/mod/cloud.google.com/go/spanner@v1.24.0/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 x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/6_/x9frq0ln18q7vxw939szy0q80000gp/T/go-build2047722779
=/tmp/go-build -gno-record-gcc-switches -fno-common"

Code

e.g.

package main_test

import (
	"testing"

	"cloud.google.com/go/spanner/spansql"
)

func TestParseAlterDatabase(t *testing.T) {
	uri := "alter-database.sql"
	s := `ALTER DATABASE db SET OPTIONS(enable_key_visualizer=true)`
	ddl, err := spansql.ParseDDL(uri, s)
	if err != nil {
		t.Fatalf("failed to parse DDL: %s", err)
	}

	stmt := ddl.List[0]
	if s != stmt.SQL() {
		t.Errorf("not equal SQL: %s", ddl.List[0].SQL())
	}
}

Expected behavior

Pass the test

Actual behavior

Failed and show the below message
not equal SQL: ALTER DATABASE db SET OPTIONS (, enable_key_visualizer=true)

Additional context

related this issue: #4390

@iwata iwata added the triage me I really want to be triaged. label Aug 4, 2021
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label Aug 4, 2021
@hengfengli hengfengli assigned olavloite and unassigned hengfengli Aug 4, 2021
@hengfengli hengfengli added priority: p2 Moderately-important priority. Fix may not be included in next release. and removed triage me I really want to be triaged. labels Aug 4, 2021
@hengfengli hengfengli changed the title spanner/spansql: spanner/spansql: failed to parse ALTER DATABASE Aug 4, 2021
@iwata iwata changed the title spanner/spansql: failed to parse ALTER DATABASE spanner/spansql: (*AlterDatabase).SQL() includes incorrect commas Aug 4, 2021
@olavloite
Copy link
Contributor

Fixed in #4551

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the Spanner API. priority: p2 Moderately-important priority. Fix may not be included in next release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants