We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1dcb532 commit ff70bc3Copy full SHA for ff70bc3
datafusion-postgres/src/handlers.rs
@@ -93,8 +93,11 @@ impl SimpleQueryHandler for DfSessionService {
93
.await
94
.map_err(|e| PgWireError::ApiError(Box::new(e)))?;
95
96
- // Get the number of rows affected (typically 1 for INSERT)
97
- let rows_affected = result.iter().map(|batch| batch.num_rows()).sum::<usize>();
+ // Extract count field from the first batch
+ let rows_affected = result.first()
98
+ .and_then(|batch| batch.column_by_name("count"))
99
+ .and_then(|col| col.as_any().downcast_ref::<datafusion::arrow::array::UInt64Array>())
100
+ .map_or(0, |array| array.value(0) as usize);
101
102
// Create INSERT tag with the affected row count
103
let tag = Tag::new("INSERT").with_oid(0).with_rows(rows_affected);
0 commit comments