[wp-hackers] WPDB does not seem to support RENAME TABLE query

Chris McCoy chris at lod.com
Sun Sep 22 22:28:37 UTC 2013

Curious about this, is it really good practice to rename a table in a
plugin from a security standpoint?

On 2013-09-22 2:24 PM, "Andrew Nacin" <wp at andrewnacin.com> wrote:

>On Sat, Sep 21, 2013 at 7:02 PM, Paul Menard <paul at codehooligans.com>
>> Maybe I'm missing something. Or maybe this is just an oversight on the
>> wpdb class.
>> When calling the SQL RENAME TABLE `table_source` TO `table_dest`;
>> I get a PHP Warning: errno:2 mysql_fetch_object(): supplied argument is
>> not a valid MySQL result resource /usr/local/www/htdocs/projects/Incsub/
>> local.inc352-snapshot.com/wp-includes/wp-db.php on line 1225
>I've honestly never seen someone need to use wpdb to rename a table at
>runtime. Nothing wrong with wp-db.php being patched to support this. That
>said, this should work: ALTER TABLE old_name RENAME new_name;
>wp-hackers mailing list
>wp-hackers at lists.automattic.com

More information about the wp-hackers mailing list