Bug #26572 Error in editing sql view defintion, destroys original definiton
Submitted: 22 Feb 2007 16:16 Modified: 23 Feb 2007 16:43
Reporter: Heinz Schweitzer (Gold Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Administrator Severity:S3 (Non-critical)
Version:1.2.9 OS:Windows (XP)
Assigned to: Vladimir Kolesnikov CPU Architecture:Any

[22 Feb 2007 16:16] Heinz Schweitzer
Description:
Error in editing sql view defintion, destroys original definiton

MySQL Administrator 1.2.9

MySQL Server Information
--------------------------------------------------------------------------------
Connected to MySQL Server Instance
  Username:                root
  Hostname:                localhost
  Port:                    3306
--------------------------------------------------------------------------------
Server Information
  MySQL Version:           MySQL 5.0.27-community-nt via TCP/IP
  Network Name:            localhost
  IP:                      127.0.0.1
--------------------------------------------------------------------------------
Client Information
  Version:                 MySQL Client Version 5.1.11
  Network Name:            xxxxxxxxxxx
  IP:                      xxxxxxxxxxx
  Operating System:        Windows XP
  Hardware:                2x Intel(R) Core(TM)2 CPU         T7200  @ 2.00GHz, 2.0 GB RAM

How to repeat:
Start English or German MySQL Administrator 1.2.9
Open Catalogs
Select from Catalogs  databasee 'mysql'

In the right pane activate the 'Views' tab
in there create a view with name 'aaa' as 
CREATE OR REPLACE VIEW `mysql`.`aaa` AS SELECT * from db
Say 'Execute SQL'.
A view named 'aa'a should now exist.
Select this view 'aaa' and say 'Edit'

MySQL Editor comes up with the view definiton.
In there just change the field name 'db' to 'db123' like
in screen shot v1.
Say 'Execute SQL'.
An execution error dialog will pop up.
Just click OK in there, and Cancel in the MySQL Editor.
All windows go away.

Select this view 'aaa' and say 'Edit' again.
MySQL Editor comes up with just the name of the view in it
everthing else is gone see screen shot v2.

Suggested fix:
Please display and keep the original definiton, in
case of an error.
[22 Feb 2007 16:16] Heinz Schweitzer
v1

Attachment: ScreenHunter_001.jpg (image/pjpeg, text), 122.87 KiB.

[22 Feb 2007 16:17] Heinz Schweitzer
v2

Attachment: ScreenHunter_002.jpg (image/pjpeg, text), 111.01 KiB.

[22 Feb 2007 23:06] MySQL Verification Team
Thank you for the bug report.
[23 Feb 2007 16:43] Vladimir Kolesnikov
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html
[23 Feb 2007 16:50] Vladimir Kolesnikov
The following behavior was implemented:
1. if view is renamed, a dialog is shown that asks if the old view should be preserved. if user chooses to drop the old object it will dropped only after successful creation of the new view
2. if view name isn't changed then 'or replace' logics is applied. this is handled by the server and basically should act in a safe way
3, if user explicitly removes 'or replace' clause from view definition he/she will get 'view with such name already exists' error