#5 0x00000000006d4528 in mysql_explain_union (thd=0x31d1050, unit=0x7fffa00072a0, result=0x7fffa0008288) at /home/psergey/dev2/10.0/sql/sql_select.cc:23924
#6 0x00000000006d4287 in select_describe (join=0x7fffa0075068, need_tmp_table=false, need_order=false, distinct=false, message=0x103585c "No tables used") at /home/psergey/dev2/10.0/sql/sql_select.cc:23881
#7 0x000000000069e670 in JOIN::exec_inner (this=0x7fffa0075068) at /home/psergey/dev2/10.0/sql/sql_select.cc:2431
#8 0x000000000069e2aa in JOIN::exec (this=0x7fffa0075068) at /home/psergey/dev2/10.0/sql/sql_select.cc:2370
#10 0x0000000000697b7b in handle_select (thd=0x31d1050, lex=0x31d4c98, result=0x7fffa0008288, setup_tables_done_option=1073741824) at /home/psergey/dev2/10.0/sql/sql_select.cc:373
#11 0x0000000000665c9f in mysql_execute_command (thd=0x31d1050) at /home/psergey/dev2/10.0/sql/sql_parse.cc:3519
#12 0x000000000066dd51 in mysql_parse (thd=0x31d1050, rawbuf=0x7fffa0006788 "explain replace into t2 select 100, (select a from t1)", length=54, parser_state=0x7fffe00674f0) at /home/psergey/dev2/10.0/sql/sql_parse.cc:6407
select_describe(join, join->select_lex->select_number=1) calls
mysql_explain_union for the subquery.
mysql_explain_union calls mysql_select, which makes this call
//here is EXPLAIN of subselect or derived table
if (join->change_result(result))
{
DBUG_RETURN(TRUE);
}
where the result is select_insert object. The number of columns select_insert
expects is not (and doesn't have to be) equal to number of columns produced by
the subquery, and we get an error.
Sergei Petrunia
added a comment - The error is generated here:
(gdb) wher
#0 my_error (nr=1136, MyFlags=0) at /home/psergey/dev2/10.0/mysys/my_error.c:113
#1 0x00000000006438ad in check_insert_fields (thd=0x31d1050, table_list=0x7fffa00068a0, fields=..., values=..., check_unique=true, fields_and_values_from_different_maps=true, map=0x7fffe0066300) at /home/psergey/dev2/10.0/sql/sql_insert.cc:215
#2 0x000000000064b548 in select_insert::prepare (this=0x7fffa0008288, values=..., u=0x7fffa00072a0) at /home/psergey/dev2/10.0/sql/sql_insert.cc:3377
#3 0x00000000006d5b2a in JOIN::change_result (this=0x7fffa00755a0, res=0x7fffa0008288) at /home/psergey/dev2/10.0/sql/sql_select.cc:24412
#4 0x00000000006a1590 in mysql_select (thd=0x31d1050, rref_pointer_array=0x7fffa00071a0, tables=0x7fffa0007ad8, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748612, result=0x7fffa0008288, unit=0x7fffa00072a0, select_lex=0x7fffa0006f28) at /home/psergey/dev2/10.0/sql/sql_select.cc:3248
#5 0x00000000006d4528 in mysql_explain_union (thd=0x31d1050, unit=0x7fffa00072a0, result=0x7fffa0008288) at /home/psergey/dev2/10.0/sql/sql_select.cc:23924
#6 0x00000000006d4287 in select_describe (join=0x7fffa0075068, need_tmp_table=false, need_order=false, distinct=false, message=0x103585c "No tables used") at /home/psergey/dev2/10.0/sql/sql_select.cc:23881
#7 0x000000000069e670 in JOIN::exec_inner (this=0x7fffa0075068) at /home/psergey/dev2/10.0/sql/sql_select.cc:2431
#8 0x000000000069e2aa in JOIN::exec (this=0x7fffa0075068) at /home/psergey/dev2/10.0/sql/sql_select.cc:2370
#9 0x00000000006a1869 in mysql_select (thd=0x31d1050, rref_pointer_array=0x31d56c0, tables=0x0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=3489925892, result=0x7fffa0008288, unit=0x31d4d60, select_lex=0x31d5448) at /home/psergey/dev2/10.0/sql/sql_select.cc:3308
#10 0x0000000000697b7b in handle_select (thd=0x31d1050, lex=0x31d4c98, result=0x7fffa0008288, setup_tables_done_option=1073741824) at /home/psergey/dev2/10.0/sql/sql_select.cc:373
#11 0x0000000000665c9f in mysql_execute_command (thd=0x31d1050) at /home/psergey/dev2/10.0/sql/sql_parse.cc:3519
#12 0x000000000066dd51 in mysql_parse (thd=0x31d1050, rawbuf=0x7fffa0006788 "explain replace into t2 select 100, (select a from t1)", length=54, parser_state=0x7fffe00674f0) at /home/psergey/dev2/10.0/sql/sql_parse.cc:6407
select_describe(join, join->select_lex->select_number=1) calls
mysql_explain_union for the subquery.
mysql_explain_union calls mysql_select, which makes this call
//here is EXPLAIN of subselect or derived table
if (join->change_result(result))
{
DBUG_RETURN(TRUE);
}
where the result is select_insert object. The number of columns select_insert
expects is not (and doesn't have to be) equal to number of columns produced by
the subquery, and we get an error.
#3 0x0000000000697b7b in handle_select (thd=0x31d1050, lex=0x31d4c98, result=0x7fffa0008288, setup_tables_done_option=1073741824) at /home/psergey/dev2/10.0/sql/sql_select.cc:373
and it succeeds.
For the second call, see the previous comment. The second call should not have
been made.
Sergei Petrunia
added a comment -
select_insert::prepare is called twice.
The first call is from here:
#0 select_insert::prepare (this=0x7fffa0008288, values=..., u=0x31d4d60) at /home/psergey/dev2/10.0/sql/sql_insert.cc:3364
#1 0x0000000000699753 in JOIN::prepare (this=0x7fffa0075068, rref_pointer_array=0x31d56c0, tables_init=0x0, wild_num=0, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x31d5448, unit_arg=0x31d4d60) at /home/psergey/dev2/10.0/sql/sql_select.cc:967
#2 0x00000000006a17bb in mysql_select (thd=0x31d1050, rref_pointer_array=0x31d56c0, tables=0x0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=3489925892, result=0x7fffa0008288, unit=0x31d4d60, select_lex=0x31d5448) at /home/psergey/dev2/10.0/sql/sql_select.cc:3286
#3 0x0000000000697b7b in handle_select (thd=0x31d1050, lex=0x31d4c98, result=0x7fffa0008288, setup_tables_done_option=1073741824) at /home/psergey/dev2/10.0/sql/sql_select.cc:373
and it succeeds.
For the second call, see the previous comment. The second call should not have
been made.
MDEV-7215 EXPLAIN REPLACE produces an error: Column count doesn't match value count
removed outdated code which was cousing error (no need reassign result for subqueries & Co)
—
Oleksandr Byelkin
added a comment - revision-id: 4e3fa980d47fa511ab2b4b41b7a16b63e27acb2a (mariadb-10.1.8-49-g4e3fa98)
parent(s): a430df3aba59c57b0756c25b1586d880d19286df
committer: Oleksandr Byelkin
timestamp: 2015-11-13 17:47:46 +0100
message:
MDEV-7215 EXPLAIN REPLACE produces an error: Column count doesn't match value count
removed outdated code which was cousing error (no need reassign result for subqueries & Co)
—
One thing I'm wondering about: AffectsVersion is 10.0, but FixVersion is 10.1 and the patch is against 10.1. So, we don't fix it in 10.0, because it's not critical there?
Sergei Petrunia
added a comment - The patch looks ok.
One thing I'm wondering about: AffectsVersion is 10.0, but FixVersion is 10.1 and the patch is against 10.1. So, we don't fix it in 10.0, because it's not critical there?
People
Oleksandr Byelkin
Sergei Petrunia
Votes:
0Vote for this issue
Watchers:
4Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":1757.6999998092651,"ttfb":385.59999990463257,"pageVisibility":"visible","entityId":49135,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"1e3b54d5-2c11-46b8-82e1-56c1dd231b9a","navigationType":0,"readyForUser":1836.9000000953674,"redirectCount":0,"resourceLoadedEnd":2752.4000000953674,"resourceLoadedStart":393.90000009536743,"resourceTiming":[{"duration":770,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":393.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":393.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1163.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":769.8999996185303,"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":394.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":394.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1164.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":823.4000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":394.40000009536743,"connectEnd":394.40000009536743,"connectStart":394.40000009536743,"domainLookupEnd":394.40000009536743,"domainLookupStart":394.40000009536743,"fetchStart":394.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":394.40000009536743,"responseEnd":1217.8000001907349,"responseStart":1217.8000001907349,"secureConnectionStart":394.40000009536743},{"duration":986.4000000953674,"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":394.59999990463257,"connectEnd":394.59999990463257,"connectStart":394.59999990463257,"domainLookupEnd":394.59999990463257,"domainLookupStart":394.59999990463257,"fetchStart":394.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":394.59999990463257,"responseEnd":1381,"responseStart":1381,"secureConnectionStart":394.59999990463257},{"duration":990.5,"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":394.80000019073486,"connectEnd":394.80000019073486,"connectStart":394.80000019073486,"domainLookupEnd":394.80000019073486,"domainLookupStart":394.80000019073486,"fetchStart":394.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":394.80000019073486,"responseEnd":1385.3000001907349,"responseStart":1385.3000001907349,"secureConnectionStart":394.80000019073486},{"duration":991.0999999046326,"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":395,"connectEnd":395,"connectStart":395,"domainLookupEnd":395,"domainLookupStart":395,"fetchStart":395,"redirectEnd":0,"redirectStart":0,"requestStart":395,"responseEnd":1386.0999999046326,"responseStart":1386.0999999046326,"secureConnectionStart":395},{"duration":991.7000002861023,"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":395.19999980926514,"connectEnd":395.19999980926514,"connectStart":395.19999980926514,"domainLookupEnd":395.19999980926514,"domainLookupStart":395.19999980926514,"fetchStart":395.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":395.19999980926514,"responseEnd":1386.9000000953674,"responseStart":1386.9000000953674,"secureConnectionStart":395.19999980926514},{"duration":1015.2999997138977,"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":395.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":395.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1410.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":992.6999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":395.40000009536743,"connectEnd":395.40000009536743,"connectStart":395.40000009536743,"domainLookupEnd":395.40000009536743,"domainLookupStart":395.40000009536743,"fetchStart":395.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":395.40000009536743,"responseEnd":1388.0999999046326,"responseStart":1388,"secureConnectionStart":395.40000009536743},{"duration":1015.2000002861023,"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":395.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":395.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1410.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":993.2999997138977,"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":395.80000019073486,"connectEnd":395.80000019073486,"connectStart":395.80000019073486,"domainLookupEnd":395.80000019073486,"domainLookupStart":395.80000019073486,"fetchStart":395.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":395.80000019073486,"responseEnd":1389.0999999046326,"responseStart":1389.0999999046326,"secureConnectionStart":395.80000019073486},{"duration":2271.5999999046326,"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":401.5,"connectEnd":401.5,"connectStart":401.5,"domainLookupEnd":401.5,"domainLookupStart":401.5,"fetchStart":401.5,"redirectEnd":0,"redirectStart":0,"requestStart":401.5,"responseEnd":2673.0999999046326,"responseStart":2673.0999999046326,"secureConnectionStart":401.5},{"duration":2348.5999999046326,"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":403.80000019073486,"connectEnd":403.80000019073486,"connectStart":403.80000019073486,"domainLookupEnd":403.80000019073486,"domainLookupStart":403.80000019073486,"fetchStart":403.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":403.80000019073486,"responseEnd":2752.4000000953674,"responseStart":2752.4000000953674,"secureConnectionStart":403.80000019073486},{"duration":1242.9000000953674,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1431.4000000953674,"connectEnd":1431.4000000953674,"connectStart":1431.4000000953674,"domainLookupEnd":1431.4000000953674,"domainLookupStart":1431.4000000953674,"fetchStart":1431.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":1431.4000000953674,"responseEnd":2674.300000190735,"responseStart":2674.300000190735,"secureConnectionStart":1431.4000000953674},{"duration":1026.2000002861023,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1751.1999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1751.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":2777.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":165.7000002861023,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":2678.699999809265,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":2678.699999809265,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":2844.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":162.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":2679.699999809265,"connectEnd":2679.699999809265,"connectStart":2679.699999809265,"domainLookupEnd":2679.699999809265,"domainLookupStart":2679.699999809265,"fetchStart":2679.699999809265,"redirectEnd":0,"redirectStart":0,"requestStart":2679.699999809265,"responseEnd":2842.199999809265,"responseStart":2842.199999809265,"secureConnectionStart":2679.699999809265},{"duration":168.7999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/s/097ae97cb8fbec7d6ea4bbb1f26955b9-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":2680.300000190735,"connectEnd":2680.300000190735,"connectStart":2680.300000190735,"domainLookupEnd":2680.300000190735,"domainLookupStart":2680.300000190735,"fetchStart":2680.300000190735,"redirectEnd":0,"redirectStart":0,"requestStart":2680.300000190735,"responseEnd":2849.0999999046326,"responseStart":2849.0999999046326,"secureConnectionStart":2680.300000190735}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":214,"responseStart":385,"responseEnd":403,"domLoading":391,"domInteractive":2786,"domContentLoadedEventStart":2786,"domContentLoadedEventEnd":2840,"domComplete":3081,"loadEventStart":3081,"loadEventEnd":3082,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":2754.5},{"name":"bigPipe.sidebar-id.end","time":2755.300000190735},{"name":"bigPipe.activity-panel-pipe-id.start","time":2755.5},{"name":"bigPipe.activity-panel-pipe-id.end","time":2758.4000000953674},{"name":"activityTabFullyLoaded","time":2860.199999809265}],"measures":[],"correlationId":"ec65d95950cd7d","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":109,"dbReadsTimeInMs":12,"dbConnsTimeInMs":21,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
The error is generated here:
(gdb) wher
#0 my_error (nr=1136, MyFlags=0) at /home/psergey/dev2/10.0/mysys/my_error.c:113
#1 0x00000000006438ad in check_insert_fields (thd=0x31d1050, table_list=0x7fffa00068a0, fields=..., values=..., check_unique=true, fields_and_values_from_different_maps=true, map=0x7fffe0066300) at /home/psergey/dev2/10.0/sql/sql_insert.cc:215
#2 0x000000000064b548 in select_insert::prepare (this=0x7fffa0008288, values=..., u=0x7fffa00072a0) at /home/psergey/dev2/10.0/sql/sql_insert.cc:3377
#3 0x00000000006d5b2a in JOIN::change_result (this=0x7fffa00755a0, res=0x7fffa0008288) at /home/psergey/dev2/10.0/sql/sql_select.cc:24412
#4 0x00000000006a1590 in mysql_select (thd=0x31d1050, rref_pointer_array=0x7fffa00071a0, tables=0x7fffa0007ad8, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748612, result=0x7fffa0008288, unit=0x7fffa00072a0, select_lex=0x7fffa0006f28) at /home/psergey/dev2/10.0/sql/sql_select.cc:3248
#5 0x00000000006d4528 in mysql_explain_union (thd=0x31d1050, unit=0x7fffa00072a0, result=0x7fffa0008288) at /home/psergey/dev2/10.0/sql/sql_select.cc:23924
#6 0x00000000006d4287 in select_describe (join=0x7fffa0075068, need_tmp_table=false, need_order=false, distinct=false, message=0x103585c "No tables used") at /home/psergey/dev2/10.0/sql/sql_select.cc:23881
#7 0x000000000069e670 in JOIN::exec_inner (this=0x7fffa0075068) at /home/psergey/dev2/10.0/sql/sql_select.cc:2431
#8 0x000000000069e2aa in JOIN::exec (this=0x7fffa0075068) at /home/psergey/dev2/10.0/sql/sql_select.cc:2370
#9 0x00000000006a1869 in mysql_select (thd=0x31d1050, rref_pointer_array=0x31d56c0, tables=0x0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=3489925892, result=0x7fffa0008288, unit=0x31d4d60, select_lex=0x31d5448) at /home/psergey/dev2/10.0/sql/sql_select.cc:3308
#10 0x0000000000697b7b in handle_select (thd=0x31d1050, lex=0x31d4c98, result=0x7fffa0008288, setup_tables_done_option=1073741824) at /home/psergey/dev2/10.0/sql/sql_select.cc:373
#11 0x0000000000665c9f in mysql_execute_command (thd=0x31d1050) at /home/psergey/dev2/10.0/sql/sql_parse.cc:3519
#12 0x000000000066dd51 in mysql_parse (thd=0x31d1050, rawbuf=0x7fffa0006788 "explain replace into t2 select 100, (select a from t1)", length=54, parser_state=0x7fffe00674f0) at /home/psergey/dev2/10.0/sql/sql_parse.cc:6407
select_describe(join, join->select_lex->select_number=1) calls
mysql_explain_union for the subquery.
mysql_explain_union calls mysql_select, which makes this call
//here is EXPLAIN of subselect or derived table
if (join->change_result(result))
{
DBUG_RETURN(TRUE);
}
where the result is select_insert object. The number of columns select_insert
expects is not (and doesn't have to be) equal to number of columns produced by
the subquery, and we get an error.