get_table_relationships
Analyze PostgreSQL table relationships including foreign keys, dependencies, and inheritance to understand database schema design and plan data migrations.
Instructions
[Tool Purpose]: Analyze table relationships including foreign keys, dependencies, and inheritance
[Exact Functionality]:
Show foreign key relationships (inbound and outbound)
Display view dependencies and table references
Analyze inheritance and partition relationships
Identify orphaned tables and relationship patterns
[Required Use Cases]:
When user requests "table relationships", "foreign keys", "dependencies", etc.
When analyzing database schema design and data model
When planning data migration or schema changes
[Strictly Prohibited Use Cases]:
Requests for actual data inside tables
Requests for relationship modifications or DDL operations
Requests for performance statistics (use other tools for that)
Args: database_name: Database name to query (REQUIRED - specify which database to analyze) table_name: Specific table name to analyze (if None, shows database-wide relationship overview) schema_name: Schema name to search in (default: "public") relationship_type: Type of relationships to show ("all", "foreign_keys", "dependencies", "inheritance")
Returns: Detailed relationship information including foreign keys, dependencies, and metadata
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database_name | Yes | ||
| table_name | No | ||
| schema_name | No | public | |
| relationship_type | No | all |