Type:
Technical task
Priority:
Major
Resolution:
Fixed
Affects Version/s:
None
Sprint:
10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-4, 10.1.18
When running sql_mode=ORACLE , MariaDB should support:
user defined EXCEPTION declaration
using user defined exceptions in RAISE name (signal)
using user defined exceptions in RAISE (resignal)
using user defined exceptions in EXCEPTION WHEN
DROP FUNCTION f1;
CREATE FUNCTION f1 (a INT ) RETURN INT
AS
e1 EXCEPTION;
BEGIN
IF a < 0 THEN
RAISE e1;
END IF ;
RETURN 0;
EXCEPTION
WHEN e1 THEN RETURN 1;
END ;
/
User defined exception names should be case insensitive.
Details
MariaDB does not support multiple handlers for the same SQLSTATE. This script returns an error:
SET sql_mode= DEFAULT ;
DROP PROCEDURE IF EXISTS p1;
DELIMITER $$
CREATE PROCEDURE p1()
BEGIN
DECLARE c0 CONDITION FOR SQLSTATE '45000' ;
DECLARE c1 CONDITION FOR SQLSTATE '45000' ;
DECLARE CONTINUE HANDLER FOR c0 SET @c0= 0;
DECLARE CONTINUE HANDLER FOR c1 SET @c0= 1;
END ;
$$
ERROR 1413 (42000): Duplicate handler declared in the same block
In sql_mode=ORACLE it will be possible to have multiple user-defined exceptions in the same block. All user defined exceptions will be associated with SQLSTATE '45000' and MySQL errno ER_SIGNAL_EXCEPTION
SET sql_mode=ORACLE;
DELIMITER $$;
CREATE FUNCTION f1(c VARCHAR ) RETURN VARCHAR
AS
e EXCEPTION;
f EXCEPTION;
a VARCHAR (64):= '' ;
BEGIN
BEGIN
IF c = 'e' THEN RAISE e; END IF ;
IF c = 'f' THEN RAISE f; END IF ;
EXCEPTION
WHEN e THEN BEGIN a:= 'Got EXCEPTION1/e; ' ; RAISE e; END ;
WHEN f THEN BEGIN a:= 'Got EXCEPTION1/f; ' ; RAISE f; END ;
END ;
RETURN 'Got no exceptions' ;
EXCEPTION
WHEN OTHERS THEN RETURN a || 'Got EXCEPTION2/OTHERS;' ;
END ;
$$
Notice, both e and f are associated with the same SQLSTATE and errno, but having WHEN e followed by WHEN f is valid, because e and f are different exceptions.
However, specifying the same exception multiple times in WHEN clause will not be possible:
SET sql_mode=ORACLE;
DELIMITER $$;
CREATE FUNCTION f1() RETURN VARCHAR
AS
e EXCEPTION;
BEGIN
RETURN 'Got no exceptions' ;
EXCEPTION
WHEN e THEN RETURN 'Got exception e' ;
WHEN e THEN RETURN 'Got exception e' ;
END ;
$$
The above script will return the ER_SP_DUP_HANDLER error:
ERROR 42000: Duplicate handler declared in the same block
Name space
In MariaDB variables and exceptions (conditions) are in separate name spaces. Oracle-alike user defined exceptions will be in the same name space with MariaDB conditions.
In Oracle, variables and exceptions (conditions) are in the same name space. Placing exceptions and variables into the same name space will be done separately. See MDEV-11058 .
{"report":{"fcp":773.1999999880791,"ttfb":226.9000000357628,"pageVisibility":"visible","entityId":57688,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"cec48ba5-1803-4360-9ad9-ec2e22de6927","navigationType":0,"readyForUser":883.1000000238419,"redirectCount":0,"resourceLoadedEnd":959.4000000357628,"resourceLoadedStart":232.4000000357628,"resourceTiming":[{"duration":11.699999988079071,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":232.4000000357628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":232.4000000357628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":244.10000002384186,"responseStart":0,"secureConnectionStart":0},{"duration":11.899999976158142,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/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","startTime":232.60000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":232.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":244.5,"responseStart":0,"secureConnectionStart":0},{"duration":68.59999996423721,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":232.9000000357628,"connectEnd":232.9000000357628,"connectStart":232.9000000357628,"domainLookupEnd":232.9000000357628,"domainLookupStart":232.9000000357628,"fetchStart":232.9000000357628,"redirectEnd":0,"redirectStart":0,"requestStart":232.9000000357628,"responseEnd":301.5,"responseStart":301.5,"secureConnectionStart":232.9000000357628},{"duration":115.69999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/s/c32eb0da7ad9831253f8397e6cc26afd-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/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","startTime":233,"connectEnd":233,"connectStart":233,"domainLookupEnd":233,"domainLookupStart":233,"fetchStart":233,"redirectEnd":0,"redirectStart":0,"requestStart":233,"responseEnd":348.69999998807907,"responseStart":348.60000002384186,"secureConnectionStart":233},{"duration":119.40000003576279,"initiatorType":"script","name":"https://jira.mariadb.org/s/bc0bcb146314416123c992714ee00ff7-CDN/lu2bv2/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":233.19999998807907,"connectEnd":233.19999998807907,"connectStart":233.19999998807907,"domainLookupEnd":233.19999998807907,"domainLookupStart":233.19999998807907,"fetchStart":233.19999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":233.19999998807907,"responseEnd":352.60000002384186,"responseStart":352.60000002384186,"secureConnectionStart":233.19999998807907},{"duration":119.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":233.5,"connectEnd":233.5,"connectStart":233.5,"domainLookupEnd":233.5,"domainLookupStart":233.5,"fetchStart":233.5,"redirectEnd":0,"redirectStart":0,"requestStart":233.5,"responseEnd":353.10000002384186,"responseStart":353.10000002384186,"secureConnectionStart":233.5},{"duration":119.89999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":233.60000002384186,"connectEnd":233.60000002384186,"connectStart":233.60000002384186,"domainLookupEnd":233.60000002384186,"domainLookupStart":233.60000002384186,"fetchStart":233.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":233.60000002384186,"responseEnd":353.5,"responseStart":353.5,"secureConnectionStart":233.60000002384186},{"duration":209.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bv2/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":233.80000001192093,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":233.80000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":443.30000001192093,"responseStart":0,"secureConnectionStart":0},{"duration":119.90000003576279,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":234,"connectEnd":234,"connectStart":234,"domainLookupEnd":234,"domainLookupStart":234,"fetchStart":234,"redirectEnd":0,"redirectStart":0,"requestStart":234,"responseEnd":353.9000000357628,"responseStart":353.9000000357628,"secureConnectionStart":234},{"duration":209.30000001192093,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bv2/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":234.19999998807907,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":234.19999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":443.5,"responseStart":0,"secureConnectionStart":0},{"duration":120.19999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/s/719848dd97ebe0663199f49a3936487a-CDN/lu2bv2/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":234.30000001192093,"connectEnd":234.30000001192093,"connectStart":234.30000001192093,"domainLookupEnd":234.30000001192093,"domainLookupStart":234.30000001192093,"fetchStart":234.30000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":234.30000001192093,"responseEnd":354.5,"responseStart":354.5,"secureConnectionStart":234.30000001192093},{"duration":341.39999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":239.9000000357628,"connectEnd":239.9000000357628,"connectStart":239.9000000357628,"domainLookupEnd":239.9000000357628,"domainLookupStart":239.9000000357628,"fetchStart":239.9000000357628,"redirectEnd":0,"redirectStart":0,"requestStart":239.9000000357628,"responseEnd":581.3000000119209,"responseStart":581.3000000119209,"secureConnectionStart":239.9000000357628},{"duration":690.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":240.10000002384186,"connectEnd":240.10000002384186,"connectStart":240.10000002384186,"domainLookupEnd":240.10000002384186,"domainLookupStart":240.10000002384186,"fetchStart":240.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":240.10000002384186,"responseEnd":930.6000000238419,"responseStart":930.6000000238419,"secureConnectionStart":240.10000002384186},{"duration":111.39999997615814,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":470.30000001192093,"connectEnd":470.30000001192093,"connectStart":470.30000001192093,"domainLookupEnd":470.30000001192093,"domainLookupStart":470.30000001192093,"fetchStart":470.30000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":470.30000001192093,"responseEnd":581.6999999880791,"responseStart":581.6999999880791,"secureConnectionStart":470.30000001192093},{"duration":216.9000000357628,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2bv2/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","startTime":717,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":717,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":933.9000000357628,"responseStart":0,"secureConnectionStart":0},{"duration":217.0999999642372,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/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","startTime":717.9000000357628,"connectEnd":717.9000000357628,"connectStart":717.9000000357628,"domainLookupEnd":717.9000000357628,"domainLookupStart":717.9000000357628,"fetchStart":717.9000000357628,"redirectEnd":0,"redirectStart":0,"requestStart":717.9000000357628,"responseEnd":935,"responseStart":935,"secureConnectionStart":717.9000000357628},{"duration":241.10000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/53a43b6764f587426c7bb9a150184c00-CDN/lu2bv2/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","startTime":718.3000000119209,"connectEnd":718.3000000119209,"connectStart":718.3000000119209,"domainLookupEnd":718.3000000119209,"domainLookupStart":718.3000000119209,"fetchStart":718.3000000119209,"redirectEnd":0,"redirectStart":0,"requestStart":718.3000000119209,"responseEnd":959.4000000357628,"responseStart":959.4000000357628,"secureConnectionStart":718.3000000119209},{"duration":223.5,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":766.9000000357628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":766.9000000357628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":990.4000000357628,"responseStart":0,"secureConnectionStart":0}],"fetchStart":1,"domainLookupStart":1,"domainLookupEnd":1,"connectStart":1,"connectEnd":1,"requestStart":22,"responseStart":227,"responseEnd":234,"domLoading":231,"domInteractive":1029,"domContentLoadedEventStart":1029,"domContentLoadedEventEnd":1077,"domComplete":1564,"loadEventStart":1564,"loadEventEnd":1566,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":992},{"name":"bigPipe.sidebar-id.end","time":992.9000000357628},{"name":"bigPipe.activity-panel-pipe-id.start","time":993.1000000238419},{"name":"bigPipe.activity-panel-pipe-id.end","time":997},{"name":"activityTabFullyLoaded","time":1088.1000000238419}],"measures":[],"correlationId":"29a98533c6518d","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":129,"dbReadsTimeInMs":26,"dbConnsTimeInMs":35,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}