{"record":{"id":"a83d6a795fb69e55","repo":"laravel/framework","slug":"this-database-driver-does-not-support-retrieving-t","errorCode":null,"errorMessage":"This database driver does not support retrieving tables.","messagePattern":"This database driver does not support retrieving tables\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Database/Schema/Grammars/Grammar.php","lineNumber":100,"sourceCode":"     * @param  string  $table\n     * @return string|null\n     */\n    public function compileTableExists($schema, $table)\n    {\n        //\n    }\n\n    /**\n     * Compile the query to determine the tables.\n     *\n     * @param  string|string[]|null  $schema\n     * @return string\n     *\n     * @throws \\RuntimeException\n     */\n    public function compileTables($schema)\n    {\n        throw new RuntimeException('This database driver does not support retrieving tables.');\n    }\n\n    /**\n     * Compile the query to determine the views.\n     *\n     * @param  string|string[]|null  $schema\n     * @return string\n     *\n     * @throws \\RuntimeException\n     */\n    public function compileViews($schema)\n    {\n        throw new RuntimeException('This database driver does not support retrieving views.');\n    }\n\n    /**\n     * Compile the query to determine the user-defined types.\n     *","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Database/Schema/Grammars/Grammar.php#L82-L118","documentation":"Grammar::compileTables() is a RuntimeException stub on the base class. All four shipped grammars (SQLite, SQL Server, Postgres, MySQL) override it; reaching the base indicates the connection is using an unimplemented grammar. Builder::getTables() routes here, so any call to list tables hits this on an unsupported grammar.","triggerScenarios":"Schema::getTables() or Schema::hasTable() (which internally calls compileTables via the table-existence path on some drivers) on a connection whose SchemaGrammar is the base Grammar. Commonly a custom driver whose Connection does not provide a real grammar.","commonSituations":"Third-party driver bridge returning a base Grammar; test setup that does not bind a concrete grammar; an engine whose integration was started but whose grammar methods were never filled in.","solutions":["Use a supported driver (sqlite/mysql/pgsql/sqlsrv).","In your custom grammar, override compileTables($schema) to return the engine's table-listing SQL.","Query information_schema directly with DB::select() as a stopgap."],"exampleFix":"// before - throws on base grammar\n$tables = Schema::connection('custom')->getTables();\n\n// after - implement compileTables in CustomGrammar, or fall back to raw SQL\n$tables = DB::connection('custom')->select(\n    \"SELECT name FROM sqlite_master WHERE type='table'\"\n);","handlingStrategy":"type-guard","validationCode":"$grammar = Schema::getConnection()->getSchemaGrammar();\nif (get_class($grammar) === \\Illuminate\\Database\\Schema\\Grammars\\Grammar::class) {\n    throw new \\DomainException('Connection uses the base Grammar; cannot list tables.');\n}","typeGuard":"function supportsCompileTables(\\Illuminate\\Database\\Schema\\Grammars\\Grammar $grammar): bool\n{\n    return (new \\ReflectionMethod($grammar, 'compileTables'))\n        ->getDeclaringClass()->getName() !== \\Illuminate\\Database\\Schema\\Grammars\\Grammar::class;\n}","tryCatchPattern":"try {\n    $tables = Schema::getTables();\n} catch (\\RuntimeException $e) {\n    if (str_contains($e->getMessage(), 'retrieving tables')) {\n        $tables = DB::select(\"SELECT name FROM sqlite_master WHERE type='table'\");\n    } else {\n        throw $e;\n    }\n}","preventionTips":["Bind a concrete grammar in custom driver connections.","In admin/inspection tools, detect the grammar class before listing tables.","Cover all compile* overrides when authoring a new grammar, not just the migration-critical ones."],"tags":["schema","grammar","database-driver","runtime-exception"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}