Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion crates/executor/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,15 @@ impl UserQuery {
Statement::Use(entity) => {
return self.execute_use_statement(entity).await;
}
Statement::ShowDatabases { .. }
| Statement::ShowSchemas { .. }
| Statement::ShowTables { .. }
| Statement::ShowColumns { .. }
| Statement::ShowViews { .. }
| Statement::ShowFunctions { .. }
| Statement::ShowObjects { .. }
| Statement::ShowVariables { .. }
| Statement::ShowVariable { .. } => return Box::pin(self.show_query(*s)).await,
other => {
return ex_error::NotSupportedStatementInReadOnlyModeSnafu {
statement: other.to_string(),
Expand All @@ -297,7 +306,17 @@ impl UserQuery {
},
DFStatement::Explain(explain) => match *explain.statement {
DFStatement::Statement(s) => match *s {
Statement::Query(..) | Statement::Use(..) => {
Statement::Query(..)
| Statement::Use(..)
| Statement::ShowDatabases { .. }
| Statement::ShowSchemas { .. }
| Statement::ShowTables { .. }
| Statement::ShowColumns { .. }
| Statement::ShowViews { .. }
| Statement::ShowFunctions { .. }
| Statement::ShowObjects { .. }
| Statement::ShowVariables { .. }
| Statement::ShowVariable { .. } => {
return self.execute_sql(&self.query).await;
}
other => {
Expand Down
19 changes: 19 additions & 0 deletions crates/executor/src/tests/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,4 +562,23 @@ async fn test_execute_read_only_mode() {
)
.await
.expect("Failed to execute query in read only mode");

execution_svc
.query("test_session_id", "SHOW TABLES;", QueryContext::default())
.await
.expect("Failed to execute query in read only mode");

execution_svc
.query("test_session_id", "SHOW SCHEMAS;", QueryContext::default())
.await
.expect("Failed to execute query in read only mode");

execution_svc
.query(
"test_session_id",
"SHOW DATABASES;",
QueryContext::default(),
)
.await
.expect("Failed to execute query in read only mode");
}