Skip to content

Timestamps must end with Z #3

@jdiamond

Description

@jdiamond

Create a table like this with spanner-cli:

create table timestamp_offsets (
  id string(max),
  ts timestamp,
  last_commit_ts timestamp options (allow_commit_timestamp=true)
) primary key (id);

Insert the metadata:

INSERT INTO TableConfigurations (KeySpaceName, TableName, ColumnName, ColumnType, IsPrimaryKey, PK_Precedence) VALUES ('test', 'timestamp_offsets', 'id', 'text', true, 0);
INSERT INTO TableConfigurations (KeySpaceName, TableName, ColumnName, ColumnType, IsPrimaryKey, PK_Precedence) VALUES ('test', 'timestamp_offsets', 'ts', 'timestamp', false, 0);

I can insert timestamps with "Z" or with a numeric offset via spanner-cli:

insert into timestamp_offsets (id, ts) values ('a', '2024-10-22T12:00:00Z');
insert into timestamp_offsets (id, ts) values ('b', '2024-10-22T12:00:00-07:00');

Only the timestamp ending with "Z" works via cqlsh:

insert into test.timestamp_offsets (id, ts) values ('c', '2024-10-22T12:00:00Z');
insert into test.timestamp_offsets (id, ts) values ('d', '2024-10-22T12:00:00-07:00');

When I try to execute that last insert, I get this error in cqlsh:

InvalidRequest: Error from server: code=2200 [Invalid query] message="spanner: code = "FailedPrecondition", desc = "Invalid value for column ts in table timestamp_offsets: Expected TIMESTAMP.""

And this error in the proxy:

{"level":"error","time":"2024-10-23T00:04:03.244Z","caller":"proxy/proxy.go:1548","msg":"Error occurred at spanner - ","Query":"insert into test.timestamp_offsets (id, ts) values ('d', '2024-10-22T12:00:00-07:00');","error":"spanner: code = \"FailedPrecondition\", desc = \"Invalid value for column ts in table timestamp_offsets: Expected TIMESTAMP.\"","stacktrace":"github.com/ollionorg/cassandra-to-spanner-proxy/third_party/datastax/proxy.(*client).handleQuery\n\t/go/src/cassandra-to-spanner-proxy/third_party/datastax/proxy/proxy.go:1548\ngithub.com/ollionorg/cassandra-to-spanner-proxy/third_party/datastax/proxy.(*client).Receive\n\t/go/src/cassandra-to-spanner-proxy/third_party/datastax/proxy/proxy.go:641\ngithub.com/ollionorg/cassandra-to-spanner-proxy/third_party/datastax/proxycore.(*Conn).read\n\t/go/src/cassandra-to-spanner-proxy/third_party/datastax/proxycore/conn.go:114"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions