{"record":{"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/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Database/Schema/Grammars/Grammar.php#L108-L144","documentation":"Grammar::compileTypes() throws RuntimeException on the base class and is overridden ONLY by PostgresGrammar. User-defined types (Postgres enums, composites, domains) are a Postgres-specific concept; SQLite, SQL Server, and MySQL grammars inherit the throwing stub. Builder::getTypes() routes here, so calling it on any non-Postgres supported driver throws.","triggerScenarios":"Schema::getTypes() invoked on a MySQL, SQLite, or SQL Server connection (or any non-Pgsql custom grammar). Reachable from admin/inspection tooling that assumes every engine exposes a type catalog.","commonSituations":"An admin panel or migration analyzer that calls getTypes() on every connection; copying a Postgres introspection routine onto MySQL; a generic database documentation generator iterating all connections.","solutions":["Gate getTypes() on the connection being Postgres (\\Illuminate\\Database\\PostgresConnection).","On other engines, query the engine-specific type catalog directly if one exists, or skip the call.","If you maintain a custom driver with user-defined types, override compileTypes() in its grammar."],"exampleFix":"// before - throws on MySQL/SQLite/SQL Server\nforeach (array_keys(config('database.connections')) as $conn) {\n    $types = Schema::connection($conn)->getTypes();\n}\n\n// after\nuse Illuminate\\Database\\PostgresConnection;\nforeach (array_keys(config('database.connections')) as $conn) {\n    if (DB::connection($conn) instanceof PostgresConnection) {\n        $types[$conn] = Schema::connection($conn)->getTypes();\n    }\n}","handlingStrategy":"type-guard","validationCode":"use Illuminate\\Database\\PostgresConnection;\n\nif (Schema::getConnection() instanceof PostgresConnection) {\n    $types = Schema::getTypes();\n} else {\n    // user-defined types are Postgres-only; nothing to introspect\n}","typeGuard":"use Illuminate\\Database\\PostgresConnection;\n\nfunction supportsGetTypes(\\Illuminate\\Database\\Connection $connection): bool\n{\n    return $connection instanceof PostgresConnection;\n}","tryCatchPattern":"try {\n    $types = Schema::getTypes();\n} catch (\\RuntimeException $e) {\n    if (str_contains($e->getMessage(), 'user-defined types')) {\n        $types = []; // not applicable on this engine\n    } else {\n        throw $e;\n    }\n}","preventionTips":["Treat getTypes() as Postgres-only.","When building cross-engine inspection tools, branch the type-listing step on the connection driver.","Document that Postgres enums/composites are intentionally absent on other engines."],"tags":["schema","grammar","database-driver","postgres","user-defined-types","runtime-exception"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}