提交 4f50464a authored 作者: Noel Grandin's avatar Noel Grandin

#411: "TIMEZONE" should be "TIME ZONE" in type "TIMESTAMP WITH TIMEZONE"

上级 72f706f5
...@@ -2335,17 +2335,17 @@ Mapped to ""java.sql.Timestamp"" (""java.util.Date"" is also supported). ...@@ -2335,17 +2335,17 @@ Mapped to ""java.sql.Timestamp"" (""java.util.Date"" is also supported).
TIMESTAMP TIMESTAMP
" "
"Data Types","TIMESTAMP WITH TIMEZONE Type"," "Data Types","TIMESTAMP WITH TIME ZONE Type","
TIMESTAMP WITH TIMEZONE TIMESTAMP WITH TIME ZONE
"," ","
VERY MUCH STILL IN TESTING. VERY MUCH STILL IN TESTING.
The timestamp with timezone data type. The timestamp with time zone data type.
Stored internally as a BCD-encoded date, nano-seconds since midnight, and timezone offset in minutes. Stored internally as a BCD-encoded date, nano-seconds since midnight, and timezone offset in minutes.
Note that range queries on this datatype may do some weird stuff close to DST boundaries. Note that range queries on this datatype may do some weird stuff close to DST boundaries.
Mapped to ""org.h2.api.TimestampWithTimeZone"" Mapped to ""org.h2.api.TimestampWithTimeZone""
"," ","
TIMESTAMP WITH TIMEZONE TIMESTAMP WITH TIME ZONE
" "
"Data Types","BINARY Type"," "Data Types","BINARY Type","
......
...@@ -21,6 +21,8 @@ Change Log ...@@ -21,6 +21,8 @@ Change Log
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul> <ul>
<li>#411: "TIMEZONE" should be "TIME ZONE" in type "TIMESTAMP WITH TIMEZONE"
</li>
<li>#429: Tables not found : Fix some turkish locale bugs around uppercasing <li>#429: Tables not found : Fix some turkish locale bugs around uppercasing
</li> </li>
<li>Fixed bug in metadata locking, obscure combination of DDL and SELECT SEQUENCE.NEXTVAL required <li>Fixed bug in metadata locking, obscure combination of DDL and SELECT SEQUENCE.NEXTVAL required
......
...@@ -10271,7 +10271,7 @@ Issue 50: Oracle compatibility: support calling 0-parameters functions without p ...@@ -10271,7 +10271,7 @@ Issue 50: Oracle compatibility: support calling 0-parameters functions without p
MySQL, HSQLDB compatibility: support where 'a'=1 (not supported by Derby, PostgreSQL) MySQL, HSQLDB compatibility: support where 'a'=1 (not supported by Derby, PostgreSQL)
@roadmap_1272_li @roadmap_1272_li
Support a data type "timestamp with timezone" using java.util.Calendar. Support a data type "timestamp with time zone" using java.util.Calendar.
@roadmap_1273_li @roadmap_1273_li
Finer granularity for SLF4J trace - See http://code.google.com/p/h2database/issues/detail?id=62 Finer granularity for SLF4J trace - See http://code.google.com/p/h2database/issues/detail?id=62
......
...@@ -10271,7 +10271,7 @@ H2 コンソール アプリケーション ...@@ -10271,7 +10271,7 @@ H2 コンソール アプリケーション
#MySQL, HSQLDB compatibility: support where 'a'=1 (not supported by Derby, PostgreSQL) #MySQL, HSQLDB compatibility: support where 'a'=1 (not supported by Derby, PostgreSQL)
@roadmap_1272_li @roadmap_1272_li
#Support a data type "timestamp with timezone" using java.util.Calendar. #Support a data type "timestamp with time zone" using java.util.Calendar.
@roadmap_1273_li @roadmap_1273_li
#Finer granularity for SLF4J trace - See http://code.google.com/p/h2database/issues/detail?id=62 #Finer granularity for SLF4J trace - See http://code.google.com/p/h2database/issues/detail?id=62
......
...@@ -3422,7 +3422,7 @@ roadmap_1268_li=Javadoc search\: weight for titles should be higher ('random' sh ...@@ -3422,7 +3422,7 @@ roadmap_1268_li=Javadoc search\: weight for titles should be higher ('random' sh
roadmap_1269_li=Replace information_schema tables with regular tables that are automatically re-built when needed. Use indexes. roadmap_1269_li=Replace information_schema tables with regular tables that are automatically re-built when needed. Use indexes.
roadmap_1270_li=Issue 50\: Oracle compatibility\: support calling 0-parameters functions without parenthesis. Make constants obsolete. roadmap_1270_li=Issue 50\: Oracle compatibility\: support calling 0-parameters functions without parenthesis. Make constants obsolete.
roadmap_1271_li=MySQL, HSQLDB compatibility\: support where 'a'\=1 (not supported by Derby, PostgreSQL) roadmap_1271_li=MySQL, HSQLDB compatibility\: support where 'a'\=1 (not supported by Derby, PostgreSQL)
roadmap_1272_li=Support a data type "timestamp with timezone" using java.util.Calendar. roadmap_1272_li=Support a data type "timestamp with time zone" using java.util.Calendar.
roadmap_1273_li=Finer granularity for SLF4J trace - See http\://code.google.com/p/h2database/issues/detail?id\=62 roadmap_1273_li=Finer granularity for SLF4J trace - See http\://code.google.com/p/h2database/issues/detail?id\=62
roadmap_1274_li=Add database creation date and time to the database. roadmap_1274_li=Add database creation date and time to the database.
roadmap_1275_li=Support ASSERTION. roadmap_1275_li=Support ASSERTION.
......
...@@ -4104,8 +4104,16 @@ public class Parser { ...@@ -4104,8 +4104,16 @@ public class Parser {
} }
} else if (readIf("TIMESTAMP")) { } else if (readIf("TIMESTAMP")) {
if (readIf("WITH")) { if (readIf("WITH")) {
// originally we used TIMEZONE, which turns out not to be standards-compliant,
// but lets keep backwards compatibility
if (readIf("TIMEZONE")) {
read("TIMEZONE"); read("TIMEZONE");
original += " WITH TIMEZONE"; original += " WITH TIMEZONE";
} else {
read("TIME");
read("ZONE");
original += " WITH TIME ZONE";
}
} }
} else { } else {
regular = true; regular = true;
......
...@@ -789,8 +789,8 @@ The date data type." ...@@ -789,8 +789,8 @@ The date data type."
{ TIMESTAMP | DATETIME | SMALLDATETIME } { TIMESTAMP | DATETIME | SMALLDATETIME }
"," ","
The timestamp data type." The timestamp data type."
"Data Types","TIMESTAMP WITH TIMEZONE Type"," "Data Types","TIMESTAMP WITH TIME ZONE Type","
TIMESTAMP WITH TIMEZONE TIMESTAMP WITH TIME ZONE
"," ","
VERY MUCH STILL IN TESTING." VERY MUCH STILL IN TESTING."
"Data Types","BINARY Type"," "Data Types","BINARY Type","
......
...@@ -318,7 +318,7 @@ public class DataType { ...@@ -318,7 +318,7 @@ public class DataType {
add(Value.TIMESTAMP_TZ, Types.OTHER, "TimestampTimeZone", add(Value.TIMESTAMP_TZ, Types.OTHER, "TimestampTimeZone",
createDate(ValueTimestampTimeZone.PRECISION, "TIMESTAMP_TZ", createDate(ValueTimestampTimeZone.PRECISION, "TIMESTAMP_TZ",
ValueTimestampTimeZone.DEFAULT_SCALE, ValueTimestampTimeZone.DISPLAY_SIZE), ValueTimestampTimeZone.DEFAULT_SCALE, ValueTimestampTimeZone.DISPLAY_SIZE),
new String[]{"TIMESTAMP WITH TIMEZONE"}, new String[]{"TIMESTAMP WITH TIME ZONE"},
// 26 for ValueTimestampUtc, 32 for java.sql.Timestamp // 26 for ValueTimestampUtc, 32 for java.sql.Timestamp
58 58
); );
......
...@@ -162,7 +162,7 @@ public abstract class Value { ...@@ -162,7 +162,7 @@ public abstract class Value {
* 23 was a short-lived experiment "TIMESTAMP UTC" which has been removed. * 23 was a short-lived experiment "TIMESTAMP UTC" which has been removed.
*/ */
/** /**
* The value type for TIMESTAMP WITH TIMEZONE values. * The value type for TIMESTAMP WITH TIME ZONE values.
*/ */
public static final int TIMESTAMP_TZ = 24; public static final int TIMESTAMP_TZ = 24;
......
...@@ -18,7 +18,7 @@ import org.h2.util.MathUtils; ...@@ -18,7 +18,7 @@ import org.h2.util.MathUtils;
import org.h2.util.StringUtils; import org.h2.util.StringUtils;
/** /**
* Implementation of the TIMESTAMP WITH TIMEZONE data type. * Implementation of the TIMESTAMP WITH TIME ZONE data type.
* *
* @see <a href="https://en.wikipedia.org/wiki/ISO_8601#Time_zone_designators"> * @see <a href="https://en.wikipedia.org/wiki/ISO_8601#Time_zone_designators">
* ISO 8601 Time zone designators</a> * ISO 8601 Time zone designators</a>
...@@ -113,7 +113,7 @@ public class ValueTimestampTimeZone extends Value { ...@@ -113,7 +113,7 @@ public class ValueTimestampTimeZone extends Value {
return parseTry(s); return parseTry(s);
} catch (Exception e) { } catch (Exception e) {
throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e,
"TIMESTAMP WITH TIMEZONE", s); "TIMESTAMP WITH TIME ZONE", s);
} }
} }
...@@ -249,7 +249,7 @@ public class ValueTimestampTimeZone extends Value { ...@@ -249,7 +249,7 @@ public class ValueTimestampTimeZone extends Value {
@Override @Override
public String getSQL() { public String getSQL() {
return "TIMESTAMP WITH TIMEZONE '" + getString() + "'"; return "TIMESTAMP WITH TIME ZONE '" + getString() + "'";
} }
@Override @Override
...@@ -353,13 +353,13 @@ public class ValueTimestampTimeZone extends Value { ...@@ -353,13 +353,13 @@ public class ValueTimestampTimeZone extends Value {
@Override @Override
public Value add(Value v) { public Value add(Value v) {
throw DbException.getUnsupportedException( throw DbException.getUnsupportedException(
"manipulating TIMESTAMP WITH TIMEZONE values is unsupported"); "manipulating TIMESTAMP WITH TIME ZONE values is unsupported");
} }
@Override @Override
public Value subtract(Value v) { public Value subtract(Value v) {
throw DbException.getUnsupportedException( throw DbException.getUnsupportedException(
"manipulating TIMESTAMP WITH TIMEZONE values is unsupported"); "manipulating TIMESTAMP WITH TIME ZONE values is unsupported");
} }
} }
...@@ -41,7 +41,7 @@ public class TestTimeStampWithTimeZone extends TestBase { ...@@ -41,7 +41,7 @@ public class TestTimeStampWithTimeZone extends TestBase {
private void test1() throws SQLException { private void test1() throws SQLException {
Connection conn = getConnection(getTestName()); Connection conn = getConnection(getTestName());
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("create table test(id identity, t1 timestamp with timezone)"); stat.execute("create table test(id identity, t1 timestamp with time zone)");
stat.execute("insert into test(t1) values('1970-01-01 12:00:00.00+00:15')"); stat.execute("insert into test(t1) values('1970-01-01 12:00:00.00+00:15')");
// verify NanosSinceMidnight is in local time and not UTC // verify NanosSinceMidnight is in local time and not UTC
stat.execute("insert into test(t1) values('2016-09-24 00:00:00.000000001+00:01')"); stat.execute("insert into test(t1) values('2016-09-24 00:00:00.000000001+00:01')");
...@@ -131,7 +131,7 @@ public class TestTimeStampWithTimeZone extends TestBase { ...@@ -131,7 +131,7 @@ public class TestTimeStampWithTimeZone extends TestBase {
private void testOrder() throws SQLException { private void testOrder() throws SQLException {
Connection conn = getConnection(getTestName()); Connection conn = getConnection(getTestName());
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("create table test_order(id identity, t1 timestamp with timezone)"); stat.execute("create table test_order(id identity, t1 timestamp with time zone)");
stat.execute("insert into test_order(t1) values('1970-01-01 12:00:00.00+00:15')"); stat.execute("insert into test_order(t1) values('1970-01-01 12:00:00.00+00:15')");
stat.execute("insert into test_order(t1) values('1970-01-01 12:00:01.00+01:15')"); stat.execute("insert into test_order(t1) values('1970-01-01 12:00:01.00+01:15')");
ResultSet rs = stat.executeQuery("select t1 from test_order order by t1"); ResultSet rs = stat.executeQuery("select t1 from test_order order by t1");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论