You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Yu Xu (Jira)" <ji...@apache.org> on 2026/08/04 07:16:00 UTC
[jira] [Assigned] (CALCITE-7229) Support PostgreSQL ROW constructor alias reference from LATERAL subquery
[ https://issues.apache.org/jira/browse/CALCITE-7229?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Yu Xu reassigned CALCITE-7229:
------------------------------
Assignee: Yu Xu
> Support PostgreSQL ROW constructor alias reference from LATERAL subquery
> ------------------------------------------------------------------------
>
> Key: CALCITE-7229
> URL: https://issues.apache.org/jira/browse/CALCITE-7229
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: Zhengqiang Duan
> Assignee: Yu Xu
> Priority: Major
>
> In https://github.com/apache/calcite/pull/4553, @dssysolyatin provided a SQL example of a constructor alias reference in PostgreSQL.
> {code:java}
> SELECT e.empno,r.r
> FROM emp AS e, LATERAL (SELECT ROW(e.empno, e.ename) AS r) AS r
> WHERE ROW(e.empno, e.ename) IN (
> r.r,
> ROW(?, ?)
> ); {code}
> I did some testing and found that this SQL statement cannot be executed in Calcite. The following is the execution error:
> {code:java}
> java.lang.AssertionError at org.apache.calcite.sql.validate.implicit.TypeCoercionImpl.inOperationCoercion(TypeCoercionImpl.java:571) at org.apache.calcite.sql.fun.SqlInOperator.deriveType(SqlInOperator.java:156) at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:7094) at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:7081) at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:175) at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1998) at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveType(SqlValidatorImpl.java:1985) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateWhereOrOn(SqlValidatorImpl.java:5068) {code}
> Calcite should support reference ROW constructor alias from LATERAL subquery to improve support for PostgreSQL.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)