未验证 提交 7de0b936 编写于 作者: J JingShang Lu 提交者: GitHub

fix PostgreSQL union syntax definition (#7959)

* fix #7948

* fix
上级 1fa89ae2
......@@ -122,9 +122,9 @@ selectNoParens
selectClauseN
: simpleSelect
| selectWithParens
| selectClauseN UNION allOrDistinct selectClauseN
| selectClauseN INTERSECT allOrDistinct selectClauseN
| selectClauseN EXCEPT allOrDistinct selectClauseN
| selectClauseN UNION allOrDistinct? selectClauseN
| selectClauseN INTERSECT allOrDistinct? selectClauseN
| selectClauseN EXCEPT allOrDistinct? selectClauseN
;
simpleSelect
......
......@@ -61,6 +61,9 @@ public final class SelectStatementAssert {
}
private static void assertProjection(final SQLCaseAssertContext assertContext, final SelectStatement actual, final SelectStatementTestCase expected) {
if (null == actual.getProjections() && 0 == expected.getProjections().getSize()) {
return;
}
ProjectionAssert.assertIs(assertContext, actual.getProjections(), expected.getProjections());
}
......
......@@ -22,6 +22,9 @@
<expression-projection alias="a" start-index="7" stop-index="12" />
</projections>
</select>
<select sql-case-id="select_with_union">
</select>
<select sql-case-id="select_with_function_name" >
<projections start-index="7" stop-index="23">
......
......@@ -18,6 +18,7 @@
<sql-cases>
<sql-case id="select_constant_without_table" value="SELECT 1 as a" />
<sql-case id="select_with_union" value="SELECT * from table1 union select * from table2" db-types="PostgreSQL"/>
<sql-case id="select_with_function_name" value="SELECT current_timestamp" db-types="MySQL"/>
<sql-case id="select_with_same_table_name_and_alias" value="SELECT t_order.* FROM t_order t_order WHERE user_id = ? AND order_id = ?" />
<sql-case id="select_with_same_table_name_and_alias_column_with_owner" value="SELECT t_order.order_id,t_order.user_id,status FROM t_order t_order WHERE t_order.user_id = ? AND order_id = ?" db-types="MySQL,H2"/>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册