Skip to content

Commit 81d8909

Browse files
killertuxiffyio
andauthored
Fix STRAIGHT_JOIN constraint when table alias is absent (#1812)
Co-authored-by: Ifeanyi Ubah <[email protected]>
1 parent 3ad13af commit 81d8909

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/dialect/mysql.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ use crate::{
2727

2828
use super::keywords;
2929

30-
const RESERVED_FOR_TABLE_ALIAS_MYSQL: &[Keyword] = &[Keyword::USE, Keyword::IGNORE, Keyword::FORCE];
30+
const RESERVED_FOR_TABLE_ALIAS_MYSQL: &[Keyword] = &[
31+
Keyword::USE,
32+
Keyword::IGNORE,
33+
Keyword::FORCE,
34+
Keyword::STRAIGHT_JOIN,
35+
];
3136

3237
/// A [`Dialect`] for [MySQL](https://www.mysql.com/)
3338
#[derive(Debug)]

tests/sqlparser_mysql.rs

+3
Original file line numberDiff line numberDiff line change
@@ -3715,4 +3715,7 @@ fn parse_straight_join() {
37153715
mysql().verified_stmt(
37163716
"SELECT a.*, b.* FROM table_a AS a STRAIGHT_JOIN table_b AS b ON a.b_id = b.id",
37173717
);
3718+
// Without table alias
3719+
mysql()
3720+
.verified_stmt("SELECT a.*, b.* FROM table_a STRAIGHT_JOIN table_b AS b ON a.b_id = b.id");
37183721
}

0 commit comments

Comments
 (0)