Unverified 提交 c433682f authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov 提交者: GitHub

Merge pull request #1109 from katzyn/datetime

Restore limited support of DATETIME2
......@@ -4465,7 +4465,7 @@ public class Parser {
precision = displaySize = ValueTimestampTimeZone.getDisplaySize(originalScale);
break;
}
} else if (original.equals("DATETIME")) {
} else if (original.equals("DATETIME") || original.equals("DATETIME2")) {
if (readIf("(")) {
originalScale = readPositiveInt();
if (originalScale > ValueTime.MAXIMUM_SCALE) {
......
......@@ -16,7 +16,9 @@ SELECT T1, T2, T1 = T2 FROM TEST;
> rows: 1
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
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
> DT1 93 TIMESTAMP DATETIME 6
> DT2 93 TIMESTAMP DATETIME(0) 0
> 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
> rows (ordered): 8
> rows (ordered): 11
ALTER TABLE TEST ADD T5 TIMESTAMP(10);
> exception INVALID_VALUE_SCALE_PRECISION
......@@ -39,6 +44,9 @@ ALTER TABLE TEST ADD T5 TIMESTAMP(10);
ALTER TABLE TEST ADD DT4 DATETIME(10);
> 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);
> exception SYNTAX_ERROR_1
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论