提交 88f5caea authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 d103edc1
...@@ -16,7 +16,8 @@ Change Log ...@@ -16,7 +16,8 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>The build target 'build jarSmall' now includes the embedded database. <ul><li>The H2 Console replaced an empty user name with a single space.
</li><li>The build target 'build jarSmall' now includes the embedded database.
</li><li>JdbcDataSource now keeps the password in a char array where possible. </li><li>JdbcDataSource now keeps the password in a char array where possible.
</li><li>ResultSet.absolute did not always work with large result sets. </li><li>ResultSet.absolute did not always work with large result sets.
</li><li>Column aliases can now be used in GROUP BY and HAVING. </li><li>Column aliases can now be used in GROUP BY and HAVING.
......
...@@ -11,6 +11,7 @@ import java.util.HashMap; ...@@ -11,6 +11,7 @@ import java.util.HashMap;
import org.h2.command.Parser; import org.h2.command.Parser;
import org.h2.command.dml.Select; import org.h2.command.dml.Select;
import org.h2.command.dml.SelectListColumnResolver;
import org.h2.constant.ErrorCode; import org.h2.constant.ErrorCode;
import org.h2.engine.Database; import org.h2.engine.Database;
import org.h2.engine.Session; import org.h2.engine.Session;
...@@ -101,9 +102,13 @@ public class ExpressionColumn extends Expression { ...@@ -101,9 +102,13 @@ public class ExpressionColumn extends Expression {
column = col; column = col;
this.resolver = resolver; this.resolver = resolver;
} else if (queryLevel == level && this.resolver != resolver) { } else if (queryLevel == level && this.resolver != resolver) {
if (resolver instanceof SelectListColumnResolver) {
// ignore - already mapped, that's ok
} else {
throw Message.getSQLException(ErrorCode.AMBIGUOUS_COLUMN_NAME_1, columnName); throw Message.getSQLException(ErrorCode.AMBIGUOUS_COLUMN_NAME_1, columnName);
} }
} }
}
public Expression optimize(Session session) throws SQLException { public Expression optimize(Session session) throws SQLException {
if (resolver == null) { if (resolver == null) {
......
SELECT X FROM dual GROUP BY X HAVING X=AVG(X);
> 1;
create view test_view(id,) as select * from dual; create view test_view(id,) as select * from dual;
drop view test_view; drop view test_view;
create table test(id int,); create table test(id int,);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论