wp-cli: WordPress database error Unknown column 'Tables_in_' during search-replace

Hi all, using version 1.5, in a multisite installs with wp-content in custom location, if i try to launch wp search-replace something someone i get this error WordPress database error Unknown column 'Tables_in_' in 'where clause' for query SHOW TABLES WHERE Tables_in_ IN [...]

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 3
  • Comments: 24 (7 by maintainers)

Most upvoted comments

Just to drop some notes in here for how I’m dealing with this issue (hyperdb in my case, should be applicable elsewhere):

--all-tables/--all-tables-with-prefix both work with the optional <table> arg(s), as well as --url flag. --all-tables/--all-tables-with-prefix is effectively a broader scope that will be narrowed down by the other parameters.

I know it’s not ideal, but it gets the job done in the meantime.

single-site

either --all-tables flag works for me (there are some nuances, check the docs). If I need to restirct, I can specify a table. This isn’t much different the normal usage.

not-main-site of multisite

I’ll do one of two things:

  1. use --all-tables-with-prefix combined with --url. The url sets the context, so the prefix will be something like wp_12_. This effectively restricts the command to the child site.
  2. use --all-tables with wildcard <table> arg (e.g. wp search-replace old new wp_12_* --all-tables). Note: --all-tables-with-prefix will also work, as without --url the prefix is just wp_.

Again, neither are terribly different than normal usage.

main site of multisite

This is the odd ball. Because the main site doesn’t have a unique prefix, you pretty much have to specify a table list.

wp search-replace old new wp_posts wp_postmeta wp_options... --all-tables

Hi all, we use HyperDB on a number of sites with multisite and keep running into this issue. It would be terrific to get it fixed.

resolved, I have to add --all-tables, or specify the blogs. https://make.wordpress.org/cli/

Would be great to get this one resolved if at all possible. I had the same issue again today.

Experiencing this issue with WordPress VIP. Any updates?

Another HyperDB user here facing this same issue and it’s going to force me to write a lot of extra scripting – is this fixable?

Thanks @gitlost