GoogleCloudPlatform / cloud-spanner-emulator

An open source emulator for Cloud Spanner.
Apache License 2.0
265 stars 44 forks source link

v1.5.4: still getting "THEN RETURN is not supported" #104

Closed kberezin-nshl closed 1 year ago

kberezin-nshl commented 1 year ago

Release notes for emulator v1.5.1 say that DML returning statements are now supported, however I am still getting an error if I use it:

org.jboss.resteasy.spi.UnhandledException: org.jdbi.v3.core.statement.UnableToExecuteStatementException: com.google.cloud.spanner.jdbc.JdbcSqlExceptionFactory$JdbcSqlExceptionImpl: INVALID_ARGUMENT: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: THEN RETURN is not supported [at 1:68]
...id, data) VALUES (@p1, PARSE_JSON(@p2)) THEN RETURN data
                                           ^ - Statement: 'INSERT INTO foo(id, data) VALUES (@p1, PARSE_JSON(@p2)) THEN RETURN data' 
xinjiacs commented 1 year ago

Sorry about the confusion. It was a miscommunication on the release note that DML returning statements were still under development. We anticipate it would be coming soon. Thanks for filling this issue.

kberezin-nshl commented 1 year ago

UPD: v1.5.4, still the same error....

org.jboss.resteasy.spi.UnhandledException: org.jdbi.v3.core.statement.UnableToExecuteStatementException: com.google.cloud.spanner.jdbc.JdbcSqlExceptionFactory$JdbcSqlExceptionImpl: INVALID_ARGUMENT: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: THEN RETURN is not supported [at 1:68]
...id, data) VALUES (@p1, PARSE_JSON(@p2)) THEN RETURN data
                                           ^ - Statement: 'INSERT INTO foo(id, data) VALUES (@p1, PARSE_JSON(@p2)) THEN RETURN data' 
kberezin-nshl commented 1 year ago

cc @xinjiacs @gauravpurohit06

kberezin-nshl commented 1 year ago

Is this the reason? https://github.com/GoogleCloudPlatform/cloud-spanner-emulator/blob/bf500538c354a9d57023105f32699f93c51f017c/common/feature_flags.h#L36

zachnicoll commented 1 year ago

Is there a timeline on when this will be implemented? Super keen to use this at work to reduce the chance of a race condition when fetching and updating data.

xinjiacs commented 1 year ago

Sorry about the confusion, it's the communication error on our side. "THEN RETURN" support is expected to be in the following emulator release. Thanks for your patience.

xinjiacs commented 1 year ago

v15.5 is out. You can try the THEN RETURN feature again.

FYI: https://github.com/GoogleCloudPlatform/cloud-spanner-emulator/releases/tag/v1.5.5

kberezin-nshl commented 1 year ago

It works, thanks!