Skip to content

Commit 0272c5f

Browse files
yoavcloudayman-sigma
authored andcommitted
Do not parse ASOF and MATCH_CONDITION as table factor aliases (apache#1698)
1 parent 376a46d commit 0272c5f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/keywords.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,8 @@ pub const RESERVED_FOR_TABLE_ALIAS: &[Keyword] = &[
10001000
Keyword::ANTI,
10011001
Keyword::SEMI,
10021002
Keyword::RETURNING,
1003+
Keyword::ASOF,
1004+
Keyword::MATCH_CONDITION,
10031005
// for MSSQL-specific OUTER APPLY (seems reserved in most dialects)
10041006
Keyword::OUTER,
10051007
Keyword::SET,

tests/sqlparser_snowflake.rs

+14
Original file line numberDiff line numberDiff line change
@@ -2738,6 +2738,20 @@ fn asof_joins() {
27382738
"ON s.state = p.state ",
27392739
"ORDER BY s.observed",
27402740
));
2741+
2742+
// Test without explicit aliases
2743+
#[rustfmt::skip]
2744+
snowflake_and_generic().verified_query(concat!(
2745+
"SELECT * ",
2746+
"FROM snowtime ",
2747+
"ASOF JOIN raintime ",
2748+
"MATCH_CONDITION (snowtime.observed >= raintime.observed) ",
2749+
"ON snowtime.state = raintime.state ",
2750+
"ASOF JOIN preciptime ",
2751+
"MATCH_CONDITION (showtime.observed >= preciptime.observed) ",
2752+
"ON showtime.state = preciptime.state ",
2753+
"ORDER BY showtime.observed",
2754+
));
27412755
}
27422756

27432757
#[test]

0 commit comments

Comments
 (0)