提交 902a6476 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Restore limited support of DATETIME2

上级 ebb7d972
...@@ -4465,7 +4465,7 @@ public class Parser { ...@@ -4465,7 +4465,7 @@ public class Parser {
precision = displaySize = ValueTimestampTimeZone.getDisplaySize(originalScale); precision = displaySize = ValueTimestampTimeZone.getDisplaySize(originalScale);
break; break;
} }
} else if (original.equals("DATETIME")) { } else if (original.equals("DATETIME") || original.equals("DATETIME2")) {
if (readIf("(")) { if (readIf("(")) {
originalScale = readPositiveInt(); originalScale = readPositiveInt();
if (originalScale > ValueTime.MAXIMUM_SCALE) { if (originalScale > ValueTime.MAXIMUM_SCALE) {
......
...@@ -16,7 +16,9 @@ SELECT T1, T2, T1 = T2 FROM TEST; ...@@ -16,7 +16,9 @@ SELECT T1, T2, T1 = T2 FROM TEST;
> rows: 1 > rows: 1
ALTER TABLE TEST ADD (T3 TIMESTAMP(0), T4 TIMESTAMP(9) WITHOUT TIME ZONE, ALTER TABLE TEST ADD (T3 TIMESTAMP(0), T4 TIMESTAMP(9) WITHOUT TIME ZONE,
DT1 DATETIME, DT2 DATETIME(0), DT3 DATETIME(9), SDT1 SMALLDATETIME); DT1 DATETIME, DT2 DATETIME(0), DT3 DATETIME(9),
DT2_1 DATETIME2, DT2_2 DATETIME2(0), DT2_3 DATETIME2(7),
SDT1 SMALLDATETIME);
> ok > ok
SELECT COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_TYPE, NUMERIC_SCALE FROM INFORMATION_SCHEMA.COLUMNS SELECT COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_TYPE, NUMERIC_SCALE FROM INFORMATION_SCHEMA.COLUMNS
...@@ -30,8 +32,11 @@ SELECT COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_TYPE, NUMERIC_SCALE FROM INFORM ...@@ -30,8 +32,11 @@ SELECT COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_TYPE, NUMERIC_SCALE FROM INFORM
> DT1 93 TIMESTAMP DATETIME 6 > DT1 93 TIMESTAMP DATETIME 6
> DT2 93 TIMESTAMP DATETIME(0) 0 > DT2 93 TIMESTAMP DATETIME(0) 0
> DT3 93 TIMESTAMP DATETIME(9) 9 > DT3 93 TIMESTAMP DATETIME(9) 9
> DT2_1 93 TIMESTAMP DATETIME2 6
> DT2_2 93 TIMESTAMP DATETIME2(0) 0
> DT2_3 93 TIMESTAMP DATETIME2(7) 7
> SDT1 93 TIMESTAMP SMALLDATETIME 0 > SDT1 93 TIMESTAMP SMALLDATETIME 0
> rows (ordered): 8 > rows (ordered): 11
ALTER TABLE TEST ADD T5 TIMESTAMP(10); ALTER TABLE TEST ADD T5 TIMESTAMP(10);
> exception INVALID_VALUE_SCALE_PRECISION > exception INVALID_VALUE_SCALE_PRECISION
...@@ -39,6 +44,9 @@ ALTER TABLE TEST ADD T5 TIMESTAMP(10); ...@@ -39,6 +44,9 @@ ALTER TABLE TEST ADD T5 TIMESTAMP(10);
ALTER TABLE TEST ADD DT4 DATETIME(10); ALTER TABLE TEST ADD DT4 DATETIME(10);
> exception INVALID_VALUE_SCALE_PRECISION > exception INVALID_VALUE_SCALE_PRECISION
ALTER TABLE TEST ADD DT2_4 DATETIME2(10);
> exception INVALID_VALUE_SCALE_PRECISION
ALTER TABLE TEST ADD STD2 SMALLDATETIME(1); ALTER TABLE TEST ADD STD2 SMALLDATETIME(1);
> exception SYNTAX_ERROR_1 > exception SYNTAX_ERROR_1
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论