Don't silently accept naked OUTER JOINS

`SELECT * FROM a OUTER JOIN b` was previously being parsed as an inner
join where table `a` was aliased to `OUTER`. This is extremely
surprising, as the user likely intended to say FULL OUTER JOIN. Since
the SQL specification lists OUTER as a keyword, we are well within our
rights to return an error here.
This commit is contained in:
Nikhil Benesch 2019-06-17 17:12:13 -04:00
parent 7857543749
commit 2c99635709
No known key found for this signature in database
GPG key ID: FCF98542083C5A69
3 changed files with 13 additions and 1 deletions

View file

@ -1801,6 +1801,12 @@ fn parse_join_syntax_variants() {
"SELECT c1 FROM t1 FULL OUTER JOIN t2 USING(c1)",
"SELECT c1 FROM t1 FULL JOIN t2 USING(c1)",
);
let res = parse_sql_statements("SELECT * FROM a OUTER JOIN b ON 1");
assert_eq!(
ParserError::ParserError("Expected LEFT, RIGHT, or FULL, found: OUTER".to_string()),
res.unwrap_err()
);
}
#[test]