How to reproduce, setup:
CREATE TABLE t1(val int);
|
INSERT INTO t1 VALUES (1), (2), (3);
|
|
CREATE VIEW v1 AS SELECT MEDIAN(val) OVER() FROM t1;
|
All of the above statements succeed without warnings.
Direct median query works:
MariaDB [test]> select median(val) OVER () FROM t1;
|
+---------------------+
|
| median(val) OVER () |
|
+---------------------+
|
| 2.0000000000 |
|
| 2.0000000000 |
|
| 2.0000000000 |
|
+---------------------+
|
3 rows in set (0.00 sec)
|
Doing this by using the view doesn't:
MariaDB [test]> SELECT * FROM v1;
|
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'over ( order by `test`.`t1`.`val` desc) AS `MEDIAN(val) OVER()` from `test`.`t1`' at line 1
|
And even SHOW CREATE VIEW fails with the same syntax error:
MariaDB [test]> SHOW CREATE VIEW v1;
|
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'over ( order by `test`.`t1`.`val` desc) AS `MEDIAN(val) OVER()` from `test`.`t1`' at line 1
|
Also the view shows up in SHOW TABLES output, but not in the INFORMATION_SCHEMA.VIEWS table:
MariaDB [test]> show tables;
|
+----------------+
|
| Tables_in_test |
|
+----------------+
|
| t1 |
|
| v1 |
|
+----------------+
|
|
MariaDB [test]> SELECT * FROM INFORMATION_SCHEMA.VIEWS;
|
Empty set (0.00 sec)
|
The views v1.frm file looks like this:
TYPE=VIEW
|
query=select percentile_cont(0.5) over ( order by `test`.`t1`.`val` desc) AS `MEDIAN(val) OVER()` from `test`.`t1`
|
md5=69b78fe9f2a70d478f26a26535b7a029
|
updatable=0
|
algorithm=0
|
definer_user=
|
definer_host=localhost
|
suid=2
|
with_check_option=0
|
timestamp=2018-09-05 11:11:08
|
create-version=2
|
source=SELECT MEDIAN(val) OVER() FROM t1
|
client_cs_name=utf8
|
connection_cl_name=utf8_general_ci
|
view_body_utf8=select percentile_cont(0.5) over ( order by `test`.`t1`.`val` desc) AS `MEDIAN(val) OVER()` from `test`.`t1`
|
mariadb-version=100309
|
{"report":{"fcp":1275.3000001907349,"ttfb":579.3999996185303,"pageVisibility":"visible","entityId":69504,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":32,"apdex":0.5,"journeyId":"c9f4f063-b4bd-4568-9e07-ba25b8625373","navigationType":0,"readyForUser":1355.3000001907349,"redirectCount":0,"resourceLoadedEnd":992.3000001907349,"resourceLoadedStart":585.8000001907349,"resourceTiming":[{"duration":175.5999994277954,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":585.8000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":585.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":761.3999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":175.69999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/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":586,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":586,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":761.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":184.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":586.1999998092651,"connectEnd":586.1999998092651,"connectStart":586.1999998092651,"domainLookupEnd":586.1999998092651,"domainLookupStart":586.1999998092651,"fetchStart":586.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":586.1999998092651,"responseEnd":770.8999996185303,"responseStart":770.8999996185303,"secureConnectionStart":586.1999998092651},{"duration":275.4000005722046,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/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":586.3999996185303,"connectEnd":586.3999996185303,"connectStart":586.3999996185303,"domainLookupEnd":586.3999996185303,"domainLookupStart":586.3999996185303,"fetchStart":586.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":586.3999996185303,"responseEnd":861.8000001907349,"responseStart":861.8000001907349,"secureConnectionStart":586.3999996185303},{"duration":278.69999980926514,"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":586.6999998092651,"connectEnd":586.6999998092651,"connectStart":586.6999998092651,"domainLookupEnd":586.6999998092651,"domainLookupStart":586.6999998092651,"fetchStart":586.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":586.6999998092651,"responseEnd":865.3999996185303,"responseStart":865.3999996185303,"secureConnectionStart":586.6999998092651},{"duration":279,"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":586.8999996185303,"connectEnd":586.8999996185303,"connectStart":586.8999996185303,"domainLookupEnd":586.8999996185303,"domainLookupStart":586.8999996185303,"fetchStart":586.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":586.8999996185303,"responseEnd":865.8999996185303,"responseStart":865.8999996185303,"secureConnectionStart":586.8999996185303},{"duration":279.30000019073486,"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":587,"connectEnd":587,"connectStart":587,"domainLookupEnd":587,"domainLookupStart":587,"fetchStart":587,"redirectEnd":0,"redirectStart":0,"requestStart":587,"responseEnd":866.3000001907349,"responseStart":866.3000001907349,"secureConnectionStart":587},{"duration":328.5,"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":587.1999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":587.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":915.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":279.3999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":587.3000001907349,"connectEnd":587.3000001907349,"connectStart":587.3000001907349,"domainLookupEnd":587.3000001907349,"domainLookupStart":587.3000001907349,"fetchStart":587.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":587.3000001907349,"responseEnd":866.6999998092651,"responseStart":866.6999998092651,"secureConnectionStart":587.3000001907349},{"duration":328.19999980926514,"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":587.6000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":587.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":915.8000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":279.5,"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":587.6999998092651,"connectEnd":587.6999998092651,"connectStart":587.6999998092651,"domainLookupEnd":587.6999998092651,"domainLookupStart":587.6999998092651,"fetchStart":587.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":587.6999998092651,"responseEnd":867.1999998092651,"responseStart":867.1999998092651,"secureConnectionStart":587.6999998092651},{"duration":376.69999980926514,"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":588.6000003814697,"connectEnd":588.6000003814697,"connectStart":588.6000003814697,"domainLookupEnd":588.6000003814697,"domainLookupStart":588.6000003814697,"fetchStart":588.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":588.6000003814697,"responseEnd":965.3000001907349,"responseStart":965.3000001907349,"secureConnectionStart":588.6000003814697},{"duration":403.69999980926514,"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":588.6000003814697,"connectEnd":588.6000003814697,"connectStart":588.6000003814697,"domainLookupEnd":588.6000003814697,"domainLookupStart":588.6000003814697,"fetchStart":588.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":588.6000003814697,"responseEnd":992.3000001907349,"responseStart":992.3000001907349,"secureConnectionStart":588.6000003814697},{"duration":47.80000019073486,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":930.3000001907349,"connectEnd":930.3000001907349,"connectStart":930.3000001907349,"domainLookupEnd":930.3000001907349,"domainLookupStart":930.3000001907349,"fetchStart":930.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":930.3000001907349,"responseEnd":978.1000003814697,"responseStart":978.1000003814697,"secureConnectionStart":930.3000001907349},{"duration":437.4000005722046,"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","startTime":982.1999998092651,"connectEnd":982.1999998092651,"connectStart":982.1999998092651,"domainLookupEnd":982.1999998092651,"domainLookupStart":982.1999998092651,"fetchStart":982.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":982.1999998092651,"responseEnd":1419.6000003814697,"responseStart":1419.6000003814697,"secureConnectionStart":982.1999998092651},{"duration":189.69999980926514,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1268.8000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1268.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1458.5,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":11,"responseStart":579,"responseEnd":582,"domLoading":583,"domInteractive":1413,"domContentLoadedEventStart":1413,"domContentLoadedEventEnd":1455,"domComplete":2050,"loadEventStart":2050,"loadEventEnd":2052,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1393.3999996185303},{"name":"bigPipe.sidebar-id.end","time":1394.3999996185303},{"name":"bigPipe.activity-panel-pipe-id.start","time":1394.6000003814697},{"name":"bigPipe.activity-panel-pipe-id.end","time":1396.8999996185303},{"name":"activityTabFullyLoaded","time":1464.1000003814697}],"measures":[],"correlationId":"43f805343cfbf3","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":86,"dbReadsTimeInMs":8,"dbConnsTimeInMs":14,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}