dynamobi/dynamobi — Issue #755: [FRG-115] having clause with between not working
Author: dynamobi-build
Created: 2011-12-30 03:47:08+00:00
State: open
Labels: FRG, Sql2Rel

[reporter="elin", created="Fri, 28 Apr 2006 14:41:02 -0500 (GMT-05:00)"]
To reproduce:

create table t1(cola int primary key, colb int);

insert into t1 values (1,1),(2,2),(3,3);

-- this errors

select colb from t1 group by colb having colb between 1 and 3;

-- this works fine

select colb from t1 group by colb having colb > 1 and colb < 3;

Here's the stack trace:Error: From line 1, column 42 to line 1, column 45: Unknown identifier 'COLB' (state=,code=0)

net.sf.farrago.jdbc.FarragoJdbcUtil$FarragoSqlException: From line 1, column 42 to line 1, column 45: Unknown identifier 'COLB'

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

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:2557)

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

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

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

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

at org.eigenbase.sql.validate.SqlValidatorImpl.validateHavingClause(SqlValidatorImpl.java:2157)

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

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:483)

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

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

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

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

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

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

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

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

at net.sf.farrago.db.FarragoDbSession.prepare(FarragoDbSession.java:784)at net.sf.farrago.db.FarragoDbStmtContext.prepare(FarragoDbStmtContext.java:108)

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

at sqlline.SqlLine$Commands.execute(Unknown Source)

at sqlline.SqlLine$Commands.sql(Unknown Source)

at sqlline.SqlLine.dispatch(Unknown Source)

at sqlline.SqlLine.begin(Unknown Source)

at sqlline.SqlLine.mainWithInputRedirection(Unknown Source)

at sqlline.SqlLine.main(Unknown Source)

0: jdbc:farrago:>