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

Andrew Nacin wp at andrewnacin.com
Sun Sep 22 18:24:08 UTC 2013

On Sat, Sep 21, 2013 at 7:02 PM, Paul Menard <paul at codehooligans.com> wrote:

> 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;


More information about the wp-hackers mailing list