NAME

DBIO::DB2::Introspect::Indexes - Introspect DB2 indexes

VERSION

version 0.900007

DESCRIPTION

Fetches index metadata via SYSCAT.INDEXES and SYSCAT.INDEXCOLUSE. The index behind a UNIQUE constraint (same name as the constraint, see DBIO::DB2::Introspect::UniqueConstraints) is not reported: it is the constraint. The one behind a primary key lives in schema SYSIBM (UNIQUERULE = 'P'), not in the table's; it is in the model, marked origin => 'pk' (ADR 0011), and it is the primary key, not an index to create or drop: its name is the server's (SQL...) and differs from schema to schema, so DBIO::DB2::Diff::Index leaves every index of origin pk alone. The others are the indexes made with CREATE INDEX, unique or not.

METHODS

fetch

my $indexes = DBIO::DB2::Introspect::Indexes->fetch($dbh, $schema, $tables);

Returns a hashref keyed by table name, each value a hashref keyed by index name with: index_name, is_unique, columns (arrayref), and origin ('pk' for the primary-key-backing index, else undef). The origin marker lets "table_uniq_info" in DBIO::Introspect::Base drop the PK index from the unique-constraint list.

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.