Bug #80543 Cannot use DEFAULT function in a view
Submitted: 28 Feb 2016 1:50 Modified: 28 Feb 2016 13:41
Reporter: Elena Stepanova Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version:5.5, 5.6, 5.7 OS:Any
Assigned to: CPU Architecture:Any

[28 Feb 2016 1:50] Elena Stepanova
Description:
MySQL [test]> create view v1 as select default(i) from t1;
ERROR 1143 (42000): create view command denied to user 'root'@'localhost' for column 'default(i)' in table 'v1'

MySQL [test]> select @@version;
+--------------+
| @@version    |
+--------------+
| 5.7.10-debug |
+--------------+
1 row in set (0.00 sec)

I can't find the limitation in the manual. 

How to repeat:
create table t1 (i int default 0);
insert into t1 values (1);
select default(i) from t1;
create view v1 as select default(i) from t1;
[28 Feb 2016 13:41] MySQL Verification Team
Thank you for the bug report. Repeatable since 5.0:

C:\dbs>c:\dbs\5.7\bin\mysql -uroot -p --port=3570 --prompt="mysql 5.7 > "
Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.12 Source distribution PULL: 2016-FEB-19

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql 5.7 > use test
Database changed
mysql 5.7 > create table t1 (i int default 0);
Query OK, 0 rows affected (0.03 sec)

mysql 5.7 > insert into t1 values (1);
Query OK, 1 row affected (0.00 sec)

mysql 5.7 > select default(i) from t1;
+------------+
| default(i) |
+------------+
|          0 |
+------------+
1 row in set (0.00 sec)

mysql 5.7 > create view v1 as select default(i) from t1;
ERROR 1143 (42000): create view command denied to user 'root'@'localhost' for column 'default(i)' in table 'v1'
mysql 5.7 >