{"record":{"id":"eecff4e11467825b","repo":"laravel/framework","slug":"this-database-driver-does-not-support-retrieving-v","errorCode":null,"errorMessage":"This database driver does not support retrieving views.","messagePattern":"This database driver does not support retrieving views\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Database/Schema/Grammars/Grammar.php","lineNumber":113,"sourceCode":"     *\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     *\n     * @param  string|string[]|null  $schema\n     * @return string\n     *\n     * @throws \\RuntimeException\n     */\n    public function compileTypes($schema)\n    {\n        throw new RuntimeException('This database driver does not support retrieving user-defined types.');\n    }\n\n    /**\n     * Compile the query to determine the columns.\n     *","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Database/Schema/Grammars/Grammar.php#L95-L131","documentation":"Grammar::compileViews() throws RuntimeException on the base class. SQLiteGrammar, SqlServerGrammar, PostgresGrammar, and MySqlGrammar override it; reaching the base means no driver-specific grammar is bound. Builder::getViews() routes here.","triggerScenarios":"Schema::getViews() on a connection whose SchemaGrammar is the base Grammar (custom driver not implementing the method).","commonSituations":"Custom/in-progress driver whose grammar does not override compileViews; an inspection/admin tool that calls getViews() across every configured connection regardless of engine support.","solutions":["Run getViews() only on connections backed by sqlite/mysql/pgsql/sqlsrv grammars.","Override compileViews() in your custom grammar.","Query the engine's view catalog (information_schema.views, pg_views) directly."],"exampleFix":"// before\n$views = Schema::connection('custom')->getViews();\n\n// after\n$views = DB::connection('custom')->select(\"SELECT table_name FROM information_schema.views\");","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 views.');\n}","typeGuard":"function supportsCompileViews(\\Illuminate\\Database\\Schema\\Grammars\\Grammar $grammar): bool\n{\n    return (new \\ReflectionMethod($grammar, 'compileViews'))\n        ->getDeclaringClass()->getName() !== \\Illuminate\\Database\\Schema\\Grammars\\Grammar::class;\n}","tryCatchPattern":"try {\n    $views = Schema::getViews();\n} catch (\\RuntimeException $e) {\n    if (str_contains($e->getMessage(), 'retrieving views')) {\n        $views = DB::select('SELECT table_name FROM information_schema.views');\n    } else {\n        throw $e;\n    }\n}","preventionTips":["Only call getViews() where a real driver grammar is bound.","Implement compileViews() in any custom grammar you ship.","Hide view-listing UI affordances when the grammar is unsupported."],"tags":["schema","grammar","database-driver","views","runtime-exception"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}