You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 7, 2026. It is now read-only.
Looks like when the query has returning clause, one of the precondition check fails as it expects only SELECTs. But as per docs we should have the ability to use INSERT INTO ... VALUES (...) ... THEN RETURN .... It works as expected when using the Spanner studio UI.
CREATESEQUENCEIF NOT EXISTS test_seq OPTIONS (
sequence_kind ='bit_reversed_positive',
skip_range_min =1,
skip_range_max =1000,
start_with_counter =1
);
CREATETABLEIF NOT EXISTS test
(
id INT64 NOT NULL DEFAULT (GET_NEXT_SEQUENCE_VALUE(SEQUENCE test_seq)),
value INT64 NOT NULL
) PRIMARY KEY (id);
java.lang.IllegalArgumentException: Statement is not a query
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:143)
at com.google.cloud.spanner.connection.AbstractMultiUseTransaction.executeQueryAsync(AbstractMultiUseTransaction.java:132)
at com.google.cloud.spanner.connection.ReadWriteTransaction.executeQueryAsync(ReadWriteTransaction.java:692)
at com.google.cloud.spanner.connection.ConnectionImpl.internalExecuteQuery(ConnectionImpl.java:2088)
at com.google.cloud.spanner.connection.ConnectionImpl.parseAndExecuteQuery(ConnectionImpl.java:1768)
at com.google.cloud.spanner.connection.ConnectionImpl.executeQuery(ConnectionImpl.java:1576)
at com.google.cloud.spanner.jdbc.AbstractJdbcStatement.lambda$executeQuery$0(AbstractJdbcStatement.java:238)
at com.google.cloud.spanner.jdbc.AbstractJdbcStatement.doWithStatementTimeout(AbstractJdbcStatement.java:260)
at com.google.cloud.spanner.jdbc.AbstractJdbcStatement.doWithStatementTimeout(AbstractJdbcStatement.java:247)
at com.google.cloud.spanner.jdbc.AbstractJdbcStatement.executeQuery(AbstractJdbcStatement.java:234)
at com.google.cloud.spanner.jdbc.AbstractJdbcStatement.executeQuery(AbstractJdbcStatement.java:225)
at com.google.cloud.spanner.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:85)
Environment details
Looks like when the query has returning clause, one of the precondition check fails as it expects only SELECTs. But as per docs we should have the ability to use
INSERT INTO ... VALUES (...) ... THEN RETURN .... It works as expected when using the Spanner studio UI.Note - We are using
retryAbortsInternally=falseSteps to reproduce
retryAbortsInternally=falseCode example
Stack trace
External references such as API reference guides