###### Basic preparations --disable_abort_on_error # Please assign the number of executions of the prepared statement here let $exec_loop_count= 3; --disable_warnings DROP TABLE IF EXISTS t1, t2; --enable_warnings CREATE TABLE t2 ( stmt_no smallint, exec_time BIGINT, statement VARCHAR(500), PRIMARY KEY(stmt_no)); CREATE TABLE t1 AS SELECT * FROM INFORMATION_SCHEMA.COLUMNS; # crash, minimalistic but non realistic statement INSERT INTO t2 SET stmt_no= 1, statement= "SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, t1 B"; # crash, more realistic situation assuming that # - t1 is table containing a collection of tablenames belonging to a # special application field # - the select should give an overview about table names, columnnames # and data types. Let's assume the customer wants to compare them. INSERT INTO t2 SET stmt_no= 2, statement= "SELECT A.TABLE_NAME, A.COLUMN_NAME, A.DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS A, t1 B WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA AND A.TABLE_NAME = B.TABLE_NAME"; # crash, the original NIST statement. I guess the NIST intended to torture # INFORMATION_SCHEMA.COLUMN because they know that some DBMS vendors # - do not use their common B trees for the underlying base tables # - use complicated VIEWs structures to provide the INFORMATION_SCHEMA # tables data needed # Both solutions open a wide area of possible implementations bugs. INSERT INTO t2 SET stmt_no= 3, statement= "SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA AND A.TABLE_NAME = B.TABLE_NAME AND A.COLUMN_NAME = B.COLUMN_NAME"; #### statement for comparison # no crash !! # Attention: t1 is here the first join table mentioned within the statement INSERT INTO t2 SET stmt_no= 4, statement= "SELECT COUNT(*) FROM t1 A, INFORMATION_SCHEMA.COLUMNS B"; # Please assign here the number of the statement you want to get checked let $stmt_no= 1; while ($stmt_no) { eval SET @aux= (SELECT statement FROM t2 WHERE stmt_no= $stmt_no); eval prepare my_stmt from @aux; while ($exec_loop_count) { eval execute my_stmt; dec $exec_loop_count; } deallocate prepare my_stmt; let $stmt_no= 0; }