You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by gi...@apache.org on 2026/06/05 09:06:41 UTC
(datafusion-sqlparser-rs) 01/01: Fix issue #2353: Incorrect canonicalization of `NATURAL JOIN` (#2355)
This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-2355-575ee264dffa3c5039dc3d15abd903fd420eba2b
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git
commit d0c081ea2dea327031ad31300cd0791a3b87a667
Author: revitalkr <10...@users.noreply.github.com>
AuthorDate: Fri Jun 5 12:06:16 2026 +0300
Fix issue #2353: Incorrect canonicalization of `NATURAL JOIN` (#2355)
---
src/parser/mod.rs | 1 +
tests/sqlparser_common.rs | 12 +-----------
2 files changed, 2 insertions(+), 11 deletions(-)
diff --git a/src/parser/mod.rs b/src/parser/mod.rs
index e0c2dc26..d7dd2803 100644
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -15994,6 +15994,7 @@ impl<'a> Parser<'a> {
if !self
.dialect
.supports_left_associative_joins_without_parens()
+ && !natural
&& self.peek_parens_less_nested_join()
{
let joins = self.parse_joins()?;
diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
index d12b6a44..62701642 100644
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -17443,8 +17443,7 @@ fn column_check_enforced() {
#[test]
fn join_precedence() {
- all_dialects_except(|d| !d.supports_left_associative_joins_without_parens())
- .verified_query_with_canonical(
+ all_dialects().verified_query_with_canonical(
"SELECT *
FROM t1
NATURAL JOIN t5
@@ -17453,15 +17452,6 @@ fn join_precedence() {
// canonical string without parentheses
"SELECT * FROM t1 NATURAL JOIN t5 INNER JOIN t0 ON (t0.v1 + t5.v0) > 0 WHERE t0.v1 = t1.v0",
);
- all_dialects_except(|d| d.supports_left_associative_joins_without_parens()).verified_query_with_canonical(
- "SELECT *
- FROM t1
- NATURAL JOIN t5
- INNER JOIN t0 ON (t0.v1 + t5.v0) > 0
- WHERE t0.v1 = t1.v0",
- // canonical string with parentheses
- "SELECT * FROM t1 NATURAL JOIN (t5 INNER JOIN t0 ON (t0.v1 + t5.v0) > 0) WHERE t0.v1 = t1.v0",
- );
}
#[test]
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org