A valid SQL query is
select nullif(count(distinct col1),0) from table1 ;
|
now if I create this as a view with
create view counts4 AS select nullif(count(distinct col1),0) from table1 ;
|
and try to look at the view I get an error
select * from counts4;
|
/* SQL Error (1064): 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 '<cache>(count(distinct `testdb5`.`table1`.`col1`)),0) AS `nullif(count(distinct ' at line 1 */
|
this exact same procedure works fine on mariadb 10.0.23
and this bug may have something to do with https://lists.launchpad.net/maria-developers/msg09111.html
I can't test it on 10.1.10 since windows wont allow me to downgrade and I cant uninstall.
This (again) affects all kodi users that can't create db's anymore 
to recreate db
CREATE DATABASE IF NOT EXISTS `testdb5`
|
USE `testdb5`;
|
|
CREATE TABLE IF NOT EXISTS `table1` (
|
`col1` varchar(50) DEFAULT NULL
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
Thanks!
{"report":{"fcp":764.5,"ttfb":153.89999985694885,"pageVisibility":"visible","entityId":55606,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"e6c7dfc0-4191-400d-86fb-0281763a3b38","navigationType":0,"readyForUser":872.2000000476837,"redirectCount":0,"resourceLoadedEnd":503.2999999523163,"resourceLoadedStart":162.70000004768372,"resourceTiming":[{"duration":12.099999904632568,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bsh/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":162.70000004768372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":162.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":174.79999995231628,"responseStart":0,"secureConnectionStart":0},{"duration":12.200000047683716,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bsh/820016/12ta74/eb142f92e4bd16bd1ef8b08c1b9d5d56/_/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":163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":175.20000004768372,"responseStart":0,"secureConnectionStart":0},{"duration":198.20000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/s/b09d0d077992e4331b5f9ec0d3ec448c-CDN/lu2bsh/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":163.09999990463257,"connectEnd":163.09999990463257,"connectStart":163.09999990463257,"domainLookupEnd":163.09999990463257,"domainLookupStart":163.09999990463257,"fetchStart":163.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":180.89999985694885,"responseEnd":361.2999999523163,"responseStart":203.5,"secureConnectionStart":163.09999990463257},{"duration":339.7000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/b47ab3df14096803b180217eb8482517-CDN/lu2bsh/820016/12ta74/eb142f92e4bd16bd1ef8b08c1b9d5d56/_/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":163.59999990463257,"connectEnd":163.59999990463257,"connectStart":163.59999990463257,"domainLookupEnd":163.59999990463257,"domainLookupStart":163.59999990463257,"fetchStart":163.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":181.39999985694885,"responseEnd":503.2999999523163,"responseStart":221.09999990463257,"secureConnectionStart":163.59999990463257},{"duration":49.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/6c569cbf8087ab04e40d0bef98627457-CDN/lu2bsh/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":163.70000004768372,"connectEnd":163.70000004768372,"connectStart":163.70000004768372,"domainLookupEnd":163.70000004768372,"domainLookupStart":163.70000004768372,"fetchStart":163.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":186.59999990463257,"responseEnd":212.79999995231628,"responseStart":209.5,"secureConnectionStart":163.70000004768372},{"duration":48.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bsh/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":163.79999995231628,"connectEnd":163.79999995231628,"connectStart":163.79999995231628,"domainLookupEnd":163.79999995231628,"domainLookupStart":163.79999995231628,"fetchStart":163.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":186.70000004768372,"responseEnd":212.29999995231628,"responseStart":208.79999995231628,"secureConnectionStart":163.79999995231628},{"duration":18.59999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bsh/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":164,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":164,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":182.59999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":49.39999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bsh/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":164,"connectEnd":164,"connectStart":164,"domainLookupEnd":164,"domainLookupStart":164,"fetchStart":164,"redirectEnd":0,"redirectStart":0,"requestStart":187.79999995231628,"responseEnd":213.39999985694885,"responseStart":210.59999990463257,"secureConnectionStart":164},{"duration":20.899999856948853,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bsh/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":164.20000004768372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":164.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":185.09999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":49.39999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":164.20000004768372,"connectEnd":164.20000004768372,"connectStart":164.20000004768372,"domainLookupEnd":164.20000004768372,"domainLookupStart":164.20000004768372,"fetchStart":164.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":188,"responseEnd":213.59999990463257,"responseStart":211.29999995231628,"secureConnectionStart":164.20000004768372},{"duration":52.200000047683716,"initiatorType":"script","name":"https://jira.mariadb.org/s/81b5d7c27af3ebc078cc4a36383678ba-CDN/lu2bsh/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":164.39999985694885,"connectEnd":164.39999985694885,"connectStart":164.39999985694885,"domainLookupEnd":164.39999985694885,"domainLookupStart":164.39999985694885,"fetchStart":164.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":188.89999985694885,"responseEnd":216.59999990463257,"responseStart":213.79999995231628,"secureConnectionStart":164.39999985694885},{"duration":270.2999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bsh/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":170.5,"connectEnd":170.5,"connectStart":170.5,"domainLookupEnd":170.5,"domainLookupStart":170.5,"fetchStart":170.5,"redirectEnd":0,"redirectStart":0,"requestStart":258.09999990463257,"responseEnd":440.7999999523163,"responseStart":433,"secureConnectionStart":170.5},{"duration":263.39999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bsh/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":178.70000004768372,"connectEnd":178.70000004768372,"connectStart":178.70000004768372,"domainLookupEnd":178.70000004768372,"domainLookupStart":178.70000004768372,"fetchStart":178.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":290.7000000476837,"responseEnd":442.09999990463257,"responseStart":434.7000000476837,"secureConnectionStart":178.70000004768372},{"duration":83.39999985694885,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":504.7000000476837,"connectEnd":504.7000000476837,"connectStart":504.7000000476837,"domainLookupEnd":504.7000000476837,"domainLookupStart":504.7000000476837,"fetchStart":504.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":557.7000000476837,"responseEnd":588.0999999046326,"responseStart":587.2000000476837,"secureConnectionStart":504.7000000476837},{"duration":223,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":757.2000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":757.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":980.2000000476837,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":10,"responseStart":154,"responseEnd":178,"domLoading":157,"domInteractive":933,"domContentLoadedEventStart":933,"domContentLoadedEventEnd":980,"domComplete":1461,"loadEventStart":1461,"loadEventEnd":1462,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":904.5999999046326},{"name":"bigPipe.sidebar-id.end","time":905.3999998569489},{"name":"bigPipe.activity-panel-pipe-id.start","time":905.7000000476837},{"name":"bigPipe.activity-panel-pipe-id.end","time":906.7000000476837},{"name":"activityTabFullyLoaded","time":997.2000000476837}],"measures":[],"correlationId":"d40990fa16990","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":72,"dbReadsTimeInMs":10,"dbConnsTimeInMs":17,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Thanks for the report.
create table table1 (col1 int);
create view counts4 AS select nullif(count(distinct col1),0) from table1 ;
show create view counts4;
The behavior changed with this commit:
commit ce40ccaf24af2fe395f541cb1079256de8727ccd
Author: Alexander Barkov <bar@mariadb.org>
Date: Thu Jan 28 13:58:39 2016 +0400
MDEV-9181 (NULLIF(count(table.col)), 0) gives wrong result on 10.1.x
Wrapping args[0] and args[2] into an Item_cache for aggregate functions.
Before the commit, SHOW CREATE VIEW would pass on a non-debug build; but on debug build, we wouldn't even get this far, because CREATE VIEW would cause an assertion failure. The patch made the assertion failure go away, but now SHOW CREATE fails as described.