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: the format of the timestamp literal is invalid #6076

Closed
neglect-yp opened this issue May 22, 2022 · 1 comment · Fixed by #6077
Closed

spanner/spansql: the format of the timestamp literal is invalid #6076

neglect-yp opened this issue May 22, 2022 · 1 comment · Fixed by #6077
Assignees
Labels
api: spanner Issues related to the Spanner API. priority: p3 Desirable enhancement or fix. May not be included in next release.

Comments

@neglect-yp
Copy link
Contributor

(tl TimestampLiteral) SQL() generates a timestamp literal like TIMESTAMP '2014-09-27 12:34:56.123456 -07:00' now.

fmt.Fprintf(sb, "TIMESTAMP '%s'", time.Time(tl).Format("2006-01-02 15:04:05.000000 -07:00"))

`TIMESTAMP '2014-09-27 12:34:56.123456 -07:00'`,

However, this format is not allowed in the real spanner. I tested this issue using https://github.com/cloudspannerecosystem/spanner-cli and web console.

spanner> SELECT TIMESTAMP '2014-09-27 12:34:56.123456 -07:00';
ERROR: spanner: code = "InvalidArgument", desc = "Invalid TIMESTAMP literal [at 1:8]\\nSELECT TIMESTAMP \\'2014-09-27 12:34:56.123456 -07:00\\'\\n       ^"
spanner> SELECT TIMESTAMP '2014-09-27 12:34:56.123456-07:00';
+-----------------------------+
|                             |
+-----------------------------+
| 2014-09-27T19:34:56.123456Z |
+-----------------------------+
1 rows in set (1.11 msecs)
@neglect-yp neglect-yp added the triage me I really want to be triaged. label May 22, 2022
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label May 22, 2022
@neglect-yp
Copy link
Contributor Author

I'll create a PR for this issue.

@rahul2393 rahul2393 added priority: p3 Desirable enhancement or fix. May not be included in next release. and removed triage me I really want to be triaged. labels May 23, 2022
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: p3 Desirable enhancement or fix. May not be included in next release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants