[MDEV-15818] Fix shift-reduce conflicts in the new 10.3 syntax Created: 2018-04-09  Updated: 2018-05-22  Resolved: 2018-05-17

Status: Closed
Project: MariaDB Server
Component/s: Parser
Fix Version/s: 10.3.7

Type: Task Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-15004 parser greedily parses AS OF TIMESTAMP Closed

 Description   

There were a few changes 10.3 in sql_yacc.yy that increased the amout of shift/reduce conflicts.

We need to cleanup the grammar, trying to change the %expect value back to around 102.

The commits that changed %expect recently:

commit f1bd02d99416649717c1f73d9f44b3474736f192
Author: Aleksey Midenkov <midenok@gmail.com>
Date:   Fri Feb 16 19:07:32 2018 +0100
 
    MDEV-15004 parser greedily parses AS OF TIMESTAMP
    
    * TIMESTAMP precedence fixed.
 
-%expect 125
+%expect 139

commit 9fa715b84d68d5089bae3bfcfda060da816339e0
Author: Sergei Golubchik <serg@mariadb.org>
Date:   Thu Jan 18 06:28:37 2018 +0300
 
    MDEV-14798 Add, drop system versioning semantic and syntax
    
    SQL: DROP PERIOD FOR SYSTEM_TIME syntax
    
    and remove ER_VERS_SYS_FIELD_EXISTS
    
    originally by: Eugene Kosov
 
-%expect 123
+%expect 125

commit 617e108fb6e2bc24e5c9badb94e7d8eaa65d8851
Author: Sergei Golubchik <serg@mariadb.org>
Date:   Sat Dec 16 21:33:43 2017 +0100
 
    s/TRUNCATE ... TO/DELETE HISTORY FROM ... BEFORE/
 
-%expect 122
+%expect 123

commit ca6454bcfe2da8f2a639ae6cf223b626ad116100
Author: Sergei Golubchik <serg@mariadb.org>
Date:   Mon Dec 11 14:09:58 2017 +0100
 
    for now, remove FOR SYSTEM_TIME at the end of the query
    
    non-standard, redundant, potentially risky in the future,
    hides bugs. See #383, #384, #385
    
    Fixed a parser bug where
    SELECT * FROM (t1 join t2) FOR SYSTEM_TIME ...
    was not an error.
 
-%expect 125
+%expect 122

commit 79dd77e6aebc861b82e4895941224bbbad441650
Merge: b7cd182 8f581e8
Author: Aleksey Midenkov <midenok@gmail.com>
Date:   Mon Dec 11 15:43:41 2017 +0300
 
    System Versioning 1.0 pre3
    
    Merge branch '10.3' into trunk
 
- %expect 123
 -%expect 104
++%expect 125

commit ea1ccfa5000c7f5d01895e3474b2929eee52e2e8
Author: Sergei Golubchik <serg@mariadb.org>
Date:   Sat Dec 2 16:23:16 2017 +0100
 
    SQL: regression fix: make NOW a valid identifier again [#363]
    
    * again, as in 10.2, NOW is a keyword only if followed by parentheses
    * use AS OF CURRENT_TIMESTAMP or AS OF NOW()
    * AS OF CURRENT_TIMESTAMP and AS OF NOW() mean AS OF NOW(6),
      not AS OF NOW(0), (same behavior as in a DEFAULT clause)
 
-%expect 124
+%expect 123

commit 3198bc839da3259c277d2f80ed698a84d683d496
Author: Sergei Golubchik <serg@mariadb.org>
Date:   Tue Nov 28 16:38:58 2017 +0100
 
    Parser: unreserve keywords
    
    SELECT * FROM t1 FOR SYSTEM_TIME AS OF ...
    
    becomes ambiguous, but it's the same as with
    
    SELECT ... UNION SELECT ... ORDER BY ...
 
-%expect 117
+%expect 124

commit 01a8bad897abcc1445d98886bfdfff7a2b2d1530
Author: Eugene Kosov <claprix@yandex.ru>
Date:   Sat Nov 25 18:04:14 2017 +0300
 
    SQL: allow PERIOD as identifier [fixes #331]
 
-%expect 115
+%expect 117

commit d8d725101992d50b00edf149e7ccd7f720b850dc
Merge: 835cbbc ce66d5b
Author: Aleksey Midenkov <midenok@gmail.com>
Date:   Tue Nov 7 00:37:49 2017 +0300
 
    System Versioning pre0.12
    
    Merge remote-tracking branch 'origin/archive/2017-10-17' into 10.3
 
- %expect 102
 -%expect 116
++%expect 115

Summary for earlier changes:

78a891c87bcc584e28fad3a0c0fc7d791bc93ae4 -> 102
17a87d606302b55d547104d7fe6c536c6c288a8b -> 103
9073f9fd7da80752c4fcb7c6bed1d51b4853d3ce -> 102
1b4f0962c14b3c827553e2a470c82afc419f9352 -> 103
f6a7c1c75ac68dbd23c0666bf586126c2e5b3617 -> 102
7e66a24dfb381290d59786c36e1dc478ad365bd1 -> 104
c0a59b46be5be341bd6ffc9fe188a236ced46522 -> 123


Generated at Thu Feb 08 08:24:15 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.