{"record":{"id":"a0329285470fa719","repo":"laravel/framework","slug":"this-database-driver-does-not-support-retrieving-i","errorCode":null,"errorMessage":"This database driver does not support retrieving indexes.","messagePattern":"This database driver does not support retrieving indexes\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Database/Schema/Grammars/Grammar.php","lineNumber":154,"sourceCode":"     * @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.\n     *\n     * @param  string|null  $schema\n     * @param  string  $table\n     * @return string\n     *\n     * @throws \\RuntimeException\n     */\n    public function compileIndexes($schema, $table)\n    {\n        throw new RuntimeException('This database driver does not support retrieving indexes.');\n    }\n\n    /**\n     * Compile a vector index key command.\n     *\n     * @param  \\Illuminate\\Database\\Schema\\Blueprint  $blueprint\n     * @param  \\Illuminate\\Support\\Fluent  $command\n     * @return void\n     *\n     * @throws \\RuntimeException\n     */\n    public function compileVectorIndex(Blueprint $blueprint, Fluent $command)\n    {\n        throw new RuntimeException('The database driver in use does not support vector indexes.');\n    }\n\n    /**\n     * Compile the query to determine the foreign keys.","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Database/Schema/Grammars/Grammar.php#L136-L172","documentation":"Grammar::compileIndexes() throws RuntimeException on the base class. All four shipped grammars override it, so the throw fires only when the connection's SchemaGrammar is the unimplemented base. Builder::getIndexes() routes here.","triggerScenarios":"Schema::getIndexes($table) on a connection whose SchemaGrammar is the base Grammar (custom driver).","commonSituations":"A driver bridge that returns the base Grammar; admin/inspection tooling that lists indexes across connections including an unsupported one.","solutions":["Use a supported driver for index introspection.","Override compileIndexes($schema, $table) in your custom grammar.","Query the engine's index catalog directly (pg_indexes, SHOW INDEX, sys.indexes)."],"exampleFix":"// before\n$idx = Schema::connection('custom')->getIndexes('users');\n\n// after\n$idx = DB::connection('custom')->select(\"SHOW INDEX FROM users\");","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 indexes.');\n}","typeGuard":"function supportsCompileIndexes(\\Illuminate\\Database\\Schema\\Grammars\\Grammar $grammar): bool\n{\n    return (new \\ReflectionMethod($grammar, 'compileIndexes'))\n        ->getDeclaringClass()->getName() !== \\Illuminate\\Database\\Schema\\Grammars\\Grammar::class;\n}","tryCatchPattern":"try {\n    $indexes = Schema::getIndexes('users');\n} catch (\\RuntimeException $e) {\n    if (str_contains($e->getMessage(), 'retrieving indexes')) {\n        $indexes = DB::select('SHOW INDEX FROM users');\n    } else {\n        throw $e;\n    }\n}","preventionTips":["Bind a real grammar in custom drivers; do not ship the base Grammar.","Gate index-inspection UI on the grammar class.","Implement compileIndexes when authoring a new grammar."],"tags":["schema","grammar","database-driver","indexes","runtime-exception"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}