You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "libopeng (Jira)" <ji...@apache.org> on 2023/03/14 14:13:00 UTC
[jira] [Created] (CALCITE-5583) Rel2Sql will get an error when select * and join is present
libopeng created CALCITE-5583:
---------------------------------
Summary: Rel2Sql will get an error when select * and join is present
Key: CALCITE-5583
URL: https://issues.apache.org/jira/browse/CALCITE-5583
Project: Calcite
Issue Type: Bug
Reporter: libopeng
Rel2Sql will get an error when select * and join is present
{code:java}
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(c0=[$0])
LogicalTableScan(table=[[scott, EMP]])
LogicalProject(c0=[$0])
LogicalTableScan(table=[[scott, EMP]]) {code}
to sql
{code:java}
SELECT *
FROM (SELECT "EMPNO" AS "c0"
FROM "scott"."EMP") AS "t"
INNER JOIN (SELECT "EMPNO" AS "c0"
FROM "scott"."EMP") AS "t0" ON "t"."c0" = "t0"."c0" {code}
When this sql is a subquery, it can be wrong
{code:java}
select *
from "EMPNO" t1
left join (
SELECT * FROM (SELECT "EMPNO" AS "c0" FROM "scott"."EMP") AS "t" INNER JOIN (SELECT "EMPNO" AS "c0" FROM "scott"."EMP") AS "t0" ON "t"."c0" = "t0"."c0"
) t2
on t1.EMPNO=t2."c0"{code}
{color:#FF0000}fault: 'column reference "c0" is ambiguous' error when executing in postgresql{color}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)