提交 10757c6a authored 作者: Thomas Mueller's avatar Thomas Mueller

Remove support for function "version()" - issue 406 (due to compatibility problems with PostgreSQL)

上级 806e3797
...@@ -3821,14 +3821,6 @@ Returns the name of the current user of this session. ...@@ -3821,14 +3821,6 @@ Returns the name of the current user of this session.
CURRENT_USER() CURRENT_USER()
" "
"Functions (System)","VERSION","
VERSION()
","
Returns the H2 version as a String.
","
VERSION()
"
"System Tables","Information Schema"," "System Tables","Information Schema","
INFORMATION_SCHEMA INFORMATION_SCHEMA
"," ","
......
...@@ -34,7 +34,6 @@ Change Log ...@@ -34,7 +34,6 @@ Change Log
</li><li>MVStore: old data is now retained for 45 seconds by default. </li><li>MVStore: old data is now retained for 45 seconds by default.
</ul><li>MVStore: compress is now disabled by default, and can be enabled on request. </ul><li>MVStore: compress is now disabled by default, and can be enabled on request.
</ul><li>Support ALTER TABLE ADD ... AFTER. Patch from Andrew Gaul (argaul at gmail.com). Fixes issue 401. </ul><li>Support ALTER TABLE ADD ... AFTER. Patch from Andrew Gaul (argaul at gmail.com). Fixes issue 401.
</ul><li>support "SELECT version()". Patch from Andrew Gaul. Fixes issue 406.
</ul><li>Improved OSGi support. H2 now registers itself as a DataSourceFactory service. Fixes issue 365. </ul><li>Improved OSGi support. H2 now registers itself as a DataSourceFactory service. Fixes issue 365.
</ul><li>Add a DISK_SPACE_USED system function. Fixes issue 270. </ul><li>Add a DISK_SPACE_USED system function. Fixes issue 270.
</li></ul> </li></ul>
......
...@@ -26,7 +26,6 @@ import java.util.regex.PatternSyntaxException; ...@@ -26,7 +26,6 @@ import java.util.regex.PatternSyntaxException;
import org.h2.command.Command; import org.h2.command.Command;
import org.h2.command.Parser; import org.h2.command.Parser;
import org.h2.constant.ErrorCode; import org.h2.constant.ErrorCode;
import org.h2.engine.Constants;
import org.h2.engine.Database; import org.h2.engine.Database;
import org.h2.engine.Mode; import org.h2.engine.Mode;
import org.h2.engine.Session; import org.h2.engine.Session;
...@@ -99,8 +98,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -99,8 +98,7 @@ public class Function extends Expression implements FunctionCall {
CASE = 206, NEXTVAL = 207, CURRVAL = 208, ARRAY_GET = 209, CSVREAD = 210, CSVWRITE = 211, CASE = 206, NEXTVAL = 207, CURRVAL = 208, ARRAY_GET = 209, CSVREAD = 210, CSVWRITE = 211,
MEMORY_FREE = 212, MEMORY_USED = 213, LOCK_MODE = 214, SCHEMA = 215, SESSION_ID = 216, ARRAY_LENGTH = 217, MEMORY_FREE = 212, MEMORY_USED = 213, LOCK_MODE = 214, SCHEMA = 215, SESSION_ID = 216, ARRAY_LENGTH = 217,
LINK_SCHEMA = 218, GREATEST = 219, LEAST = 220, CANCEL_SESSION = 221, SET = 222, TABLE = 223, TABLE_DISTINCT = 224, LINK_SCHEMA = 218, GREATEST = 219, LEAST = 220, CANCEL_SESSION = 221, SET = 222, TABLE = 223, TABLE_DISTINCT = 224,
FILE_READ = 225, TRANSACTION_ID = 226, TRUNCATE_VALUE = 227, NVL2 = 228, DECODE = 229, ARRAY_CONTAINS = 230, FILE_READ = 225, TRANSACTION_ID = 226, TRUNCATE_VALUE = 227, NVL2 = 228, DECODE = 229, ARRAY_CONTAINS = 230;
VERSION = 231;
public static final int ROW_NUMBER = 300; public static final int ROW_NUMBER = 300;
...@@ -346,7 +344,6 @@ public class Function extends Expression implements FunctionCall { ...@@ -346,7 +344,6 @@ public class Function extends Expression implements FunctionCall {
addFunction("FILE_READ", FILE_READ, VAR_ARGS, Value.NULL, false, false, false); addFunction("FILE_READ", FILE_READ, VAR_ARGS, Value.NULL, false, false, false);
addFunctionNotDeterministic("TRANSACTION_ID", TRANSACTION_ID, 0, Value.STRING); addFunctionNotDeterministic("TRANSACTION_ID", TRANSACTION_ID, 0, Value.STRING);
addFunctionWithNull("DECODE", DECODE, VAR_ARGS, Value.NULL); addFunctionWithNull("DECODE", DECODE, VAR_ARGS, Value.NULL);
addFunction("VERSION", VERSION, 0, Value.STRING);
addFunctionNotDeterministic("DISK_SPACE_USED", DISK_SPACE_USED, 1, Value.LONG); addFunctionNotDeterministic("DISK_SPACE_USED", DISK_SPACE_USED, 1, Value.LONG);
// TableFunction // TableFunction
...@@ -1129,10 +1126,6 @@ public class Function extends Expression implements FunctionCall { ...@@ -1129,10 +1126,6 @@ public class Function extends Expression implements FunctionCall {
case LPAD: case LPAD:
result = ValueString.get(StringUtils.pad(v0.getString(), v1.getInt(), v2 == null ? null : v2.getString(), false)); result = ValueString.get(StringUtils.pad(v0.getString(), v1.getInt(), v2 == null ? null : v2.getString(), false));
break; break;
case VERSION:
result = ValueString.get(Constants.getVersion());
break;
// date
case DATE_ADD: case DATE_ADD:
result = ValueTimestamp.get(dateadd(v0.getString(), v1.getInt(), v2.getTimestamp())); result = ValueTimestamp.get(dateadd(v0.getString(), v1.getInt(), v2.getTimestamp()));
break; break;
......
...@@ -29,7 +29,6 @@ import java.util.Properties; ...@@ -29,7 +29,6 @@ import java.util.Properties;
import java.util.UUID; import java.util.UUID;
import org.h2.api.AggregateFunction; import org.h2.api.AggregateFunction;
import org.h2.constant.ErrorCode; import org.h2.constant.ErrorCode;
import org.h2.engine.Constants;
import org.h2.store.fs.FileUtils; import org.h2.store.fs.FileUtils;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.tools.SimpleResultSet; import org.h2.tools.SimpleResultSet;
...@@ -55,7 +54,6 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -55,7 +54,6 @@ public class TestFunctions extends TestBase implements AggregateFunction {
public void test() throws Exception { public void test() throws Exception {
deleteDb("functions"); deleteDb("functions");
testVersion();
testFunctionTable(); testFunctionTable();
testArrayParameters(); testArrayParameters();
testDefaultConnection(); testDefaultConnection();
...@@ -81,20 +79,6 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -81,20 +79,6 @@ public class TestFunctions extends TestBase implements AggregateFunction {
FileUtils.deleteRecursive(TEMP_DIR, true); FileUtils.deleteRecursive(TEMP_DIR, true);
} }
private void testVersion() throws SQLException {
Connection conn = getConnection("functions");
Statement stat = conn.createStatement();
String query = "select version()";
ResultSet rs = stat.executeQuery(query);
assertTrue(rs.next());
String version = rs.getString(1);
assertEquals(Constants.getVersion(), version);
assertFalse(rs.next());
rs.close();
stat.close();
conn.close();
}
private void testFunctionTable() throws SQLException { private void testFunctionTable() throws SQLException {
Connection conn = getConnection("functions"); Connection conn = getConnection("functions");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论