Do not parse ASOF and MATCH_CONDITION as table factor aliases (#1698)

This commit is contained in:
Yoav Cohen 2025-02-01 13:42:38 +01:00 committed by GitHub
parent 447142c6d0
commit c3256a80d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 0 deletions

View file

@ -1000,6 +1000,8 @@ pub const RESERVED_FOR_TABLE_ALIAS: &[Keyword] = &[
Keyword::ANTI,
Keyword::SEMI,
Keyword::RETURNING,
Keyword::ASOF,
Keyword::MATCH_CONDITION,
// for MSSQL-specific OUTER APPLY (seems reserved in most dialects)
Keyword::OUTER,
Keyword::SET,

View file

@ -2731,6 +2731,20 @@ fn asof_joins() {
"ON s.state = p.state ",
"ORDER BY s.observed",
));
// Test without explicit aliases
#[rustfmt::skip]
snowflake_and_generic().verified_query(concat!(
"SELECT * ",
"FROM snowtime ",
"ASOF JOIN raintime ",
"MATCH_CONDITION (snowtime.observed >= raintime.observed) ",
"ON snowtime.state = raintime.state ",
"ASOF JOIN preciptime ",
"MATCH_CONDITION (showtime.observed >= preciptime.observed) ",
"ON showtime.state = preciptime.state ",
"ORDER BY showtime.observed",
));
}
#[test]