Description:
A definition of view requres that temporary table is created.
However, a method:
Field *Item::tmp_table_field_from_field_type(TABLE *table)
does not have a switch for MYSQL_TYPE_BIT, which therefore leads to assert in that function and to a crash.
How to repeat:
DROP TABLE IF EXISTS `porttypes`;
CREATE TABLE `porttypes` (
`PortTypeID` int(11) NOT NULL default '0',
`Description` char(16) NOT NULL,
PRIMARY KEY (`PortTypeID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `system`;
CREATE TABLE `system` (
`SystemID` mediumint(9) NOT NULL auto_increment,
`MinTUIPasswordLength` int(11) NOT NULL,
`MaxTUIPasswordLength` int(11) NOT NULL,
`MinGUIPasswordLength` int(11) NOT NULL,
`MaxGUIPasswordLength` int(11) NOT NULL,
`MaxTuiErrors` int(11) NOT NULL,
`DnDigits` int(11) NOT NULL,
`SwitchAutoRestart` bit(1) NOT NULL,
`SAEType` int(11) NOT NULL,
`RemoteSAEType` int(11) NOT NULL,
`RemoteSAEFaxType` int(11) NOT NULL,
`JitterBuffer` int(11) NOT NULL,
`RegistrationStatus` int(11) default NULL,
`MaxPowerDesktops` int(11) NOT NULL,
`GoToQuickLook` bit(1) NOT NULL,
`UnassignedTelephoneUserGroupID` mediumint(9) default NULL,
`T2TSilentHangUp` bit(1) default NULL,
`T2TSHUMinutes` int(11) default NULL,
`T2TGenEvent` bit(1) default NULL,
`T2TGEMinutes` int(11) default NULL,
`T2THangUp` bit(1) default NULL,
`T2THUMinutes` int(11) default NULL,
`ReNumPrefixDigits` char(10) default NULL,
`MaxLogHistoryDays` int(11) NOT NULL,
`MaxLogStorageMegabytes` int(11) NOT NULL,
`ClusterMode` bit(1) default NULL,
`MinMessagesSendLength` int(11) NOT NULL,
`SilenceSuppression` bit(1) default NULL,
`CompressRTPHeaders` bit(1) default NULL,
`DatabaseUpgraded` bit(1) default NULL,
`AMISEnabled` bit(1) default NULL,
`AMISAllowBroadcastDL` bit(1) default NULL,
`AMISAllowSystemDL` bit(1) default NULL,
`UnassignedIPPhoneUserGroupID` mediumint(9) default NULL,
`IPPhoneConfigurationSwitchID1` int(11) default NULL,
`IPPhoneConfigurationSwitchID2` int(11) default NULL,
`QualityOfService` tinyint(3) unsigned default NULL,
`802_1p` tinyint(3) unsigned default NULL,
`ACCUserGroupID` mediumint(9) default NULL,
`ParkTimeout` int(11) NOT NULL,
`EnableRecordingWarningTone` bit(1) NOT NULL,
`IPPhoneWatchDogs` bit(1) NOT NULL,
`MaxTUIPasswordAge` int(11) NOT NULL,
`MaxGUIPasswordAge` int(11) NOT NULL,
`CheckTUIPasswordAgainstHistoryN` int(11) NOT NULL,
`CheckGUIPasswordAgainstHistoryN` int(11) NOT NULL,
`TUIPasswordExpirationWarning` int(11) NOT NULL,
`GUIPasswordExpirationWarning` int(11) NOT NULL,
`PhonePassword` varchar(50) default NULL,
`PhoneAnnouncement` varchar(50) default NULL,
`ConferenceTimeout` int(11) default NULL,
`EmailDeliverySource` varchar(64) default NULL,
`DelayBeforeSendingDTMFToFaxServer` int(11) default NULL,
`UsePort5004` bit(1) NOT NULL,
`SIPKeepAlive` bit(1) NOT NULL,
`MediaEncryption` bit(1) NOT NULL,
`DelayAfterCollectDigits` int(11) default NULL,
`LanguageRegistrationStatus` bit(1) default NULL,
`AllowPCMUpgrade` bit(1) default NULL,
`EnableSIPSessionTimer` bit(1) default NULL,
`SIPSessionInterval` int(11) default NULL,
`SIPRefresher` int(11) default NULL,
PRIMARY KEY (`SystemID`),
KEY `SAETypesSystem` (`SAEType`),
KEY `SAETypesSystem1` (`RemoteSAEType`),
KEY `SAETypesSystem2` (`RemoteSAEFaxType`),
KEY `SwitchesSystemIPPhoneConfig1` (`IPPhoneConfigurationSwitchID1`),
KEY `SwitchesSystemIPPhoneConfig2` (`IPPhoneConfigurationSwitchID2`),
KEY `UserGroupsSystem` (`UnassignedTelephoneUserGroupID`),
KEY `UserGroupsSystemACC` (`ACCUserGroupID`),
KEY `UserGroupsSystemIP` (`UnassignedIPPhoneUserGroupID`),
CONSTRAINT `UserGroupsSystemIP` FOREIGN KEY (`UnassignedIPPhoneUserGroupID`) REFERENCES `usergroups` (`UserGroupID`) ON UPDATE CASCADE,
CONSTRAINT `SAETypesSystem` FOREIGN KEY (`SAEType`) REFERENCES `saetypes` (`SAEID`) ON UPDATE CASCADE,
CONSTRAINT `SAETypesSystem1` FOREIGN KEY (`RemoteSAEType`) REFERENCES `saetypes` (`SAEID`) ON UPDATE CASCADE,
CONSTRAINT `SAETypesSystem2` FOREIGN KEY (`RemoteSAEFaxType`) REFERENCES `saetypes` (`SAEID`) ON UPDATE CASCADE,
CONSTRAINT `SwitchesSystemIPPhoneConfig1` FOREIGN KEY (`IPPhoneConfigurationSwitchID1`) REFERENCES `switches` (`SwitchID`) ON UPDATE CASCADE,
CONSTRAINT `SwitchesSystemIPPhoneConfig2` FOREIGN KEY (`IPPhoneConfigurationSwitchID2`) REFERENCES `switches` (`SwitchID`) ON UPDATE CASCADE,
CONSTRAINT `UserGroupsSystem` FOREIGN KEY (`UnassignedTelephoneUserGroupID`) REFERENCES `usergroups` (`UserGroupID`) ON UPDATE CASCADE,
CONSTRAINT `UserGroupsSystemACC` FOREIGN KEY (`ACCUserGroupID`) REFERENCES `usergroups` (`UserGroupID`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP VIEW IF EXISTS `tmsanonymoususergroup`;
CREATE ALGORITHM=UNDEFINED VIEW `shore5`.`tmsanonymoususergroup` AS select `shore5`.`porttypes`.`PortTypeID` AS `PortTypeID`,`shore5`.`system`.`UnassignedIPPhoneUserGroupID` AS `UserGroupID`,`shore5`.`usergroups`.`COSCPID` AS `COSCPID`,`shore5`.`usergroups`.`COSTID` AS `COSTID`,`shore5`.`usergroups`.`AccountCodeTypeID` AS `AccountCodeTypeID`,`shore5`.`usergroups`.`SendDIDAsCESID` AS `SendDIDAsCESID` from `shore5`.`porttypes` join (`shore5`.`usergroups` join `shore5`.`system` on((`shore5`.`usergroups`.`UserGroupID` = `shore5`.`system`.`UnassignedIPPhoneUserGroupID`))) where (`shore5`.`porttypes`.`PortTypeID` = 3) union select `shore5`.`porttypes`.`PortTypeID` AS `PortTypeID`,`shore5`.`system`.`UnassignedTelephoneUserGroupID` AS `UserGroupID`,`shore5`.`usergroups`.`COSCPID` AS `COSCPID`,`shore5`.`usergroups`.`COSTID` AS `COSTID`,`shore5`.`usergroups`.`AccountCodeTypeID` AS `AccountCodeTypeID`,`shore5`.`usergroups`.`SendDIDAsCESID` AS `SendDIDAsCESID` from `shore5`.`porttypes` join (`shore5`.`usergroups` join `shore5`.`system` on((`shore5`.`usergroups`.`UserGroupID` = `shore5`.`system`.`UnassignedTelephoneUserGroupID`))) where (`shore5`.`porttypes`.`PortTypeID` = 6);
Suggested fix:
Add another switch into the method Item::tmp_table_field_from_field_type.
Here is suggested fix, that works fine:
===== sql/item.cc 1.141 vs edited =====
*** /tmp/item.cc-1.141-2779 Wed Jun 22 23:56:00 2005
--- edited/sql/item.cc Sat Jun 25 17:16:51 2005
***************
*** 3336,3341 ****
--- 3336,3344 ----
case MYSQL_TYPE_INT24:
return new Field_medium((char*) 0, max_length, null_ptr, 0, Field::NONE,
name, table, 0, unsigned_flag);
+ case MYSQL_TYPE_BIT:
+ return new Field_bit((char*) 0, max_length, null_ptr, 0, null_ptr,
+ 0, Field::NONE, name, table);
case MYSQL_TYPE_NEWDATE:
case MYSQL_TYPE_DATE:
return new Field_date(maybe_null, name, table, &my_charset_bin);