提交 5174c527 authored 作者: Bekrenev Dmitry's avatar Bekrenev Dmitry

Fix compatibility postgresql function string_agg

上级 89f239ba
...@@ -2293,8 +2293,9 @@ public class Parser { ...@@ -2293,8 +2293,9 @@ public class Parser {
} }
} else if (aggregateType == Aggregate.GROUP_CONCAT) { } else if (aggregateType == Aggregate.GROUP_CONCAT) {
Aggregate agg = null; Aggregate agg = null;
boolean distinct = readIf("DISTINCT");
if (equalsToken("GROUP_CONCAT", aggregateName)) { if (equalsToken("GROUP_CONCAT", aggregateName)) {
boolean distinct = readIf("DISTINCT");
agg = new Aggregate(Aggregate.GROUP_CONCAT, agg = new Aggregate(Aggregate.GROUP_CONCAT,
readExpression(), currentSelect, distinct); readExpression(), currentSelect, distinct);
if (readIf("ORDER")) { if (readIf("ORDER")) {
...@@ -2308,8 +2309,13 @@ public class Parser { ...@@ -2308,8 +2309,13 @@ public class Parser {
} else if (equalsToken("STRING_AGG", aggregateName)) { } else if (equalsToken("STRING_AGG", aggregateName)) {
// PostgreSQL compatibility: string_agg(expression, delimiter) // PostgreSQL compatibility: string_agg(expression, delimiter)
agg = new Aggregate(Aggregate.GROUP_CONCAT, agg = new Aggregate(Aggregate.GROUP_CONCAT,
readExpression(), currentSelect, false); readExpression(), currentSelect, distinct);
read(","); read(",");
if(readIf("ORDER")) {
read("BY");
agg.setGroupConcatOrder(parseSimpleOrderList());
}
agg.setGroupConcatSeparator(readExpression()); agg.setGroupConcatSeparator(readExpression());
} }
r = agg; r = agg;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论