Skip to content

feat(ios): open the referenced row from a foreign key preview - #3682

Merged
datlechin merged 2 commits into
mainfrom
feat/ios-foreign-key-open-table
Oct 20, 2026
Merged

datlechin merged 2 commits into
mainfrom
feat/ios-foreign-key-open-table

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

  • Foreign key preview: Open Table in the bottom bar opens the referenced table filtered to the key, with the matching row on the row screen under the connection's Safe Mode. Back returns to the filtered list, then to the source row.
  • A preview value that is part of one of that table's foreign keys is a link. It pushes the next row inside the sheet; Back returns one step.
  • The sheet title shows the schema when it differs from the current one.
  • Composite and cross-schema keys: the preview and Open Table match every column pair, in the key's own schema. SQL Server and Oracle now report the referenced schema. MySQL reads keys, columns and indexes from the database asked for, below 5.1.10 too.
  • SQLite: a shorthand REFERENCES parent points at the parent's primary key, and the pairs of a composite key share one name.
  • Filters: SQL Server [col] closes with ], MySQL doubles backslashes, and a number-like value against a text column is quoted ('02134') from the column's type.
  • The table browser reads columns, keys and full values in its own schema, and a slow row count no longer overwrites a newer load's total.
  • A row whose primary key is binary or truncated offers no Edit or Delete, instead of a save that reports success and changes nothing.
  • Switching database rebuilds the table browser, and the database menu is off while a row edit has changes.

Test plan

  • Fail on main, pass here: FilterSQLGeneratorTests (TableProCore), SQLBuilderFilterLiteralTests, SQLBuilderSingleRowLookupTests, SQLiteDriverFileTests, MySQLForeignKeyCatalogTests, MySQLColumnListingTests, MySQLDriverLegacyServerTests, DataBrowserViewModelTests, RowDetailViewModelTests, ForeignKeyReferenceTests, ForeignKeyPreviewModelTests, TableBrowserIdentityTests.
  • DataBrowserViewModelTests primaryKeyExtraction is rewritten for primaryKeyValues(forRowAt:), which replaces the old single-value API.
  • iPhone 18 Pro simulator, iOS 27.0, Chinook sample: Invoice row, Customer.CustomerId, then Open Table. Customer opens filtered to CustomerId = 2 (Filter badge 1) with the row on screen, "1 of 1", Edit available. Back returns to the filtered list, then to Invoice. SupportRepId in the sheet links to Employee.
Light Dark
Before: preview sheet Before, light Before, dark
After: preview sheet After, light After, dark
After: Open Table, row screen After Open Table, light After Open Table, dark
After: Back to the filtered list After filtered list, light After filtered list, dark

Fixes #3636

Not in this PR

  • PostgreSQL bit(n) filter columns still compare bare (= 101), which has no operator. Main does the same for user filters, and MySQL BIT needs the bare form. Open Table on such a key shows the browser's load error.
  • A SQLite parent key column with no type that holds integers: the preview's quoted lookup finds no row, as on main, so Open Table stays off.
  • Mac: SQLiteForeignKeyGrouping.resolvedNames keeps a declared name equal to another key's positional fk_<table>_<id>, so the schema editor groups two keys as one composite key. iOS no longer passes the DDL.
  • TableProQuery/SQLStatementGenerator.swift and TableQueryBuilder.swift repeat the old [ quoting and number guessing, but nothing calls them.

@datlechin
datlechin enabled auto-merge (squash) October 20, 2026 02:29
@datlechin
datlechin merged commit 966cc0e into main Oct 20, 2026
8 checks passed
@datlechin
datlechin deleted the feat/ios-foreign-key-open-table branch October 20, 2026 03:18
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.

Open the referenced row from a foreign key on iPhone and iPad

1 participant