Show foreign tables in the sidebar#851
Open
lucassamir wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Foreign tables (
pg_class.relkind = 'f') don't appear in the sidebar even though theCASEinobjects.sqlalready maps'f'to'foreign_table'— therelkind 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 filterpkg/client/result.go: addObjTypeForeignTable, aForeignTablesslice on theObjectsstruct, and a case inObjectsFromResultstatic/js/app.js: add "Foreign Tables" title/icon, include it in the schema render order, theemptyObjectList, and the autocomplete filterForeign tables are rendered and behave like regular tables in the sidebar — clicking one fetches rows via the usual
SELECT ... LIMITpath, which works unchanged for FDW-backed relations.Test plan
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;testObjectsstill passes).🤖 Generated with Claude Code