Closed jzelinskie closed 1 year ago
My team is running into a similar issue. Specifically that PENDING_COMMIT_TIMESTAMP
is allowed by the emulator in a COALESCE
, in odds with:
The PENDING_COMMIT_TIMESTAMP function may only be used as a value for INSERT or UPDATE of an appropriately typed column. It cannot be used in SELECT, or as the input to any other scalar expression.
From https://cloud.google.com/spanner/docs/reference/standard-sql/timestamp_functions
V15.5 is out, we believe that issue has been resolved, and emulator should have the same behavior with cloud spanner. Thanks for reporting this issue.
Thank you @jzelinskie for reporting the issue. Closing it.
We're creating rows in one table and copying them in to another table for auditing within the same transaction. We initially tried to copy using a subquery along the lines of
INSERT ... FROM (SELECT PENDING_COMMIT_TIMESTAMP(), columns... FROM table)
.Cloud Spanner does not support PENDING_COMMIT_TIMESTAMP() in a SELECT statement, but the emulator did not throw any errors when provided a query as described above. It was only once we ran against a live Cloud Spanner instance that we discovered this type of query was unsupported.