Bug #27687 ALTER TABLE ... CONVERT TO uses @@collation_database

Submitted: 6 Apr 2007 12:47 Modified: 9 Apr 2007 15:19
Reporter: Alexander Nozdrin Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Charsets Severity:S3 (Non-critical)
Version:5.0.40-BK OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[6 Apr 2007 12:47] Alexander Nozdrin
Description:
ALTER TABLE ... CONVERT TO CHARSET DEFAULT uses @@collation_database
variable (character set of the current db) in its job.

Although The Manual (http://dev.mysql.com/doc/refman/5.0/en/alter-table.html)
does not explicitly states what should be used in this case, I think,
default database character set should be used. Otherwise, this statement
depends on the current database (the value of @@collation_database),
which seems to be inadequate to me.

How to repeat:
CREATE DATABASE db1 CHARACTER SET latin1;
use db1;

CREATE DATABASE db2 CHARACTER SET utf8;
CREATE TABLE db2.t1(s CHAR(10));
INSERT INTO db2.t1 VALUES('a');
SELECT CHARSET(s) FROM db2.t1; --> utf8;

ALTER TABLE db2.t1 CONVERT TO CHARSET DEFAULT;
SELECT CHARSET(s) FROM db2.t1; --> latin1;
[6 Apr 2007 12:48] Alexander Nozdrin
"default database character set should be used" -- I mean,
the character set of the database which is being altered.
[6 Apr 2007 14:21] Valeriy Kravchuk
Thank you for a problem report. I am not sure is it a bug or a feature request, but I verified current behaviour just as described wiht latest 5.0.40-BK on Linux.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.038 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.