This is an automated email from the ASF dual-hosted git repository.
iffyio pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git
The following commit(s) were added to refs/heads/main by this push:
new 3f4d5f96 pretty-print CREATE VIEW statements (#1855)
3f4d5f96 is described below
commit 3f4d5f96ee2622a0a2ad3fedf56dfd93baeb9a03
Author: Ophir LOJKINE <[email protected]>
AuthorDate: Wed May 21 05:44:33 2025 +0200
pretty-print CREATE VIEW statements (#1855)
---
src/ast/mod.rs | 4 +++-
tests/pretty_print.rs | 1 -
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/ast/mod.rs b/src/ast/mod.rs
index d711a106..e18251ea 100644
--- a/src/ast/mod.rs
+++ b/src/ast/mod.rs
@@ -4858,7 +4858,9 @@ impl fmt::Display for Statement {
if matches!(options, CreateTableOptions::Options(_)) {
write!(f, " {options}")?;
}
- write!(f, " AS {query}")?;
+ f.write_str(" AS")?;
+ SpaceOrNewline.fmt(f)?;
+ query.fmt(f)?;
if *with_no_schema_binding {
write!(f, " WITH NO SCHEMA BINDING")?;
}
diff --git a/tests/pretty_print.rs b/tests/pretty_print.rs
index d6794218..e1d35eb0 100644
--- a/tests/pretty_print.rs
+++ b/tests/pretty_print.rs
@@ -264,7 +264,6 @@ CREATE TABLE my_table (
}
#[test]
-#[ignore = "https://github.com/apache/datafusion-sqlparser-rs/issues/1850"]
fn test_pretty_print_create_view() {
assert_eq!(
prettify("CREATE VIEW my_view AS SELECT a, b FROM my_table WHERE x >
0"),
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]