Bug #97169 After altering definitions , "Send to SQL Editor" can not make correct queries
Submitted: 10 Oct 2019 1:53 Modified: 23 Oct 2019 5:51
Reporter: iida イイダ Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:8.0.16, 8.0.18 OS:Ubuntu (18.04.3)
Assigned to: CPU Architecture:Any

[10 Oct 2019 1:53] iida イイダ
Description:
"Send to SQL Editor" in MySQL Workbench will make wrong queries like this pattern.

1. use "Send to SQL Editor" -> Workbench makes correct queries.
2. alter table add column
3. use "Send to SQL Editor" -> Workbench makes wrong queries.

but
1. alter table add column
2. use "Send to SQL Editor" -> Workbench makes correct queries.

Please review this problem.

How to repeat:
1. make table like this.

```
CREATE TABLE test1 (
    id INT NOT NULL AUTO_INCREMENT COMMENT 'ID',
    col1 VARCHAR(10) COLLATE UTF8MB4_BIN NOT NULL COMMENT 'column 1st',
    PRIMARY KEY (`id`)
)  ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COLLATE = UTF8MB4_BIN COMMENT='for test';
```

2. "Send to SQL Editor" makes correct query.

SCHEMAS>{schema_name}>Tables>test1>{right click}>Send to SQL Editor>Select All Statement

```
SELECT `test1`.`id`,
    `test1`.`col1`
FROM `test`.`test1`;
```

3. Alter table

add column

```
alter table test1
add col2 VARCHAR(10) COLLATE UTF8MB4_BIN NOT NULL COMMENT 'column 2nd';
```

```
# checked by prompt
mysql> desc test1;
+-------+-------------+------+-----+---------+----------------+
| Field | Type        | Null | Key | Default | Extra          |
+-------+-------------+------+-----+---------+----------------+
| id    | int(11)     | NO   | PRI | NULL    | auto_increment |
| col1  | varchar(10) | NO   |     | NULL    |                |
| col2  | varchar(10) | NO   |     | NULL    |                |
+-------+-------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)

```

4. "Send to SQL Editor" makes wrong query.

SCHEMAS>{schema_name}>Tables>test1>{right click}>Send to SQL Editor>Select All Statement

```
SELECT `test1`.`id`,
    `test1`.`col1`
FROM `test`.`test1`;
```
[23 Oct 2019 5:51] MySQL Verification Team
Hello iida takayuki,

Thank you for the report.
Verified as described.

Regards,
Ashwini Patil