Bug #7609 Pasted SQL does not work
Submitted: 1 Jan 2005 16:39 Modified: 15 Feb 2005 13:33
Reporter: Steen Rabol Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Query Browser Severity:S2 (Serious)
Version:1.1.4 OS:Windows (Windows XP SP2)
Assigned to: Mike Lischke CPU Architecture:Any

[1 Jan 2005 16:39] Steen Rabol
Description:
SQL statemens created by Query browser does not work

How to repeat:
Right click on a table, select "Copy SQL to clibboard"
Paste the code into the text area and execute, and you will get a SQL error
[2 Jan 2005 14:57] MySQL Verification Team
Are you noticed that the SQL copied to clipboard is the
create table statement ? like below:

DROP TABLE IF EXISTS `test`.`t1`;
CREATE TABLE `t1` (`a` int(11) NOT NULL default '0') ENGINE=MyISAM DEFAULT CHARSET=latin1;

then when you executed it what was the error message ?

Thanks in advance.
[5 Jan 2005 8:03] Steen Rabol
DROP TABLE IF EXISTS `test`.`test`;
CREATE TABLE `test` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(45) NOT NULL default '',
  `title` varchar(45) NOT NULL default '',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM;

The above is generated by the query browser (Right click on a table, copy SQL...)

I get 2 errors

1: Access violation at address 00568e06 in module 'MySQLQueryBrowser.exe'. Read of address 00000018 - when I paste the SQL

2: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near ';
CREATE TABLE `test` (
  `id` int(10) unsigned NOT NULL auto

when I execute the statement

MySql server version is 4.0.18-nt.

Let me know if you need more information.

Best
Steen
[3 Feb 2005 12:03] Teemu Kuulasmaa
I encontered the same kind of "paste" problem. If I copy sql from the righ pane ("Copy sql to clipboard") and try to paste the sql to a sql editor. The editor doesn't get updated. I have to change the size window or editor to get editor updated.
[15 Feb 2005 11:27] Mike Lischke
Actually, these are two things in one. The problem with pasting text in the query area has been reported at least 3 times and is fixed already. The second issue that you mentioned (cannot execute SQL produced by QB) isn't really an issue because you tried to execute a multi-statement query in the query area. Try that with a script editor (Ctrl+Shift+T to open one). There it works flawlessly. In the query area you can only execute one command at a time. There are plans to change that but currently this is the situation.

One thing remains, though. The created CREATE TABLE statement does not include the schema name so the table is created in which schema is currently active. I have not found a solution for this yet as the server returns the actual creation statement.
[15 Feb 2005 12:45] Steen Rabol
Hi

If the editor don't support multi statemenst, why does the "Copy sql.." function then produce a multi statement ?
[15 Feb 2005 13:33] Mike Lischke
Steen,

There are two editors for queries. One is kind of an address bar (the upper edit, we call it the query area), which can only take one command at a time and the other one is a full SQL editor with debugging features. You can open one instance by pressing Ctrl+Shift+T or via the menu. This script editor of course supports multi-statements.