Bug #45867 Synchronize model. Error when sync only stored proc
Submitted: 1 Jul 2009 4:57 Modified: 10 Aug 2009 9:40
Reporter: Pavel Dobryakov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:5.1.16 OS:Any
Assigned to: Alexander Musienko CPU Architecture:Any
Tags: CHECKED

[1 Jul 2009 4:57] Pavel Dobryakov
Description:
When i synchornize model,and it`s only stored rpco to sync, there is an error with the script.
Executing SQL script in server

ERROR: Error 1046: No database selected

How to repeat:
Here script,which program generated:
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;

SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;

SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';

DELIMITER //

CREATE FUNCTION `check_zone`(reg bigint) RETURNS tinyint(1)

READS SQL DATA

begin

declare intcount int;

select count(pkdm_zone.region) into intcount from pkdm_zone where  pkdm_zone.region=reg LIMIT 1;

return intcount;

end//

DROP function IF EXISTS `PkdMon`.`check_locality` //

CREATE FUNCTION `check_locality`(zone bigint) RETURNS tinyint(1)

READS SQL DATA

begin

declare intcount int;

select count(pkdm_locality.zone) into intcount from pkdm_locality where  pkdm_locality.zone=zone LIMIT 1;

return intcount;

end//

DELIMITER ;

SET SQL_MODE=@OLD_SQL_MODE;

SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;

SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

But there is now USE command. And after execute script thereis error
ERROR: Error 1046: No database selected
[2 Jul 2009 4:19] Valeriy Kravchuk
Thank you for the bug report. Verified just as described.
[6 Aug 2009 19:09] Johannes Taxacher
fixed in sourcecode. will be included in 5.1.17
[10 Aug 2009 9:40] Tony Bedford
An entry was added to the 5.1.17 changelog:

When a model was synchronized with a live database, and only stored procedures needed to be synchronized, then the following error was generated:

ERROR: Error 1046: No database selected