Bug #7953 Calling a procedure with an out parameter gives ERROR 1247 (42S22)
Submitted: 17 Jan 2005 11:37 Modified: 25 Feb 2005 15:44
Reporter: Sushil Kumar Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.2-alpha-log OS:Windows (Windows 2000 / XP)
Assigned to: Bugs System CPU Architecture:Any

[17 Jan 2005 11:37] Sushil Kumar
I have a fresh installation of MySQL from the mysql-5.0.2-alpha-win-noinstall.zip.

I am trying to use stored procedures in MySQL.

I create a stored procedure and call as deescribed under. I get a "ERROR 1247 (42S22): Reference '(null)' not supported (reference to group function)" error.

How to repeat:
mysql> create table t1 (f1 int primary key);
Query OK, 0 rows affected (0.08 sec)

mysql> create table t2 (f1 int primary key);
Query OK, 0 rows affected (0.06 sec)

mysql> delimiter //
mysql> CREATE PROCEDURE test (OUT param1 INT)
    -> BEGIN
    -> SELECT (MAX( f1) + 1) INTO param1 FROM t1;
    -> INSERT INTO t1 VALUES (param1);
    -> END
    -> //
Query OK, 0 rows affected (0.00 sec)
mysql> INSERT INTO t1 VALUES (1)//
Query OK, 1 row affected (0.00 sec)

mysql> CALL test(@a)//
ERROR 1247 (42S22): Reference '(null)' not supported (reference to group function)
[17 Jan 2005 11:39] Sushil Kumar
I have applied a patch as suggested in Bug 6950 / 6955.
[17 Jan 2005 11:41] Sushil Kumar
Sometimes, I get the error if I execute the same stored procedure the second time.
[17 Jan 2005 11:59] Sushil Kumar
While I know that I can use auto increment, in our actual case, the primary key is a composite key, so I cannot use auto increment. I have given the example to simplify the problem.
[19 Jan 2005 20:14] Hartmut Holzgraefe
verified with 5.0.2 on linux, on 5.0.3 it even crashes the server
[25 Feb 2005 15:44] Per-Erik Martin
This was fixed by a previous bugfix.