NAME

DBIO::DB2::Introspect::UniqueConstraints - Introspect DB2 unique constraints

VERSION

version 0.900007

DESCRIPTION

Fetches the UNIQUE constraints of a schema: SYSCAT.TABCONST rows of type U with their columns from SYSCAT.KEYCOLUSE. The primary key (type P) is not one, and neither is a unique index made with CREATE UNIQUE INDEX.

Db2 keeps an index of the constraint's name behind each constraint (SYSCAT.INDEXES, system_required 1). That index is the constraint, not a second object: DBIO::DB2::Introspect::Indexes leaves it out (ADR 0009).

METHODS

fetch

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

Returns the unique_constraints section of the model as DBIO::Introspect::Base defines it: a hashref keyed by table name, each value an arrayref of [ $constraint_name, \@columns ] pairs, the columns in key order (COLSEQ). Every table of $tables has an entry, an empty one for a table without constraints.

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.