提交 27f2c8d6 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Restore possibility to use TIMESTAMP as a column name

上级 e861f6b5
...@@ -3149,17 +3149,22 @@ public class Parser { ...@@ -3149,17 +3149,22 @@ public class Parser {
read(); read();
r = ValueExpression.get(ValueTimestampTimeZone.parse(timestamp)); r = ValueExpression.get(ValueTimestampTimeZone.parse(timestamp));
} else { } else {
if (readIf("WITHOUT")) { boolean without = readIf("WITHOUT");
if (without) {
read("TIME"); read("TIME");
read("ZONE"); read("ZONE");
} }
if (currentTokenType != VALUE if (currentTokenType != VALUE
|| currentValue.getType() != Value.STRING) { || currentValue.getType() != Value.STRING) {
throw getSyntaxError(); if (without) {
throw getSyntaxError();
}
r = new ExpressionColumn(database, null, null, name);
} else {
String timestamp = currentValue.getString();
read();
r = ValueExpression.get(ValueTimestamp.parse(timestamp, database.getMode()));
} }
String timestamp = currentValue.getString();
read();
r = ValueExpression.get(ValueTimestamp.parse(timestamp, database.getMode()));
} }
} else if (currentTokenType == VALUE && } else if (currentTokenType == VALUE &&
currentValue.getType() == Value.STRING) { currentValue.getType() == Value.STRING) {
......
...@@ -25,3 +25,19 @@ SELECT COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_TYPE FROM INFORMATION_SCHEMA.CO ...@@ -25,3 +25,19 @@ SELECT COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_TYPE FROM INFORMATION_SCHEMA.CO
DROP TABLE TEST; DROP TABLE TEST;
> ok > ok
-- Check that TIMESTAMP is allowed as a column name
CREATE TABLE TEST(TIMESTAMP TIMESTAMP);
> ok
INSERT INTO TEST VALUES (TIMESTAMP '1999-12-31 08:00:00');
> update count: 1
SELECT TIMESTAMP FROM TEST;
> TIMESTAMP
> ---------------------
> 1999-12-31 08:00:00.0
> rows: 1
DROP TABLE TEST;
> ok
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论