[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - connectivity/source

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Sun Apr 26 11:05:51 UTC 2020


 connectivity/source/parse/sqlbison.y |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

New commits:
commit 4310b8b67ed9d0d32d4fd468b370bd3cfed07975
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Sat Apr 25 15:30:19 2020 +0200
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Sun Apr 26 13:05:22 2020 +0200

    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 at mamane.lu>
    Tested-by: Jenkins

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
 	;


More information about the Libreoffice-commits mailing list