General developer forum

DROP temporary table gives error message

This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.
Picture of Alan Zaitchik
DROP temporary table gives error message

I wrote an Authentication plugin very like the LDAP Authentication plugin, for Moodle 2.2. When I drop a temporary table (MySQL 5.1.41) I see the error message (in the error log)

Potential coding error - existing temptables found when disposing database. Must be dropped!

but the actual code (a synchronization method) works like a charm. All user accounts are created or updated as they should. In the MySQL log (after I turned on logging) I can see

            7 Query    INSERT INTO mdl_user (firstname,lastname,email,city,country,idnumber,username,timecreated,timemodified,confirmed,auth,mnethostid,deleted,lang) VALUES('Alan','Zaitchik','','Waco, Texas','US','4E592EF9-D5EE-459E-A4E3-D19CD1BBA0CF','azaitchik','1358801663','1358801663','1','jics','1','0','en')
            7 Query    COMMIT
            7 Query    SHOW TABLES
            7 Query    DROP TABLE mdl_tmp_extuser
            7 Query    SHOW TABLES
            7 Query    DROP TEMPORARY TABLE mdl_tmp_extuser
            7 Quit   

Is it normal for there to be both a DROP TABLE and a DROP TEMPORARY TABLE?

Note that when I use this same plugin in the 2.3 environment there is no error message. Looking in the MySQL log I also see no "extra" DROP TABLE statement.

Where could that statement be coming from in the Moodle 2.2.5 code? It is not in the plugin code, at least not directly.The only remoteely relevant thing I can find between the call to

$id = $DB->insert_record('user', $user);

and the call to


is a call to


Is that relevant? FWIW in the Moodle 2.2.5 case I also see the following in the Apache error log. This is not found in the 2.3 Moodle site so I assume it is caused by the temp table issue, but I really have no idea why.

PHP Fatal error:  Exception thrown without a stack frame in Unknown on line 0

Remember-- as I said -- the actual synchronization of user accounts IS working, despite the error messages!

Average of ratings: -