olavloite / spanner-jdbc

JDBC Driver for Google Cloud Spanner
MIT License
38 stars 10 forks source link

Delete error when composite primary key includes timestamp #47

Closed gil-naamani closed 6 years ago

gil-naamani commented 6 years ago

Hello, I am running into the following error when I am trying to execute a simple delete command:

DELETE FROM tableA WHERE id=1

In this case tableA has a composite primary key which includes a timestamp. The following is the resulting error:

CloudSpannerSQLException: Error while parsing sql statement DELETE FROM `tableA` WHERE `ID`=? AND ... AND `TIMESTAMP`=?: Unsupported type [java.sql.Timestamp] for argument: 2018-04-19 17:00:00.0`

The error is being thrown from nl.topicus.jdbc.shaded.com.google.cloud.spanner.Key on L187, where the class of the values seem to be in different namespaces.

If I change the sql statement to be a SELECT or an UPDATE the operation will be executed as expected. Is this a bug or a user error? Thanks for your help!

olavloite commented 6 years ago

Confirmed as bug, I'll look into it.

olavloite commented 6 years ago

Fixed in version 1.0.1 and further.

gil-naamani commented 6 years ago

:+1: Thanks, works like a charm!