Bug #7024 FUNCTION does not exist when using CREATE VIEW
Submitted: 5 Dec 2004 22:52 Modified: 24 Jun 2005 19:09
Reporter: Shiang-Rung Wang
Status: Closed
Category:Server Severity:S3 (Non-critical)
Version:5.0.1 OS:FreeBSD (FreeBSD 5.x)
Assigned to: Bugs System Target Version:

[5 Dec 2004 22:52] Shiang-Rung Wang
Description:
I can't use some function in the VIEW.
Ex: ENCRYPT, SUBSTRING_INDEX

How to repeat:
mysql> CREATE TABLE `t` (`a` VARCHAR(8));
mysql> INSERT INTO `t` VALUES("aaa");
mysql> CREATE VIEW `v` AS SELECT ENCRYPT(`a`) FROM `t`;
mysql> SELECT * FROM `v`;
ERROR 1304 (42000): FUNCTION test.ecrypt does not exist

mysql> CREATE TABLE `t` (`a` VARCHAR(13));
mysql> INSERT INTO `t` VALUES("a:b:c");
mysql> CREATE VIEW `v` AS SELECT SUBSTRING_INDEX(`a`, ":", 1) FROM `t`;
mysql> SELECT * FROM `v`;
ERROR 1304 (42000): FUNCTION test.substr_index does not exist
[5 Dec 2004 23:46] Hartmut Holzgraefe
Could only verify the first case. Please note that the error message says "ecrypt", not
"encrypt". Maybe the missing "n" is the key to it?
[6 Dec 2004 8:03] Shiang-Rung Wang
I didn't missing the 'n'
if I use "ECRYPT"
when I CREATE VIEW, mysql will give me error.

mysql> CREATE TABLE `t` (`a` VARCHAR(8));
mysql> INSERT INTO `t` VALUES("aaa");
mysql> CREATE VIEW `v` AS SELECT ECRYPT(`a`) FROM `t`;
ERROR 1304 (42000): FUNCTION test.ECRYPT does not exist
[23 Jun 2005 23:24] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/26385
[24 Jun 2005 9:09] Oleksandr Byelkin
pushed to 5.0.9
[24 Jun 2005 19:09] Mike Hillyer
Documented in 5.0.9 changelog:

<listitem><para>The <literal>ENCRYPT()</literal> and <literal>SUBSTRING_INDEX()</literal>
functions would cause errors when used with a <literal>VIEW</literal>. (Bug
#7024)</para></listitem>