Skip to content
Permalink
Browse files

MDEV-8525 mariadb 10.0.20 crashing when data is read by Kodi media ce…

…nter (http://kodi.tv).

Item_direct_view_ref maintains its own item_const() method so should use it when asked of temporary table field to be in sync with it.
  • Loading branch information...
Oleksandr Byelkin
Oleksandr Byelkin committed Oct 28, 2015
1 parent b0e3f48 commit d88aaaa841aefabce770ad73373363275f606d22
Showing with 217 additions and 0 deletions.
  1. +102 −0 mysql-test/r/view.result
  2. +113 −0 mysql-test/t/view.test
  3. +2 −0 sql/item.h
@@ -5597,6 +5597,108 @@ count(v3.i)
0
drop table t1, t2;
drop view v3;
#
# MDEV-8525: mariadb 10.0.20 crashing when data is read by Kodi
# media center (http://kodi.tv).
#
CREATE TABLE `t1` (
`idSong` int(11) NOT NULL AUTO_INCREMENT,
`idAlbum` int(11) DEFAULT NULL,
`idPath` int(11) DEFAULT NULL,
`strArtists` text,
`strGenres` text,
`strTitle` varchar(512) DEFAULT NULL,
`iTrack` int(11) DEFAULT NULL,
`iDuration` int(11) DEFAULT NULL,
`iYear` int(11) DEFAULT NULL,
`dwFileNameCRC` text,
`strFileName` text,
`strMusicBrainzTrackID` text,
`iTimesPlayed` int(11) DEFAULT NULL,
`iStartOffset` int(11) DEFAULT NULL,
`iEndOffset` int(11) DEFAULT NULL,
`idThumb` int(11) DEFAULT NULL,
`lastplayed` varchar(20) DEFAULT NULL,
`rating` char(1) DEFAULT '0',
`comment` text,
`mood` text,
PRIMARY KEY (`idSong`),
UNIQUE KEY `idxSong7` (`idAlbum`,`strMusicBrainzTrackID`(36)),
KEY `idxSong` (`strTitle`(255)),
KEY `idxSong1` (`iTimesPlayed`),
KEY `idxSong2` (`lastplayed`),
KEY `idxSong3` (`idAlbum`),
KEY `idxSong6` (`idPath`,`strFileName`(255))
) DEFAULT CHARSET=utf8;
INSERT INTO `t1` VALUES (1,1,1,'strArtists1','strGenres1','strTitle1',1,100,2000,NULL,'strFileName1','strMusicBrainzTrackID1',0,0,0,NULL,NULL,'0','',''),(2,2,2,'strArtists2','strGenres2','strTitle2',2,200,2001,NULL,'strFileName2','strMusicBrainzTrackID2',0,0,0,NULL,NULL,'0','','');
CREATE TABLE `t2` (
`idAlbum` int(11) NOT NULL AUTO_INCREMENT,
`strAlbum` varchar(256) DEFAULT NULL,
`strMusicBrainzAlbumID` text,
`strArtists` text,
`strGenres` text,
`iYear` int(11) DEFAULT NULL,
`idThumb` int(11) DEFAULT NULL,
`bCompilation` int(11) NOT NULL DEFAULT '0',
`strMoods` text,
`strStyles` text,
`strThemes` text,
`strReview` text,
`strImage` text,
`strLabel` text,
`strType` text,
`iRating` int(11) DEFAULT NULL,
`lastScraped` varchar(20) DEFAULT NULL,
`dateAdded` varchar(20) DEFAULT NULL,
`strReleaseType` text,
PRIMARY KEY (`idAlbum`),
UNIQUE KEY `idxAlbum_2` (`strMusicBrainzAlbumID`(36)),
KEY `idxAlbum` (`strAlbum`(255)),
KEY `idxAlbum_1` (`bCompilation`)
) DEFAULT CHARSET=utf8;
INSERT INTO `t2` VALUES (1,'strAlbum1','strMusicBrainzAlbumID1','strArtists1','strGenres1',2000,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'album');
CREATE TABLE `t3` (
`idArtist` int(11) DEFAULT NULL,
`idAlbum` int(11) DEFAULT NULL,
`strJoinPhrase` text,
`boolFeatured` int(11) DEFAULT NULL,
`iOrder` int(11) DEFAULT NULL,
`strArtist` text,
UNIQUE KEY `idxAlbumArtist_1` (`idAlbum`,`idArtist`),
UNIQUE KEY `idxAlbumArtist_2` (`idArtist`,`idAlbum`),
KEY `idxAlbumArtist_3` (`boolFeatured`)
) DEFAULT CHARSET=utf8;
INSERT INTO `t3` VALUES (1,1,'',0,0,'strArtist1');
CREATE TABLE `t4` (
`idArtist` int(11) NOT NULL AUTO_INCREMENT,
`strArtist` varchar(256) DEFAULT NULL,
`strMusicBrainzArtistID` text,
`strBorn` text,
`strFormed` text,
`strGenres` text,
`strMoods` text,
`strStyles` text,
`strInstruments` text,
`strBiography` text,
`strDied` text,
`strDisbanded` text,
`strYearsActive` text,
`strImage` text,
`strFanart` text,
`lastScraped` varchar(20) DEFAULT NULL,
`dateAdded` varchar(20) DEFAULT NULL,
PRIMARY KEY (`idArtist`),
UNIQUE KEY `idxArtist1` (`strMusicBrainzArtistID`(36)),
KEY `idxArtist` (`strArtist`(255))
) DEFAULT CHARSET=utf8;
INSERT INTO `t4` VALUES (1,'strArtist1','strMusicBrainzArtistID',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
CREATE VIEW `v1` AS select `t2`.`idAlbum` AS `idAlbum`,`t2`.`strAlbum` AS `strAlbum`,`t2`.`strMusicBrainzAlbumID` AS `strMusicBrainzAlbumID`,`t2`.`strArtists` AS `strArtists`,`t2`.`strGenres` AS `strGenres`,`t2`.`iYear` AS `iYear`,`t2`.`strMoods` AS `strMoods`,`t2`.`strStyles` AS `strStyles`,`t2`.`strThemes` AS `strThemes`,`t2`.`strReview` AS `strReview`,`t2`.`strLabel` AS `strLabel`,`t2`.`strType` AS `strType`,`t2`.`strImage` AS `strImage`,`t2`.`iRating` AS `iRating`,`t2`.`bCompilation` AS `bCompilation`,(select min(`t1`.`iTimesPlayed`) from `t1` where (`t1`.`idAlbum` = `t2`.`idAlbum`)) AS `iTimesPlayed`,`t2`.`strReleaseType` AS `strReleaseType` from `t2`;
CREATE VIEW `v2` AS select `t3`.`idAlbum` AS `idAlbum`,`t3`.`idArtist` AS `idArtist`,`t4`.`strArtist` AS `strArtist`,`t4`.`strMusicBrainzArtistID` AS `strMusicBrainzArtistID`,`t3`.`boolFeatured` AS `boolFeatured`,`t3`.`strJoinPhrase` AS `strJoinPhrase`,`t3`.`iOrder` AS `iOrder` from (`t3` join `t4` on((`t3`.`idArtist` = `t4`.`idArtist`)));
SELECT v1.*,v2.* FROM v1 LEFT JOIN v2 ON v1.idAlbum = v2.idAlbum WHERE v1.idAlbum = 1 ORDER BY v2.iOrder;
idAlbum strAlbum strMusicBrainzAlbumID strArtists strGenres iYear strMoods strStyles strThemes strReview strLabel strType strImage iRating bCompilation iTimesPlayed strReleaseType idAlbum idArtist strArtist strMusicBrainzArtistID boolFeatured strJoinPhrase iOrder
1 strAlbum1 strMusicBrainzAlbumID1 strArtists1 strGenres1 2000 NULL NULL NULL NULL NULL NULL NULL NULL 0 0 album 1 1 strArtist1 strMusicBrainzArtistID 0 0
drop view v1,v2;
drop table t1,t2,t3,t4;
# -----------------------------------------------------------------
# -- End of 10.0 tests.
# -----------------------------------------------------------------
@@ -5489,6 +5489,119 @@ execute stmt;
drop table t1, t2;
drop view v3;

--echo #
--echo # MDEV-8525: mariadb 10.0.20 crashing when data is read by Kodi
--echo # media center (http://kodi.tv).
--echo #

CREATE TABLE `t1` (
`idSong` int(11) NOT NULL AUTO_INCREMENT,
`idAlbum` int(11) DEFAULT NULL,
`idPath` int(11) DEFAULT NULL,
`strArtists` text,
`strGenres` text,
`strTitle` varchar(512) DEFAULT NULL,
`iTrack` int(11) DEFAULT NULL,
`iDuration` int(11) DEFAULT NULL,
`iYear` int(11) DEFAULT NULL,
`dwFileNameCRC` text,
`strFileName` text,
`strMusicBrainzTrackID` text,
`iTimesPlayed` int(11) DEFAULT NULL,
`iStartOffset` int(11) DEFAULT NULL,
`iEndOffset` int(11) DEFAULT NULL,
`idThumb` int(11) DEFAULT NULL,
`lastplayed` varchar(20) DEFAULT NULL,
`rating` char(1) DEFAULT '0',
`comment` text,
`mood` text,
PRIMARY KEY (`idSong`),
UNIQUE KEY `idxSong7` (`idAlbum`,`strMusicBrainzTrackID`(36)),
KEY `idxSong` (`strTitle`(255)),
KEY `idxSong1` (`iTimesPlayed`),
KEY `idxSong2` (`lastplayed`),
KEY `idxSong3` (`idAlbum`),
KEY `idxSong6` (`idPath`,`strFileName`(255))
) DEFAULT CHARSET=utf8;

INSERT INTO `t1` VALUES (1,1,1,'strArtists1','strGenres1','strTitle1',1,100,2000,NULL,'strFileName1','strMusicBrainzTrackID1',0,0,0,NULL,NULL,'0','',''),(2,2,2,'strArtists2','strGenres2','strTitle2',2,200,2001,NULL,'strFileName2','strMusicBrainzTrackID2',0,0,0,NULL,NULL,'0','','');

CREATE TABLE `t2` (
`idAlbum` int(11) NOT NULL AUTO_INCREMENT,
`strAlbum` varchar(256) DEFAULT NULL,
`strMusicBrainzAlbumID` text,
`strArtists` text,
`strGenres` text,
`iYear` int(11) DEFAULT NULL,
`idThumb` int(11) DEFAULT NULL,
`bCompilation` int(11) NOT NULL DEFAULT '0',
`strMoods` text,
`strStyles` text,
`strThemes` text,
`strReview` text,
`strImage` text,
`strLabel` text,
`strType` text,
`iRating` int(11) DEFAULT NULL,
`lastScraped` varchar(20) DEFAULT NULL,
`dateAdded` varchar(20) DEFAULT NULL,
`strReleaseType` text,
PRIMARY KEY (`idAlbum`),
UNIQUE KEY `idxAlbum_2` (`strMusicBrainzAlbumID`(36)),
KEY `idxAlbum` (`strAlbum`(255)),
KEY `idxAlbum_1` (`bCompilation`)
) DEFAULT CHARSET=utf8;

INSERT INTO `t2` VALUES (1,'strAlbum1','strMusicBrainzAlbumID1','strArtists1','strGenres1',2000,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'album');

CREATE TABLE `t3` (
`idArtist` int(11) DEFAULT NULL,
`idAlbum` int(11) DEFAULT NULL,
`strJoinPhrase` text,
`boolFeatured` int(11) DEFAULT NULL,
`iOrder` int(11) DEFAULT NULL,
`strArtist` text,
UNIQUE KEY `idxAlbumArtist_1` (`idAlbum`,`idArtist`),
UNIQUE KEY `idxAlbumArtist_2` (`idArtist`,`idAlbum`),
KEY `idxAlbumArtist_3` (`boolFeatured`)
) DEFAULT CHARSET=utf8;

INSERT INTO `t3` VALUES (1,1,'',0,0,'strArtist1');

CREATE TABLE `t4` (
`idArtist` int(11) NOT NULL AUTO_INCREMENT,
`strArtist` varchar(256) DEFAULT NULL,
`strMusicBrainzArtistID` text,
`strBorn` text,
`strFormed` text,
`strGenres` text,
`strMoods` text,
`strStyles` text,
`strInstruments` text,
`strBiography` text,
`strDied` text,
`strDisbanded` text,
`strYearsActive` text,
`strImage` text,
`strFanart` text,
`lastScraped` varchar(20) DEFAULT NULL,
`dateAdded` varchar(20) DEFAULT NULL,
PRIMARY KEY (`idArtist`),
UNIQUE KEY `idxArtist1` (`strMusicBrainzArtistID`(36)),
KEY `idxArtist` (`strArtist`(255))
) DEFAULT CHARSET=utf8;

INSERT INTO `t4` VALUES (1,'strArtist1','strMusicBrainzArtistID',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);

CREATE VIEW `v1` AS select `t2`.`idAlbum` AS `idAlbum`,`t2`.`strAlbum` AS `strAlbum`,`t2`.`strMusicBrainzAlbumID` AS `strMusicBrainzAlbumID`,`t2`.`strArtists` AS `strArtists`,`t2`.`strGenres` AS `strGenres`,`t2`.`iYear` AS `iYear`,`t2`.`strMoods` AS `strMoods`,`t2`.`strStyles` AS `strStyles`,`t2`.`strThemes` AS `strThemes`,`t2`.`strReview` AS `strReview`,`t2`.`strLabel` AS `strLabel`,`t2`.`strType` AS `strType`,`t2`.`strImage` AS `strImage`,`t2`.`iRating` AS `iRating`,`t2`.`bCompilation` AS `bCompilation`,(select min(`t1`.`iTimesPlayed`) from `t1` where (`t1`.`idAlbum` = `t2`.`idAlbum`)) AS `iTimesPlayed`,`t2`.`strReleaseType` AS `strReleaseType` from `t2`;

CREATE VIEW `v2` AS select `t3`.`idAlbum` AS `idAlbum`,`t3`.`idArtist` AS `idArtist`,`t4`.`strArtist` AS `strArtist`,`t4`.`strMusicBrainzArtistID` AS `strMusicBrainzArtistID`,`t3`.`boolFeatured` AS `boolFeatured`,`t3`.`strJoinPhrase` AS `strJoinPhrase`,`t3`.`iOrder` AS `iOrder` from (`t3` join `t4` on((`t3`.`idArtist` = `t4`.`idArtist`)));

SELECT v1.*,v2.* FROM v1 LEFT JOIN v2 ON v1.idAlbum = v2.idAlbum WHERE v1.idAlbum = 1 ORDER BY v2.iOrder;

drop view v1,v2;
drop table t1,t2,t3,t4;

--echo # -----------------------------------------------------------------
--echo # -- End of 10.0 tests.
--echo # -----------------------------------------------------------------
@@ -3770,6 +3770,8 @@ class Item_direct_view_ref :public Item_direct_ref
bool eq(const Item *item, bool binary_cmp) const;
Item *get_tmp_table_item(THD *thd)
{
if (const_item())
return copy_or_same(thd);
Item *item= Item_ref::get_tmp_table_item(thd);
item->name= name;
return item;

0 comments on commit d88aaaa

Please sign in to comment.
You can’t perform that action at this time.