Bug #5155 Views: COLLATE clause conflicts cause crashes
Submitted: 23 Aug 2004 1:32 Modified: 6 Sep 2004 13:45
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.2-alpha-debug OS:Linux (SuSE 8.2)
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[23 Aug 2004 1:32] Peter Gulutzan
Description:
If I have a table, that has a column, that has a COLLATE 
clause ... If I make a view of the table but with a 
different COLLATE clause ... Errors 
happen, and eventually "Lost connection to MySQL Server". 
 

How to repeat:
mysql> create table t2 (col1 char collate latin1_german2_ci); 
Query OK, 0 rows affected (0.28 sec) 
 
mysql> create view v2 as select col1 collate latin1_german1_ci from t2; 
Query OK, 0 rows affected (0.03 sec) 
 
mysql> show create view v2; 
ERROR 1064 (42000): 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 
'_latin1'latin1_german1_ci') AS `col1 collate latin1_german1_ci` from `db5`.`t2`' at line 1 
mysql> show create view v1; 
Packets out of order (Found: 2, expected 1) 
ERROR 2013 (HY000): Lost connection to MySQL server during query
[27 Aug 2004 8:14] Alexander Barkov
It does not look like a character set related problem.
Looking into v2.frm I found this:

query=select (`test`.`t2`.`col1` collate _latin1'latin1_german1_ci') AS `col1 co
llate latin1_german1_ci` from `test`.`t2`

Which is wrong. The correct query is:

query=select (`test`.`t2`.`col1` collate latin1_german1_ci) AS `col1 co
llate latin1_german1_ci` from `test`.`t2`

Note, there should not be quotes around latin1_german1_ci, and
there should not be character set introduces before it.

I'm reassigning this bug to Sanja.
[31 Aug 2004 9:11] Oleksandr Byelkin
ChangeSet 
  1.1739 04/08/31 10:06:38 bell@sanja.is.com.ua +18 -0 
  fixed open_and_lock_tables result processing (all open_and_lock_tables revision) 
  fixed printing of COLLATE operation 
  (BUG#5155)
[6 Sep 2004 13:45] Oleksandr Byelkin
Thank You for bugreport! Bug is fixed and patch is pushed into our internal source 
repository.