Skip to content

Commit 01bf360

Browse files
committed
environmentd: fix test_dataflow_error_codes setup and format branch code
`test_dataflow_error_codes` issued `CREATE TABLE` and `INSERT` in a single `batch_execute`, which forms an implicit transaction block; DDL cannot run inside one, so the test failed at setup with E25001. Run the statements separately. Also apply `cargo fmt` to the `PeekError` call sites introduced earlier on this branch.
1 parent 82f15ed commit 01bf360

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

src/compute-client/src/controller/instance.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,9 +1221,9 @@ impl Instance {
12211221
self.deliver_response(response);
12221222
}
12231223
for uuid in to_drop {
1224-
let response = PeekResponse::Error(
1225-
crate::protocol::response::PeekError::internal(ERROR_TARGET_REPLICA_FAILED),
1226-
);
1224+
let response = PeekResponse::Error(crate::protocol::response::PeekError::internal(
1225+
ERROR_TARGET_REPLICA_FAILED,
1226+
));
12271227
self.finish_peek(uuid, response);
12281228
}
12291229

src/compute/src/compute_state.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,9 @@ impl IndexPeek {
15911591
// Preserve the structured dataflow error so the adapter can
15921592
// assign a precise SQLSTATE instead of a generic internal error.
15931593
let error = cursor.key(&storage).deserialize();
1594-
return PeekStatus::Ready(PeekResponse::Error(PeekError::Dataflow(Box::new(error))));
1594+
return PeekStatus::Ready(PeekResponse::Error(PeekError::Dataflow(Box::new(
1595+
error,
1596+
))));
15951597
}
15961598
cursor.step_key(&storage);
15971599
}

src/environmentd/tests/sql.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2382,9 +2382,12 @@ fn test_dataflow_error_codes() {
23822382

23832383
// Referencing a table column keeps the optimizer from constant-folding the
23842384
// failing expression, so the error is produced during dataflow execution.
2385+
// Run the DDL and DML separately: a multi-statement batch forms an implicit
2386+
// transaction block, and `CREATE TABLE` cannot run inside one.
23852387
client
2386-
.batch_execute("CREATE TABLE t (a int4, b int4); INSERT INTO t VALUES (1, 0);")
2388+
.batch_execute("CREATE TABLE t (a int4, b int4)")
23872389
.unwrap();
2390+
client.batch_execute("INSERT INTO t VALUES (1, 0)").unwrap();
23882391

23892392
let cases: &[(&str, &SqlState)] = &[
23902393
// Division by zero over a collection -> division_by_zero (22012).

0 commit comments

Comments
 (0)