diff --git a/src/frontend/src/handler/extended_handle.rs b/src/frontend/src/handler/extended_handle.rs index daab63b1ad308..5d20c21fa9fdd 100644 --- a/src/frontend/src/handler/extended_handle.rs +++ b/src/frontend/src/handler/extended_handle.rs @@ -88,7 +88,7 @@ pub fn handle_parse( specific_param_types: Vec>, ) -> Result { session.clear_cancel_query_flag(); - let sql: Arc = Arc::from(statement.to_string()); + let sql: Arc = Arc::from(statement.to_unredacted_string()); let handler_args = HandlerArgs::new(session, &statement, sql)?; match &statement { Statement::Query(_) @@ -177,7 +177,7 @@ pub async fn handle_execute(session: Arc, 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 = Arc::from(portal.statement.to_string()); + let sql: Arc = Arc::from(portal.statement.to_unredacted_string()); let handler_args = HandlerArgs::new(session, &portal.statement, sql)?; match &portal.statement { Statement::Query(_) diff --git a/src/sqlparser/src/test_utils.rs b/src/sqlparser/src/test_utils.rs index 7519b200ccd66..52779c06e5fbf 100644 --- a/src/sqlparser/src/test_utils.rs +++ b/src/sqlparser/src/test_utils.rs @@ -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 } diff --git a/src/sqlparser/tests/sqlparser_common.rs b/src/sqlparser/tests/sqlparser_common.rs index 0fc2f3c2530f7..608d06de99c52 100644 --- a/src/sqlparser/tests/sqlparser_common.rs +++ b/src/sqlparser/tests/sqlparser_common.rs @@ -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"), } diff --git a/src/sqlparser/tests/sqlparser_postgres.rs b/src/sqlparser/tests/sqlparser_postgres.rs index 6a5dec5d809c1..40e3ee4cfb9e6 100644 --- a/src/sqlparser/tests/sqlparser_postgres.rs +++ b/src/sqlparser/tests/sqlparser_postgres.rs @@ -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] diff --git a/src/tests/sqlsmith/src/test_runners/fuzzing.rs b/src/tests/sqlsmith/src/test_runners/fuzzing.rs index b29a78b4b07d1..0d5140ce10386 100644 --- a/src/tests/sqlsmith/src/test_runners/fuzzing.rs +++ b/src/tests/sqlsmith/src/test_runners/fuzzing.rs @@ -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(); } diff --git a/src/tests/sqlsmith/src/test_runners/utils.rs b/src/tests/sqlsmith/src/test_runners/utils.rs index fa744c4c551bc..f9d316d91d707 100644 --- a/src/tests/sqlsmith/src/test_runners/utils.rs +++ b/src/tests/sqlsmith/src/test_runners/utils.rs @@ -41,7 +41,7 @@ pub(super) async fn update_base_tables( ) { 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(); }