diff --git a/src/wp-includes/class-wpdb.php b/src/wp-includes/class-wpdb.php index a676d395ee95c..2d128dcb8dd9f 100644 --- a/src/wp-includes/class-wpdb.php +++ b/src/wp-includes/class-wpdb.php @@ -3874,7 +3874,7 @@ protected function get_table_from_query( $query ) { // Quickly match most common queries. if ( preg_match( '/^\s*(?:' - . 'SELECT.*?\s+FROM' + . 'SELECT.*\s+FROM' . '|INSERT(?:\s+LOW_PRIORITY|\s+DELAYED|\s+HIGH_PRIORITY)?(?:\s+IGNORE)?(?:\s+INTO)?' . '|REPLACE(?:\s+LOW_PRIORITY|\s+DELAYED)?(?:\s+INTO)?' . '|UPDATE(?:\s+LOW_PRIORITY)?(?:\s+IGNORE)?' diff --git a/tests/phpunit/tests/db.php b/tests/phpunit/tests/db.php index 22eeb235e4819..7b245eff3ce01 100644 --- a/tests/phpunit/tests/db.php +++ b/tests/phpunit/tests/db.php @@ -866,6 +866,9 @@ public function data_get_table_from_query() { // @ticket 63777 "SET STATEMENT max_statement_time=1 FOR SELECT * FROM $table", + + // @ticket 43664 + "SELECT c AS 'a from b' FROM $table", ); $querycount = count( $queries );