diff --git a/sbroad-core/src/frontend/sql/query.pest b/sbroad-core/src/frontend/sql/query.pest index be7a257cdd14cf60013a82573613cf5c5f1435b9..50834bfedfa2fa456734bbe2dc1ca0302bf4e296 100644 --- a/sbroad-core/src/frontend/sql/query.pest +++ b/sbroad-core/src/frontend/sql/query.pest @@ -102,7 +102,7 @@ Query = { (SelectWithOptionalContinuation | Values | Insert | Update | Delete) ~ UnionAllContinuation = { ^"union" ~ ^"all" ~ Select } Select = { ^"select" ~ Projection ~ ^"from" ~ Scan ~ - Join? ~ WhereClause? ~ + Join? ~ WhereClause? ~ (^"group" ~ ^"by" ~ GroupBy)? ~ (^"having" ~ Having)? } @@ -127,7 +127,7 @@ Query = { (SelectWithOptionalContinuation | Values | Insert | Update | Delete) ~ GroupBy = { GroupingElement ~ ("," ~ GroupingElement)* } Having = { Expr } SubQuery = { "(" ~ (SelectWithOptionalContinuation | Values) ~ ")" } - Insert = { ^"insert" ~ ^"into" ~ Table ~ ("(" ~ TargetColumns ~ ")")? ~ + Insert = { ^"insert" ~ ^"into" ~ Table ~ ("(" ~ TargetColumns ~ ")")? ~ (Values | Select) ~ OnConflict? } TargetColumns = { ColumnName ~ ("," ~ ColumnName)* } OnConflict = _{ ^"on conflict" ~ ^"do" ~ (DoNothing | DoReplace | DoFail) }