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

--no commit message

--no commit message
上级 d103edc1
......@@ -16,7 +16,8 @@ Change Log
<h1>Change Log</h1>
<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>ResultSet.absolute did not always work with large result sets.
</li><li>Column aliases can now be used in GROUP BY and HAVING.
......
......@@ -11,6 +11,7 @@ import java.util.HashMap;
import org.h2.command.Parser;
import org.h2.command.dml.Select;
import org.h2.command.dml.SelectListColumnResolver;
import org.h2.constant.ErrorCode;
import org.h2.engine.Database;
import org.h2.engine.Session;
......@@ -101,7 +102,11 @@ public class ExpressionColumn extends Expression {
column = col;
this.resolver = resolver;
} else if (queryLevel == level && this.resolver != resolver) {
throw Message.getSQLException(ErrorCode.AMBIGUOUS_COLUMN_NAME_1, columnName);
if (resolver instanceof SelectListColumnResolver) {
// ignore - already mapped, that's ok
} else {
throw Message.getSQLException(ErrorCode.AMBIGUOUS_COLUMN_NAME_1, columnName);
}
}
}
......
......@@ -107,7 +107,7 @@ public class Function extends Expression implements FunctionCall {
private static final char[] SOUNDEX_INDEX = new char[128];
protected Expression[] args;
private FunctionInfo info;
private ObjectArray varArgs;
private int dataType, scale;
......@@ -192,7 +192,7 @@ public class Function extends Expression implements FunctionCall {
addFunction("CHR", CHAR, 1, Value.STRING);
addFunction("CHAR_LENGTH", CHAR_LENGTH, 1, Value.INT);
// same as CHAR_LENGTH
addFunction("CHARACTER_LENGTH", CHAR_LENGTH, 1, Value.INT);
addFunction("CHARACTER_LENGTH", CHAR_LENGTH, 1, Value.INT);
addFunctionWithNull("CONCAT", CONCAT, VAR_ARGS, Value.STRING);
addFunction("DIFFERENCE", DIFFERENCE, 2, Value.INT);
addFunction("HEXTORAW", HEXTORAW, 1, Value.STRING);
......@@ -201,9 +201,9 @@ public class Function extends Expression implements FunctionCall {
addFunction("LEFT", LEFT, 2, Value.STRING);
addFunction("LENGTH", LENGTH, 1, Value.INT);
// 2 or 3 arguments
addFunction("LOCATE", LOCATE, VAR_ARGS, Value.INT);
addFunction("LOCATE", LOCATE, VAR_ARGS, Value.INT);
// same as LOCATE with 2 arguments
addFunction("POSITION", LOCATE, 2, Value.INT);
addFunction("POSITION", LOCATE, 2, Value.INT);
addFunction("INSTR", INSTR, VAR_ARGS, Value.INT);
addFunction("LTRIM", LTRIM, VAR_ARGS, Value.STRING);
addFunction("OCTET_LENGTH", OCTET_LENGTH, 1, Value.INT);
......@@ -301,7 +301,7 @@ public class Function extends Expression implements FunctionCall {
addFunctionWithNull("TABLE", TABLE, VAR_ARGS, Value.RESULT_SET);
addFunctionWithNull("TABLE_DISTINCT", TABLE_DISTINCT, VAR_ARGS, Value.RESULT_SET);
}
protected Function(Database database, FunctionInfo info) {
this.database = database;
this.info = info;
......@@ -339,7 +339,7 @@ public class Function extends Expression implements FunctionCall {
/**
* Get the function info object for this function, or null if there is no
* such function.
*
*
* @param name the function name
* @return the function info
*/
......@@ -350,7 +350,7 @@ public class Function extends Expression implements FunctionCall {
/**
* Get an instance of the given function for this database.
* If no function with this name is found, null is returned.
*
*
* @param database the database
* @param name the function name
* @return the function object or null
......@@ -371,7 +371,7 @@ public class Function extends Expression implements FunctionCall {
/**
* Set the parameter expression at the given index.
*
*
* @param index the index (0, 1,...)
* @param param the expression
*/
......@@ -1453,7 +1453,7 @@ public class Function extends Expression implements FunctionCall {
/**
* Check if the parameter count is correct.
*
*
* @param len the number of parameters set
* @throws SQLException if the parameter count is incorrect
*/
......@@ -1542,7 +1542,7 @@ public class Function extends Expression implements FunctionCall {
/**
* Set the result data type of this function.
*
*
* @param dataType the data type
* @param precision the precision
* @param scale the scale
......@@ -1653,7 +1653,7 @@ public class Function extends Expression implements FunctionCall {
case SUBSTR: {
precision = args[0].getPrecision();
if (args[1].isConstant()) {
// if only two arguments are used,
// if only two arguments are used,
// subtract offset from first argument length
precision -= args[1].getValue(session).getLong() - 1;
}
......@@ -1758,7 +1758,7 @@ public class Function extends Expression implements FunctionCall {
case DAYNAME:
case MONTHNAME:
// day and month names may be long in some languages
precision = 20;
precision = 20;
displaySize = (int) precision;
break;
default:
......
SELECT X FROM dual GROUP BY X HAVING X=AVG(X);
> 1;
create view test_view(id,) as select * from dual;
drop view test_view;
create table test(id int,);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论