Bug #5526 Views: SELECT fails if the base table has multi-byte column name
Submitted: 10 Sep 2004 23:18 Modified: 12 Sep 2004 20:47
Reporter: Shuichi Tamagawa Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.1-alpha-log OS:Linux (SuSE Linux 9.0)
Assigned to: CPU Architecture:Any

[10 Sep 2004 23:18] Shuichi Tamagawa
Description:
'SELECT * FROM view_name' fails if the base table has multi-byte column name.

ERROR 1355 (HY000): View 'test.v2' references invalid table(s) or column(s)

How to repeat:
Use the attached test case (encoded in ujis).

mysql> source view.test;
[10 Sep 2004 23:18] Shuichi Tamagawa
Test case file to reproduce the problem

Attachment: view.test (application/octet-stream, text), 589 bytes.

[12 Sep 2004 20:47] MySQL Verification Team
Hi Shuichi,

I ran your script against latest 5.0 and I wasn't able to repeat:

mysql> set character_set_database=ujis;
Query OK, 0 rows affected (0.00 sec)

mysql> drop table if exists t1;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> drop table if exists t2;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> drop view if exists v1;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> drop view if exists v2;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> create table t1(a int);
Query OK, 0 rows affected (0.00 sec)

mysql> # create table with multi-byte column name
mysql> create table t2(`¤¢` int);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into t1 values(1),(2),(3);
Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql> insert into t2 values(1),(2),(3);
Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql> select * from t1;
+------+
| a    |
+------+
|    1 |
|    2 |
|    3 |
+------+
3 rows in set (0.02 sec)

mysql> # this query is fine
mysql> select * from t2;
+------+
| ¤¢   |
+------+
|    1 |
|    2 |
|    3 |
+------+
3 rows in set (0.00 sec)

mysql> create view v1 as select * from t1;
Query OK, 0 rows affected (0.00 sec)

mysql> create view v2 as select * from t2;
Query OK, 0 rows affected (0.00 sec)

mysql> select * from v1;
+------+
| a    |
+------+
|    1 |
|    2 |
|    3 |
+------+
3 rows in set (0.00 sec)

mysql> # this query fails
mysql> select * from v2;
+------+
| ¤¢   |
+------+
|    1 |
|    2 |
|    3 |
+------+
3 rows in set (0.00 sec)

mysql> drop table t1;
Query OK, 0 rows affected (0.00 sec)

mysql> drop table t2;
Query OK, 0 rows affected (0.00 sec)

mysql> drop view v1;
Query OK, 0 rows affected (0.00 sec)

mysql> drop view v2;
Query OK, 0 rows affected (0.00 sec)
[14 Sep 2004 2:48] Shuichi Tamagawa
I was using 5.0.1 Snapshot release when I found this problem.
Now I confirmed that it works fine in 5.0.2-alpha(bk version).

Thanks