function drush_sql_filter_tables

8.0.x drush_sql_filter_tables($tables, $db_tables)
6.x drush_sql_filter_tables($tables, $db_tables)
7.x drush_sql_filter_tables($tables, $db_tables)
master drush_sql_filter_tables($tables, $db_tables)

Filters tables.


array $tables: An array of table names to filter.

array $db_tables: An array with all the existing table names in the current database.

Return value

An array with only valid table names (i.e. all of which actually exist in the database).

2 calls to drush_sql_filter_tables()
WildcardUnitCase::testFilterTables in tests/expandWildcardTablesUnitTest.php
Tests drush_sql_filter_tables().
_drush_sql_expand_and_filter_tables in commands/sql/
Given the table names in the input array that may contain wildcards (`*`), expand the table names so that the array returned only contains table names that exist in the database.


commands/sql/, line 329
Drush sql commands


function drush_sql_filter_tables($tables, $db_tables) {
  // Ensure all the tables actually exist in the database.
  foreach ($tables as $k => $table) {
    if (!in_array($table, $db_tables)) {

  return $tables;