Skip to content

Commit

Permalink
mysql: limit 0 describe
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed May 4, 2024
1 parent 1769b3d commit 9dab78b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nexus/peer-mysql/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use peer_cursor::{
};
use pgwire::error::{ErrorInfo, PgWireError, PgWireResult};
use pt::peerdb_peers::MySqlConfig;
use sqlparser::ast::{CloseCursor, Declare, FetchDirection, Statement};
use sqlparser::ast::{CloseCursor, Declare, Expr, FetchDirection, Statement, Value};
use stream::MyRecordStream;

pub struct MySqlQueryExecutor {
Expand Down Expand Up @@ -202,6 +202,7 @@ impl QueryExecutor for MySqlQueryExecutor {
Statement::Query(query) => {
let mut query = query.clone();
ast::rewrite_query(&self.peer_name, &mut query);
query.limit = Expr::Value(Value::Number("0", false));
Ok(Some(self.query_schema(query.to_string()).await?))
}
Statement::Declare { stmts } => {
Expand All @@ -228,5 +229,5 @@ impl QueryExecutor for MySqlQueryExecutor {
"only SELECT statements are supported in mysql".to_owned(),
)))),
}
}
}
}

0 comments on commit 9dab78b

Please sign in to comment.