laravel/framework · error · RuntimeException
This database driver does not support retrieving tables.
Error message
This database driver does not support retrieving tables.
What it means
Base Grammar::compileTables() throws RuntimeException when the driver's grammar does not override it. compileTables produces the query behind Schema::getTableListing()/getTables(); all four first-class drivers override it, so hitting this usually means a custom/incomplete driver or a broken connection binding.
Source
Thrown at src/Illuminate/Database/Schema/Grammars/Grammar.php:100
* @param string $table
* @return string|null
*/
public function compileTableExists($schema, $table)
{
//
}
/**
* Compile the query to determine the tables.
*
* @param string|string[]|null $schema
* @return string
*
* @throws \RuntimeException
*/
public function compileTables($schema)
{
throw new RuntimeException('This database driver does not support retrieving tables.');
}
/**
* Compile the query to determine the views.
*
* @param string|string[]|null $schema
* @return string
*
* @throws \RuntimeException
*/
public function compileViews($schema)
{
throw new RuntimeException('This database driver does not support retrieving views.');
}
/**
* Compile the query to determine the user-defined types.
*View on GitHub (pinned to bd6b5437e6)
Solutions
- Switch to a first-class driver (mysql, pgsql, sqlite, sqlsrv) whose grammar implements compileTables.
- If you maintain the driver, override compileTables($schema) with the engine's table-listing SQL.
- Verify the connection key in config/database.php resolves to the intended driver, not a stub.
Example fix
// before — 'custom' connection uses a Grammar that does not override compileTables
$tables = Schema::connection('custom')->getTableListing();
// after
class CustomGrammar extends \Illuminate\Database\Schema\Grammars\Grammar
{
public function compileTables($schema)
{
return 'select ... from information_schema.tables ...';
}
} Defensive patterns
Strategy: type-guard
Validate before calling
$grammar = Schema::getConnection()->getSchemaGrammar();
if ((new \ReflectionMethod($grammar, 'compileTables'))->getDeclaringClass()->getName()
=== \Illuminate\Database\Schema\Grammars\Grammar::class) {
throw new \RuntimeException('Table listing unsupported on '.DB::connection()->getDriverName());
}
return Schema::getTableListing(); Type guard
function driverSupportsTableListing(): bool
{
$g = Schema::getConnection()->getSchemaGrammar();
return (new \ReflectionMethod($g, 'compileTables'))
->getDeclaringClass()->getName() !== \Illuminate\Database\Schema\Grammars\Grammar::class;
} Try / catch
try {
$tables = Schema::getTableListing();
} catch (\RuntimeException $e) {
// custom/incomplete driver — surface to caller
throw $e;
} Prevention
- Use a first-class driver for table introspection.
- Implement compileTables on custom grammars.
- Verify config/database.php connection bindings.
When it happens
Trigger: Calling Schema::getTables(), Schema::getTableListing(), or hasTable() on a Connection whose schema grammar is the base Grammar or a subclass that did not override compileTables.
Common situations: A custom driver extending Grammar without implementing compileTables; an old/community driver behind the framework version in use.
Related errors
- This database driver does not support retrieving schemas.
- This database driver does not support retrieving columns.
- This database driver does not support retrieving indexes.
- This database driver does not support retrieving foreign key
- This database driver does not support retrieving views.
AI-assisted analysis of laravel/framework@bd6b5437e6 (2026-08-06).
Data as JSON: /data/errors/a83d6a795fb69e55.json.
Report an issue: GitHub.