Bug #39524 Forward Engineer SQL CREATE, case-sensitive issues for a VIEW's JOINed tables
Submitted: 18 Sep 2008 18:46 Modified: 24 Oct 2008 23:55
Reporter: Douglas Boberg Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:5.0.25 OS:Windows (Vista)
Assigned to: CPU Architecture:Any
Tags: case sensitive, forward engineer, VIEW

[18 Sep 2008 18:46] Douglas Boberg
Description:
When using Forward Engineer SQL CREATE scripts, the generated SQL contains irregularities with regard to character case.

Reading from the bottom up of the attached generated script, you can see that there is a JOIN of the `user_usr` table using the alias `Q_U` for the table.  However, if you look at the JOIN's restriction, the alias has had it's character case changed:  `q_u`.`id_usr`

This causes an issue when running the script on a Linux based MySQL installation.

-- -----------------------------------------------------
-- View `mydb`.`queue_table_name`
-- -----------------------------------------------------
DROP VIEW IF EXISTS `mydb`.`queue_view_name` ;
SHOW WARNINGS;
DROP TABLE IF EXISTS `mydb`.`queue_view_name`;
SHOW WARNINGS;
CREATE  OR REPLACE ALGORITHM=UNDEFINED   
         DEFINER=`root`@`localhost` SQL SECURITY DEFINER   
         VIEW `queue_view_name` AS select `spk`.`id_spk` AS `id_qtc`,`spk`.`id_spk` AS `idspk_qtc`,`q`.`id_que` AS `idque_qtc`,`q_u`.`id_usr` AS `idusr_qtc` from (((((((`our_table_spk` `SPK` left join `our_table_transaction_stx` `ST` on((`st`.`id_stx` = `spk`.`idstx_spk`))) left join `sub_txcode_stc` `STC` on((`st`.`idstc_stx` = `stc`.`id_stc`))) left join `txcode_txc` `TC` on((`stc`.`idtxc_stc` = `tc`.`id_txc`))) left join `que_txcode_mapping_qtm` `QTC_M` on((`tc`.`id_txc` = `qtc_m`.`idtxc_qtm`))) left join `queue_que` `Q` on((`qtc_m`.`idque_qtm` = `q`.`id_que`))) left join `que_user_mapping_qum` `QU_M` on((`q`.`id_que` = `qu_m`.`idque_qum`))) left join `user_usr` `Q_U` on((`qu_m`.`idusr_qum` = `q_u`.`id_usr`)));
SHOW WARNINGS;

How to repeat:
Use Windows Vista, MySQL Workbench version 5.0.2.5 OSS

Reverse engineer a Schema containing Tables and Views.

Use Forward Engineer SQL CREATE scripts...

Choose the first three check-box options:
  [x] Generate DROP <object> statements
  [x] Generate separate CREATE INDEX statements
  [x] Generate SHOW WARNINGS after every DDL statement

Choose to export the View objects only:
  [x] Object of type MySQL View

Finish.

Suggested fix:
Standardize the formatting of the table aliases and use them consistently.
[24 Sep 2008 23:55] MySQL Verification Team
Thank you for the bug report. Could you please provide a sample project file?. Thanks in advance.
[25 Oct 2008 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".