Skip to content

Show foreign tables in the sidebar#851

Open
lucassamir wants to merge 1 commit into
sosedoff:mainfrom
lucassamir:show-foreign-tables-in-sidebar
Open

Show foreign tables in the sidebar#851
lucassamir wants to merge 1 commit into
sosedoff:mainfrom
lucassamir:show-foreign-tables-in-sidebar

Conversation

@lucassamir
Copy link
Copy Markdown

Foreign tables (pg_class.relkind = 'f') don't appear in the sidebar even though the CASE in objects.sql already maps 'f' to 'foreign_table' — the relkind IN (...) filter excludes 'f', and the Go/JS layers have no handling for the type.

This wires them through end-to-end:

  • pkg/statements/sql/objects.sql: add 'f' to the relkind filter
  • pkg/client/result.go: add ObjTypeForeignTable, a ForeignTables slice on the Objects struct, and a case in ObjectsFromResult
  • static/js/app.js: add "Foreign Tables" title/icon, include it in the schema render order, the emptyObjectList, and the autocomplete filter

Foreign tables are rendered and behave like regular tables in the sidebar — clicking one fetches rows via the usual SELECT ... LIMIT path, which works unchanged for FDW-backed relations.

Test plan

  • Manually verified against a Postgres DB with ~470 foreign tables in a schema populated via postgres_fdw: the new "Foreign Tables" section appears, counts are correct, and row browsing works.
  • go test ./pkg/... passes (the booktown fixture has no foreign tables, so no existing assertions change; testObjects still passes).

🤖 Generated with Claude Code

Foreign tables (pg_class.relkind = 'f') currently don't appear in the
sidebar even though the CASE in objects.sql already maps 'f' to
'foreign_table' — the relkind IN (...) filter excludes 'f', and the
Go/JS layers have no handling for the type.

This wires them through end-to-end:

- pkg/statements/sql/objects.sql: add 'f' to the relkind filter
- pkg/client/result.go: add ObjTypeForeignTable, a ForeignTables slice
  on the Objects struct, and a case in ObjectsFromResult
- static/js/app.js: add "Foreign Tables" title/icon, include it in the
  schema render order, the emptyObjectList, and the autocomplete filter

Foreign tables are rendered and behave like regular tables in the
sidebar — clicking one fetches rows via the usual SELECT-LIMIT path,
which works unchanged for FDW-backed relations.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

1 participant