Erroneous SQL catches too many keys
-
$custom_sql = "SELECT user_id, meta_key FROM " . $table_new_prefix . "usermeta WHERE meta_key LIKE '" . $old_table_prefix . "%'"; $meta_keys = $wpdb->get_results( $custom_sql );
I think there’s a bug there.
$old_table_prefix almost certainly contains an underscore (e.g. wp_).
So the resulting SQL contains: LIKE ‘wp_%’
However an underscore in MySQL is a one-character wildcard. The above SQL will catch all entries beginning with ‘wp’, not just those beginning with ‘wp_’. You need to escape the prefix first.
https://www.ads-software.com/extend/plugins/change-table-prefix/
- The topic ‘Erroneous SQL catches too many keys’ is closed to new replies.