Bug #34441 Creating View with AS Select clause
Submitted: 9 Feb 2008 0:40 Modified: 9 Feb 2008 12:10
Reporter: tariq rahiman Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Views Severity:S3 (Non-critical)
Version:6.0.0 OS:Any (View with AS select clause)
Assigned to: CPU Architecture:Any

[9 Feb 2008 0:40] tariq rahiman
Description:
I created a view with the as Select clause. When I query for Count, it shows 1 record, but when I query for actual data , it doesnt display any thing.

Warnings shows Incorrect INTEGER value, where as I have created nothing in INTEGER data type.

How to repeat:
mysql> CREATE VIEW view_1 AS select char('Tariq');
Query OK, 0 rows affected (0.00 sec)

mysql> select count(*) from view_1;
+----------+
| count(*) |
+----------+
|        1 |
+----------+
1 row in set, 1 warning (0.00 sec)

mysql> select * from View_1;
+---------------+
| char('Tariq') |
+---------------+
|               |
+---------------+
1 row in set, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+--------------------------------------------+
| Level   | Code | Message                                    |
+---------+------+--------------------------------------------+
| Warning | 1292 | Truncated incorrect INTEGER value: 'Tariq' |
+---------+------+--------------------------------------------+
1 row in set (0.00 sec)
[9 Feb 2008 0:41] tariq rahiman
Version
[9 Feb 2008 12:10] MySQL Verification Team
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

http://dev.mysql.com/doc/refman/6.0/en/string-functions.html#function_char

CHAR(N,... [USING charset_name])

CHAR() interprets each argument N as an integer and returns a string consisting of the characters given by the code values of those integers. NULL values are skipped. 

........

c:\dbs>6.0\bin\mysql -uroot db3
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 6.0.5-alpha-nt Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE VIEW view_1 AS select char(74);
Query OK, 0 rows affected (0.00 sec)

mysql> select count(*) from view_1;
+----------+
| count(*) |
+----------+
|        1 |
+----------+
1 row in set (0.00 sec)

mysql> select * from View_1;
+----------+
| char(74) |
+----------+
| J        |
+----------+
1 row in set (0.00 sec)

mysql>