NAME
DBIO::DuckDB::Introspect::Indexes - Introspect DuckDB indexes
VERSION
version 0.900007
DESCRIPTION
Fetches index metadata via the duckdb_indexes() system view. Each entry captures index_name, is_unique, and the raw sql of the CREATE INDEX statement. The column list, expression elements included, is parsed out of the SQL.
Auto-generated indexes backing PRIMARY KEY and UNIQUE constraints are omitted -- they belong to the table, not to explicit CREATE INDEX.
METHODS
fetch
my $indexes = DBIO::DuckDB::Introspect::Indexes->fetch($dbh, $schema, $tables);
my $indexes = DBIO::DuckDB::Introspect::Indexes->fetch($dbh, $schema, $tables, $catalog);
Returns a hashref keyed by table name, each value a hashref keyed by index name with: index_name, is_unique, columns (arrayref), sql, origin, partial.
When $catalog is defined, AND database_name = ? is added to the duckdb_indexes() query.
An expression element of the index is kept as DuckDB writes it into the statement, with its parentheses: (lower(b)). A plain column is its name, unquoted. DuckDB wraps every expression in a pair of parentheses and normalises it (function names fold to upper case where it knows them), so the same declaration always reads back as the same text.
AUTHOR
DBIO Authors
COPYRIGHT AND LICENSE
Copyright (C) 2026 DBIO Authors
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.