[ 
https://issues.apache.org/jira/browse/IGNITE-22307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Maksim Zhuravkov updated IGNITE-22307:
--------------------------------------
    Description: 
Query:
{noformat}
statement ok
CREATE TABLE t3 (a INTEGER, b INTEGER, c INTEGER)

statement ok
CREATE TABLE t2 (a INTEGER, c INTEGER)

query III
SELECT a, b, c FROM t3 NATURAL JOIN t2
----
1 2 3
# Error: Column 'A' is ambiguous
{noformat}

Result of a natural join between t2 and t3 consists of:
* common columns (columns used in a join condition)
* columns from t3 (excluding common columns)
* columns from t2 (excluding common columns)

{noformat}
# a, b - common columns
# c - column from t3
# there are no columns from t2
a, b, c
{noformat}

So column "a" must not be ambiguous because it relation t3 NATURAL JOIN t2 
refers column "a" only once.


  was:
Query:
{noformat}
statement ok
CREATE TABLE t3 (a INTEGER, b INTEGER, c INTEGER)

statement ok
CREATE TABLE t2 (a INTEGER, c INTEGER)

query III
SELECT a, b, c FROM t3 NATURAL JOIN t2
----
1 2 3
# Error: Column 'A' is ambiguous
{noformat}

Result of a natural join between t2 and t3 consists of:
* common columns (columns used in join condition)
* columns from t3 (excluding common columns)
* columns from t2 (excluding common columns)

{noformat}
# a, b - common columns
# c - column from t3
# there are no columns from t2
a, b, c
{noformat}

So column "a" must not be ambiguous because it relation t3 NATURAL JOIN t2 
refers column "a" only once.



> Sql. NATURAL JOIN. Common column name is ambiguous.
> ---------------------------------------------------
>
>                 Key: IGNITE-22307
>                 URL: https://issues.apache.org/jira/browse/IGNITE-22307
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Maksim Zhuravkov
>            Priority: Minor
>              Labels: ignite-3
>
> Query:
> {noformat}
> statement ok
> CREATE TABLE t3 (a INTEGER, b INTEGER, c INTEGER)
> statement ok
> CREATE TABLE t2 (a INTEGER, c INTEGER)
> query III
> SELECT a, b, c FROM t3 NATURAL JOIN t2
> ----
> 1 2 3
> # Error: Column 'A' is ambiguous
> {noformat}
> Result of a natural join between t2 and t3 consists of:
> * common columns (columns used in a join condition)
> * columns from t3 (excluding common columns)
> * columns from t2 (excluding common columns)
> {noformat}
> # a, b - common columns
> # c - column from t3
> # there are no columns from t2
> a, b, c
> {noformat}
> So column "a" must not be ambiguous because it relation t3 NATURAL JOIN t2 
> refers column "a" only once.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to