Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
zwang28 committed Mar 7, 2024
1 parent 63cb4ee commit 006df4b
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/frontend/src/handler/extended_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub fn handle_parse(
specific_param_types: Vec<Option<DataType>>,
) -> Result<PrepareStatement> {
session.clear_cancel_query_flag();
let sql: Arc<str> = Arc::from(statement.to_string());
let sql: Arc<str> = Arc::from(statement.to_unredacted_string());
let handler_args = HandlerArgs::new(session, &statement, sql)?;
match &statement {
Statement::Query(_)
Expand Down Expand Up @@ -177,7 +177,7 @@ pub async fn handle_execute(session: Arc<SessionImpl>, portal: Portal) -> Result
Portal::Portal(portal) => {
session.clear_cancel_query_flag();
let _guard = session.txn_begin_implicit(); // TODO(bugen): is this behavior correct?
let sql: Arc<str> = Arc::from(portal.statement.to_string());
let sql: Arc<str> = Arc::from(portal.statement.to_unredacted_string());
let handler_args = HandlerArgs::new(session, &portal.statement, sql)?;
match &portal.statement {
Statement::Query(_)
Expand Down
2 changes: 1 addition & 1 deletion src/sqlparser/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub fn one_statement_parses_to(sql: &str, canonical: &str) -> Statement {

let only_statement = statements.pop().unwrap();
if !canonical.is_empty() {
assert_eq!(canonical, only_statement.to_string())
assert_eq!(canonical, only_statement.to_unredacted_string())
}
only_statement
}
Expand Down
2 changes: 1 addition & 1 deletion src/sqlparser/tests/sqlparser_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1721,7 +1721,7 @@ fn run_explain_analyze(query: &str, expected_analyze: bool, expected_options: Ex
} => {
assert_eq!(analyze, expected_analyze);
assert_eq!(options, expected_options);
assert_eq!("SELECT sqrt(id) FROM foo", statement.to_string());
assert_eq!("SELECT sqrt(id) FROM foo", statement.to_unredacted_string());
}
_ => panic!("Unexpected Statement, must be Explain"),
}
Expand Down
2 changes: 1 addition & 1 deletion src/sqlparser/tests/sqlparser_postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ PHP ₱ USD $
\\."#;
let ast = one_statement_parses_to(sql, "");
println!("{:#?}", ast);
// assert_eq!(sql, ast.to_string());
// assert_eq!(sql, ast.to_unredacted_string());
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/tests/sqlsmith/src/test_runners/fuzzing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub async fn run_pre_generated(client: &Client, outdir: &str) {
let queries_path = format!("{}/queries.sql", outdir);
let queries = read_file_contents(queries_path).unwrap();
for statement in parse_sql(&queries) {
let sql = statement.to_string();
let sql = statement.to_unredacted_string();
tracing::info!("[EXECUTING STATEMENT]: {}", sql);
run_query(timeout_duration, client, &sql).await.unwrap();
}
Expand Down
2 changes: 1 addition & 1 deletion src/tests/sqlsmith/src/test_runners/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub(super) async fn update_base_tables<R: Rng>(
) {
let update_statements = generate_update_statements(rng, base_tables, inserts).unwrap();
for update_statement in update_statements {
let sql = update_statement.to_string();
let sql = update_statement.to_unredacted_string();
tracing::info!("[EXECUTING UPDATES]: {}", &sql);
client.simple_query(&sql).await.unwrap();
}
Expand Down

0 comments on commit 006df4b

Please sign in to comment.