{"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/bd6b5437e6ad87bb49f9b426724f07a9f64e9683/src/Illuminate/Database/Schema/Grammars/Grammar.php#L95-L131","documentation":"Base Grammar::compileViews() throws RuntimeException because the driver's grammar does not override it. It powers Schema::getViews(); drivers with a view catalogue (Postgres, MySQL, SQL Server) override it. SQLite and incomplete custom drivers do not.","triggerScenarios":"Calling Schema::getViews() on SQLite or a custom driver whose grammar lacks the override.","commonSituations":"Cross-driver introspection utility that calls getViews() unconditionally; test fixtures using SQLite but migrations referencing views.","solutions":["Use a driver whose grammar overrides compileViews (pgsql/mysql/sqlsrv).","Query the engine's view catalogue directly on unsupported drivers.","Guard the call by driver type before invoking."],"exampleFix":"// before\n$views = Schema::getViews();\n\n// after — guard by supported driver\n$ok = ['pgsql', 'mysql', 'sqlsrv'];\n$views = in_array(DB::connection()->getDriverName(), $ok, true) ? Schema::getViews() : [];","handlingStrategy":"type-guard","validationCode":"$driver = DB::connection()->getDriverName();\nif (! in_array($driver, ['pgsql','mysql','sqlsrv'], true)) {\n    return [];\n}\nreturn Schema::getViews();","typeGuard":"function driverSupportsViewListing(): bool\n{\n    return in_array(DB::connection()->getDriverName(), ['pgsql','mysql','sqlsrv'], true);\n}","tryCatchPattern":"try {\n    $views = Schema::getViews();\n} catch (\\RuntimeException $e) {\n    $views = [];\n}","preventionTips":["Guard getViews() by driver.","Query the engine's view catalogue directly on unsupported drivers.","Avoid views in cross-driver test fixtures."],"tags":["schema","database","driver-support","grammar","views"],"analyzedSha":"bd6b5437e6ad87bb49f9b426724f07a9f64e9683","analyzedAt":"2026-08-06T00:28:32.783Z","schemaVersion":2}