NAME

DBIO::DuckDB::Introspect::ForeignKeys - Introspect DuckDB foreign keys

VERSION

version 0.900000

DESCRIPTION

Fetches foreign-key metadata via information_schema.referential_constraints joined against key_column_usage. Composite FKs are grouped by constraint name.

DuckDB accepts FK declarations but does not enforce them as of 1.x. They are still round-tripped here for schema correctness.

METHODS

fetch

my $fks = DBIO::DuckDB::Introspect::ForeignKeys->fetch($dbh, $schema, $tables);
my $fks = DBIO::DuckDB::Introspect::ForeignKeys->fetch($dbh, $schema, $tables, $catalog);

Returns a hashref keyed by table name, each value an arrayref of FK hashrefs with: fk_id, from_columns, to_table, to_columns, on_update, on_delete, match.

When $catalog is defined, AND tc.table_catalog = ? and AND rc.constraint_catalog = ? clauses are added.

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.