提交 0923d5bb authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Fix Parser.readTermObjectDot()

上级 0fb3208f
......@@ -3759,11 +3759,13 @@ public class Parser {
return function;
}
private Expression readWildcardOrSequenceValue(String schema,
String objectName) {
private Expression readWildcardRowidOrSequenceValue(String schema, String objectName) {
if (readIf(ASTERISK)) {
return parseWildcard(schema, objectName);
}
if (readIf(_ROWID_)) {
return new ExpressionColumn(database, schema, objectName, Column.ROWID, true);
}
if (schema == null) {
schema = session.getCurrentSchemaName();
}
......@@ -3820,13 +3822,10 @@ public class Parser {
}
private Expression readTermObjectDot(String objectName) {
Expression expr = readWildcardOrSequenceValue(null, objectName);
Expression expr = readWildcardRowidOrSequenceValue(null, objectName);
if (expr != null) {
return expr;
}
if (readIf(_ROWID_)) {
return new ExpressionColumn(database, null, objectName, Column.ROWID, true);
}
String name = readColumnIdentifier();
Schema s = database.findSchema(objectName);
if (readIf(OPEN_PAREN)) {
......@@ -3834,13 +3833,10 @@ public class Parser {
} else if (readIf(DOT)) {
String schema = objectName;
objectName = name;
expr = readWildcardOrSequenceValue(schema, objectName);
expr = readWildcardRowidOrSequenceValue(schema, objectName);
if (expr != null) {
return expr;
}
if (readIf(_ROWID_)) {
return new ExpressionColumn(database, schema, objectName, Column.ROWID, true);
}
name = readColumnIdentifier();
if (readIf(OPEN_PAREN)) {
String databaseName = schema;
......@@ -3858,7 +3854,7 @@ public class Parser {
}
schema = objectName;
objectName = name;
expr = readWildcardOrSequenceValue(schema, objectName);
expr = readWildcardRowidOrSequenceValue(schema, objectName);
if (expr != null) {
return expr;
}
......
......@@ -640,3 +640,17 @@ SELECT * FROM
> ----- -
> 36 2
> rows: 1
CREATE TABLE TEST("_ROWID_" INT) AS VALUES 2;
> ok
SELECT _ROWID_ S1, TEST._ROWID_ S2, PUBLIC.TEST._ROWID_ S3, SCRIPT.PUBLIC.TEST._ROWID_ S4,
"_ROWID_" U1, TEST."_ROWID_" U2, PUBLIC.TEST."_ROWID_" U3, SCRIPT.PUBLIC.TEST."_ROWID_" U4
FROM TEST;
> S1 S2 S3 S4 U1 U2 U3 U4
> -- -- -- -- -- -- -- --
> 1 1 1 1 2 2 2 2
> rows: 1
DROP TABLE TEST;
> ok
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论