mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-29 18:34:04 +00:00
add SELECT INTO statement variation (#447)
Signed-off-by: Maciej Obuchowski <obuchowski.maciej@gmail.com>
This commit is contained in:
parent
b68e9a3801
commit
d38c30e9ff
7 changed files with 74 additions and 2 deletions
|
@ -380,6 +380,32 @@ fn parse_select_all_distinct() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_select_into() {
|
||||
let sql = "SELECT * INTO table0 FROM table1";
|
||||
one_statement_parses_to(sql, "SELECT * INTO table0 FROM table1");
|
||||
let select = verified_only_select(sql);
|
||||
assert_eq!(
|
||||
&SelectInto {
|
||||
temporary: false,
|
||||
unlogged: false,
|
||||
name: ObjectName(vec![Ident::new("table0")])
|
||||
},
|
||||
only(&select.into)
|
||||
);
|
||||
|
||||
let sql = "SELECT * INTO TEMPORARY UNLOGGED table0 FROM table1";
|
||||
one_statement_parses_to(sql, "SELECT * INTO TEMPORARY UNLOGGED table0 FROM table1");
|
||||
|
||||
// Do not allow aliases here
|
||||
let sql = "SELECT * INTO table0 asdf FROM table1";
|
||||
let result = parse_sql_statements(sql);
|
||||
assert_eq!(
|
||||
ParserError::ParserError("Expected end of statement, found: asdf".to_string()),
|
||||
result.unwrap_err()
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_select_wildcard() {
|
||||
let sql = "SELECT * FROM foo";
|
||||
|
@ -4235,6 +4261,7 @@ fn parse_merge() {
|
|||
distinct: false,
|
||||
top: None,
|
||||
projection: vec![SelectItem::Wildcard],
|
||||
into: None,
|
||||
from: vec![TableWithJoins {
|
||||
relation: TableFactor::Table {
|
||||
name: ObjectName(vec![Ident::new("s"), Ident::new("foo")]),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue