diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionStatementExecutor.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionStatementExecutor.java index 1f1c7031a83..2d3da27e90e 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionStatementExecutor.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionStatementExecutor.java @@ -109,4 +109,6 @@ StatementResult statementSetPgSessionCharacteristicsTransactionMode( StatementResult statementSetRPCPriority(Priority priority); StatementResult statementShowRPCPriority(); + + StatementResult statementShowTransactionIsolationLevel(); } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionStatementExecutorImpl.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionStatementExecutorImpl.java index a1bfd99ed2b..15da7d0553a 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionStatementExecutorImpl.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionStatementExecutorImpl.java @@ -49,6 +49,7 @@ import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.SHOW_RPC_PRIORITY; import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.SHOW_STATEMENT_TAG; import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.SHOW_STATEMENT_TIMEOUT; +import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.SHOW_TRANSACTION_ISOLATION_LEVEL; import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.SHOW_TRANSACTION_TAG; import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.START_BATCH_DDL; import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.START_BATCH_DML; @@ -436,4 +437,9 @@ public StatementResult statementShowRPCPriority() { : getConnection().getRPCPriority(), SHOW_RPC_PRIORITY); } + + @Override + public StatementResult statementShowTransactionIsolationLevel() { + return resultSet("transaction_isolation", "serializable", SHOW_TRANSACTION_ISOLATION_LEVEL); + } } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/StatementResult.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/StatementResult.java index 476ae804435..71a9a88cab2 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/StatementResult.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/StatementResult.java @@ -82,7 +82,8 @@ enum ClientSideStatementType { RUN_BATCH, ABORT_BATCH, SET_RPC_PRIORITY, - SHOW_RPC_PRIORITY + SHOW_RPC_PRIORITY, + SHOW_TRANSACTION_ISOLATION_LEVEL } /** diff --git a/google-cloud-spanner/src/main/resources/com/google/cloud/spanner/connection/PG_ClientSideStatements.json b/google-cloud-spanner/src/main/resources/com/google/cloud/spanner/connection/PG_ClientSideStatements.json index d0488dc8c54..31e3a801005 100644 --- a/google-cloud-spanner/src/main/resources/com/google/cloud/spanner/connection/PG_ClientSideStatements.json +++ b/google-cloud-spanner/src/main/resources/com/google/cloud/spanner/connection/PG_ClientSideStatements.json @@ -125,6 +125,14 @@ "method": "statementShowRPCPriority", "exampleStatements": ["show spanner.rpc_priority","show variable spanner.rpc_priority"] }, + { + "name": "SHOW [VARIABLE] TRANSACTION ISOLATION LEVEL", + "executorName": "ClientSideStatementNoParamExecutor", + "resultType": "RESULT_SET", + "regex": "(?is)\\A\\s*show\\s+(?:variable\\s+)?transaction\\s*isolation\\s*level\\s*\\z", + "method": "statementShowTransactionIsolationLevel", + "exampleStatements": ["show transaction isolation level","show variable transaction isolation level"] + }, { "name": "{START | BEGIN} [TRANSACTION | WORK] [{ (READ ONLY|READ WRITE) | (ISOLATION LEVEL (DEFAULT|SERIALIZABLE)) }]", "executorName": "ClientSideStatementPgBeginExecutor", diff --git a/google-cloud-spanner/src/test/resources/com/google/cloud/spanner/connection/ConnectionImplGeneratedSqlScriptTest.sql b/google-cloud-spanner/src/test/resources/com/google/cloud/spanner/connection/ConnectionImplGeneratedSqlScriptTest.sql index 90a5a93b9d1..be5a1671ae0 100644 --- a/google-cloud-spanner/src/test/resources/com/google/cloud/spanner/connection/ConnectionImplGeneratedSqlScriptTest.sql +++ b/google-cloud-spanner/src/test/resources/com/google/cloud/spanner/connection/ConnectionImplGeneratedSqlScriptTest.sql @@ -1,23 +1,23 @@ NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -26,123 +26,125 @@ SET AUTOCOMMIT=TRUE; SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; SET READONLY=FALSE; @EXPECT RESULT_SET 'READONLY',FALSE SHOW VARIABLE READONLY; @@ -151,58 +153,60 @@ SET READONLY=TRUE; SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:33.243000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:33.243000000Z' +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:27.061000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:27.061000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:33.243000000Z'; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:27.061000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:27.061000000Z' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -217,34 +221,34 @@ SET OPTIMIZER_VERSION=''; SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -253,8 +257,8 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -297,45 +301,46 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; BEGIN TRANSACTION; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION @@ -346,28 +351,36 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -376,123 +389,173 @@ SET AUTOCOMMIT=TRUE; SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -@EXPECT RESULT_SET 'READ_TIMESTAMP',null +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; +@EXPECT RESULT_SET 'READ_TIMESTAMP' SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; SET READONLY=FALSE; @EXPECT RESULT_SET 'READONLY',FALSE SHOW VARIABLE READONLY; @@ -501,58 +564,78 @@ SET READONLY=TRUE; SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:33.362000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:33.362000000Z' +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:27.474000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:27.474000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:33.362000000Z'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:27.474000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:27.474000000Z' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -567,34 +650,48 @@ SET OPTIMIZER_VERSION=''; SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -603,8 +700,10 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -647,45 +746,62 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -NEW_CONNECTION; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; +NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; BEGIN TRANSACTION; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION @@ -696,324 +812,207 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE -SHOW VARIABLE AUTOCOMMIT; -SET AUTOCOMMIT=TRUE; -@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE -SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -ROLLBACK; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READONLY=FALSE; -@EXPECT RESULT_SET 'READONLY',FALSE -SHOW VARIABLE READONLY; -SET READONLY=TRUE; -@EXPECT RESULT_SET 'READONLY',TRUE -SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:33.470000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:33.470000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:27.868000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:27.868000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:33.470000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:27.868000000Z'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -1028,55 +1027,34 @@ SET OPTIMIZER_VERSION=''; SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -1085,11 +1063,8 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -1132,116 +1107,71 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -1250,195 +1180,125 @@ SET AUTOCOMMIT=TRUE; SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'READ_TIMESTAMP' SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; SET READONLY=FALSE; @EXPECT RESULT_SET 'READONLY',FALSE SHOW VARIABLE READONLY; @@ -1447,85 +1307,60 @@ SET READONLY=TRUE; SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:33.589000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:33.589000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:28.152000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:28.152000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:33.589000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:28.152000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:28.152000000Z' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -1540,55 +1375,34 @@ SET OPTIMIZER_VERSION=''; SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -1597,11 +1411,8 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -1644,69 +1455,46 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; BEGIN TRANSACTION; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION @@ -1717,208 +1505,217 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=TRUE; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE +SHOW VARIABLE AUTOCOMMIT; SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE +SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'READ_TIMESTAMP',null +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; +@EXPECT RESULT_SET 'READ_TIMESTAMP' SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; +SET READONLY=FALSE; +@EXPECT RESULT_SET 'READONLY',FALSE +SHOW VARIABLE READONLY; SET READONLY=TRUE; +@EXPECT RESULT_SET 'READONLY',TRUE +SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:33.695000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:33.695000000Z' +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:28.470000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:28.470000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:33.695000000Z'; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:28.470000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:28.470000000Z' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; +SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -1933,34 +1730,34 @@ SET OPTIMIZER_VERSION=''; SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -1969,8 +1766,8 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -2013,282 +1810,230 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; BEGIN TRANSACTION; +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=TRUE; +SET AUTOCOMMIT=TRUE; SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE +SHOW VARIABLE AUTOCOMMIT; SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE +SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT RESULT_SET 'READ_TIMESTAMP' +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +@EXPECT RESULT_SET 'READONLY',FALSE +SHOW VARIABLE READONLY; SET READONLY=TRUE; +@EXPECT RESULT_SET 'READONLY',TRUE +SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; SET READ_ONLY_STALENESS='STRONG'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:33.792000000Z'; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:28.774000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:28.774000000Z' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:33.792000000Z'; +SET AUTOCOMMIT=TRUE; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:28.774000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:28.774000000Z' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -2303,41 +2048,27 @@ SET OPTIMIZER_VERSION=''; SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -2346,9 +2077,7 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -2391,254 +2120,254 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE +SHOW VARIABLE AUTOCOMMIT; SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE +SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT RESULT_SET 'READ_TIMESTAMP' +COMMIT; +@EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; +SET READONLY=FALSE; +@EXPECT RESULT_SET 'READONLY',FALSE +SHOW VARIABLE READONLY; SET READONLY=TRUE; +@EXPECT RESULT_SET 'READONLY',TRUE +SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; SET READ_ONLY_STALENESS='STRONG'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:33.894000000Z'; +COMMIT; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:29.031000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:29.031000000Z' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:33.894000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:29.031000000Z'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -2654,33 +2383,33 @@ SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -2690,7 +2419,7 @@ SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -2734,66 +2463,76 @@ SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +COMMIT; +BEGIN TRANSACTION; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -2803,98 +2542,122 @@ SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; ROLLBACK; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET READONLY=FALSE; @EXPECT RESULT_SET 'READONLY',FALSE SHOW VARIABLE READONLY; @@ -2904,48 +2667,57 @@ SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:33.991000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:33.991000000Z' +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:29.261000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:29.261000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:33.991000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:29.261000000Z'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -2961,26 +2733,33 @@ SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -2990,6 +2769,7 @@ SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -3033,36 +2813,44 @@ SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; COMMIT; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; BEGIN TRANSACTION; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION @@ -3074,26 +2862,39 @@ BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -3101,134 +2902,196 @@ SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'AUTOCOMMIT',TRUE SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; -@EXPECT UPDATE_COUNT 1 +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; -START BATCH DML; -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -UPDATE foo SET bar=1; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET READONLY=FALSE; @EXPECT RESULT_SET 'READONLY',FALSE SHOW VARIABLE READONLY; @@ -3236,59 +3099,86 @@ SET READONLY=TRUE; @EXPECT RESULT_SET 'READONLY',TRUE SHOW VARIABLE READONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.083000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:34.083000000Z' +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:29.514000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:29.514000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.083000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:29.514000000Z'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -3302,35 +3192,56 @@ SET OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -3338,9 +3249,12 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -3382,84 +3296,117 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT',null SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; BEGIN TRANSACTION; SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -3467,182 +3414,196 @@ SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'AUTOCOMMIT',TRUE SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; -@EXPECT UPDATE_COUNT 1 +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; -@EXPECT RESULT_SET 'READ_TIMESTAMP',null +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; +@EXPECT RESULT_SET 'READ_TIMESTAMP' SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; -START BATCH DML; -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -UPDATE foo SET bar=1; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; SET READONLY=FALSE; @EXPECT RESULT_SET 'READONLY',FALSE SHOW VARIABLE READONLY; @@ -3650,77 +3611,86 @@ SET READONLY=TRUE; @EXPECT RESULT_SET 'READONLY',TRUE SHOW VARIABLE READONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.165000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:34.165000000Z' +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:29.790000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:29.790000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.165000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:29.790000000Z'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -3734,49 +3704,56 @@ SET OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -3784,11 +3761,12 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -3830,305 +3808,282 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT',null SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; BEGIN TRANSACTION; SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; +@EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=TRUE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; +@EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION SET READONLY=TRUE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; SET READ_ONLY_STALENESS='STRONG'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.239000000Z'; +BEGIN TRANSACTION; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:30.050000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:30.050000000Z' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.239000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:30.050000000Z'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -4142,42 +4097,35 @@ SET OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -4185,10 +4133,9 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -4230,255 +4177,283 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT',null SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; +@EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=TRUE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -@EXPECT RESULT_SET 'READ_TIMESTAMP',null +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT RESULT_SET 'READ_TIMESTAMP' SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET READONLY=TRUE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='STRONG'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.299000000Z'; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:30.238000000Z'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.299000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:30.238000000Z'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -4492,35 +4467,42 @@ SET OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -4528,9 +4510,10 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -4572,378 +4555,255 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT',null SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE -SHOW VARIABLE AUTOCOMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=TRUE; -@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE -SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; -@EXPECT UPDATE_COUNT 1 +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'READ_TIMESTAMP' SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -COMMIT; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -COMMIT; -START BATCH DML; -@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; -SET READONLY=FALSE; -@EXPECT RESULT_SET 'READONLY',FALSE -SHOW VARIABLE READONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READONLY=TRUE; -@EXPECT RESULT_SET 'READONLY',TRUE -SHOW VARIABLE READONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='STRONG'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.360000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:34.360000000Z' -SHOW VARIABLE READ_ONLY_STALENESS; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:30.477000000Z'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.360000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:30.477000000Z'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -4957,56 +4817,35 @@ SET OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -5014,12 +4853,9 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -5061,279 +4897,220 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT',null SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -COMMIT; -BEGIN TRANSACTION; SELECT 1 AS TEST; -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE +SHOW VARIABLE AUTOCOMMIT; SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE +SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; SET TRANSACTION READ ONLY; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; ROLLBACK; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET READONLY=FALSE; +@EXPECT RESULT_SET 'READONLY',FALSE +SHOW VARIABLE READONLY; SET READONLY=TRUE; +@EXPECT RESULT_SET 'READONLY',TRUE +SHOW VARIABLE READONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.435000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:34.435000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:30.698000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:30.698000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.435000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:30.698000000Z'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -5347,35 +5124,28 @@ SET OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -5383,9 +5153,8 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -5427,267 +5196,243 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT',null SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; COMMIT; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=FALSE; +SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +START BATCH DDL; ABORT BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE -SHOW VARIABLE AUTOCOMMIT; SET AUTOCOMMIT=TRUE; -@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE -SHOW VARIABLE AUTOCOMMIT; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -@EXPECT UPDATE_COUNT 1 +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -START BATCH DML; -@EXPECT EXCEPTION FAILED_PRECONDITION -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -UPDATE foo SET bar=1; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READONLY=FALSE; -@EXPECT RESULT_SET 'READONLY',FALSE -SHOW VARIABLE READONLY; -SET READONLY=TRUE; -@EXPECT RESULT_SET 'READONLY',TRUE -SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='STRONG'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.491000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:34.491000000Z' -SHOW VARIABLE READ_ONLY_STALENESS; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:30.897000000Z'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.491000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:30.897000000Z'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -5702,34 +5447,34 @@ SET OPTIMIZER_VERSION=''; SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -5738,8 +5483,8 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -5782,381 +5527,284 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS' +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +START BATCH DDL; RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -BEGIN TRANSACTION; -SELECT 1 AS TEST; -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET AUTOCOMMIT=TRUE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE -SHOW VARIABLE AUTOCOMMIT; -SET AUTOCOMMIT=TRUE; -@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE -SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; -@EXPECT UPDATE_COUNT 1 +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; -START BATCH DML; -@EXPECT EXCEPTION FAILED_PRECONDITION -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -UPDATE foo SET bar=1; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; ROLLBACK; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READONLY=FALSE; -@EXPECT RESULT_SET 'READONLY',FALSE -SHOW VARIABLE READONLY; -SET READONLY=TRUE; -@EXPECT RESULT_SET 'READONLY',TRUE -SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.554000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:34.554000000Z' +SET TRANSACTION READ ONLY; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:31.065000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:31.065000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.554000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:31.065000000Z'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -6171,55 +5819,41 @@ SET OPTIMIZER_VERSION=''; SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -6228,11 +5862,9 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -6275,113 +5907,87 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -SELECT 1 AS TEST; -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE @@ -6391,166 +5997,150 @@ SET AUTOCOMMIT=TRUE; SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; +@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','TRANSACTIONAL' +SHOW VARIABLE AUTOCOMMIT_DML_MODE; SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; +@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' +SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION @@ -6562,10 +6152,9 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; START BATCH DML; @EXPECT EXCEPTION FAILED_PRECONDITION @@ -6577,18 +6166,17 @@ UPDATE foo SET bar=1; START BATCH DML; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; SET READONLY=FALSE; @EXPECT RESULT_SET 'READONLY',FALSE @@ -6598,84 +6186,77 @@ SET READONLY=TRUE; SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.640000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:34.640000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:31.341000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:31.341000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.640000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:31.341000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:31.341000000Z' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP' SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' @@ -6691,54 +6272,47 @@ SET OPTIMIZER_VERSION=''; SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP' SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' @@ -6748,10 +6322,9 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' @@ -6795,67 +6368,61 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; BEGIN TRANSACTION; SELECT 1 AS TEST; @@ -6866,138 +6433,137 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; START BATCH DML; @EXPECT EXCEPTION FAILED_PRECONDITION @@ -7009,68 +6575,68 @@ UPDATE foo SET bar=1; START BATCH DML; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; ROLLBACK; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READONLY=TRUE; +SET READONLY=FALSE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.715000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:34.715000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:31.608000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:31.608000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.715000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:31.608000000Z'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' @@ -7086,33 +6652,33 @@ SET OPTIMIZER_VERSION=''; SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' @@ -7122,7 +6688,7 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' @@ -7166,206 +6732,193 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=FALSE; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE +SHOW VARIABLE AUTOCOMMIT; SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE +SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; +@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','TRANSACTIONAL' +SHOW VARIABLE AUTOCOMMIT_DML_MODE; SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; +@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' +SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); START BATCH DML; @EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @@ -7376,76 +6929,76 @@ UPDATE foo SET bar=1; START BATCH DML; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET READONLY=FALSE; +@EXPECT RESULT_SET 'READONLY',FALSE +SHOW VARIABLE READONLY; SET READONLY=TRUE; +@EXPECT RESULT_SET 'READONLY',TRUE +SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET READ_ONLY_STALENESS='STRONG'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.780000000Z'; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:31.834000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:31.834000000Z' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.780000000Z'; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:31.834000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:31.834000000Z' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -7460,41 +7013,34 @@ SET OPTIMIZER_VERSION=''; SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -7503,9 +7049,8 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -7548,190 +7093,200 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; SELECT 1 AS TEST; +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=FALSE; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE +SHOW VARIABLE AUTOCOMMIT; SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE +SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; +SET AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; +@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','TRANSACTIONAL' +SHOW VARIABLE AUTOCOMMIT_DML_MODE; SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; +@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' +SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; START BATCH DML; @EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @@ -7742,65 +7297,76 @@ UPDATE foo SET bar=1; START BATCH DML; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; +SET READONLY=FALSE; +@EXPECT RESULT_SET 'READONLY',FALSE +SHOW VARIABLE READONLY; SET READONLY=TRUE; +@EXPECT RESULT_SET 'READONLY',TRUE +SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; SET READ_ONLY_STALENESS='STRONG'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.852000000Z'; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:32.161000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:32.161000000Z' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.852000000Z'; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:32.161000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:32.161000000Z' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; +@EXPECT RESULT_SET 'COMMIT_TIMESTAMP' SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -7815,34 +7381,34 @@ SET OPTIMIZER_VERSION=''; SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; +@EXPECT RESULT_SET 'COMMIT_TIMESTAMP' SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -7851,8 +7417,8 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -7895,67 +7461,81 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; +BEGIN TRANSACTION; SELECT 1 AS TEST; +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION -BEGIN TRANSACTION; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -7964,83 +7544,130 @@ SET AUTOCOMMIT=TRUE; SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +SET AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; +@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','TRANSACTIONAL' +SHOW VARIABLE AUTOCOMMIT_DML_MODE; SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; +@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' +SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'READ_TIMESTAMP',null +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT RESULT_SET 'READ_TIMESTAMP' SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @@ -8051,7 +7678,9 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; START BATCH DML; @EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @@ -8062,11 +7691,16 @@ UPDATE foo SET bar=1; START BATCH DML; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET READONLY=FALSE; @EXPECT RESULT_SET 'READONLY',FALSE SHOW VARIABLE READONLY; @@ -8075,49 +7709,69 @@ SET READONLY=TRUE; SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.919000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:34.919000000Z' +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:32.402000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:32.402000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.919000000Z'; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:32.402000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:32.402000000Z' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -8132,27 +7786,41 @@ SET OPTIMIZER_VERSION=''; SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -8161,7 +7829,9 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -8204,36 +7874,54 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; BEGIN TRANSACTION; SELECT 1 AS TEST; UPDATE foo SET bar=1; @@ -8243,201 +7931,232 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; SET AUTOCOMMIT=FALSE; -NEW_CONNECTION; -SET READONLY=FALSE; +@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE +SHOW VARIABLE AUTOCOMMIT; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE +SHOW VARIABLE AUTOCOMMIT; +NEW_CONNECTION; +SET READONLY=FALSE; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +SET AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; +@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','TRANSACTIONAL' +SHOW VARIABLE AUTOCOMMIT_DML_MODE; SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; +@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' +SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT RESULT_SET 'READ_TIMESTAMP',null +SELECT 1 AS TEST; +@EXPECT RESULT_SET 'READ_TIMESTAMP' SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; +START BATCH DML; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; SET READONLY=FALSE; +@EXPECT RESULT_SET 'READONLY',FALSE +SHOW VARIABLE READONLY; +SET READONLY=TRUE; +@EXPECT RESULT_SET 'READONLY',TRUE +SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; SET READ_ONLY_STALENESS='STRONG'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.974000000Z'; +SELECT 1 AS TEST; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:32.626000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:32.626000000Z' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.974000000Z'; +SELECT 1 AS TEST; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:32.626000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:32.626000000Z' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -8453,33 +8172,33 @@ SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -8489,7 +8208,7 @@ SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -8533,283 +8252,242 @@ SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; -@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE +SHOW VARIABLE AUTOCOMMIT; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE +SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; -@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; -@EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; +@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','TRANSACTIONAL' +SHOW VARIABLE AUTOCOMMIT_DML_MODE; SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; +@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' +SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; +START BATCH DML; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; -@EXPECT EXCEPTION FAILED_PRECONDITION SET READONLY=FALSE; +@EXPECT RESULT_SET 'READONLY',FALSE +SHOW VARIABLE READONLY; +SET READONLY=TRUE; +@EXPECT RESULT_SET 'READONLY',TRUE +SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.028000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.028000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:32.905000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:32.905000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.028000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:32.905000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:32.905000000Z' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; -@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -8825,40 +8503,26 @@ SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -8868,8 +8532,6 @@ SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -8913,86 +8575,66 @@ SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; +SELECT 1 AS TEST; +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE @@ -9002,150 +8644,103 @@ SET AUTOCOMMIT=TRUE; SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; -SET AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; -@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','TRANSACTIONAL' -SHOW VARIABLE AUTOCOMMIT_DML_MODE; +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; -@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' -SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION @@ -9157,9 +8752,7 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; START BATCH DML; @EXPECT EXCEPTION FAILED_PRECONDITION @@ -9171,17 +8764,12 @@ UPDATE foo SET bar=1; START BATCH DML; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; SET READONLY=FALSE; @EXPECT RESULT_SET 'READONLY',FALSE @@ -9191,77 +8779,57 @@ SET READONLY=TRUE; SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.092000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.092000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:33.118000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:33.118000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.092000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.092000000Z' -SHOW VARIABLE READ_ONLY_STALENESS; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:33.118000000Z'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; -@EXPECT RESULT_SET 'COMMIT_TIMESTAMP' +@EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' @@ -9277,47 +8845,33 @@ SET OPTIMIZER_VERSION=''; SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; -@EXPECT RESULT_SET 'COMMIT_TIMESTAMP' +@EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' @@ -9327,9 +8881,7 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' @@ -9373,61 +8925,43 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; BEGIN TRANSACTION; SELECT 1 AS TEST; @@ -9438,138 +8972,198 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE +SHOW VARIABLE AUTOCOMMIT; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE +SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; START BATCH DML; @EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @@ -9580,69 +9174,95 @@ UPDATE foo SET bar=1; START BATCH DML; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; ROLLBACK; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SET READONLY=FALSE; +@EXPECT RESULT_SET 'READONLY',FALSE +SHOW VARIABLE READONLY; +SET READONLY=TRUE; +@EXPECT RESULT_SET 'READONLY',TRUE +SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.168000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.168000000Z' +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:33.313000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:33.313000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.168000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:33.313000000Z'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -9657,34 +9277,48 @@ SET OPTIMIZER_VERSION=''; SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -9693,8 +9327,10 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -9737,272 +9373,303 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; BEGIN TRANSACTION; +SELECT 1 AS TEST; +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE -SHOW VARIABLE AUTOCOMMIT; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=TRUE; -@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE -SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT UPDATE_COUNT 1 +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -SET AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; -@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','TRANSACTIONAL' -SHOW VARIABLE AUTOCOMMIT_DML_MODE; +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; -@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' -SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT RESULT_SET 'TEST',1 +@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' +@EXPECT EXCEPTION FAILED_PRECONDITION SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET AUTOCOMMIT=FALSE; START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -START BATCH DML; -@EXPECT EXCEPTION FAILED_PRECONDITION -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -SET READONLY=FALSE; -@EXPECT RESULT_SET 'READONLY',FALSE -SHOW VARIABLE READONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READONLY=TRUE; -@EXPECT RESULT_SET 'READONLY',TRUE -SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='STRONG'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.230000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.230000000Z' -SHOW VARIABLE READ_ONLY_STALENESS; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:33.570000000Z'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.230000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.230000000Z' -SHOW VARIABLE READ_ONLY_STALENESS; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:33.570000000Z'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' @@ -10018,33 +9685,40 @@ SET OPTIMIZER_VERSION=''; SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' @@ -10054,7 +9728,8 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' @@ -10098,280 +9773,254 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT RESULT_SET 'READ_ONLY_STALENESS' +@EXPECT EXCEPTION FAILED_PRECONDITION SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -BEGIN TRANSACTION; -SELECT 1 AS TEST; -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +START BATCH DDL; ABORT BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE -SHOW VARIABLE AUTOCOMMIT; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=TRUE; -@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE -SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -@EXPECT UPDATE_COUNT 1 +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -SET AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; -@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','TRANSACTIONAL' -SHOW VARIABLE AUTOCOMMIT_DML_MODE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; -@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' -SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -START BATCH DML; -@EXPECT EXCEPTION FAILED_PRECONDITION -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -SET READONLY=FALSE; -@EXPECT RESULT_SET 'READONLY',FALSE -SHOW VARIABLE READONLY; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READONLY=TRUE; -@EXPECT RESULT_SET 'READONLY',TRUE -SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='STRONG'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.310000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.310000000Z' -SHOW VARIABLE READ_ONLY_STALENESS; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:33.779000000Z'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.310000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.310000000Z' -SHOW VARIABLE READ_ONLY_STALENESS; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:33.779000000Z'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -@EXPECT RESULT_SET 'COMMIT_TIMESTAMP' +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -10386,34 +10035,34 @@ SET OPTIMIZER_VERSION=''; SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -@EXPECT RESULT_SET 'COMMIT_TIMESTAMP' +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -10422,8 +10071,8 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -10466,81 +10115,83 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS' +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +START BATCH DDL; RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -BEGIN TRANSACTION; -SELECT 1 AS TEST; -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET AUTOCOMMIT=FALSE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -10549,130 +10200,167 @@ SET AUTOCOMMIT=TRUE; SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -SET AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; -@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','TRANSACTIONAL' -SHOW VARIABLE AUTOCOMMIT_DML_MODE; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; -@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' -SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'READ_TIMESTAMP' SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @@ -10683,9 +10371,11 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; START BATCH DML; @EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @@ -10696,16 +10386,19 @@ UPDATE foo SET bar=1; START BATCH DML; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; ROLLBACK; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; SET READONLY=FALSE; @EXPECT RESULT_SET 'READONLY',FALSE SHOW VARIABLE READONLY; @@ -10714,69 +10407,85 @@ SET READONLY=TRUE; SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.379000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.379000000Z' +COMMIT; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:34.015000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:34.015000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.379000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.379000000Z' -SHOW VARIABLE READ_ONLY_STALENESS; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:34.015000000Z'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -10791,41 +10500,55 @@ SET OPTIMIZER_VERSION=''; SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -10834,9 +10557,11 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -10879,54 +10604,68 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; BEGIN TRANSACTION; SELECT 1 AS TEST; UPDATE foo SET bar=1; @@ -10936,232 +10675,207 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE -SHOW VARIABLE AUTOCOMMIT; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=TRUE; -@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE -SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -@EXPECT UPDATE_COUNT 1 +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -SET AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; -@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','TRANSACTIONAL' -SHOW VARIABLE AUTOCOMMIT_DML_MODE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; -@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' -SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -@EXPECT RESULT_SET 'READ_TIMESTAMP' +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; +@EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -START BATCH DML; -@EXPECT EXCEPTION FAILED_PRECONDITION -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; ROLLBACK; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -SET READONLY=FALSE; -@EXPECT RESULT_SET 'READONLY',FALSE -SHOW VARIABLE READONLY; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READONLY=TRUE; -@EXPECT RESULT_SET 'READONLY',TRUE -SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.452000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.452000000Z' +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:34.249000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:34.249000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.452000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.452000000Z' -SHOW VARIABLE READ_ONLY_STALENESS; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:34.249000000Z'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -11176,34 +10890,34 @@ SET OPTIMIZER_VERSION=''; SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -11212,8 +10926,8 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -11256,73 +10970,71 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -BEGIN TRANSACTION; -SELECT 1 AS TEST; -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -11331,88 +11043,104 @@ SET AUTOCOMMIT=TRUE; SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +@EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SET AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; -@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','TRANSACTIONAL' -SHOW VARIABLE AUTOCOMMIT_DML_MODE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; -@EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' -SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET TRANSACTION READ ONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET TRANSACTION READ WRITE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @@ -11423,7 +11151,8 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); START BATCH DDL; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; START BATCH DML; @EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @@ -11434,12 +11163,13 @@ UPDATE foo SET bar=1; START BATCH DML; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; ROLLBACK; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET READONLY=FALSE; @EXPECT RESULT_SET 'READONLY',FALSE SHOW VARIABLE READONLY; @@ -11448,51 +11178,58 @@ SET READONLY=TRUE; SHOW VARIABLE READONLY; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.516000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.516000000Z' +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:34.423000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:34.423000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.516000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.516000000Z' -SHOW VARIABLE READ_ONLY_STALENESS; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:34.423000000Z'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -11507,27 +11244,34 @@ SET OPTIMIZER_VERSION=''; SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -11536,7 +11280,8 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -11579,38 +11324,44 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS' +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; COMMIT; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; BEGIN TRANSACTION; SELECT 1 AS TEST; UPDATE foo SET bar=1; @@ -11620,27 +11371,40 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); BEGIN TRANSACTION; NEW_CONNECTION; SET READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -11648,126 +11412,206 @@ SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'AUTOCOMMIT',TRUE SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +@EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +START BATCH DML; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET READONLY=FALSE; @EXPECT RESULT_SET 'READONLY',FALSE SHOW VARIABLE READONLY; @@ -11775,61 +11619,86 @@ SET READONLY=TRUE; @EXPECT RESULT_SET 'READONLY',TRUE SHOW VARIABLE READONLY; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.572000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.572000000Z' +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:34.634000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:34.634000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.572000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.572000000Z' -SHOW VARIABLE READ_ONLY_STALENESS; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:34.634000000Z'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -11843,35 +11712,56 @@ SET OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -11879,9 +11769,12 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -11923,85 +11816,113 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT',null SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; BEGIN TRANSACTION; SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; SET AUTOCOMMIT=FALSE; @@ -12011,172 +11932,204 @@ SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'AUTOCOMMIT',TRUE SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -@EXPECT RESULT_SET 'READ_TIMESTAMP' +@EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; +START BATCH DML; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; SET READONLY=FALSE; @@ -12186,77 +12139,84 @@ SET READONLY=TRUE; @EXPECT RESULT_SET 'READONLY',TRUE SHOW VARIABLE READONLY; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.636000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.636000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:34.943000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:34.943000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.636000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.636000000Z' -SHOW VARIABLE READ_ONLY_STALENESS; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:34.943000000Z'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -@EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null +@EXPECT RESULT_SET 'COMMIT_TIMESTAMP' SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; SET OPTIMIZER_VERSION='1'; @@ -12272,47 +12232,54 @@ SET OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -@EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null +@EXPECT RESULT_SET 'COMMIT_TIMESTAMP' SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @@ -12322,9 +12289,10 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; SET STATEMENT_TIMEOUT='1s'; @@ -12368,273 +12336,283 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT',null SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; BEGIN TRANSACTION; SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET AUTOCOMMIT=FALSE; -NEW_CONNECTION; -SET READONLY=TRUE; SET AUTOCOMMIT=TRUE; +NEW_CONNECTION; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; -@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; -@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +START BATCH DML; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READONLY=FALSE; -NEW_CONNECTION; SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +NEW_CONNECTION; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.701000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.701000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:35.194000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:35.194000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.701000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:35.194000000Z'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' @@ -12649,34 +12627,34 @@ SET OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' @@ -12685,8 +12663,8 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' @@ -12729,260 +12707,286 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT',null SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; -@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE -SHOW VARIABLE AUTOCOMMIT; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=TRUE; -@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE -SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT RESULT_SET 'READ_TIMESTAMP' +@EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +START BATCH DML; +@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; SET READONLY=FALSE; -@EXPECT RESULT_SET 'READONLY',FALSE -SHOW VARIABLE READONLY; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READONLY=TRUE; -@EXPECT RESULT_SET 'READONLY',TRUE -SHOW VARIABLE READONLY; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='STRONG'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.756000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.756000000Z' -SHOW VARIABLE READ_ONLY_STALENESS; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:35.388000000Z'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.756000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.756000000Z' -SHOW VARIABLE READ_ONLY_STALENESS; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:35.388000000Z'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' @@ -12997,34 +13001,41 @@ SET OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' @@ -13033,8 +13044,9 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' @@ -13077,267 +13089,259 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT',null SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -BEGIN TRANSACTION; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE -SHOW VARIABLE AUTOCOMMIT; +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=TRUE; -@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE -SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; -@EXPECT RESULT_SET 'READ_TIMESTAMP' +@EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +SELECT 1 AS TEST; +START BATCH DML; +@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; SET READONLY=FALSE; -@EXPECT RESULT_SET 'READONLY',FALSE -SHOW VARIABLE READONLY; +SET AUTOCOMMIT=FALSE; +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READONLY=TRUE; -@EXPECT RESULT_SET 'READONLY',TRUE -SHOW VARIABLE READONLY; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='STRONG'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.818000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.818000000Z' -SHOW VARIABLE READ_ONLY_STALENESS; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:35.635000000Z'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.818000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.818000000Z' -SHOW VARIABLE READ_ONLY_STALENESS; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:35.635000000Z'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' @@ -13352,34 +13356,34 @@ SET OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' @@ -13388,8 +13392,8 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' @@ -13432,75 +13436,68 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT',null SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -BEGIN TRANSACTION; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'OPTIMIZER_VERSION' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -13508,102 +13505,110 @@ SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'AUTOCOMMIT',TRUE SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT_DML_MODE' SHOW VARIABLE AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'READ_TIMESTAMP',null SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +START BATCH DML; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; ROLLBACK; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET READONLY=FALSE; @EXPECT RESULT_SET 'READONLY',FALSE SHOW VARIABLE READONLY; @@ -13611,52 +13616,50 @@ SET READONLY=TRUE; @EXPECT RESULT_SET 'READONLY',TRUE SHOW VARIABLE READONLY; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','STRONG' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.878000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.878000000Z' +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:35.872000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:35.872000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.878000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.878000000Z' -SHOW VARIABLE READ_ONLY_STALENESS; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:35.872000000Z'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT EXCEPTION FAILED_PRECONDITION SET READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_RESPONSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','1' SHOW VARIABLE OPTIMIZER_VERSION; @@ -13670,28 +13673,28 @@ SET OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'OPTIMIZER_VERSION','' SHOW VARIABLE OPTIMIZER_VERSION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'COMMIT_TIMESTAMP',null SHOW VARIABLE COMMIT_TIMESTAMP; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; @@ -13699,8 +13702,8 @@ SET OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -13742,47 +13745,44 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT',null SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'READ_ONLY_STALENESS' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET READONLY=FALSE; +SET AUTOCOMMIT=FALSE; diff --git a/google-cloud-spanner/src/test/resources/com/google/cloud/spanner/connection/postgresql/ConnectionImplGeneratedSqlScriptTest.sql b/google-cloud-spanner/src/test/resources/com/google/cloud/spanner/connection/postgresql/ConnectionImplGeneratedSqlScriptTest.sql index 8c774c17302..ac9528cc83d 100644 --- a/google-cloud-spanner/src/test/resources/com/google/cloud/spanner/connection/postgresql/ConnectionImplGeneratedSqlScriptTest.sql +++ b/google-cloud-spanner/src/test/resources/com/google/cloud/spanner/connection/postgresql/ConnectionImplGeneratedSqlScriptTest.sql @@ -1,23 +1,23 @@ NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -26,123 +26,125 @@ SET AUTOCOMMIT=TRUE; SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; SET SPANNER.READONLY=FALSE; @EXPECT RESULT_SET 'SPANNER.READONLY',FALSE SHOW VARIABLE SPANNER.READONLY; @@ -151,58 +153,60 @@ SET SPANNER.READONLY=TRUE; SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:33.302000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:33.302000000Z' +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:27.293000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:27.293000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:33.302000000Z'; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:27.293000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:27.293000000Z' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -217,34 +221,34 @@ SET SPANNER.OPTIMIZER_VERSION=''; SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -253,8 +257,8 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -297,45 +301,46 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; BEGIN TRANSACTION; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION @@ -346,28 +351,36 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -COMMIT; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -376,123 +389,173 @@ SET AUTOCOMMIT=TRUE; SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; +@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP' SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; SET SPANNER.READONLY=FALSE; @EXPECT RESULT_SET 'SPANNER.READONLY',FALSE SHOW VARIABLE SPANNER.READONLY; @@ -501,58 +564,78 @@ SET SPANNER.READONLY=TRUE; SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:33.419000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:33.419000000Z' +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:27.688000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:27.688000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:33.419000000Z'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:27.688000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:27.688000000Z' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -567,34 +650,48 @@ SET SPANNER.OPTIMIZER_VERSION=''; SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -603,8 +700,10 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -647,45 +746,62 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -NEW_CONNECTION; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; +NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; BEGIN TRANSACTION; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION @@ -696,324 +812,207 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE -SHOW VARIABLE AUTOCOMMIT; -SET AUTOCOMMIT=TRUE; -@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE -SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -ROLLBACK; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READONLY=FALSE; -@EXPECT RESULT_SET 'SPANNER.READONLY',FALSE -SHOW VARIABLE SPANNER.READONLY; -SET SPANNER.READONLY=TRUE; -@EXPECT RESULT_SET 'SPANNER.READONLY',TRUE -SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:33.530000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:33.530000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:28.001000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:28.001000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:33.530000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:28.001000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -1028,55 +1027,34 @@ SET SPANNER.OPTIMIZER_VERSION=''; SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -1085,11 +1063,8 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -1132,116 +1107,71 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -1250,195 +1180,125 @@ SET AUTOCOMMIT=TRUE; SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP' SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; SET SPANNER.READONLY=FALSE; @EXPECT RESULT_SET 'SPANNER.READONLY',FALSE SHOW VARIABLE SPANNER.READONLY; @@ -1447,85 +1307,60 @@ SET SPANNER.READONLY=TRUE; SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:33.650000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:33.650000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:28.314000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:28.314000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:33.650000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:28.314000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:28.314000000Z' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -1540,55 +1375,34 @@ SET SPANNER.OPTIMIZER_VERSION=''; SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -1597,11 +1411,8 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -1644,69 +1455,46 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; BEGIN TRANSACTION; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION @@ -1717,208 +1505,217 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE +SHOW VARIABLE AUTOCOMMIT; SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE +SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; +@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP' SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; +SET SPANNER.READONLY=FALSE; +@EXPECT RESULT_SET 'SPANNER.READONLY',FALSE +SHOW VARIABLE SPANNER.READONLY; SET SPANNER.READONLY=TRUE; +@EXPECT RESULT_SET 'SPANNER.READONLY',TRUE +SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:33.734000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:33.734000000Z' +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:28.639000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:28.639000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:33.734000000Z'; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:28.639000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:28.639000000Z' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -1933,34 +1730,34 @@ SET SPANNER.OPTIMIZER_VERSION=''; SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -1969,8 +1766,8 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -2013,282 +1810,230 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; BEGIN TRANSACTION; +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; +SET AUTOCOMMIT=TRUE; SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE +SHOW VARIABLE AUTOCOMMIT; SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE +SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP' +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +@EXPECT RESULT_SET 'SPANNER.READONLY',FALSE +SHOW VARIABLE SPANNER.READONLY; SET SPANNER.READONLY=TRUE; +@EXPECT RESULT_SET 'SPANNER.READONLY',TRUE +SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; SET SPANNER.READ_ONLY_STALENESS='STRONG'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:33.841000000Z'; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:28.902000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:28.902000000Z' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:33.841000000Z'; +SET AUTOCOMMIT=TRUE; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:28.902000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:28.902000000Z' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -2303,41 +2048,27 @@ SET SPANNER.OPTIMIZER_VERSION=''; SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -2346,9 +2077,7 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -2391,254 +2120,254 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; +BEGIN TRANSACTION; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE +SHOW VARIABLE AUTOCOMMIT; SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE +SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP' +COMMIT; +@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; +SET SPANNER.READONLY=FALSE; +@EXPECT RESULT_SET 'SPANNER.READONLY',FALSE +SHOW VARIABLE SPANNER.READONLY; SET SPANNER.READONLY=TRUE; +@EXPECT RESULT_SET 'SPANNER.READONLY',TRUE +SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; SET SPANNER.READ_ONLY_STALENESS='STRONG'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:33.945000000Z'; +COMMIT; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:29.148000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:29.148000000Z' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:33.945000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:29.148000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -2654,33 +2383,33 @@ SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -2690,7 +2419,7 @@ SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -2734,66 +2463,76 @@ SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +COMMIT; +BEGIN TRANSACTION; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -2803,98 +2542,122 @@ SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET SPANNER.READONLY=FALSE; @EXPECT RESULT_SET 'SPANNER.READONLY',FALSE SHOW VARIABLE SPANNER.READONLY; @@ -2904,48 +2667,57 @@ SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.026000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:34.026000000Z' +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:29.376000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:29.376000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.026000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:29.376000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -2961,26 +2733,33 @@ SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -2990,6 +2769,7 @@ SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -3033,36 +2813,44 @@ SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; BEGIN TRANSACTION; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION @@ -3074,26 +2862,39 @@ BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -3101,134 +2902,196 @@ SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'AUTOCOMMIT',TRUE SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; -@EXPECT UPDATE_COUNT 1 +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; -START BATCH DML; -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -UPDATE foo SET bar=1; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET SPANNER.READONLY=FALSE; @EXPECT RESULT_SET 'SPANNER.READONLY',FALSE SHOW VARIABLE SPANNER.READONLY; @@ -3236,59 +3099,86 @@ SET SPANNER.READONLY=TRUE; @EXPECT RESULT_SET 'SPANNER.READONLY',TRUE SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.128000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:34.128000000Z' +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:29.657000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:29.657000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.128000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:29.657000000Z'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -3302,35 +3192,56 @@ SET SPANNER.OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -3338,9 +3249,12 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -3382,84 +3296,117 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','0' SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; BEGIN TRANSACTION; SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -COMMIT; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -3467,182 +3414,196 @@ SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'AUTOCOMMIT',TRUE SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; -@EXPECT UPDATE_COUNT 1 +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; -@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; +@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP' SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; -START BATCH DML; -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -UPDATE foo SET bar=1; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; SET SPANNER.READONLY=FALSE; @EXPECT RESULT_SET 'SPANNER.READONLY',FALSE SHOW VARIABLE SPANNER.READONLY; @@ -3650,77 +3611,86 @@ SET SPANNER.READONLY=TRUE; @EXPECT RESULT_SET 'SPANNER.READONLY',TRUE SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.205000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:34.205000000Z' +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:29.941000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:29.941000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.205000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:29.941000000Z'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -3734,49 +3704,56 @@ SET SPANNER.OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -3784,11 +3761,12 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -3830,305 +3808,282 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','0' SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; BEGIN TRANSACTION; SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -RUN BATCH; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; +@EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=TRUE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; +@EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READONLY=TRUE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; SET SPANNER.READ_ONLY_STALENESS='STRONG'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.271000000Z'; +BEGIN TRANSACTION; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:30.135000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:30.135000000Z' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.271000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:30.135000000Z'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -4142,42 +4097,35 @@ SET SPANNER.OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -4185,10 +4133,9 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -4230,255 +4177,283 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','0' SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; +@EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=TRUE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP' SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READONLY=TRUE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='STRONG'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.327000000Z'; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:30.355000000Z'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.327000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:30.355000000Z'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -4492,35 +4467,42 @@ SET SPANNER.OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -4528,9 +4510,10 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -4572,378 +4555,255 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','0' SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -START BATCH DDL; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE -SHOW VARIABLE AUTOCOMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=TRUE; -@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE -SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; -@EXPECT UPDATE_COUNT 1 +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP' SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -COMMIT; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -COMMIT; -START BATCH DML; -@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; -SET SPANNER.READONLY=FALSE; -@EXPECT RESULT_SET 'SPANNER.READONLY',FALSE -SHOW VARIABLE SPANNER.READONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READONLY=TRUE; -@EXPECT RESULT_SET 'SPANNER.READONLY',TRUE -SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='STRONG'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.399000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:34.399000000Z' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:30.594000000Z'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.399000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:30.594000000Z'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -4957,56 +4817,35 @@ SET SPANNER.OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -5014,12 +4853,9 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -5061,279 +4897,220 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','0' SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -COMMIT; -BEGIN TRANSACTION; SELECT 1 AS TEST; -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE +SHOW VARIABLE AUTOCOMMIT; SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE +SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; SET TRANSACTION READ ONLY; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READONLY=FALSE; +@EXPECT RESULT_SET 'SPANNER.READONLY',FALSE +SHOW VARIABLE SPANNER.READONLY; SET SPANNER.READONLY=TRUE; +@EXPECT RESULT_SET 'SPANNER.READONLY',TRUE +SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.463000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:34.463000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:30.790000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:30.790000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.463000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:30.790000000Z'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -5347,35 +5124,28 @@ SET SPANNER.OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -5383,9 +5153,8 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -5427,267 +5196,243 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','0' SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +START BATCH DDL; ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE -SHOW VARIABLE AUTOCOMMIT; SET AUTOCOMMIT=TRUE; -@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE -SHOW VARIABLE AUTOCOMMIT; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -@EXPECT UPDATE_COUNT 1 +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -START BATCH DML; -@EXPECT EXCEPTION FAILED_PRECONDITION -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -UPDATE foo SET bar=1; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READONLY=FALSE; -@EXPECT RESULT_SET 'SPANNER.READONLY',FALSE -SHOW VARIABLE SPANNER.READONLY; -SET SPANNER.READONLY=TRUE; -@EXPECT RESULT_SET 'SPANNER.READONLY',TRUE -SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='STRONG'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.520000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:34.520000000Z' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:30.980000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.520000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:30.980000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -5702,34 +5447,34 @@ SET SPANNER.OPTIMIZER_VERSION=''; SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -5738,8 +5483,8 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -5782,381 +5527,284 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +START BATCH DDL; RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -BEGIN TRANSACTION; -SELECT 1 AS TEST; -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET AUTOCOMMIT=TRUE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET AUTOCOMMIT=TRUE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE -SHOW VARIABLE AUTOCOMMIT; -SET AUTOCOMMIT=TRUE; -@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE -SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; -@EXPECT UPDATE_COUNT 1 +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; -START BATCH DML; -@EXPECT EXCEPTION FAILED_PRECONDITION -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -UPDATE foo SET bar=1; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READONLY=FALSE; -@EXPECT RESULT_SET 'SPANNER.READONLY',FALSE -SHOW VARIABLE SPANNER.READONLY; -SET SPANNER.READONLY=TRUE; -@EXPECT RESULT_SET 'SPANNER.READONLY',TRUE -SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.592000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:34.592000000Z' +SET TRANSACTION READ ONLY; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:31.151000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:31.151000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.592000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:31.151000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -6171,55 +5819,41 @@ SET SPANNER.OPTIMIZER_VERSION=''; SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -6228,11 +5862,9 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -6275,113 +5907,87 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -SELECT 1 AS TEST; -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -ROLLBACK; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE @@ -6391,166 +5997,150 @@ SET AUTOCOMMIT=TRUE; SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; +@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','TRANSACTIONAL' +SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; +@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' +SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION @@ -6562,10 +6152,9 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; START BATCH DML; @EXPECT EXCEPTION FAILED_PRECONDITION @@ -6577,18 +6166,17 @@ UPDATE foo SET bar=1; START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; SET SPANNER.READONLY=FALSE; @EXPECT RESULT_SET 'SPANNER.READONLY',FALSE @@ -6598,84 +6186,77 @@ SET SPANNER.READONLY=TRUE; SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.681000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:34.681000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:31.485000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:31.485000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.681000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:31.485000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:31.485000000Z' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP' SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' @@ -6691,54 +6272,47 @@ SET SPANNER.OPTIMIZER_VERSION=''; SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP' SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' @@ -6748,10 +6322,9 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' @@ -6795,67 +6368,61 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; BEGIN TRANSACTION; SELECT 1 AS TEST; @@ -6866,138 +6433,137 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +UPDATE foo SET bar=1; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; START BATCH DML; @EXPECT EXCEPTION FAILED_PRECONDITION @@ -7009,68 +6575,68 @@ UPDATE foo SET bar=1; START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READONLY=TRUE; +SET SPANNER.READONLY=FALSE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.744000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:34.744000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:31.700000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:31.700000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.744000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:31.700000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' @@ -7086,33 +6652,33 @@ SET SPANNER.OPTIMIZER_VERSION=''; SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' @@ -7122,7 +6688,7 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' @@ -7166,206 +6732,193 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE +SHOW VARIABLE AUTOCOMMIT; SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE +SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET SPANNER.AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; +@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','TRANSACTIONAL' +SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; +@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' +SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); START BATCH DML; @EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @@ -7376,76 +6929,76 @@ UPDATE foo SET bar=1; START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET SPANNER.READONLY=FALSE; +@EXPECT RESULT_SET 'SPANNER.READONLY',FALSE +SHOW VARIABLE SPANNER.READONLY; SET SPANNER.READONLY=TRUE; +@EXPECT RESULT_SET 'SPANNER.READONLY',TRUE +SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET SPANNER.READ_ONLY_STALENESS='STRONG'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.816000000Z'; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:32.018000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:32.018000000Z' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.816000000Z'; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:32.018000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:32.018000000Z' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -7460,41 +7013,34 @@ SET SPANNER.OPTIMIZER_VERSION=''; SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -7503,9 +7049,8 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -7548,190 +7093,200 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +BEGIN TRANSACTION; SELECT 1 AS TEST; +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'TEST',1 -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE +SHOW VARIABLE AUTOCOMMIT; SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE +SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; +SET SPANNER.AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; +@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','TRANSACTIONAL' +SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; +@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' +SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; START BATCH DML; @EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @@ -7742,65 +7297,76 @@ UPDATE foo SET bar=1; START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; +SET SPANNER.READONLY=FALSE; +@EXPECT RESULT_SET 'SPANNER.READONLY',FALSE +SHOW VARIABLE SPANNER.READONLY; SET SPANNER.READONLY=TRUE; +@EXPECT RESULT_SET 'SPANNER.READONLY',TRUE +SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; SET SPANNER.READ_ONLY_STALENESS='STRONG'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.888000000Z'; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:32.292000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:32.292000000Z' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.888000000Z'; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:32.292000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:32.292000000Z' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; +@EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP' SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -7815,34 +7381,34 @@ SET SPANNER.OPTIMIZER_VERSION=''; SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; -@EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; +@EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP' SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -7851,8 +7417,8 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -7895,67 +7461,81 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; +BEGIN TRANSACTION; SELECT 1 AS TEST; +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION -BEGIN TRANSACTION; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION +BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=TRUE; +UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -7964,83 +7544,130 @@ SET AUTOCOMMIT=TRUE; SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +SET SPANNER.AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; +@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','TRANSACTIONAL' +SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; +@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' +SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP' SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @@ -8051,7 +7678,9 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; START BATCH DML; @EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @@ -8062,11 +7691,16 @@ UPDATE foo SET bar=1; START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET SPANNER.READONLY=FALSE; @EXPECT RESULT_SET 'SPANNER.READONLY',FALSE SHOW VARIABLE SPANNER.READONLY; @@ -8075,49 +7709,69 @@ SET SPANNER.READONLY=TRUE; SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:34.947000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:34.947000000Z' +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:32.518000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:32.518000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:34.947000000Z'; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:32.518000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:32.518000000Z' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -8132,27 +7786,41 @@ SET SPANNER.OPTIMIZER_VERSION=''; SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -8161,7 +7829,9 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -8204,36 +7874,54 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; BEGIN TRANSACTION; SELECT 1 AS TEST; UPDATE foo SET bar=1; @@ -8243,201 +7931,232 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=FALSE; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; SET AUTOCOMMIT=FALSE; -NEW_CONNECTION; -SET SPANNER.READONLY=FALSE; +@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE +SHOW VARIABLE AUTOCOMMIT; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE +SHOW VARIABLE AUTOCOMMIT; +NEW_CONNECTION; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +SET SPANNER.AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; +@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','TRANSACTIONAL' +SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; +@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' +SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null +SELECT 1 AS TEST; +@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP' SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; +SELECT 1 AS TEST; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; +START BATCH DML; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; SET SPANNER.READONLY=FALSE; +@EXPECT RESULT_SET 'SPANNER.READONLY',FALSE +SHOW VARIABLE SPANNER.READONLY; +SET SPANNER.READONLY=TRUE; +@EXPECT RESULT_SET 'SPANNER.READONLY',TRUE +SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; SET SPANNER.READ_ONLY_STALENESS='STRONG'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.001000000Z'; +SELECT 1 AS TEST; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:32.770000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:32.770000000Z' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.001000000Z'; +SELECT 1 AS TEST; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:32.770000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:32.770000000Z' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -8453,33 +8172,33 @@ SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -8489,7 +8208,7 @@ SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -8533,283 +8252,242 @@ SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; +BEGIN TRANSACTION; +SELECT 1 AS TEST; +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -START BATCH DDL; +SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; -@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE +SHOW VARIABLE AUTOCOMMIT; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE +SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; -@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; -@EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; +@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','TRANSACTIONAL' +SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; +@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' +SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; +START BATCH DML; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; -@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READONLY=FALSE; +@EXPECT RESULT_SET 'SPANNER.READONLY',FALSE +SHOW VARIABLE SPANNER.READONLY; +SET SPANNER.READONLY=TRUE; +@EXPECT RESULT_SET 'SPANNER.READONLY',TRUE +SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.055000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.055000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:33.018000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:33.018000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; -@EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.055000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:33.018000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-23T14:42:33.018000000Z' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; -@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' +SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -8825,40 +8503,26 @@ SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -8868,8 +8532,6 @@ SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -8913,86 +8575,66 @@ SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; +SELECT 1 AS TEST; +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE @@ -9002,150 +8644,103 @@ SET AUTOCOMMIT=TRUE; SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; -SET SPANNER.AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; -@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','TRANSACTIONAL' -SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; -@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' -SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION @@ -9157,9 +8752,7 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; START BATCH DML; @EXPECT EXCEPTION FAILED_PRECONDITION @@ -9171,17 +8764,12 @@ UPDATE foo SET bar=1; START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; SET SPANNER.READONLY=FALSE; @EXPECT RESULT_SET 'SPANNER.READONLY',FALSE @@ -9191,77 +8779,57 @@ SET SPANNER.READONLY=TRUE; SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.130000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.130000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:33.206000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:33.206000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.130000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.130000000Z' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:33.206000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; -@EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP' +@EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' @@ -9277,47 +8845,33 @@ SET SPANNER.OPTIMIZER_VERSION=''; SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; -@EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP' +@EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' @@ -9327,9 +8881,7 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' @@ -9373,61 +8925,43 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; BEGIN TRANSACTION; SELECT 1 AS TEST; @@ -9438,138 +8972,198 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE +SHOW VARIABLE AUTOCOMMIT; +SET AUTOCOMMIT=TRUE; +@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE +SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; START BATCH DML; @EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @@ -9580,69 +9174,95 @@ UPDATE foo SET bar=1; START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SET SPANNER.READONLY=FALSE; +@EXPECT RESULT_SET 'SPANNER.READONLY',FALSE +SHOW VARIABLE SPANNER.READONLY; +SET SPANNER.READONLY=TRUE; +@EXPECT RESULT_SET 'SPANNER.READONLY',TRUE +SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.196000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.196000000Z' +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:33.448000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:33.448000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.196000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:33.449000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -9657,34 +9277,48 @@ SET SPANNER.OPTIMIZER_VERSION=''; SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -9693,8 +9327,10 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -9737,272 +9373,303 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; BEGIN TRANSACTION; +SELECT 1 AS TEST; +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -BEGIN TRANSACTION; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE -SHOW VARIABLE AUTOCOMMIT; +START BATCH DDL; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=TRUE; -@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE -SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT UPDATE_COUNT 1 +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -SET SPANNER.AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; -@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','TRANSACTIONAL' -SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; -@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' -SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT RESULT_SET 'TEST',1 +@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' +@EXPECT EXCEPTION FAILED_PRECONDITION SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET AUTOCOMMIT=FALSE; START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -START BATCH DML; -@EXPECT EXCEPTION FAILED_PRECONDITION -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -SET SPANNER.READONLY=FALSE; -@EXPECT RESULT_SET 'SPANNER.READONLY',FALSE -SHOW VARIABLE SPANNER.READONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READONLY=TRUE; -@EXPECT RESULT_SET 'SPANNER.READONLY',TRUE -SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='STRONG'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.273000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.273000000Z' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:33.677000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.273000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.273000000Z' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:33.677000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' @@ -10018,33 +9685,40 @@ SET SPANNER.OPTIMIZER_VERSION=''; SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' @@ -10054,7 +9728,8 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' @@ -10098,280 +9773,254 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' +@EXPECT EXCEPTION FAILED_PRECONDITION SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -BEGIN TRANSACTION; -SELECT 1 AS TEST; -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +START BATCH DDL; ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE -SHOW VARIABLE AUTOCOMMIT; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=TRUE; -@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE -SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -@EXPECT UPDATE_COUNT 1 +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -SET SPANNER.AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; -@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','TRANSACTIONAL' -SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; -@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' -SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -@EXPECT RESULT_SET 'TEST',1 +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -START BATCH DML; -@EXPECT EXCEPTION FAILED_PRECONDITION -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -SET SPANNER.READONLY=FALSE; -@EXPECT RESULT_SET 'SPANNER.READONLY',FALSE -SHOW VARIABLE SPANNER.READONLY; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READONLY=TRUE; -@EXPECT RESULT_SET 'SPANNER.READONLY',TRUE -SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='STRONG'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.346000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.346000000Z' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:33.887000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.346000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.346000000Z' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:33.887000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -@EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP' +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -10386,34 +10035,34 @@ SET SPANNER.OPTIMIZER_VERSION=''; SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -@EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP' +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -10422,8 +10071,8 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -10466,81 +10115,83 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +START BATCH DDL; RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; -BEGIN TRANSACTION; -SELECT 1 AS TEST; -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET AUTOCOMMIT=FALSE; +START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -10549,130 +10200,167 @@ SET AUTOCOMMIT=TRUE; SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -SET SPANNER.AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; -@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','TRANSACTIONAL' -SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; -@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' -SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP' SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @@ -10683,9 +10371,11 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; START BATCH DML; @EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @@ -10696,16 +10386,19 @@ UPDATE foo SET bar=1; START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; SET SPANNER.READONLY=FALSE; @EXPECT RESULT_SET 'SPANNER.READONLY',FALSE SHOW VARIABLE SPANNER.READONLY; @@ -10714,69 +10407,85 @@ SET SPANNER.READONLY=TRUE; SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.416000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.416000000Z' +COMMIT; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:34.149000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:34.149000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.416000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.416000000Z' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:34.149000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -10791,41 +10500,55 @@ SET SPANNER.OPTIMIZER_VERSION=''; SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -10834,9 +10557,11 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -10879,54 +10604,68 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +COMMIT; SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; BEGIN TRANSACTION; SELECT 1 AS TEST; UPDATE foo SET bar=1; @@ -10936,232 +10675,207 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE -SHOW VARIABLE AUTOCOMMIT; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=TRUE; -@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE -SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -@EXPECT UPDATE_COUNT 1 +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -SET SPANNER.AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; -@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','TRANSACTIONAL' -SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; -@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' -SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP' +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; +@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -START BATCH DDL; -@EXPECT EXCEPTION FAILED_PRECONDITION -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -START BATCH DML; -@EXPECT EXCEPTION FAILED_PRECONDITION -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -UPDATE foo SET bar=1; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -SET SPANNER.READONLY=FALSE; -@EXPECT RESULT_SET 'SPANNER.READONLY',FALSE -SHOW VARIABLE SPANNER.READONLY; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READONLY=TRUE; -@EXPECT RESULT_SET 'SPANNER.READONLY',TRUE -SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.485000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.485000000Z' +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:34.333000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:34.333000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.485000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.485000000Z' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:34.333000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -11176,34 +10890,34 @@ SET SPANNER.OPTIMIZER_VERSION=''; SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -11212,8 +10926,8 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -11256,73 +10970,71 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -BEGIN TRANSACTION; -SELECT 1 AS TEST; -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET AUTOCOMMIT=FALSE; +SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -11331,88 +11043,104 @@ SET AUTOCOMMIT=TRUE; SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +@EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.AUTOCOMMIT_DML_MODE='TRANSACTIONAL'; -@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','TRANSACTIONAL' -SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; -@EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE','PARTITIONED_NON_ATOMIC' -SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET TRANSACTION READ ONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET TRANSACTION READ WRITE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @@ -11423,7 +11151,8 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); START BATCH DDL; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; START BATCH DML; @EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @@ -11434,12 +11163,13 @@ UPDATE foo SET bar=1; START BATCH DML; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; ROLLBACK; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET SPANNER.READONLY=FALSE; @EXPECT RESULT_SET 'SPANNER.READONLY',FALSE SHOW VARIABLE SPANNER.READONLY; @@ -11448,51 +11178,58 @@ SET SPANNER.READONLY=TRUE; SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.544000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.544000000Z' +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:34.517000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:34.517000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.544000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.544000000Z' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:34.517000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -11507,27 +11244,34 @@ SET SPANNER.OPTIMIZER_VERSION=''; SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -11536,7 +11280,8 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -11579,38 +11324,44 @@ SET STATEMENT_TIMEOUT='0ns'; SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; COMMIT; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; BEGIN TRANSACTION; SELECT 1 AS TEST; UPDATE foo SET bar=1; @@ -11620,27 +11371,40 @@ CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); BEGIN TRANSACTION; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; -SET AUTOCOMMIT=TRUE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -11648,126 +11412,206 @@ SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'AUTOCOMMIT',TRUE SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +@EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +START BATCH DML; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET SPANNER.READONLY=FALSE; @EXPECT RESULT_SET 'SPANNER.READONLY',FALSE SHOW VARIABLE SPANNER.READONLY; @@ -11775,61 +11619,86 @@ SET SPANNER.READONLY=TRUE; @EXPECT RESULT_SET 'SPANNER.READONLY',TRUE SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.601000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.601000000Z' +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:34.777000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:34.777000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.601000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.601000000Z' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:34.777000000Z'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -11843,35 +11712,56 @@ SET SPANNER.OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -11879,9 +11769,12 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -11923,85 +11816,113 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','0' SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; BEGIN TRANSACTION; SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; SET AUTOCOMMIT=FALSE; @@ -12011,172 +11932,204 @@ SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'AUTOCOMMIT',TRUE SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP' +@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; +START BATCH DML; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; SET SPANNER.READONLY=FALSE; @@ -12186,77 +12139,84 @@ SET SPANNER.READONLY=TRUE; @EXPECT RESULT_SET 'SPANNER.READONLY',TRUE SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.670000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.670000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:35.084000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:35.084000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.670000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.670000000Z' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:35.084000000Z'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -@EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null +@EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP' SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; SET SPANNER.OPTIMIZER_VERSION='1'; @@ -12272,47 +12232,54 @@ SET SPANNER.OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -@EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null +@EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP' SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @@ -12322,9 +12289,10 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; SET STATEMENT_TIMEOUT='1s'; @@ -12368,273 +12336,283 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','0' SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; BEGIN TRANSACTION; SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET AUTOCOMMIT=FALSE; -NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=TRUE; +NEW_CONNECTION; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; -@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; -@EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; +START BATCH DML; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READONLY=FALSE; -NEW_CONNECTION; SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +NEW_CONNECTION; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.727000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.727000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:35.282000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:35.282000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.727000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:35.282000000Z'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' @@ -12649,34 +12627,34 @@ SET SPANNER.OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' @@ -12685,8 +12663,8 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' @@ -12729,260 +12707,286 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','0' SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; -@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE -SHOW VARIABLE AUTOCOMMIT; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=TRUE; -@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE -SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP' +@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +START BATCH DML; +@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; SET SPANNER.READONLY=FALSE; -@EXPECT RESULT_SET 'SPANNER.READONLY',FALSE -SHOW VARIABLE SPANNER.READONLY; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READONLY=TRUE; -@EXPECT RESULT_SET 'SPANNER.READONLY',TRUE -SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='STRONG'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.786000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.786000000Z' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:35.509000000Z'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.786000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.786000000Z' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:35.509000000Z'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' @@ -12997,34 +13001,41 @@ SET SPANNER.OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' @@ -13033,8 +13044,9 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' @@ -13077,267 +13089,259 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','0' SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -BEGIN TRANSACTION; -SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 +SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; +SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; -@EXPECT RESULT_SET 'AUTOCOMMIT',FALSE -SHOW VARIABLE AUTOCOMMIT; +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET AUTOCOMMIT=TRUE; -@EXPECT RESULT_SET 'AUTOCOMMIT',TRUE -SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION +@EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; -@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP' +@EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +SELECT 1 AS TEST; +START BATCH DML; +@EXPECT EXCEPTION FAILED_PRECONDITION SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +UPDATE foo SET bar=1; +@EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; SET SPANNER.READONLY=FALSE; -@EXPECT RESULT_SET 'SPANNER.READONLY',FALSE -SHOW VARIABLE SPANNER.READONLY; +SET AUTOCOMMIT=FALSE; +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READONLY=TRUE; -@EXPECT RESULT_SET 'SPANNER.READONLY',TRUE -SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='STRONG'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.849000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.849000000Z' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:35.756000000Z'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.849000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.849000000Z' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:35.756000000Z'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' @@ -13352,34 +13356,34 @@ SET SPANNER.OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' @@ -13388,8 +13392,8 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' @@ -13432,75 +13436,68 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','0' SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SELECT 1 AS TEST; -BEGIN TRANSACTION; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -UPDATE foo SET bar=1; -@EXPECT EXCEPTION FAILED_PRECONDITION -CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -@EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT EXCEPTION FAILED_PRECONDITION ABORT BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'AUTOCOMMIT',FALSE SHOW VARIABLE AUTOCOMMIT; @@ -13508,102 +13505,110 @@ SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'AUTOCOMMIT',TRUE SHOW VARIABLE AUTOCOMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT UPDATE_COUNT 1 UPDATE foo SET bar=1; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'SPANNER.AUTOCOMMIT_DML_MODE' SHOW VARIABLE SPANNER.AUTOCOMMIT_DML_MODE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET TRANSACTION READ ONLY; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET TRANSACTION READ WRITE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'SPANNER.READ_TIMESTAMP',null SHOW VARIABLE SPANNER.READ_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +START BATCH DDL; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +UPDATE foo SET bar=1; +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DDL; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +START BATCH DML; +@EXPECT EXCEPTION FAILED_PRECONDITION +SELECT 1 AS TEST; +@EXPECT EXCEPTION FAILED_PRECONDITION +CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); +UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION START BATCH DML; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; ROLLBACK; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET SPANNER.READONLY=FALSE; @EXPECT RESULT_SET 'SPANNER.READONLY',FALSE SHOW VARIABLE SPANNER.READONLY; @@ -13611,52 +13616,50 @@ SET SPANNER.READONLY=TRUE; @EXPECT RESULT_SET 'SPANNER.READONLY',TRUE SHOW VARIABLE SPANNER.READONLY; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET SPANNER.READ_ONLY_STALENESS='STRONG'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','STRONG' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-15T06:06:35.904000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-15T06:06:35.904000000Z' +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2022-03-23T14:42:35.963000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2022-03-23T14:42:35.963000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-15T06:06:35.904000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2022-03-15T06:06:35.904000000Z' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2022-03-23T14:42:35.963000000Z'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 1s'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 1s' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; +@EXPECT EXCEPTION FAILED_PRECONDITION SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 100ms'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MAX_STALENESS 100ms' -SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 100us'; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','EXACT_STALENESS 100us' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_RESPONSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET SPANNER.OPTIMIZER_VERSION='1'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','1' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; @@ -13670,28 +13673,28 @@ SET SPANNER.OPTIMIZER_VERSION=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_VERSION','' SHOW VARIABLE SPANNER.OPTIMIZER_VERSION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'SPANNER.COMMIT_TIMESTAMP',null SHOW VARIABLE SPANNER.COMMIT_TIMESTAMP; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE='custom-package'; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','custom-package' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; @@ -13699,8 +13702,8 @@ SET SPANNER.OPTIMIZER_STATISTICS_PACKAGE=''; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE','' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET STATEMENT_TIMEOUT='1s'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','1s' SHOW VARIABLE STATEMENT_TIMEOUT; @@ -13742,47 +13745,44 @@ SET STATEMENT_TIMEOUT='0ns'; @EXPECT RESULT_SET 'STATEMENT_TIMEOUT','0' SHOW VARIABLE STATEMENT_TIMEOUT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; COMMIT; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'SPANNER.OPTIMIZER_STATISTICS_PACKAGE' SHOW VARIABLE SPANNER.OPTIMIZER_STATISTICS_PACKAGE; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; @EXPECT EXCEPTION FAILED_PRECONDITION RUN BATCH; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; -@EXPECT EXCEPTION FAILED_PRECONDITION +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; SET SPANNER.TRANSACTION_TAG = 'some-tag'; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; SELECT 1 AS TEST; -@EXPECT EXCEPTION FAILED_PRECONDITION UPDATE foo SET bar=1; @EXPECT EXCEPTION FAILED_PRECONDITION CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION BEGIN TRANSACTION; NEW_CONNECTION; -SET SPANNER.READONLY=TRUE; -SET AUTOCOMMIT=TRUE; +SET SPANNER.READONLY=FALSE; +SET AUTOCOMMIT=FALSE;