DROP FUNCTION IF EXISTS f1;
|
CREATE FUNCTION f1() RETURNS INT RETURN 1;
|
CREATE OR REPLACE TABLE t1 SELECT f1() AS a;
|
crashes the server with this stack trace:
#0 0x00000000005e7e77 in wait_while_table_is_used (thd=0x7fff9a6b0070,
|
table=0x0, function=HA_EXTRA_NOT_USED)
|
at /home/bar/maria-git/server-10.0/sql/sql_base.cc:1835
|
#1 0x00000000006f0e5c in mysql_rm_table_no_locks (thd=0x7fff9a6b0070,
|
tables=0x7ffff7f7ba70, if_exists=false, drop_temporary=false,
|
drop_view=false, dont_log_query=true, dont_free_locks=true)
|
at /home/bar/maria-git/server-10.0/sql/sql_table.cc:2469
|
#2 0x00000000006f7126 in create_table_impl (thd=0x7fff9a6b0070,
|
orig_db=0x7fff918d3770 "test", orig_table_name=0x7fff918d3158 "t1",
|
db=0x7fff918d3770 "test", table_name=0x7fff918d3158 "t1",
|
path=0x7ffff7f7c520 "./test/t1", create_info=0x7ffff7f7dc50,
|
alter_info=0x7ffff7f7dbc0, create_table_mode=1, is_trans=0x0,
|
key_info=0x7ffff7f7c728, key_count=0x7ffff7f7c724, frm=0x7ffff7f7c510)
|
at /home/bar/maria-git/server-10.0/sql/sql_table.cc:4738
|
#3 0x00000000006f7a26 in mysql_create_table_no_lock (thd=0x7fff9a6b0070,
|
db=0x7fff918d3770 "test", table_name=0x7fff918d3158 "t1",
|
create_info=0x7ffff7f7dc50, alter_info=0x7ffff7f7dbc0, is_trans=0x0,
|
create_table_mode=1)
|
at /home/bar/maria-git/server-10.0/sql/sql_table.cc:4941
|
#4 0x00000000006338ec in create_table_from_items (thd=0x7fff9a6b0070,
|
create_info=0x7ffff7f7dc50, create_table=0x7fff918d3190,
|
alter_info=0x7ffff7f7dbc0, items=0x7fff9a6b41e8, lock=0x7ffff7f7d898,
|
hooks=0x7ffff7f7d850)
|
at /home/bar/maria-git/server-10.0/sql/sql_insert.cc:3955
|
#5 0x0000000000633f7b in select_create::prepare (this=0x7fff918d4e10,
|
values=..., u=0x7fff9a6b39e0)
|
at /home/bar/maria-git/server-10.0/sql/sql_insert.cc:4128
|
#6 0x000000000067ead0 in JOIN::prepare (this=0x7fff919b6088,
|
rref_pointer_array=0x7fff9a6b4348, 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=0x7fff9a6b40d0,
|
unit_arg=0x7fff9a6b39e0)
|
at /home/bar/maria-git/server-10.0/sql/sql_select.cc:967
|
....
|
If I rewrite the script as follows:
DROP FUNCTION IF EXISTS f1;
|
CREATE FUNCTION f1() RETURNS INT RETURN 1;
|
DROP TABLE IF EXISTS t1;
|
CREATE OR REPLACE TABLE t1 SELECT f1() AS a;
|
it does not crash.
- relates to
-
MDEV-10824
Crash in CREATE OR REPLACE TABLE t1 AS SELECT spfunc()
-
-
Closed
{"report":{"fcp":1520.3000001907349,"ttfb":521,"pageVisibility":"visible","entityId":55447,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"817accef-b617-4132-99ed-bf7f4fb5a0f3","navigationType":0,"readyForUser":1601.3000001907349,"redirectCount":0,"resourceLoadedEnd":1756.4000000953674,"resourceLoadedStart":526.5,"resourceTiming":[{"duration":480.2000002861023,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":526.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":526.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1006.7000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":480.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":526.7000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":526.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1007.1000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":532.4000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":527,"connectEnd":527,"connectStart":527,"domainLookupEnd":527,"domainLookupStart":527,"fetchStart":527,"redirectEnd":0,"redirectStart":0,"requestStart":527,"responseEnd":1059.4000000953674,"responseStart":1059.4000000953674,"secureConnectionStart":527},{"duration":612.0999999046326,"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":527.1000003814697,"connectEnd":527.1000003814697,"connectStart":527.1000003814697,"domainLookupEnd":527.1000003814697,"domainLookupStart":527.1000003814697,"fetchStart":527.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":527.1000003814697,"responseEnd":1139.2000002861023,"responseStart":1139.1000003814697,"secureConnectionStart":527.1000003814697},{"duration":615.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":527.4000000953674,"connectEnd":527.4000000953674,"connectStart":527.4000000953674,"domainLookupEnd":527.4000000953674,"domainLookupStart":527.4000000953674,"fetchStart":527.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":527.4000000953674,"responseEnd":1142.9000000953674,"responseStart":1142.9000000953674,"secureConnectionStart":527.4000000953674},{"duration":615.7999997138977,"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":527.6000003814697,"connectEnd":527.6000003814697,"connectStart":527.6000003814697,"domainLookupEnd":527.6000003814697,"domainLookupStart":527.6000003814697,"fetchStart":527.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":527.6000003814697,"responseEnd":1143.4000000953674,"responseStart":1143.4000000953674,"secureConnectionStart":527.6000003814697},{"duration":616,"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":527.8000001907349,"connectEnd":527.8000001907349,"connectStart":527.8000001907349,"domainLookupEnd":527.8000001907349,"domainLookupStart":527.8000001907349,"fetchStart":527.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":527.8000001907349,"responseEnd":1143.8000001907349,"responseStart":1143.8000001907349,"secureConnectionStart":527.8000001907349},{"duration":675.4000000953674,"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":527.9000000953674,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":527.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1203.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":616.0999999046326,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":528.1000003814697,"connectEnd":528.1000003814697,"connectStart":528.1000003814697,"domainLookupEnd":528.1000003814697,"domainLookupStart":528.1000003814697,"fetchStart":528.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":528.1000003814697,"responseEnd":1144.2000002861023,"responseStart":1144.2000002861023,"secureConnectionStart":528.1000003814697},{"duration":675.2999997138977,"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":528.2000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":528.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1203.5,"responseStart":0,"secureConnectionStart":0},{"duration":617,"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":528.3000001907349,"connectEnd":528.3000001907349,"connectStart":528.3000001907349,"domainLookupEnd":528.3000001907349,"domainLookupStart":528.3000001907349,"fetchStart":528.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":528.3000001907349,"responseEnd":1145.3000001907349,"responseStart":1145.3000001907349,"secureConnectionStart":528.3000001907349},{"duration":1209.0999999046326,"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":529.1000003814697,"connectEnd":529.1000003814697,"connectStart":529.1000003814697,"domainLookupEnd":529.1000003814697,"domainLookupStart":529.1000003814697,"fetchStart":529.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":529.1000003814697,"responseEnd":1738.2000002861023,"responseStart":1738.2000002861023,"secureConnectionStart":529.1000003814697},{"duration":1205.8000001907349,"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":533.3000001907349,"connectEnd":533.3000001907349,"connectStart":533.3000001907349,"domainLookupEnd":533.3000001907349,"domainLookupStart":533.3000001907349,"fetchStart":533.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":533.3000001907349,"responseEnd":1739.1000003814697,"responseStart":1739,"secureConnectionStart":533.3000001907349},{"duration":192.59999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1215.4000000953674,"connectEnd":1215.4000000953674,"connectStart":1215.4000000953674,"domainLookupEnd":1215.4000000953674,"domainLookupStart":1215.4000000953674,"fetchStart":1215.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":1215.4000000953674,"responseEnd":1408,"responseStart":1408,"secureConnectionStart":1215.4000000953674},{"duration":282.40000009536743,"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":1474,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1474,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1756.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":284.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":1475,"connectEnd":1475,"connectStart":1475,"domainLookupEnd":1475,"domainLookupStart":1475,"fetchStart":1475,"redirectEnd":0,"redirectStart":0,"requestStart":1475,"responseEnd":1759.5,"responseStart":1759.5,"secureConnectionStart":1475},{"duration":290.30000019073486,"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":1475.4000000953674,"connectEnd":1475.4000000953674,"connectStart":1475.4000000953674,"domainLookupEnd":1475.4000000953674,"domainLookupStart":1475.4000000953674,"fetchStart":1475.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":1475.4000000953674,"responseEnd":1765.7000002861023,"responseStart":1765.7000002861023,"secureConnectionStart":1475.4000000953674}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":358,"responseStart":521,"responseEnd":526,"domLoading":524,"domInteractive":1757,"domContentLoadedEventStart":1757,"domContentLoadedEventEnd":1801,"domComplete":2401,"loadEventStart":2401,"loadEventEnd":2402,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1742},{"name":"bigPipe.sidebar-id.end","time":1742.8000001907349},{"name":"bigPipe.activity-panel-pipe-id.start","time":1742.9000000953674},{"name":"bigPipe.activity-panel-pipe-id.end","time":1744.8000001907349},{"name":"activityTabFullyLoaded","time":1822.2000002861023}],"measures":[],"correlationId":"4152f8038aa5d6","effectiveType":"4g","downlink":9.1,"rtt":0,"serverDuration":101,"dbReadsTimeInMs":13,"dbConnsTimeInMs":23,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
So, the full test case is actually this:
CREATE TABLE t1 (i INT);
DROP FUNCTION IF EXISTS f1;
CREATE FUNCTION f1() RETURNS INT RETURN 1;
CREATE OR REPLACE TABLE t1 SELECT f1() AS a;
(the table should already exist).