dynamobi/dynamobi — Issue #820: [FRG-50] cannot use a subquery output as part of a comparison
Author: dynamobi-build
Created: 2011-12-30 03:50:44+00:00
State: open
Labels: FRG, Statement Processing

[reporter="schoi", created="Sun, 19 Feb 2006 23:55:07 -0500 (GMT-05:00)"]
Repro:

----------

create schema s;

set schema 's';

create table t1(i integer primary key);

insert into t1 values(1);

values(10 < (select count(*) from t1));

Error:

---------

Error: From line 1, column 8 to line 1, column 37: Cannot apply '<' to arguments of type ' < '. Supported form(s): ' < ' (state=,code=0)

net.sf.farrago.util.FarragoUtil$FarragoSqlException: From line 1, column 8 to line 1, column 37: Cannot apply '<' to arguments of type ' < '. Supported form(s): ' < '

at org.eigenbase.resource.EigenbaseResource$_Def10.ex(EigenbaseResource.java:718)

at org.eigenbase.sql.SqlUtil.newContextException(SqlUtil.java:684)

at org.eigenbase.sql.SqlUtil.newContextException(SqlUtil.java:671)

at org.eigenbase.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:2450)

at org.eigenbase.sql.SqlCallBinding.newValidationSignatureError(SqlCallBinding.java:133)

at org.eigenbase.sql.type.ComparableOperandTypeChecker.checkOperandTypes(ComparableOperandTypeChecker.java:68)

at org.eigenbase.sql.SqlOperator.checkOperandTypes(SqlOperator.java:487)

at org.eigenbase.sql.SqlOperator.validateOperands(SqlOperator.java:412)

at org.eigenbase.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1033)

at org.eigenbase.sql.validate.SqlValidatorImpl.deriveType(SqlValidatorImpl.java:798)

at org.eigenbase.sql.SqlNode.validateExpr(SqlNode.java:243)

at org.eigenbase.sql.SqlOperator.validateCall(SqlOperator.java:382)

at org.eigenbase.sql.validate.SqlValidatorImpl.validateCall(SqlValidatorImpl.java:2666)

at org.eigenbase.sql.SqlCall.validate(SqlCall.java:131)

at org.eigenbase.sql.validate.SqlValidatorImpl.validateValues(SqlValidatorImpl.java:2361)

at org.eigenbase.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:1827)

at org.eigenbase.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:1824)

at org.eigenbase.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:1978)

at org.eigenbase.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:54)

at org.eigenbase.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:76)

at org.eigenbase.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:480)

at org.eigenbase.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:471)

at org.eigenbase.sql.SqlSelect.validate(SqlSelect.java:153)

at org.eigenbase.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:448)

at org.eigenbase.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:273)

at net.sf.farrago.query.FarragoSqlValidator.validate(FarragoSqlValidator.java:62)

at net.sf.farrago.db.FarragoDatabase.prepareStmtImpl(FarragoDatabase.java:594)

at net.sf.farrago.db.FarragoDatabase.prepareStmt(FarragoDatabase.java:530)

at net.sf.farrago.db.FarragoDbSession.prepareImpl(FarragoDbSession.java:769)

at net.sf.farrago.db.FarragoDbSession.prepare(FarragoDbSession.java:720)

at net.sf.farrago.db.FarragoDbStmtContext.prepare(FarragoDbStmtContext.java:154)

at net.sf.farrago.jdbc.engine.FarragoJdbcEngineStatement.execute(FarragoJdbcEngineStatement.java:104)

-----

note, oracle and sqlserver can both execute something like:

select * from t1 group by i having (10 < (select sum(i) from t1));