提交 efd4de99 authored 作者: Noel Grandin's avatar Noel Grandin

Issue #650: Simple nested SELECT causes error for table with TIMESTAMP WITH TIMEZONE column

上级 afdb83ee
......@@ -21,6 +21,8 @@ Change Log
<h2>Next Version (unreleased)</h2>
<ul>
<li>Issue #650: Simple nested SELECT causes error for table with TIMESTAMP WITH TIMEZONE column
</li>
<li>Issue #654: List ENUM type values in INFORMATION_SCHEMA.COLUMNS
</li>
<li>Issue #668: Fail of an update command on large table with ENUM column
......
......@@ -162,6 +162,7 @@ import org.h2.value.ValueNull;
import org.h2.value.ValueString;
import org.h2.value.ValueTime;
import org.h2.value.ValueTimestamp;
import org.h2.value.ValueTimestampTimeZone;
/**
* The parser is used to convert a SQL statement string to an command object.
......@@ -3128,6 +3129,17 @@ public class Parser {
read("FOR");
Sequence sequence = readSequence();
r = new SequenceValue(sequence);
} else if (equalsToken("TIMESTAMP", name) && readIf("WITH")) {
read("TIME");
read("ZONE");
if (currentTokenType != VALUE
|| currentValue.getType() != Value.STRING) {
throw getSyntaxError();
}
String timestamp = currentValue.getString();
read();
r = ValueExpression
.get(ValueTimestampTimeZone.parse(timestamp));
} else if (currentTokenType == VALUE &&
currentValue.getType() == Value.STRING) {
if (equalsToken("DATE", name) ||
......
......@@ -2,3 +2,15 @@
-- and the EPL 1.0 (http://h2database.com/html/license.html).
-- Initial Developer: H2 Group
--
CREATE TABLE tab_with_timezone(x TIMESTAMP WITH TIME ZONE);
> ok
INSERT INTO tab_with_timezone(x) VALUES ('2017-01-01');
> update count: 1
SELECT "Query".* FROM (select * from tab_with_timezone where x > '2016-01-01') AS "Query";
> X
> ------------------------
> 2017-01-01 00:00:00.0+00
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论