summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2020-04-25 15:30:19 +0200
committerJulien Nabet <serval2412@yahoo.fr>2020-04-26 13:05:22 +0200
commit4310b8b67ed9d0d32d4fd468b370bd3cfed07975 (patch)
tree8d7b654bd54f116f993889fc7c53c60a625a0310 /connectivity
parent983a92f697fc6399ad52dd1e757a88e8736bfdf2 (diff)
tdf#132385: sql parser: don't drop clauses from window specification
bison rule window_specification: '(' window_specification_details ')' { $$ = SQL_NEW_RULE; $$->append(newNode("(", SQLNodeType::Punctuation)); $$->append($2); $$->append(newNode(")", SQLNodeType::Punctuation)); } ; makes it look like rule "window_specification_details" is a single node, but in reality it is a sequence of four nodes: window_specification_details: opt_existing_window_name opt_window_partition_clause opt_order_by_clause opt_window_frame_clause ; The result is that only the "opt_existing_window_name" clause was being put in the parse tree, and the other three were simply discarded. Since that will forever be a trap, and this is the only place where window_specification_details is used, we inline it into window_specification and remove it. Change-Id: I568904355174d2bc36155bde1d4dd09f57759cd2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92776 Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu> Tested-by: Jenkins
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/parse/sqlbison.y18
1 files changed, 10 insertions, 8 deletions
diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y
index 453019b928ed..c9d423e3219c 100644
--- a/connectivity/source/parse/sqlbison.y
+++ b/connectivity/source/parse/sqlbison.y
@@ -250,7 +250,7 @@ using namespace connectivity;
%type <pParseNode> window_function window_function_type ntile_function number_of_tiles lead_or_lag_function lead_or_lag lead_or_lag_extent offset default_expression null_treatment
%type <pParseNode> first_or_last_value_function first_or_last_value nth_value_function nth_row from_first_or_last window_name_or_specification in_line_window_specification opt_lead_or_lag_function
%type <pParseNode> opt_null_treatment opt_from_first_or_last simple_value_specification dynamic_parameter_specification window_name window_clause window_definition_list window_definition
-%type <pParseNode> new_window_name window_specification_details existing_window_name window_partition_clause window_partition_column_reference_list window_partition_column_reference window_frame_clause
+%type <pParseNode> new_window_name existing_window_name window_partition_clause window_partition_column_reference_list window_partition_column_reference window_frame_clause
%type <pParseNode> window_frame_units window_frame_extent window_frame_start window_frame_preceding window_frame_between window_frame_bound_1 window_frame_bound_2 window_frame_bound window_frame_following window_frame_exclusion
%type <pParseNode> opt_window_frame_clause opt_window_partition_clause opt_existing_window_name window_specification opt_window_frame_exclusion opt_window_clause opt_offset
%type <pParseNode> opt_fetch_first_row_count fetch_first_clause offset_row_count fetch_first_row_count first_or_next row_or_rows opt_result_offset_clause result_offset_clause
@@ -2202,11 +2202,19 @@ new_window_name:
window_name
;
window_specification:
- '(' window_specification_details ')'
+ '('
+ opt_existing_window_name
+ opt_window_partition_clause
+ opt_order_by_clause
+ opt_window_frame_clause
+ ')'
{
$$ = SQL_NEW_RULE;
$$->append(newNode("(", SQLNodeType::Punctuation));
$$->append($2);
+ $$->append($3);
+ $$->append($4);
+ $$->append($5);
$$->append(newNode(")", SQLNodeType::Punctuation));
}
;
@@ -2222,12 +2230,6 @@ opt_window_frame_clause:
/* empty */ {$$ = SQL_NEW_RULE;}
| window_frame_clause
;
-window_specification_details:
- opt_existing_window_name
- opt_window_partition_clause
- opt_order_by_clause
- opt_window_frame_clause
- ;
existing_window_name:
window_name
;