Fix STRAIGHT_JOIN constraint when table alias is absent (#1812)

Co-authored-by: Ifeanyi Ubah <ify1992@yahoo.com>
This commit is contained in:
Bruno Clemente 2025-04-15 14:05:20 -03:00 committed by GitHub
parent 3ad13af563
commit 81d8909e00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View file

@ -27,7 +27,12 @@ use crate::{
use super::keywords;
const RESERVED_FOR_TABLE_ALIAS_MYSQL: &[Keyword] = &[Keyword::USE, Keyword::IGNORE, Keyword::FORCE];
const RESERVED_FOR_TABLE_ALIAS_MYSQL: &[Keyword] = &[
Keyword::USE,
Keyword::IGNORE,
Keyword::FORCE,
Keyword::STRAIGHT_JOIN,
];
/// A [`Dialect`] for [MySQL](https://www.mysql.com/)
#[derive(Debug)]

View file

@ -3715,4 +3715,7 @@ fn parse_straight_join() {
mysql().verified_stmt(
"SELECT a.*, b.* FROM table_a AS a STRAIGHT_JOIN table_b AS b ON a.b_id = b.id",
);
// Without table alias
mysql()
.verified_stmt("SELECT a.*, b.* FROM table_a STRAIGHT_JOIN table_b AS b ON a.b_id = b.id");
}