Skip to content

Commit 3f4d5f9

Browse files
authored
pretty-print CREATE VIEW statements (#1855)
1 parent a496f78 commit 3f4d5f9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/ast/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4858,7 +4858,9 @@ impl fmt::Display for Statement {
48584858
if matches!(options, CreateTableOptions::Options(_)) {
48594859
write!(f, " {options}")?;
48604860
}
4861-
write!(f, " AS {query}")?;
4861+
f.write_str(" AS")?;
4862+
SpaceOrNewline.fmt(f)?;
4863+
query.fmt(f)?;
48624864
if *with_no_schema_binding {
48634865
write!(f, " WITH NO SCHEMA BINDING")?;
48644866
}

tests/pretty_print.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ CREATE TABLE my_table (
264264
}
265265

266266
#[test]
267-
#[ignore = "https://github.com/apache/datafusion-sqlparser-rs/issues/1850"]
268267
fn test_pretty_print_create_view() {
269268
assert_eq!(
270269
prettify("CREATE VIEW my_view AS SELECT a, b FROM my_table WHERE x > 0"),

0 commit comments

Comments
 (0)