{"id":"306da6c812756d2e","repo":"laravel/framework","slug":"this-database-driver-does-not-support-retrieving-u","errorCode":null,"errorMessage":"This database driver does not support retrieving user-defined types.","messagePattern":"This database driver does not support retrieving user-defined types\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Database/Schema/Grammars/Grammar.php","lineNumber":126,"sourceCode":"     *\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     *\n     * @param  string|null  $schema\n     * @param  string  $table\n     * @return string\n     *\n     * @throws \\RuntimeException\n     */\n    public function compileColumns($schema, $table)\n    {\n        throw new RuntimeException('This database driver does not support retrieving columns.');\n    }\n\n    /**\n     * Compile the query to determine the indexes.","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/laravel/framework/blob/bd6b5437e6ad87bb49f9b426724f07a9f64e9683/src/Illuminate/Database/Schema/Grammars/Grammar.php#L108-L144","documentation":"Base Grammar::compileTypes() throws RuntimeException when the driver's grammar does not override it. User-defined types are primarily a Postgres feature (enums/composites), so PostgresGrammar overrides compileTypes; other drivers do not. It backs Schema::getTypes().","triggerScenarios":"Calling Schema::getTypes() on a non-Postgres driver, or any code path that compiles a user-defined-type listing query against an unsupported grammar.","commonSituations":"Cross-driver introspection tools calling getTypes() on MySQL/SQLite; migrations that switch drivers but still enumerate types.","solutions":["Use pgsql if you need user-defined type enumeration.","Remove or guard the Schema::getTypes() call on non-Postgres connections.","Return an empty list instead of calling the unsupported API."],"exampleFix":"// before\n$types = Schema::getTypes();\n\n// after\n$types = DB::connection()->getDriverName() === 'pgsql' ? Schema::getTypes() : [];","handlingStrategy":"type-guard","validationCode":"if (DB::connection()->getDriverName() !== 'pgsql') {\n    return [];\n}\nreturn Schema::getTypes();","typeGuard":"function driverSupportsTypeListing(): bool\n{\n    return DB::connection()->getDriverName() === 'pgsql';\n}","tryCatchPattern":"try {\n    $types = Schema::getTypes();\n} catch (\\RuntimeException $e) {\n    $types = [];\n}","preventionTips":["Reserve getTypes() for Postgres.","Guard by driver in cross-driver utilities.","Return an empty list instead of crashing on unsupported drivers."],"tags":["schema","database","driver-support","grammar","postgres","user-defined-types"],"analyzedSha":"bd6b5437e6ad87bb49f9b426724f07a9f64e9683","analyzedAt":"2026-08-06T00:28:32.783Z","schemaVersion":2}