Skip to content

Fix FK metadata loading#245

Merged
debba merged 3 commits into
TabularisDB:mainfrom
m-tonon:fix/244-fk-metadata-loading
May 25, 2026
Merged

Fix FK metadata loading#245
debba merged 3 commits into
TabularisDB:mainfrom
m-tonon:fix/244-fk-metadata-loading

Conversation

@m-tonon
Copy link
Copy Markdown
Contributor

@m-tonon m-tonon commented May 22, 2026

Summary

Fix PostgreSQL foreign key metadata loading by swapping the information_schema FK query for a pg_catalog one.

The old query sometimes failed to load certain foreign keys — depending on how PostgreSQL exposed things through information_schema. When that happened, the FK buttons just disappeared from the UI.

The new query reads directly from PostgreSQL system catalogs (pg_constraint, pg_attribute, pg_class, pg_namespace) and correctly handles:

  • foreign key relationships
  • composite foreign keys
  • update/delete rules

Changes

  • Replaced information_schema FK query with pg_catalog query
  • Added integration test covering:
    • single-column foreign keys
    • composite foreign keys
    • cross-schema references
    • batch FK loading

Testing

Ran:

cargo test test_postgres_foreign_keys_via_pg_catalog -- --ignored

Also manually checked that FK buttons and navigation work in the editor UI.

Closes #244

@debba
Copy link
Copy Markdown
Collaborator

debba commented May 25, 2026

Thanks for this PR :)
I'll merge it now.

@debba debba merged commit d4a831a into TabularisDB:main May 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: FK redirection only works on some schemas

2 participants