Bug #45695 No Error in Compliation of procedure when the table name not in db
Submitted: 24 Jun 2009 8:04 Modified: 24 Jun 2009 8:52
Reporter: g s Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S1 (Critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[24 Jun 2009 8:04] g s
Description:
Hi,
When we complie the procedure, it does not give the error even the column name which is not in table or variable which is not declared. The error occured while executing the procedure on run time.
Is any way to complie the procedure. As the mysql does not have the code coverage tool, so it is difficult to find out the error.

Regards,

Gautam Kumar

How to repeat:
DROP PROCEDURE IF EXISTS PBSTEST.test1;
CREATE PROCEDURE PBSTEST.`test1`(IN 	var INT, OUT po_var INT)
BEGIN
DECLARE
	v INT;

	BEGIN
# t table is not in database still no error comes while compilation.
SELECT COUNT(*) INTO v FROM t;
END;
END;
[24 Jun 2009 8:52] Valeriy Kravchuk
As MySQL allows to use DDL statements like CREATE TABLE and DROP TABLE (see http://dev.mysql.com/doc/refman/5.1/en/create-procedure.html for the details) in the SP body, there is no good way to check for correct table names usage at CREATE PROCEDURE time.