Type:
Task
Priority:
Major
Resolution:
Fixed
The rule remember_tok_start in the bison grammar may cause shift/reduce conflicts.
In order to fix MDEV-19956 easier, lets get rid of remember_tok_start gradually.
As the first step let's change the token type for the following single-character operators from <NONE> to <kwd>.
%type <kwd>
'-' '+' '*' '/' '%' '(' ')'
',' '!' '{' '}' '&' '|'
and replace remember_tok_start to token positions in with_list_element (to prove the conceipt), as follows:
@@ -15262,16 +15262,16 @@ with_list_element:
MYSQL_YYABORT;
Lex->with_column_list.empty();
}
- AS '(' remember_tok_start query_expression remember_tok_end ')'
+ AS '(' query_expression ')'
{
LEX *lex= thd->lex;
const char *query_start= lex->sphead ? lex->sphead->m_tmp_query
: thd->query();
- char *spec_start= $6 + 1;
- With_element *elem= new With_element($1, *$2, $7);
+ const char *spec_start= $5.pos() + 1;
+ With_element *elem= new With_element($1, *$2, $6);
if (elem == NULL || Lex->curr_with_clause->add_with_element(elem))
MYSQL_YYABORT;
- if (elem->set_unparsed_spec(thd, spec_start, $8,
+ if (elem->set_unparsed_spec(thd, spec_start, $7.pos(),
spec_start - query_start))
MYSQL_YYABORT;
}
Lex_input_stream::lex_one_token() will be changed to assign positions to the mentioned tokens, like this:
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1510,6 +1510,7 @@ int Lex_input_stream::lex_one_token(YYSTYPE *yylval, THD *thd)
case MY_LEX_SKIP: // This should not happen
if (c != ')' )
next_state= MY_LEX_START; // Allow signed numbers
+ yylval->kwd.set_keyword(m_tok_start, 1);
return (( int ) c);
case MY_LEX_MINUS_OR_COMMENT:
Note, this change will not immediately resolve any conflicts.
Conflicts should be resolved in a separate patch by effectively replacing remember_tok_start to token positions in these grammar rules:
parenthesized_expr:
remember_tok_start
query_expression
{
if (!($$= Lex->create_item_query_expression(thd, $1, $2)))
MYSQL_YYABORT;
}
subselect:
remember_tok_start
query_expression
{
if (!($$= Lex->parsed_subselect($2, $1)))
YYABORT;
}
;
blocks
MDEV-19956
Queries with subqueries containing UNION are not parsed
Closed
{"report":{"fcp":1636.9000000953674,"ttfb":297.5,"pageVisibility":"visible","entityId":77395,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":32,"apdex":0.5,"journeyId":"4d36b943-904b-4d56-96bd-57eba494a508","navigationType":0,"readyForUser":1752.1999998092651,"redirectCount":0,"resourceLoadedEnd":1299.3000001907349,"resourceLoadedStart":304.90000009536743,"resourceTiming":[{"duration":206,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":304.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":304.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":510.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":227.40000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":305.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":305.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":532.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":679.6999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":305.40000009536743,"connectEnd":305.40000009536743,"connectStart":305.40000009536743,"domainLookupEnd":305.40000009536743,"domainLookupStart":305.40000009536743,"fetchStart":305.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":541,"responseEnd":985.0999999046326,"responseStart":575.8000001907349,"secureConnectionStart":305.40000009536743},{"duration":993.8000001907349,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":305.5,"connectEnd":305.5,"connectStart":305.5,"domainLookupEnd":305.5,"domainLookupStart":305.5,"fetchStart":305.5,"redirectEnd":0,"redirectStart":0,"requestStart":542,"responseEnd":1299.3000001907349,"responseStart":602.1999998092651,"secureConnectionStart":305.5},{"duration":290.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":305.69999980926514,"connectEnd":305.69999980926514,"connectStart":305.69999980926514,"domainLookupEnd":305.69999980926514,"domainLookupStart":305.69999980926514,"fetchStart":305.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":544,"responseEnd":596.5999999046326,"responseStart":592,"secureConnectionStart":305.69999980926514},{"duration":281.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":305.90000009536743,"connectEnd":305.90000009536743,"connectStart":305.90000009536743,"domainLookupEnd":305.90000009536743,"domainLookupStart":305.90000009536743,"fetchStart":305.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":544.3000001907349,"responseEnd":587.4000000953674,"responseStart":584.0999999046326,"secureConnectionStart":305.90000009536743},{"duration":280.2999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":308.40000009536743,"connectEnd":308.40000009536743,"connectStart":308.40000009536743,"domainLookupEnd":308.40000009536743,"domainLookupStart":308.40000009536743,"fetchStart":308.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":544.5,"responseEnd":588.6999998092651,"responseStart":586.4000000953674,"secureConnectionStart":308.40000009536743},{"duration":233.09999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":308.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":308.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":541.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":279.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":309,"connectEnd":309,"connectStart":309,"domainLookupEnd":309,"domainLookupStart":309,"fetchStart":309,"redirectEnd":0,"redirectStart":0,"requestStart":545.4000000953674,"responseEnd":588.5,"responseStart":585.6999998092651,"secureConnectionStart":309},{"duration":232.7000002861023,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":309.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":309.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":541.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":311.3999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":309.30000019073486,"connectEnd":309.30000019073486,"connectStart":309.30000019073486,"domainLookupEnd":309.30000019073486,"domainLookupStart":309.30000019073486,"fetchStart":309.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":569,"responseEnd":620.6999998092651,"responseStart":616.6999998092651,"secureConnectionStart":309.30000019073486},{"duration":952,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":310.40000009536743,"connectEnd":310.40000009536743,"connectStart":310.40000009536743,"domainLookupEnd":310.40000009536743,"domainLookupStart":310.40000009536743,"fetchStart":310.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":838.0999999046326,"responseEnd":1262.4000000953674,"responseStart":1254.5,"secureConnectionStart":310.40000009536743},{"duration":952.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":310.5,"connectEnd":310.5,"connectStart":310.5,"domainLookupEnd":310.5,"domainLookupStart":310.5,"fetchStart":310.5,"redirectEnd":0,"redirectStart":0,"requestStart":890.5999999046326,"responseEnd":1263,"responseStart":1259.5,"secureConnectionStart":310.5},{"duration":301.2999997138977,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1263.8000001907349,"connectEnd":1263.8000001907349,"connectStart":1263.8000001907349,"domainLookupEnd":1263.8000001907349,"domainLookupStart":1263.8000001907349,"fetchStart":1263.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":1527,"responseEnd":1565.0999999046326,"responseStart":1563.1999998092651,"secureConnectionStart":1263.8000001907349},{"duration":307,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1615.3000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1615.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1922.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":237.59999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1633.9000000953674,"connectEnd":1633.9000000953674,"connectStart":1633.9000000953674,"domainLookupEnd":1633.9000000953674,"domainLookupStart":1633.9000000953674,"fetchStart":1633.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":1836.8000001907349,"responseEnd":1871.5,"responseStart":1869.8000001907349,"secureConnectionStart":1633.9000000953674}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":95,"responseStart":298,"responseEnd":299,"domLoading":302,"domInteractive":2002,"domContentLoadedEventStart":2002,"domContentLoadedEventEnd":2059,"domComplete":3255,"loadEventStart":3255,"loadEventEnd":3259,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1959.0999999046326},{"name":"bigPipe.sidebar-id.end","time":1970.3000001907349},{"name":"bigPipe.activity-panel-pipe-id.start","time":1982.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":1985.0999999046326},{"name":"activityTabFullyLoaded","time":2066.9000000953674}],"measures":[],"correlationId":"227a8b7b6a2d69","effectiveType":"4g","downlink":9.1,"rtt":0,"serverDuration":101,"dbReadsTimeInMs":8,"dbConnsTimeInMs":16,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}