Bug #8765 Stored procedures: Bad error message if CREATE TABLE inside a procedure

Submitted: 24 Feb 2005 3:27 Modified: 29 Apr 2005 12:26
Reporter: Trudy Pelzer Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.3-alpha-debug OS:Linux (SuSE 9.1)
Assigned to: Per-Erik Martin CPU Architecture:Any

[24 Feb 2005 3:27] Trudy Pelzer
Description:
Until recently, it was possible to create a table and manipulate
it within a stored procedure. Now, it appears not to be possible 
to execute CREATE TABLE from within a stored procedure: the 
CREATE PROCEDURE statements returns OK, but a CALL of the 
resulting procedure returns an error saying the table does not 
exist. This is not true however -- accessing the table shows 
that it really was created.

How to repeat:
mysql> delimiter //
Query OK, 0 rows affected (0.00 sec)

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

mysql> create procedure sp1() begin create table t1 (col1 int); end//
Query OK, 0 rows affected (0.00 sec)

mysql> call sp1()//
ERROR 1146 (42S02): Table 'tp.t1' doesn't exist
-- This is a misleading error message; the table has been created.

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

mysql> select * from t1//
+-----+
| col1 |
+-----+
|   10 |
+-----+
[29 Apr 2005 12:26] Per-Erik Martin
No longer repetable. (The fact that the table isn't created is a known bug.)

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.052 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.